diff --git a/Userland/Libraries/LibWeb/CSS/Parser/ComponentValue.cpp b/Userland/Libraries/LibWeb/CSS/Parser/ComponentValue.cpp index bc5fbf2644..58e80cc035 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/ComponentValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/ComponentValue.cpp @@ -9,7 +9,7 @@ #include #include -namespace Web::CSS { +namespace Web::CSS::Parser { ComponentValue::ComponentValue(Token token) : m_value(token) diff --git a/Userland/Libraries/LibWeb/CSS/Parser/ComponentValue.h b/Userland/Libraries/LibWeb/CSS/Parser/ComponentValue.h index 1c5fdca31f..30fa3fa52c 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/ComponentValue.h +++ b/Userland/Libraries/LibWeb/CSS/Parser/ComponentValue.h @@ -12,9 +12,11 @@ #include namespace Web::CSS { - class StyleBlockRule; class StyleFunctionRule; +} + +namespace Web::CSS::Parser { // https://www.w3.org/TR/css-syntax-3/#component-value class ComponentValue { diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Declaration.h b/Userland/Libraries/LibWeb/CSS/Parser/Declaration.h index 35d8ef7441..45af2a799c 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Declaration.h +++ b/Userland/Libraries/LibWeb/CSS/Parser/Declaration.h @@ -21,14 +21,14 @@ public: ~Declaration(); String const& name() const { return m_name; } - Vector const& values() const { return m_values; } + Vector const& values() const { return m_values; } Important importance() const { return m_important; } String to_string() const; private: String m_name; - Vector m_values; + Vector m_values; Important m_important { Important::No }; }; diff --git a/Userland/Libraries/LibWeb/CSS/Parser/StyleBlockRule.h b/Userland/Libraries/LibWeb/CSS/Parser/StyleBlockRule.h index d0573bb342..fc164cfaa7 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/StyleBlockRule.h +++ b/Userland/Libraries/LibWeb/CSS/Parser/StyleBlockRule.h @@ -20,7 +20,7 @@ class StyleBlockRule : public RefCounted { public: StyleBlockRule(); - explicit StyleBlockRule(Token token, Vector&& values) + explicit StyleBlockRule(Token token, Vector&& values) : m_token(move(token)) , m_values(move(values)) { @@ -33,12 +33,12 @@ public: Token const& token() const { return m_token; } - Vector const& values() const { return m_values; } + Vector const& values() const { return m_values; } String to_string() const; private: Token m_token; - Vector m_values; + Vector m_values; }; } diff --git a/Userland/Libraries/LibWeb/CSS/Parser/StyleFunctionRule.h b/Userland/Libraries/LibWeb/CSS/Parser/StyleFunctionRule.h index 356fef1d7f..239955b4cc 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/StyleFunctionRule.h +++ b/Userland/Libraries/LibWeb/CSS/Parser/StyleFunctionRule.h @@ -20,16 +20,16 @@ class StyleFunctionRule : public RefCounted { public: explicit StyleFunctionRule(String name); - StyleFunctionRule(String name, Vector&& values); + StyleFunctionRule(String name, Vector&& values); ~StyleFunctionRule(); String const& name() const { return m_name; } - Vector const& values() const { return m_values; } + Vector const& values() const { return m_values; } String to_string() const; private: String m_name; - Vector m_values; + Vector m_values; }; } diff --git a/Userland/Libraries/LibWeb/CSS/Parser/StyleRule.h b/Userland/Libraries/LibWeb/CSS/Parser/StyleRule.h index b999883abe..018599e3de 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/StyleRule.h +++ b/Userland/Libraries/LibWeb/CSS/Parser/StyleRule.h @@ -29,7 +29,7 @@ public: bool is_qualified_rule() const { return m_type == Type::Qualified; } bool is_at_rule() const { return m_type == Type::At; } - Vector const& prelude() const { return m_prelude; } + Vector const& prelude() const { return m_prelude; } RefPtr block() const { return m_block; } String const& at_rule_name() const { return m_at_rule_name; } @@ -38,7 +38,7 @@ public: private: Type const m_type; String m_at_rule_name; - Vector m_prelude; + Vector m_prelude; RefPtr m_block; }; diff --git a/Userland/Libraries/LibWeb/CSS/Parser/StyleRules.cpp b/Userland/Libraries/LibWeb/CSS/Parser/StyleRules.cpp index 460f3dec00..a8bf8e9743 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/StyleRules.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/StyleRules.cpp @@ -44,7 +44,7 @@ StyleFunctionRule::StyleFunctionRule(String name) { } -StyleFunctionRule::StyleFunctionRule(String name, Vector&& values) +StyleFunctionRule::StyleFunctionRule(String name, Vector&& values) : m_name(move(name)) , m_values(move(values)) { diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index 601818e2d3..8a0d4c857b 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -526,10 +526,10 @@ static RefPtr get_custom_property(DOM::Element const& element, FlySt return nullptr; } -bool StyleComputer::expand_unresolved_values(DOM::Element& element, StringView property_name, HashMap>& dependencies, Vector const& source, Vector& dest, size_t source_start_index) const +bool StyleComputer::expand_unresolved_values(DOM::Element& element, StringView property_name, HashMap>& dependencies, Vector const& source, Vector& dest, size_t source_start_index) const { // FIXME: Do this better! - // We build a copy of the tree of StyleComponentValueRules, with all var()s and attr()s replaced with their contents. + // We build a copy of the tree of ComponentValues, with all var()s and attr()s replaced with their contents. // This is a very naive solution, and we could do better if the CSS Parser could accept tokens one at a time. // Arbitrary large value chosen to avoid the billion-laughs attack. @@ -619,7 +619,7 @@ bool StyleComputer::expand_unresolved_values(DOM::Element& element, StringView p } auto const& source_function = value.function(); - Vector function_values; + Vector function_values; if (!expand_unresolved_values(element, property_name, dependencies, source_function.values(), function_values, 0)) return false; NonnullRefPtr function = adopt_ref(*new StyleFunctionRule(source_function.name(), move(function_values))); @@ -628,7 +628,7 @@ bool StyleComputer::expand_unresolved_values(DOM::Element& element, StringView p } if (value.is_block()) { auto const& source_block = value.block(); - Vector block_values; + Vector block_values; if (!expand_unresolved_values(element, property_name, dependencies, source_block.values(), block_values, 0)) return false; NonnullRefPtr block = adopt_ref(*new StyleBlockRule(source_block.token(), move(block_values))); @@ -647,7 +647,7 @@ RefPtr StyleComputer::resolve_unresolved_style_value(DOM::Element& e // to produce a different StyleValue from it. VERIFY(unresolved.contains_var_or_attr()); - Vector expanded_values; + Vector expanded_values; HashMap> dependencies; if (!expand_unresolved_values(element, string_from_property_id(property_id), dependencies, unresolved.values(), expanded_values, 0)) return {}; diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.h b/Userland/Libraries/LibWeb/CSS/StyleComputer.h index d54393ae88..b9cd4993e4 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.h +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.h @@ -86,7 +86,7 @@ private: void compute_defaulted_property_value(StyleProperties&, DOM::Element const*, CSS::PropertyID, Optional) const; RefPtr resolve_unresolved_style_value(DOM::Element&, PropertyID, UnresolvedStyleValue const&) const; - bool expand_unresolved_values(DOM::Element&, StringView property_name, HashMap>& dependencies, Vector const& source, Vector& dest, size_t source_start_index) const; + bool expand_unresolved_values(DOM::Element&, StringView property_name, HashMap>& dependencies, Vector const& source, Vector& dest, size_t source_start_index) const; template void for_each_stylesheet(CascadeOrigin, Callback) const; diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValue.h index 951563af9d..15107f7a79 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.h @@ -1625,7 +1625,7 @@ private: class UnresolvedStyleValue final : public StyleValue { public: - static NonnullRefPtr create(Vector&& values, bool contains_var_or_attr) + static NonnullRefPtr create(Vector&& values, bool contains_var_or_attr) { return adopt_ref(*new UnresolvedStyleValue(move(values), contains_var_or_attr)); } @@ -1633,18 +1633,18 @@ public: virtual String to_string() const override; - Vector const& values() const { return m_values; } + Vector const& values() const { return m_values; } bool contains_var_or_attr() const { return m_contains_var_or_attr; } private: - UnresolvedStyleValue(Vector&& values, bool contains_var_or_attr) + UnresolvedStyleValue(Vector&& values, bool contains_var_or_attr) : StyleValue(Type::Unresolved) , m_values(move(values)) , m_contains_var_or_attr(contains_var_or_attr) { } - Vector m_values; + Vector m_values; bool m_contains_var_or_attr { false }; }; diff --git a/Userland/Libraries/LibWeb/Forward.h b/Userland/Libraries/LibWeb/Forward.h index 933133b5eb..b06e1f78c2 100644 --- a/Userland/Libraries/LibWeb/Forward.h +++ b/Userland/Libraries/LibWeb/Forward.h @@ -99,6 +99,7 @@ enum class ValueID; } namespace Web::CSS::Parser { +class ComponentValue; class Parser; }