mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Move CSSRule dumping code into CSSRule classes
Having the dumping code in a separate Dump.cpp meant that it was often overlooked when the rules gained new features, and also limits dumping to publicly-accessible information.
This commit is contained in:
parent
285892b5dd
commit
180cd4b799
Notes:
github-actions[bot]
2025-12-04 16:25:53 +00:00
Author: https://github.com/AtkinsSJ
Commit: 180cd4b799
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7018
32 changed files with 211 additions and 204 deletions
|
|
@ -11,6 +11,7 @@
|
|||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/CSS/CSSFontFaceRule.h>
|
||||
#include <LibWeb/CSS/Serialize.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
|
@ -146,4 +147,13 @@ void CSSFontFaceRule::visit_edges(Visitor& visitor)
|
|||
visitor.visit(m_style);
|
||||
}
|
||||
|
||||
void CSSFontFaceRule::dump(StringBuilder& builder, int indent_levels) const
|
||||
{
|
||||
Base::dump(builder, indent_levels);
|
||||
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.appendff("Valid: {}\n", is_valid());
|
||||
dump_descriptors(builder, descriptors(), indent_levels + 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ private:
|
|||
virtual void initialize(JS::Realm&) override;
|
||||
virtual String serialized() const override;
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
virtual void dump(StringBuilder&, int indent_levels) const override;
|
||||
|
||||
GC::Ref<CSSFontFaceDescriptors> m_style;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2021, the SerenityOS developers.
|
||||
* Copyright (c) 2021-2024, Sam Atkins <sam@ladybird.org>
|
||||
* Copyright (c) 2021-2025, Sam Atkins <sam@ladybird.org>
|
||||
* Copyright (c) 2022-2024, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2025, Lorenz Ackermann <me@lorenzackermann.xyz>
|
||||
*
|
||||
|
|
@ -18,6 +18,7 @@
|
|||
#include <LibWeb/CSS/StyleComputer.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOMURL/DOMURL.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/HTTP/MIME.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/HTTP/Responses.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
|
@ -213,4 +214,12 @@ Optional<String> CSSImportRule::supports_text() const
|
|||
return m_supports->to_string();
|
||||
}
|
||||
|
||||
void CSSImportRule::dump(StringBuilder& builder, int indent_levels) const
|
||||
{
|
||||
Base::dump(builder, indent_levels);
|
||||
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.appendff("Document URL: {}\n", url().to_string());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ private:
|
|||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
virtual void dump(StringBuilder&, int indent_levels) const override;
|
||||
|
||||
virtual void set_parent_style_sheet(CSSStyleSheet*) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Ali Mohammad Pur <mpfard@serenityos.org>
|
||||
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
|
@ -8,6 +9,7 @@
|
|||
#include <LibWeb/Bindings/CSSKeyframeRulePrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/CSS/CSSRuleList.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
|
@ -45,4 +47,13 @@ String CSSKeyframeRule::serialized() const
|
|||
return MUST(builder.to_string());
|
||||
}
|
||||
|
||||
void CSSKeyframeRule::dump(StringBuilder& builder, int indent_levels) const
|
||||
{
|
||||
Base::dump(builder, indent_levels);
|
||||
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.appendff("Key: {}\n"sv, key_text());
|
||||
dump_style_properties(builder, style(), indent_levels + 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ private:
|
|||
virtual void visit_edges(Visitor&) override;
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual String serialized() const override;
|
||||
virtual void dump(StringBuilder&, int indent_levels) const override;
|
||||
|
||||
CSS::Percentage m_key;
|
||||
GC::Ref<CSSStyleProperties> m_declarations;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Ali Mohammad Pur <mpfard@serenityos.org>
|
||||
* Copyright (c) 2024, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
|
@ -9,6 +10,7 @@
|
|||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/CSS/CSSKeyframesRule.h>
|
||||
#include <LibWeb/CSS/CSSRuleList.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
|
@ -58,4 +60,16 @@ WebIDL::UnsignedLong CSSKeyframesRule::length() const
|
|||
return m_rules->length();
|
||||
}
|
||||
|
||||
void CSSKeyframesRule::dump(StringBuilder& builder, int indent_levels) const
|
||||
{
|
||||
Base::dump(builder, indent_levels);
|
||||
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.appendff("Name: {}\n", name());
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.appendff("Keyframes ({}):\n", length());
|
||||
for (auto& rule : *css_rules())
|
||||
dump_rule(builder, rule, indent_levels + 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ private:
|
|||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual String serialized() const override;
|
||||
virtual void dump(StringBuilder&, int indent_levels) const override;
|
||||
|
||||
FlyString m_name;
|
||||
GC::Ref<CSSRuleList> m_rules;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Sam Atkins <sam@ladybird.org>
|
||||
* Copyright (c) 2024-2025, Sam Atkins <sam@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
#include <LibWeb/Bindings/CSSLayerBlockRulePrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/CSS/Serialize.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
|
@ -77,4 +78,16 @@ FlyString CSSLayerBlockRule::internal_qualified_name(Badge<StyleScope>) const
|
|||
return MUST(String::formatted("{}.{}", parent_name, m_name_internal));
|
||||
}
|
||||
|
||||
void CSSLayerBlockRule::dump(StringBuilder& builder, int indent_levels) const
|
||||
{
|
||||
Base::dump(builder, indent_levels);
|
||||
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.appendff("Name: `{}` (internal `{}`)\n", m_name, m_name_internal);
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.appendff("Rules ({}):\n", css_rules().length());
|
||||
for (auto& rule : css_rules())
|
||||
dump_rule(builder, rule, indent_levels + 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ private:
|
|||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual String serialized() const override;
|
||||
virtual void dump(StringBuilder&, int indent_levels) const override;
|
||||
|
||||
FlyString m_name;
|
||||
FlyString m_name_internal;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include <LibWeb/Bindings/CSSLayerStatementRulePrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/CSS/CSSLayerBlockRule.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
|
@ -54,4 +55,13 @@ Vector<FlyString> CSSLayerStatementRule::internal_qualified_name_list(Badge<Styl
|
|||
return qualified_layer_names;
|
||||
}
|
||||
|
||||
void CSSLayerStatementRule::dump(StringBuilder& builder, int indent_levels) const
|
||||
{
|
||||
Base::dump(builder, indent_levels);
|
||||
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.append("Names: "sv);
|
||||
builder.join(", "sv, name_list());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ private:
|
|||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual String serialized() const override;
|
||||
virtual void dump(StringBuilder&, int indent_levels) const override;
|
||||
|
||||
Vector<FlyString> m_name_list;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/CSS/CSSMarginRule.h>
|
||||
#include <LibWeb/CSS/CSSStyleProperties.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
|
@ -53,6 +54,15 @@ void CSSMarginRule::visit_edges(Visitor& visitor)
|
|||
visitor.visit(m_style);
|
||||
}
|
||||
|
||||
void CSSMarginRule::dump(StringBuilder& builder, int indent_levels) const
|
||||
{
|
||||
Base::dump(builder, indent_levels);
|
||||
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.appendff("Name: {}\n", name());
|
||||
dump_style_properties(builder, style(), indent_levels + 1);
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/css-page-3/#syntax-page-selector
|
||||
bool is_margin_rule_name(StringView name)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ private:
|
|||
virtual void initialize(JS::Realm&) override;
|
||||
virtual String serialized() const override;
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
virtual void dump(StringBuilder&, int indent_levels) const override;
|
||||
|
||||
FlyString m_name;
|
||||
GC::Ref<CSSStyleProperties> m_style;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
|
||||
* Copyright (c) 2021-2025, Sam Atkins <sam@ladybird.org>
|
||||
* Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
#include <LibWeb/Bindings/CSSMediaRulePrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/CSS/CSSMediaRule.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
|
@ -75,4 +76,16 @@ String CSSMediaRule::serialized() const
|
|||
return MUST(builder.to_string());
|
||||
}
|
||||
|
||||
void CSSMediaRule::dump(StringBuilder& builder, int indent_levels) const
|
||||
{
|
||||
Base::dump(builder, indent_levels);
|
||||
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.appendff("Media: {}\n", condition_text());
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.appendff("Rules ({}):\n", css_rules().length());
|
||||
for (auto& rule : css_rules())
|
||||
dump_rule(builder, rule, indent_levels + 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ private:
|
|||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
virtual String serialized() const override;
|
||||
virtual void dump(StringBuilder&, int indent_levels) const override;
|
||||
|
||||
GC::Ref<MediaList> m_media;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Jonah Shafran <jonahshafran@gmail.com>
|
||||
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
|
@ -10,6 +11,7 @@
|
|||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/CSS/CSSNamespaceRule.h>
|
||||
#include <LibWeb/CSS/Serialize.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
|
@ -57,4 +59,16 @@ String CSSNamespaceRule::serialized() const
|
|||
return MUST(builder.to_string());
|
||||
}
|
||||
|
||||
void CSSNamespaceRule::dump(StringBuilder& builder, int indent_levels) const
|
||||
{
|
||||
Base::dump(builder, indent_levels);
|
||||
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.appendff("Namespace: {}\n", namespace_uri());
|
||||
if (!prefix().is_empty()) {
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.appendff("Prefix: {}\n", prefix());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,9 @@ private:
|
|||
CSSNamespaceRule(JS::Realm&, Optional<FlyString> prefix, FlyString namespace_uri);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
virtual String serialized() const override;
|
||||
virtual void dump(StringBuilder&, int indent_levels) const override;
|
||||
|
||||
FlyString m_namespace_uri;
|
||||
FlyString m_prefix;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Sam Atkins <sam@ladybird.org>
|
||||
* Copyright (c) 2024-2025, Sam Atkins <sam@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
#include <LibWeb/Bindings/CSSNestedDeclarationsPrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/CSS/CSSStyleRule.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
|
@ -74,4 +75,11 @@ void CSSNestedDeclarations::clear_caches()
|
|||
m_parent_style_rule = nullptr;
|
||||
}
|
||||
|
||||
void CSSNestedDeclarations::dump(StringBuilder& builder, int indent_levels) const
|
||||
{
|
||||
Base::dump(builder, indent_levels);
|
||||
|
||||
dump_style_properties(builder, declaration(), indent_levels + 1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ private:
|
|||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
virtual String serialized() const override;
|
||||
virtual void clear_caches() override;
|
||||
virtual void dump(StringBuilder&, int indent_levels) const override;
|
||||
|
||||
GC::Ref<CSSStyleProperties> m_declaration;
|
||||
GC::Ptr<CSSStyleRule const> mutable m_parent_style_rule;
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@
|
|||
#include <LibWeb/Bindings/CSSPageRulePrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/CSS/CSSPageRule.h>
|
||||
#include <LibWeb/CSS/DescriptorID.h>
|
||||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
#include <LibWeb/CSS/Serialize.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
|
@ -95,4 +95,18 @@ void CSSPageRule::visit_edges(Visitor& visitor)
|
|||
visitor.visit(m_style);
|
||||
}
|
||||
|
||||
void CSSPageRule::dump(StringBuilder& builder, int indent_levels) const
|
||||
{
|
||||
Base::dump(builder, indent_levels);
|
||||
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.appendff("Selector: {}\n", selector_text());
|
||||
dump_descriptors(builder, descriptors(), indent_levels + 1);
|
||||
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.appendff("Rules ({}):\n", css_rules().length());
|
||||
for (auto& rule : css_rules())
|
||||
dump_rule(builder, rule, indent_levels + 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ private:
|
|||
virtual void initialize(JS::Realm&) override;
|
||||
virtual String serialized() const override;
|
||||
virtual void visit_edges(Visitor&) override;
|
||||
virtual void dump(StringBuilder&, int indent_levels) const override;
|
||||
|
||||
PageSelectorList m_selectors;
|
||||
GC::Ref<CSSPageDescriptors> m_style;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Alex Ungurianu <alex@ungurianu.com>
|
||||
* Copyright (c) 2025, Sam Atkins <sam@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
|
@ -8,6 +9,7 @@
|
|||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/CSS/CSSPropertyRule.h>
|
||||
#include <LibWeb/CSS/Serialize.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
|
@ -80,4 +82,23 @@ String CSSPropertyRule::serialized() const
|
|||
return MUST(builder.to_string());
|
||||
}
|
||||
|
||||
void CSSPropertyRule::dump(StringBuilder& builder, int indent_levels) const
|
||||
{
|
||||
Base::dump(builder, indent_levels);
|
||||
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.appendff("Name: {}\n", name());
|
||||
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.appendff("Syntax: {}\n", syntax());
|
||||
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.appendff("Inherits: {}\n", inherits());
|
||||
|
||||
if (initial_value().has_value()) {
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.appendff("Initial value: {}\n", initial_value().value());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ private:
|
|||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual String serialized() const override;
|
||||
virtual void dump(StringBuilder&, int indent_levels) const override;
|
||||
|
||||
FlyString m_name;
|
||||
FlyString m_syntax;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2021, the SerenityOS developers.
|
||||
* Copyright (c) 2022-2024, Sam Atkins <sam@ladybird.org>
|
||||
* Copyright (c) 2022-2025, Sam Atkins <sam@ladybird.org>
|
||||
* Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
#include <LibWeb/CSS/CSSLayerBlockRule.h>
|
||||
#include <LibWeb/CSS/CSSRule.h>
|
||||
#include <LibWeb/CSS/CSSStyleSheet.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
|
@ -67,6 +68,12 @@ void CSSRule::set_parent_style_sheet(CSSStyleSheet* parent_style_sheet)
|
|||
clear_caches();
|
||||
}
|
||||
|
||||
void CSSRule::dump(StringBuilder& builder, int indent_levels) const
|
||||
{
|
||||
dump_indent(builder, indent_levels);
|
||||
builder.appendff("{}:\n", class_name());
|
||||
}
|
||||
|
||||
void CSSRule::clear_caches()
|
||||
{
|
||||
m_cached_layer_name.clear();
|
||||
|
|
|
|||
|
|
@ -61,6 +61,8 @@ public:
|
|||
// https://drafts.csswg.org/cssom-1/#serialize-a-css-rule
|
||||
virtual String serialized() const = 0;
|
||||
|
||||
virtual void dump(StringBuilder&, int indent_levels = 0) const;
|
||||
|
||||
virtual void clear_caches();
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
#include <LibWeb/CSS/StyleComputer.h>
|
||||
#include <LibWeb/CSS/StylePropertyMap.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
|
@ -239,4 +240,19 @@ CSSStyleRule const* CSSStyleRule::parent_style_rule() const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void CSSStyleRule::dump(StringBuilder& builder, int indent_levels) const
|
||||
{
|
||||
Base::dump(builder, indent_levels);
|
||||
|
||||
for (auto& selector : selectors()) {
|
||||
dump_selector(builder, selector, indent_levels + 1);
|
||||
}
|
||||
dump_style_properties(builder, declaration(), indent_levels + 1);
|
||||
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.appendff("Child rules ({}):\n", css_rules().length());
|
||||
for (auto& child_rule : css_rules())
|
||||
dump_rule(builder, child_rule, indent_levels + 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ private:
|
|||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
virtual void clear_caches() override;
|
||||
virtual String serialized() const override;
|
||||
virtual void dump(StringBuilder&, int indent_levels) const override;
|
||||
|
||||
virtual void set_parent_style_sheet(CSSStyleSheet*) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
|
||||
* Copyright (c) 2021-2025, Sam Atkins <sam@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/CSS/CSSSupportsRule.h>
|
||||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
#include <LibWeb/Dump.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
|
|
@ -58,4 +59,18 @@ String CSSSupportsRule::serialized() const
|
|||
return MUST(builder.to_string());
|
||||
}
|
||||
|
||||
void CSSSupportsRule::dump(StringBuilder& builder, int indent_levels) const
|
||||
{
|
||||
Base::dump(builder, indent_levels);
|
||||
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.append("Supports:\n"sv);
|
||||
supports().dump(builder, indent_levels + 2);
|
||||
|
||||
dump_indent(builder, indent_levels + 1);
|
||||
builder.appendff("Rules ({}):\n", css_rules().length());
|
||||
for (auto& rule : css_rules())
|
||||
dump_rule(builder, rule, indent_levels + 2);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org>
|
||||
* Copyright (c) 2021-2025, Sam Atkins <sam@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
|
@ -36,6 +36,7 @@ private:
|
|||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual String serialized() const override;
|
||||
virtual void dump(StringBuilder&, int indent_levels) const override;
|
||||
|
||||
NonnullRefPtr<Supports> m_supports;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue