summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Bindings/CSSRuleWrapperFactory.cpp
blob: 54cdc9643e142c78a63381a54e08953bddbe8955 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
 * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <AK/TypeCasts.h>
#include <LibWeb/Bindings/CSSRuleWrapper.h>
#include <LibWeb/Bindings/CSSRuleWrapperFactory.h>
#include <LibWeb/Bindings/CSSStyleRuleWrapper.h>
#include <LibWeb/CSS/CSSStyleRule.h>

namespace Web::Bindings {

CSSRuleWrapper* wrap(JS::GlobalObject& global_object, CSS::CSSRule& rule)
{
    if (is<CSS::CSSStyleRule>(rule))
        return static_cast<CSSRuleWrapper*>(wrap_impl(global_object, verify_cast<CSS::CSSStyleRule>(rule)));
    return static_cast<CSSRuleWrapper*>(wrap_impl(global_object, rule));
}

}