2021-09-28 12:20:32 -03:00
|
|
|
/*
|
2024-09-03 07:43:20 -03:00
|
|
|
* Copyright (c) 2021-2024, Sam Atkins <sam@ladybird.org>
|
2021-09-28 12:20:32 -03:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2021-10-08 13:02:47 -03:00
|
|
|
#include <AK/Function.h>
|
2021-09-28 12:20:32 -03:00
|
|
|
#include <AK/NonnullRefPtr.h>
|
|
|
|
|
#include <LibWeb/CSS/CSSRule.h>
|
|
|
|
|
#include <LibWeb/CSS/CSSRuleList.h>
|
|
|
|
|
#include <LibWeb/Forward.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::CSS {
|
|
|
|
|
|
|
|
|
|
class CSSGroupingRule : public CSSRule {
|
2022-08-28 08:42:07 -03:00
|
|
|
WEB_PLATFORM_OBJECT(CSSGroupingRule, CSSRule);
|
2021-09-28 12:20:32 -03:00
|
|
|
|
|
|
|
|
public:
|
2022-04-22 10:13:37 -03:00
|
|
|
virtual ~CSSGroupingRule() = default;
|
2021-09-28 12:20:32 -03:00
|
|
|
|
2022-08-07 10:46:44 -03:00
|
|
|
CSSRuleList const& css_rules() const { return m_rules; }
|
|
|
|
|
CSSRuleList& css_rules() { return m_rules; }
|
2023-02-26 20:09:02 -03:00
|
|
|
CSSRuleList* css_rules_for_bindings() { return m_rules; }
|
2022-09-25 13:03:42 -03:00
|
|
|
WebIDL::ExceptionOr<u32> insert_rule(StringView rule, u32 index = 0);
|
|
|
|
|
WebIDL::ExceptionOr<void> delete_rule(u32 index);
|
2021-09-28 12:20:32 -03:00
|
|
|
|
2024-09-03 07:43:20 -03:00
|
|
|
virtual void for_each_effective_rule(TraversalOrder, Function<void(CSSRule const&)> const& callback) const;
|
2021-10-08 13:02:47 -03:00
|
|
|
|
2022-04-22 15:56:22 -03:00
|
|
|
virtual void set_parent_style_sheet(CSSStyleSheet*) override;
|
|
|
|
|
|
2021-09-28 12:20:32 -03:00
|
|
|
protected:
|
2024-10-28 16:16:28 -03:00
|
|
|
CSSGroupingRule(JS::Realm&, CSSRuleList&, Type);
|
2023-01-10 08:28:20 -03:00
|
|
|
|
2023-08-07 03:41:28 -03:00
|
|
|
virtual void initialize(JS::Realm&) override;
|
2022-08-07 10:46:44 -03:00
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
2024-11-04 14:13:51 -03:00
|
|
|
virtual void clear_caches() override;
|
2022-08-07 10:46:44 -03:00
|
|
|
|
2022-08-08 10:32:27 -03:00
|
|
|
private:
|
2024-11-14 12:01:23 -03:00
|
|
|
GC::Ref<CSSRuleList> m_rules;
|
2021-09-28 12:20:32 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|