2021-09-28 16:53:15 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
|
2022-08-07 15:46:44 +02:00
|
|
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
2021-09-28 16:53:15 +01:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
2022-09-24 16:34:04 -06:00
|
|
|
#include <LibWeb/Bindings/CSSConditionRulePrototype.h>
|
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
2021-09-28 16:53:15 +01:00
|
|
|
#include <LibWeb/CSS/CSSConditionRule.h>
|
|
|
|
|
|
|
|
namespace Web::CSS {
|
|
|
|
|
2022-09-24 16:34:04 -06:00
|
|
|
CSSConditionRule::CSSConditionRule(JS::Realm& realm, CSSRuleList& rules)
|
|
|
|
: CSSGroupingRule(realm, rules)
|
2021-09-28 16:53:15 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-10-08 17:02:47 +01:00
|
|
|
void CSSConditionRule::for_each_effective_style_rule(Function<void(CSSStyleRule const&)> const& callback) const
|
|
|
|
{
|
|
|
|
if (condition_matches())
|
|
|
|
CSSGroupingRule::for_each_effective_style_rule(callback);
|
|
|
|
}
|
|
|
|
|
2023-01-10 06:28:20 -05:00
|
|
|
void CSSConditionRule::initialize(JS::Realm& realm)
|
|
|
|
{
|
|
|
|
Base::initialize(realm);
|
|
|
|
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSConditionRulePrototype>(realm, "CSSConditionRule"));
|
|
|
|
}
|
|
|
|
|
2021-09-28 16:53:15 +01:00
|
|
|
}
|