CSSConditionRule.cpp 775 B

1234567891011121314151617181920212223242526
  1. /*
  2. * Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
  3. * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #include <LibWeb/Bindings/CSSConditionRulePrototype.h>
  8. #include <LibWeb/Bindings/Intrinsics.h>
  9. #include <LibWeb/CSS/CSSConditionRule.h>
  10. namespace Web::CSS {
  11. CSSConditionRule::CSSConditionRule(JS::Realm& realm, CSSRuleList& rules)
  12. : CSSGroupingRule(realm, rules)
  13. {
  14. set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSConditionRulePrototype>(realm, "CSSConditionRule"));
  15. }
  16. void CSSConditionRule::for_each_effective_style_rule(Function<void(CSSStyleRule const&)> const& callback) const
  17. {
  18. if (condition_matches())
  19. CSSGroupingRule::for_each_effective_style_rule(callback);
  20. }
  21. }