diff options
100 files changed, 358 insertions, 366 deletions
diff --git a/Applications/Browser/Tab.cpp b/Applications/Browser/Tab.cpp index 945eb2bcfb..4225b75a8a 100644 --- a/Applications/Browser/Tab.cpp +++ b/Applications/Browser/Tab.cpp @@ -338,7 +338,7 @@ Tab::Tab(Type type) "Dump Style sheets", [this](auto&) { if (m_type == Type::InProcessWebView) { for (auto& sheet : m_page_view->document()->style_sheets().sheets()) { - dump_sheet(sheet); + Web::dump_sheet(sheet); } } else { TODO(); diff --git a/Libraries/LibWeb/CSS/Length.cpp b/Libraries/LibWeb/CSS/Length.cpp index 76d9b55ecc..ff5e27e02a 100644 --- a/Libraries/LibWeb/CSS/Length.cpp +++ b/Libraries/LibWeb/CSS/Length.cpp @@ -28,7 +28,7 @@ #include <LibWeb/DOM/Document.h> #include <LibWeb/HTML/HTMLHtmlElement.h> -namespace Web { +namespace Web::CSS { float Length::relative_length_to_px(const LayoutNode& layout_node) const { diff --git a/Libraries/LibWeb/CSS/Length.h b/Libraries/LibWeb/CSS/Length.h index 61ca914a7c..a0f632777f 100644 --- a/Libraries/LibWeb/CSS/Length.h +++ b/Libraries/LibWeb/CSS/Length.h @@ -29,7 +29,7 @@ #include <AK/String.h> #include <LibWeb/Forward.h> -namespace Web { +namespace Web::CSS { class Length { public: diff --git a/Libraries/LibWeb/CSS/LengthBox.h b/Libraries/LibWeb/CSS/LengthBox.h index 7c983d9ed7..931d6c6da2 100644 --- a/Libraries/LibWeb/CSS/LengthBox.h +++ b/Libraries/LibWeb/CSS/LengthBox.h @@ -28,7 +28,7 @@ #include <LibWeb/CSS/Length.h> -namespace Web { +namespace Web::CSS { struct LengthBox { Length top { Length::make_auto() }; diff --git a/Libraries/LibWeb/CSS/Selector.cpp b/Libraries/LibWeb/CSS/Selector.cpp index e5ca4e8962..bfd44f204a 100644 --- a/Libraries/LibWeb/CSS/Selector.cpp +++ b/Libraries/LibWeb/CSS/Selector.cpp @@ -26,7 +26,7 @@ #include <LibWeb/CSS/Selector.h> -namespace Web { +namespace Web::CSS { Selector::Selector(Vector<ComplexSelector>&& component_lists) : m_complex_selectors(move(component_lists)) diff --git a/Libraries/LibWeb/CSS/Selector.h b/Libraries/LibWeb/CSS/Selector.h index 8cfa41f4ed..463aa013eb 100644 --- a/Libraries/LibWeb/CSS/Selector.h +++ b/Libraries/LibWeb/CSS/Selector.h @@ -29,7 +29,7 @@ #include <AK/FlyString.h> #include <AK/Vector.h> -namespace Web { +namespace Web::CSS { class Selector { public: diff --git a/Libraries/LibWeb/CSS/SelectorEngine.cpp b/Libraries/LibWeb/CSS/SelectorEngine.cpp index 4589ff3f2e..401a455a53 100644 --- a/Libraries/LibWeb/CSS/SelectorEngine.cpp +++ b/Libraries/LibWeb/CSS/SelectorEngine.cpp @@ -30,9 +30,7 @@ #include <LibWeb/DOM/Element.h> #include <LibWeb/DOM/Text.h> -namespace Web { - -namespace SelectorEngine { +namespace Web::SelectorEngine { static bool matches_hover_pseudo_class(const DOM::Element& element) { @@ -44,57 +42,57 @@ static bool matches_hover_pseudo_class(const DOM::Element& element) return element.is_ancestor_of(*hovered_node); } -bool matches(const Selector::SimpleSelector& component, const DOM::Element& element) +bool matches(const CSS::Selector::SimpleSelector& component, const DOM::Element& element) { switch (component.pseudo_class) { - case Selector::SimpleSelector::PseudoClass::None: + case CSS::Selector::SimpleSelector::PseudoClass::None: break; - case Selector::SimpleSelector::PseudoClass::Link: + case CSS::Selector::SimpleSelector::PseudoClass::Link: if (!element.is_link()) return false; break; - case Selector::SimpleSelector::PseudoClass::Visited: + case CSS::Selector::SimpleSelector::PseudoClass::Visited: // FIXME: Maybe match this selector sometimes? return false; - case Selector::SimpleSelector::PseudoClass::Hover: + case CSS::Selector::SimpleSelector::PseudoClass::Hover: if (!matches_hover_pseudo_class(element)) return false; break; - case Selector::SimpleSelector::PseudoClass::Focus: + case CSS::Selector::SimpleSelector::PseudoClass::Focus: // FIXME: Implement matches_focus_pseudo_class(element) return false; - case Selector::SimpleSelector::PseudoClass::FirstChild: + case CSS::Selector::SimpleSelector::PseudoClass::FirstChild: if (element.previous_element_sibling()) return false; break; - case Selector::SimpleSelector::PseudoClass::LastChild: + case CSS::Selector::SimpleSelector::PseudoClass::LastChild: if (element.next_element_sibling()) return false; break; - case Selector::SimpleSelector::PseudoClass::OnlyChild: + case CSS::Selector::SimpleSelector::PseudoClass::OnlyChild: if (element.previous_element_sibling() || element.next_element_sibling()) return false; break; - case Selector::SimpleSelector::PseudoClass::Empty: + case CSS::Selector::SimpleSelector::PseudoClass::Empty: if (element.first_child_of_type<DOM::Element>() || element.first_child_of_type<DOM::Text>()) return false; break; - case Selector::SimpleSelector::PseudoClass::Root: + case CSS::Selector::SimpleSelector::PseudoClass::Root: if (!element.is_html_element()) return false; break; } switch (component.attribute_match_type) { - case Selector::SimpleSelector::AttributeMatchType::HasAttribute: + case CSS::Selector::SimpleSelector::AttributeMatchType::HasAttribute: if (!element.has_attribute(component.attribute_name)) return false; break; - case Selector::SimpleSelector::AttributeMatchType::ExactValueMatch: + case CSS::Selector::SimpleSelector::AttributeMatchType::ExactValueMatch: if (element.attribute(component.attribute_name) != component.attribute_value) return false; break; - case Selector::SimpleSelector::AttributeMatchType::Contains: + case CSS::Selector::SimpleSelector::AttributeMatchType::Contains: if (!element.attribute(component.attribute_name).split(' ').contains_slow(component.attribute_value)) return false; break; @@ -103,20 +101,20 @@ bool matches(const Selector::SimpleSelector& component, const DOM::Element& elem } switch (component.type) { - case Selector::SimpleSelector::Type::Universal: + case CSS::Selector::SimpleSelector::Type::Universal: return true; - case Selector::SimpleSelector::Type::Id: + case CSS::Selector::SimpleSelector::Type::Id: return component.value == element.attribute(HTML::AttributeNames::id); - case Selector::SimpleSelector::Type::Class: + case CSS::Selector::SimpleSelector::Type::Class: return element.has_class(component.value); - case Selector::SimpleSelector::Type::TagName: + case CSS::Selector::SimpleSelector::Type::TagName: return component.value == element.local_name(); default: ASSERT_NOT_REACHED(); } } -bool matches(const Selector& selector, int component_list_index, const DOM::Element& element) +bool matches(const CSS::Selector& selector, int component_list_index, const DOM::Element& element) { auto& component_list = selector.complex_selectors()[component_list_index]; for (auto& component : component_list.compound_selector) { @@ -124,9 +122,9 @@ bool matches(const Selector& selector, int component_list_index, const DOM::Elem return false; } switch (component_list.relation) { - case Selector::ComplexSelector::Relation::None: + case CSS::Selector::ComplexSelector::Relation::None: return true; - case Selector::ComplexSelector::Relation::Descendant: + case CSS::Selector::ComplexSelector::Relation::Descendant: ASSERT(component_list_index != 0); for (auto* ancestor = element.parent(); ancestor; ancestor = ancestor->parent()) { if (!is<DOM::Element>(*ancestor)) @@ -135,17 +133,17 @@ bool matches(const Selector& selector, int component_list_index, const DOM::Elem return true; } return false; - case Selector::ComplexSelector::Relation::ImmediateChild: + case CSS::Selector::ComplexSelector::Relation::ImmediateChild: ASSERT(component_list_index != 0); if (!element.parent() || !is<DOM::Element>(*element.parent())) return false; return matches(selector, component_list_index - 1, downcast<DOM::Element>(*element.parent())); - case Selector::ComplexSelector::Relation::AdjacentSibling: + case CSS::Selector::ComplexSelector::Relation::AdjacentSibling: ASSERT(component_list_index != 0); if (auto* sibling = element.previous_element_sibling()) return matches(selector, component_list_index - 1, *sibling); return false; - case Selector::ComplexSelector::Relation::GeneralSibling: + case CSS::Selector::ComplexSelector::Relation::GeneralSibling: ASSERT(component_list_index != 0); for (auto* sibling = element.previous_element_sibling(); sibling; sibling = sibling->previous_element_sibling()) { if (matches(selector, component_list_index - 1, *sibling)) @@ -156,12 +154,10 @@ bool matches(const Selector& selector, int component_list_index, const DOM::Elem ASSERT_NOT_REACHED(); } -bool matches(const Selector& selector, const DOM::Element& element) +bool matches(const CSS::Selector& selector, const DOM::Element& element) { ASSERT(!selector.complex_selectors().is_empty()); return matches(selector, selector.complex_selectors().size() - 1, element); } } - -} diff --git a/Libraries/LibWeb/CSS/SelectorEngine.h b/Libraries/LibWeb/CSS/SelectorEngine.h index 7453c420fc..96bd76de36 100644 --- a/Libraries/LibWeb/CSS/SelectorEngine.h +++ b/Libraries/LibWeb/CSS/SelectorEngine.h @@ -31,6 +31,6 @@ namespace Web::SelectorEngine { -bool matches(const Selector&, const DOM::Element&); +bool matches(const CSS::Selector&, const DOM::Element&); } diff --git a/Libraries/LibWeb/CSS/StyleDeclaration.cpp b/Libraries/LibWeb/CSS/StyleDeclaration.cpp index 4a56a33a65..eb56b94625 100644 --- a/Libraries/LibWeb/CSS/StyleDeclaration.cpp +++ b/Libraries/LibWeb/CSS/StyleDeclaration.cpp @@ -26,7 +26,7 @@ #include <LibWeb/CSS/StyleDeclaration.h> -namespace Web { +namespace Web::CSS { StyleDeclaration::StyleDeclaration(Vector<StyleProperty>&& properties) : m_properties(move(properties)) diff --git a/Libraries/LibWeb/CSS/StyleDeclaration.h b/Libraries/LibWeb/CSS/StyleDeclaration.h index 79fc8479ea..787429eb15 100644 --- a/Libraries/LibWeb/CSS/StyleDeclaration.h +++ b/Libraries/LibWeb/CSS/StyleDeclaration.h @@ -30,7 +30,7 @@ #include <AK/Vector.h> #include <LibWeb/CSS/StyleValue.h> -namespace Web { +namespace Web::CSS { struct StyleProperty { CSS::PropertyID property_id; diff --git a/Libraries/LibWeb/CSS/StyleProperties.cpp b/Libraries/LibWeb/CSS/StyleProperties.cpp index e8a78e1ede..2b4b656a17 100644 --- a/Libraries/LibWeb/CSS/StyleProperties.cpp +++ b/Libraries/LibWeb/CSS/StyleProperties.cpp @@ -29,7 +29,7 @@ #include <LibWeb/FontCache.h> #include <ctype.h> -namespace Web { +namespace Web::CSS { StyleProperties::StyleProperties() { diff --git a/Libraries/LibWeb/CSS/StyleProperties.h b/Libraries/LibWeb/CSS/StyleProperties.h index 05e38ac846..472d53da07 100644 --- a/Libraries/LibWeb/CSS/StyleProperties.h +++ b/Libraries/LibWeb/CSS/StyleProperties.h @@ -33,7 +33,7 @@ #include <LibWeb/CSS/LengthBox.h> #include <LibWeb/CSS/StyleValue.h> -namespace Web { +namespace Web::CSS { class StyleProperties : public RefCounted<StyleProperties> { public: diff --git a/Libraries/LibWeb/CSS/StyleResolver.cpp b/Libraries/LibWeb/CSS/StyleResolver.cpp index 682aadc292..51746c52b0 100644 --- a/Libraries/LibWeb/CSS/StyleResolver.cpp +++ b/Libraries/LibWeb/CSS/StyleResolver.cpp @@ -35,7 +35,7 @@ #include <ctype.h> #include <stdio.h> -namespace Web { +namespace Web::CSS { StyleResolver::StyleResolver(DOM::Document& document) : m_document(document) diff --git a/Libraries/LibWeb/CSS/StyleResolver.h b/Libraries/LibWeb/CSS/StyleResolver.h index cc5d3f3541..4a9ab55441 100644 --- a/Libraries/LibWeb/CSS/StyleResolver.h +++ b/Libraries/LibWeb/CSS/StyleResolver.h @@ -31,7 +31,7 @@ #include <LibWeb/CSS/StyleProperties.h> #include <LibWeb/Forward.h> -namespace Web { +namespace Web::CSS { struct MatchingRule { RefPtr<StyleRule> rule; diff --git a/Libraries/LibWeb/CSS/StyleRule.cpp b/Libraries/LibWeb/CSS/StyleRule.cpp index bed671fd47..d92f362500 100644 --- a/Libraries/LibWeb/CSS/StyleRule.cpp +++ b/Libraries/LibWeb/CSS/StyleRule.cpp @@ -26,7 +26,7 @@ #include <LibWeb/CSS/StyleRule.h> -namespace Web { +namespace Web::CSS { StyleRule::StyleRule(Vector<Selector>&& selectors, NonnullRefPtr<StyleDeclaration>&& declaration) : m_selectors(move(selectors)) diff --git a/Libraries/LibWeb/CSS/StyleRule.h b/Libraries/LibWeb/CSS/StyleRule.h index ec98ae5920..d668c5b42b 100644 --- a/Libraries/LibWeb/CSS/StyleRule.h +++ b/Libraries/LibWeb/CSS/StyleRule.h @@ -30,7 +30,7 @@ #include <LibWeb/CSS/Selector.h> #include <LibWeb/CSS/StyleDeclaration.h> -namespace Web { +namespace Web::CSS { class StyleRule : public RefCounted<StyleRule> { AK_MAKE_NONCOPYABLE(StyleRule); diff --git a/Libraries/LibWeb/CSS/StyleSheet.cpp b/Libraries/LibWeb/CSS/StyleSheet.cpp index e153a3b7ef..d4c37ba53e 100644 --- a/Libraries/LibWeb/CSS/StyleSheet.cpp +++ b/Libraries/LibWeb/CSS/StyleSheet.cpp @@ -26,7 +26,7 @@ #include <LibWeb/CSS/StyleSheet.h> -namespace Web { +namespace Web::CSS { StyleSheet::StyleSheet(NonnullRefPtrVector<StyleRule>&& rules) : m_rules(move(rules)) diff --git a/Libraries/LibWeb/CSS/StyleSheet.h b/Libraries/LibWeb/CSS/StyleSheet.h index 496260d76a..9e3695e03d 100644 --- a/Libraries/LibWeb/CSS/StyleSheet.h +++ b/Libraries/LibWeb/CSS/StyleSheet.h @@ -29,7 +29,7 @@ #include <AK/NonnullRefPtrVector.h> #include <LibWeb/CSS/StyleRule.h> -namespace Web { +namespace Web::CSS { class StyleSheet : public RefCounted<StyleSheet> { public: diff --git a/Libraries/LibWeb/CSS/StyleValue.cpp b/Libraries/LibWeb/CSS/StyleValue.cpp index a4f1a9cc80..9b6baa6583 100644 --- a/Libraries/LibWeb/CSS/StyleValue.cpp +++ b/Libraries/LibWeb/CSS/StyleValue.cpp @@ -34,7 +34,7 @@ #include <LibWeb/Loader/ResourceLoader.h> #include <LibWeb/PageView.h> -namespace Web { +namespace Web::CSS { StyleValue::StyleValue(Type type) : m_type(type) diff --git a/Libraries/LibWeb/CSS/StyleValue.h b/Libraries/LibWeb/CSS/StyleValue.h index a6b2fbedfd..b21e57d8cc 100644 --- a/Libraries/LibWeb/CSS/StyleValue.h +++ b/Libraries/LibWeb/CSS/StyleValue.h @@ -149,10 +149,6 @@ enum class Float { Right, }; -} - -namespace Web { - class StyleValue : public RefCounted<StyleValue> { public: virtual ~StyleValue(); diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp index 3bd557be1e..35954044b8 100644 --- a/Libraries/LibWeb/DOM/Document.cpp +++ b/Libraries/LibWeb/DOM/Document.cpp @@ -63,7 +63,7 @@ namespace Web::DOM { Document::Document(const URL& url) : ParentNode(*this, NodeType::DOCUMENT_NODE) - , m_style_resolver(make<StyleResolver>(*this)) + , m_style_resolver(make<CSS::StyleResolver>(*this)) , m_style_sheets(CSS::StyleSheetList::create(*this)) , m_url(url) , m_window(Window::create_with_document(*this)) @@ -213,7 +213,7 @@ RefPtr<Gfx::Bitmap> Document::background_image() const if (!background_image.has_value() || !background_image.value()->is_image()) return {}; - auto& image_value = static_cast<const ImageStyleValue&>(*background_image.value()); + auto& image_value = static_cast<const CSS::ImageStyleValue&>(*background_image.value()); if (!image_value.bitmap()) return {}; @@ -270,9 +270,9 @@ void Document::update_layout() layout(); } -RefPtr<LayoutNode> Document::create_layout_node(const StyleProperties*) +RefPtr<LayoutNode> Document::create_layout_node(const CSS::StyleProperties*) { - return adopt(*new LayoutDocument(*this, StyleProperties::create())); + return adopt(*new LayoutDocument(*this, CSS::StyleProperties::create())); } void Document::set_link_color(Color color) diff --git a/Libraries/LibWeb/DOM/Document.h b/Libraries/LibWeb/DOM/Document.h index 3bd43513a0..788c628c6c 100644 --- a/Libraries/LibWeb/DOM/Document.h +++ b/Libraries/LibWeb/DOM/Document.h @@ -69,8 +69,8 @@ public: void fixup(); - StyleResolver& style_resolver() { return *m_style_resolver; } - const StyleResolver& style_resolver() const { return *m_style_resolver; } + CSS::StyleResolver& style_resolver() { return *m_style_resolver; } + const CSS::StyleResolver& style_resolver() const { return *m_style_resolver; } CSS::StyleSheetList& style_sheets() { return *m_style_sheets; } const CSS::StyleSheetList& style_sheets() const { return *m_style_sheets; } @@ -158,9 +158,9 @@ public: const String& compat_mode() const; private: - virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) override; + virtual RefPtr<LayoutNode> create_layout_node(const CSS::StyleProperties* parent_style) override; - OwnPtr<StyleResolver> m_style_resolver; + OwnPtr<CSS::StyleResolver> m_style_resolver; RefPtr<CSS::StyleSheetList> m_style_sheets; RefPtr<Node> m_hovered_node; RefPtr<Node> m_inspected_node; diff --git a/Libraries/LibWeb/DOM/Element.cpp b/Libraries/LibWeb/DOM/Element.cpp index 169c0f254a..c938805478 100644 --- a/Libraries/LibWeb/DOM/Element.cpp +++ b/Libraries/LibWeb/DOM/Element.cpp @@ -107,7 +107,7 @@ bool Element::has_class(const FlyString& class_name) const return false; } -RefPtr<LayoutNode> Element::create_layout_node(const StyleProperties* parent_style) +RefPtr<LayoutNode> Element::create_layout_node(const CSS::StyleProperties* parent_style) { auto style = document().style_resolver().resolve_style(*this, parent_style); const_cast<Element&>(*this).m_resolved_style = style; @@ -164,7 +164,7 @@ enum class StyleDifference { NeedsRelayout, }; -static StyleDifference compute_style_difference(const StyleProperties& old_style, const StyleProperties& new_style, const Document& document) +static StyleDifference compute_style_difference(const CSS::StyleProperties& old_style, const CSS::StyleProperties& new_style, const Document& document) { if (old_style == new_style) return StyleDifference::None; @@ -223,7 +223,7 @@ void Element::recompute_style() } } -NonnullRefPtr<StyleProperties> Element::computed_style() +NonnullRefPtr<CSS::StyleProperties> Element::computed_style() { auto properties = m_resolved_style->clone(); if (layout_node() && layout_node()->has_style()) { diff --git a/Libraries/LibWeb/DOM/Element.h b/Libraries/LibWeb/DOM/Element.h index 12f8b9652c..579bee58ba 100644 --- a/Libraries/LibWeb/DOM/Element.h +++ b/Libraries/LibWeb/DOM/Element.h @@ -66,7 +66,7 @@ public: bool has_class(const FlyString&) const; const Vector<FlyString>& class_names() const { return m_classes; } - virtual void apply_presentational_hints(StyleProperties&) const { } + virtual void apply_presentational_hints(CSS::StyleProperties&) const { } virtual void parse_attribute(const FlyString& name, const String& value); void recompute_style(); @@ -76,14 +76,14 @@ public: String name() const { return attribute(HTML::AttributeNames::name); } - const StyleProperties* resolved_style() const { return m_resolved_style.ptr(); } - NonnullRefPtr<StyleProperties> computed_style(); + const CSS::StyleProperties* resolved_style() const { return m_resolved_style.ptr(); } + NonnullRefPtr<CSS::StyleProperties> computed_style(); String inner_html() const; void set_inner_html(StringView); protected: - RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) override; + RefPtr<LayoutNode> create_layout_node(const CSS::StyleProperties* parent_style) override; private: Attribute* find_attribute(const FlyString& name); @@ -92,7 +92,7 @@ private: FlyString m_tag_name; Vector<Attribute> m_attributes; - RefPtr<StyleProperties> m_resolved_style; + RefPtr<CSS::StyleProperties> m_resolved_style; Vector<FlyString> m_classes; }; diff --git a/Libraries/LibWeb/DOM/Node.cpp b/Libraries/LibWeb/DOM/Node.cpp index e2b175ad3b..fc5d0e5d0c 100644 --- a/Libraries/LibWeb/DOM/Node.cpp +++ b/Libraries/LibWeb/DOM/Node.cpp @@ -110,7 +110,7 @@ const Element* Node::previous_element_sibling() const return nullptr; } -RefPtr<LayoutNode> Node::create_layout_node(const StyleProperties*) +RefPtr<LayoutNode> Node::create_layout_node(const CSS::StyleProperties*) { return nullptr; } diff --git a/Libraries/LibWeb/DOM/Node.h b/Libraries/LibWeb/DOM/Node.h index e206ae8ec2..d81428f373 100644 --- a/Libraries/LibWeb/DOM/Node.h +++ b/Libraries/LibWeb/DOM/Node.h @@ -78,7 +78,7 @@ public: RefPtr<Node> append_child(NonnullRefPtr<Node>, bool notify = true); RefPtr<Node> insert_before(NonnullRefPtr<Node> node, RefPtr<Node> child, bool notify = true); - virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style); + virtual RefPtr<LayoutNode> create_layout_node(const CSS::StyleProperties* parent_style); virtual FlyString node_name() const = 0; diff --git a/Libraries/LibWeb/DOM/Text.cpp b/Libraries/LibWeb/DOM/Text.cpp index d3c7e92233..043998538e 100644 --- a/Libraries/LibWeb/DOM/Text.cpp +++ b/Libraries/LibWeb/DOM/Text.cpp @@ -38,7 +38,7 @@ Text::~Text() { } -RefPtr<LayoutNode> Text::create_layout_node(const StyleProperties*) +RefPtr<LayoutNode> Text::create_layout_node(const CSS::StyleProperties*) { return adopt(*new LayoutText(document(), *this)); } diff --git a/Libraries/LibWeb/DOM/Text.h b/Libraries/LibWeb/DOM/Text.h index 7869df0674..5ef79d7329 100644 --- a/Libraries/LibWeb/DOM/Text.h +++ b/Libraries/LibWeb/DOM/Text.h @@ -40,7 +40,7 @@ public: virtual FlyString node_name() const override { return "#text"; } private: - virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) override; + virtual RefPtr<LayoutNode> create_layout_node(const CSS::StyleProperties* parent_style) override; }; } diff --git a/Libraries/LibWeb/Dump.cpp b/Libraries/LibWeb/Dump.cpp index 6023e2157e..f6475f8bd4 100644 --- a/Libraries/LibWeb/Dump.cpp +++ b/Libraries/LibWeb/Dump.cpp @@ -199,28 +199,28 @@ void dump_tree(const LayoutNode& layout_node) --indent; } -void dump_selector(const Selector& selector) +void dump_selector(const CSS::Selector& selector) { - dbgprintf(" Selector:\n"); + dbgprintf(" CSS::Selector:\n"); for (auto& complex_selector : selector.complex_selectors()) { dbgprintf(" "); const char* relation_description = ""; switch (complex_selector.relation) { - case Selector::ComplexSelector::Relation::None: + case CSS::Selector::ComplexSelector::Relation::None: relation_description = "None"; break; - case Selector::ComplexSelector::Relation::ImmediateChild: + case CSS::Selector::ComplexSelector::Relation::ImmediateChild: relation_description = "ImmediateChild"; break; - case Selector::ComplexSelector::Relation::Descendant: + case CSS::Selector::ComplexSelector::Relation::Descendant: relation_description = "Descendant"; break; - case Selector::ComplexSelector::Relation::AdjacentSibling: + case CSS::Selector::ComplexSelector::Relation::AdjacentSibling: relation_description = "AdjacentSibling"; break; - case Selector::ComplexSelector::Relation::GeneralSibling: + case CSS::Selector::ComplexSelector::Relation::GeneralSibling: relation_description = "GeneralSibling"; break; } @@ -232,75 +232,75 @@ void dump_selector(const Selector& selector) auto& simple_selector = complex_selector.compound_selector[i]; const char* type_description = "Unknown"; switch (simple_selector.type) { - case Selector::SimpleSelector::Type::Invalid: + case CSS::Selector::SimpleSelector::Type::Invalid: type_description = "Invalid"; break; - case Selector::SimpleSelector::Type::Universal: + case CSS::Selector::SimpleSelector::Type::Universal: type_description = "Universal"; break; - case Selector::SimpleSelector::Type::Id: + case CSS::Selector::SimpleSelector::Type::Id: type_description = "Id"; break; - case Selector::SimpleSelector::Type::Class: + case CSS::Selector::SimpleSelector::Type::Class: type_description = "Class"; break; - case Selector::SimpleSelector::Type::TagName: + case CSS::Selector::SimpleSelector::Type::TagName: type_description = "TagName"; break; } const char* attribute_match_type_description = ""; switch (simple_selector.attribute_match_type) { - case Selector::SimpleSelector::AttributeMatchType::None: + case CSS::Selector::SimpleSelector::AttributeMatchType::None: break; - case Selector::SimpleSelector::AttributeMatchType::HasAttribute: + case CSS::Selector::SimpleSelector::AttributeMatchType::HasAttribute: attribute_match_type_description = "HasAttribute"; break; - case Selector::SimpleSelector::AttributeMatchType::ExactValueMatch: + case CSS::Selector::SimpleSelector::AttributeMatchType::ExactValueMatch: attribute_match_type_description = "ExactValueMatch"; break; - case Selector::SimpleSelector::AttributeMatchType::Contains: + case CSS::Selector::SimpleSelector::AttributeMatchType::Contains: attribute_match_type_description = "Contains"; break; } const char* pseudo_class_description = ""; switch (simple_selector.pseudo_class) { - case Selector::SimpleSelector::PseudoClass::Link: + case CSS::Selector::SimpleSelector::PseudoClass::Link: pseudo_class_description = "Link"; break; - case Selector::SimpleSelector::PseudoClass::Visited: + case CSS::Selector::SimpleSelector::PseudoClass::Visited: pseudo_class_description = "Visited"; break; - case Selector::SimpleSelector::PseudoClass::None: + case CSS::Selector::SimpleSelector::PseudoClass::None: pseudo_class_description = "None"; break; - case Selector::SimpleSelector::PseudoClass::Root: + case CSS::Selector::SimpleSelector::PseudoClass::Root: pseudo_class_description = "Root"; break; - case Selector::SimpleSelector::PseudoClass::Focus: + case CSS::Selector::SimpleSelector::PseudoClass::Focus: pseudo_class_description = "Focus"; break; - case Selector::SimpleSelector::PseudoClass::Empty: + case CSS::Selector::SimpleSelector::PseudoClass::Empty: pseudo_class_description = "Empty"; break; - case Selector::SimpleSelector::PseudoClass::Hover: + case CSS::Selector::SimpleSelector::PseudoClass::Hover: pseudo_class_description = "Hover"; break; - case Selector::SimpleSelector::PseudoClass::LastChild: + case CSS::Selector::SimpleSelector::PseudoClass::LastChild: pseudo_class_description = "LastChild"; break; - case Selector::SimpleSelector::PseudoClass::FirstChild: + case CSS::Selector::SimpleSelector::PseudoClass::FirstChild: pseudo_class_description = "FirstChild"; break; - case Selector::SimpleSelector::PseudoClass::OnlyChild: + case CSS::Selector::SimpleSelector::PseudoClass::OnlyChild: pseudo_class_description = "OnlyChild"; break; } dbgprintf("%s:%s", type_description, simple_selector.value.characters()); - if (simple_selector.pseudo_class != Selector::SimpleSelector::PseudoClass::None) + if (simple_selector.pseudo_class != CSS::Selector::SimpleSelector::PseudoClass::None) dbgprintf(" pseudo_class=%s", pseudo_class_description); - if (simple_selector.attribute_match_type != Selector::SimpleSelector::AttributeMatchType::None) { + if (simple_selector.attribute_match_type != CSS::Selector::SimpleSelector::AttributeMatchType::None) { dbgprintf(" [%s, name='%s', value='%s']", attribute_match_type_description, simple_selector.attribute_name.characters(), simple_selector.attribute_value.characters()); } @@ -311,7 +311,7 @@ void dump_selector(const Selector& selector) } } -void dump_rule(const StyleRule& rule) +void dump_rule(const CSS::StyleRule& rule) { dbgprintf("Rule:\n"); for (auto& selector : rule.selectors()) { @@ -323,7 +323,7 @@ void dump_rule(const StyleRule& rule) } } -void dump_sheet(const StyleSheet& sheet) +void dump_sheet(const CSS::StyleSheet& sheet) { dbgprintf("StyleSheet{%p}: %d rule(s)\n", &sheet, sheet.rules().size()); diff --git a/Libraries/LibWeb/Dump.h b/Libraries/LibWeb/Dump.h index c3e4bef3a6..5f7512371c 100644 --- a/Libraries/LibWeb/Dump.h +++ b/Libraries/LibWeb/Dump.h @@ -32,9 +32,9 @@ namespace Web { void dump_tree(const DOM::Node&); void dump_tree(const LayoutNode&); -void dump_sheet(const StyleSheet&); -void dump_rule(const StyleRule&); -void dump_selector(const Selector&); +void dump_sheet(const CSS::StyleSheet&); +void dump_rule(const CSS::StyleRule&); +void dump_selector(const CSS::Selector&); #undef HTML_DEBUG diff --git a/Libraries/LibWeb/Forward.h b/Libraries/LibWeb/Forward.h index a9d3f1b592..c82afaace0 100644 --- a/Libraries/LibWeb/Forward.h +++ b/Libraries/LibWeb/Forward.h @@ -26,6 +26,14 @@ #pragma once +namespace Web::CSS { +class Selector; +class StyleProperties; +class StyleResolver; +class StyleRule; +class StyleSheet; +} + namespace Web::DOM { class Document; class DocumentType; @@ -72,12 +80,7 @@ class PageView; class PaintContext; class Resource; class ResourceLoader; -class Selector; class StackingContext; -class StyleProperties; -class StyleResolver; -class StyleRule; -class StyleSheet; class XMLHttpRequest; } diff --git a/Libraries/LibWeb/HTML/HTMLBRElement.cpp b/Libraries/LibWeb/HTML/HTMLBRElement.cpp index ac2c4125a4..2772f20ddd 100644 --- a/Libraries/LibWeb/HTML/HTMLBRElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLBRElement.cpp @@ -38,7 +38,7 @@ HTMLBRElement::~HTMLBRElement() { } -RefPtr<LayoutNode> HTMLBRElement::create_layout_node(const StyleProperties*) +RefPtr<LayoutNode> HTMLBRElement::create_layout_node(const CSS::StyleProperties*) { return adopt(*new LayoutBreak(document(), *this)); } diff --git a/Libraries/LibWeb/HTML/HTMLBRElement.h b/Libraries/LibWeb/HTML/HTMLBRElement.h index e8ca242eea..a97fc15a06 100644 --- a/Libraries/LibWeb/HTML/HTMLBRElement.h +++ b/Libraries/LibWeb/HTML/HTMLBRElement.h @@ -35,7 +35,7 @@ public: HTMLBRElement(DOM::Document&, const FlyString& local_name); virtual ~HTMLBRElement() override; - virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) override; + virtual RefPtr<LayoutNode> create_layout_node(const CSS::StyleProperties* parent_style) override; }; } diff --git a/Libraries/LibWeb/HTML/HTMLBodyElement.cpp b/Libraries/LibWeb/HTML/HTMLBodyElement.cpp index 846b48f696..95bc5a56d6 100644 --- a/Libraries/LibWeb/HTML/HTMLBodyElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLBodyElement.cpp @@ -40,17 +40,17 @@ HTMLBodyElement::~HTMLBodyElement() { } -void HTMLBodyElement::apply_presentational_hints(StyleProperties& style) const +void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) const { for_each_attribute([&](auto& name, auto& value) { if (name.equals_ignoring_case("bgcolor")) { auto color = Color::from_string(value); if (color.has_value()) - style.set_property(CSS::PropertyID::BackgroundColor, ColorStyleValue::create(color.value())); + style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value())); } else if (name.equals_ignoring_case("text")) { auto color = Color::from_string(value); if (color.has_value()) - style.set_property(CSS::PropertyID::Color, ColorStyleValue::create(color.value())); + style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value())); } else if (name.equals_ignoring_case("background")) { ASSERT(m_background_style_value); style.set_property(CSS::PropertyID::BackgroundImage, *m_background_style_value); @@ -74,7 +74,7 @@ void HTMLBodyElement::parse_attribute(const FlyString& name, const String& value if (color.has_value()) document().set_visited_link_color(color.value()); } else if (name.equals_ignoring_case("background")) { - m_background_style_value = ImageStyleValue::create(document().complete_url(value), const_cast<DOM::Document&>(document())); + m_background_style_value = CSS::ImageStyleValue::create(document().complete_url(value), const_cast<DOM::Document&>(document())); } } diff --git a/Libraries/LibWeb/HTML/HTMLBodyElement.h b/Libraries/LibWeb/HTML/HTMLBodyElement.h index fe14fc86db..4c7da3db39 100644 --- a/Libraries/LibWeb/HTML/HTMLBodyElement.h +++ b/Libraries/LibWeb/HTML/HTMLBodyElement.h @@ -36,10 +36,10 @@ public: virtual ~HTMLBodyElement() override; virtual void parse_attribute(const FlyString&, const String&) override; - virtual void apply_presentational_hints(StyleProperties&) const override; + virtual void apply_presentational_hints(CSS::StyleProperties&) const override; private: - RefPtr<ImageStyleValue> m_background_style_value; + RefPtr<CSS::ImageStyleValue> m_background_style_value; }; } diff --git a/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp b/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp index 811b181eaf..a933182051 100644 --- a/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp @@ -55,7 +55,7 @@ unsigned HTMLCanvasElement::height() const return attribute(HTML::AttributeNames::height).to_uint().value_or(150); } -RefPtr<LayoutNode> HTMLCanvasElement::create_layout_node(const StyleProperties* parent_style) +RefPtr<LayoutNode> HTMLCanvasElement::create_layout_node(const CSS::StyleProperties* parent_style) { auto style = document().style_resolver().resolve_style(*this, parent_style); if (style->display() == CSS::Display::None) diff --git a/Libraries/LibWeb/HTML/HTMLCanvasElement.h b/Libraries/LibWeb/HTML/HTMLCanvasElement.h index de25f2ba7c..d426a5c6f4 100644 --- a/Libraries/LibWeb/HTML/HTMLCanvasElement.h +++ b/Libraries/LibWeb/HTML/HTMLCanvasElement.h @@ -51,7 +51,7 @@ public: unsigned height() const; private: - virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) override; + virtual RefPtr<LayoutNode> create_layout_node(const CSS::StyleProperties* parent_style) override; RefPtr<Gfx::Bitmap> m_bitmap; RefPtr<CanvasRenderingContext2D> m_context; diff --git a/Libraries/LibWeb/HTML/HTMLFontElement.cpp b/Libraries/LibWeb/HTML/HTMLFontElement.cpp index b4cef27c92..7a7a9f2cb1 100644 --- a/Libraries/LibWeb/HTML/HTMLFontElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLFontElement.cpp @@ -39,13 +39,13 @@ HTMLFontElement::~HTMLFontElement() { } -void HTMLFontElement::apply_presentational_hints(StyleProperties& style) const +void HTMLFontElement::apply_presentational_hints(CSS::StyleProperties& style) const { for_each_attribute([&](auto& name, auto& value) { if (name.equals_ignoring_case("color")) { auto color = Color::from_string(value); if (color.has_value()) - style.set_property(CSS::PropertyID::Color, ColorStyleValue::create(color.value())); + style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value())); } }); } diff --git a/Libraries/LibWeb/HTML/HTMLFontElement.h b/Libraries/LibWeb/HTML/HTMLFontElement.h index ff787e023e..1993ea2425 100644 --- a/Libraries/LibWeb/HTML/HTMLFontElement.h +++ b/Libraries/LibWeb/HTML/HTMLFontElement.h @@ -35,7 +35,7 @@ public: HTMLFontElement(DOM::Document&, const FlyString& local_name); virtual ~HTMLFontElement() override; - virtual void apply_presentational_hints(StyleProperties&) const override; + virtual void apply_presentational_hints(CSS::StyleProperties&) const override; }; } diff --git a/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp b/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp index 70618881b7..fe577a899b 100644 --- a/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp @@ -50,7 +50,7 @@ HTMLIFrameElement::~HTMLIFrameElement() { } -RefPtr<LayoutNode> HTMLIFrameElement::create_layout_node(const StyleProperties* parent_style) +RefPtr<LayoutNode> HTMLIFrameElement::create_layout_node(const CSS::StyleProperties* parent_style) { auto style = document().style_resolver().resolve_style(*this, parent_style); return adopt(*new LayoutFrame(document(), *this, move(style))); diff --git a/Libraries/LibWeb/HTML/HTMLIFrameElement.h b/Libraries/LibWeb/HTML/HTMLIFrameElement.h index 2948db0d41..ea915698e2 100644 --- a/Libraries/LibWeb/HTML/HTMLIFrameElement.h +++ b/Libraries/LibWeb/HTML/HTMLIFrameElement.h @@ -35,7 +35,7 @@ public: HTMLIFrameElement(DOM::Document&, const FlyString& local_name); virtual ~HTMLIFrameElement() override; - virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) override; + virtual RefPtr<LayoutNode> create_layout_node(const CSS::StyleProperties* parent_style) override; Frame* hosted_frame() { return m_hosted_frame; } const Frame* hosted_frame() const { return m_hosted_frame; } diff --git a/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Libraries/LibWeb/HTML/HTMLImageElement.cpp index 45adbd6f3c..79d2bada92 100644 --- a/Libraries/LibWeb/HTML/HTMLImageElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLImageElement.cpp @@ -61,7 +61,7 @@ HTMLImageElement::~HTMLImageElement() { } -void HTMLImageElement::apply_presentational_hints(StyleProperties& style) const +void HTMLImageElement::apply_presentational_hints(CSS::StyleProperties& style) const { for_each_attribute([&](auto& name, auto& value) { if (name == HTML::AttributeNames::width) { @@ -84,7 +84,7 @@ void HTMLImageElement::parse_attribute(const FlyString& name, const String& valu m_image_loader.load(document().complete_url(value)); } -RefPtr<LayoutNode> HTMLImageElement::create_layout_node(const StyleProperties* parent_style) +RefPtr<LayoutNode> HTMLImageElement::create_layout_node(const CSS::StyleProperties* parent_style) { auto style = document().style_resolver().resolve_style(*this, parent_style); if (style->display() == CSS::Display::None) diff --git a/Libraries/LibWeb/HTML/HTMLImageElement.h b/Libraries/LibWeb/HTML/HTMLImageElement.h index 2d991a5551..edffe13042 100644 --- a/Libraries/LibWeb/HTML/HTMLImageElement.h +++ b/Libraries/LibWeb/HTML/HTMLImageElement.h @@ -51,11 +51,11 @@ public: const Gfx::Bitmap* bitmap() const; private: - virtual void apply_presentational_hints(StyleProperties&) const override; + virtual void apply_presentational_hints(CSS::StyleProperties&) const override; void animate(); - virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) override; + virtual RefPtr<LayoutNode> create_layout_node(const CSS::StyleProperties* parent_style) override; ImageLoader m_image_loader; }; diff --git a/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Libraries/LibWeb/HTML/HTMLInputElement.cpp index 8883aba3e8..a248eae12e 100644 --- a/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -46,7 +46,7 @@ HTMLInputElement::~HTMLInputElement() { } -RefPtr<LayoutNode> HTMLInputElement::create_layout_node(const StyleProperties* parent_style) +RefPtr<LayoutNode> HTMLInputElement::create_layout_node(const CSS::StyleProperties* parent_style) { ASSERT(document().frame()); auto& frame = *document().frame(); diff --git a/Libraries/LibWeb/HTML/HTMLInputElement.h b/Libraries/LibWeb/HTML/HTMLInputElement.h index 2a97ad3f34..3004e78545 100644 --- a/Libraries/LibWeb/HTML/HTMLInputElement.h +++ b/Libraries/LibWeb/HTML/HTMLInputElement.h @@ -35,7 +35,7 @@ public: HTMLInputElement(DOM::Document&, const FlyString& local_name); virtual ~HTMLInputElement() override; - virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) override; + virtual RefPtr<LayoutNode> create_layout_node(const CSS::StyleProperties* parent_style) override; String type() const { return attribute(HTML::AttributeNames::type); } String value() const { return attribute(HTML::AttributeNames::value); } diff --git a/Libraries/LibWeb/HTML/HTMLLinkElement.cpp b/Libraries/LibWeb/HTML/HTMLLinkElement.cpp index adb9ce12ff..743b0ca1b5 100644 --- a/Libraries/LibWeb/HTML/HTMLLinkElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLLinkElement.cpp @@ -79,7 +79,7 @@ void HTMLLinkElement::load_stylesheet(const URL& url) { // First insert an empty style sheet in the document sheet list. // There's probably a nicer way to do this, but this ensures that sheets are in document order. - m_style_sheet = StyleSheet::create({}); + m_style_sheet = CSS::StyleSheet::create({}); document().style_sheets().add_sheet(*m_style_sheet); LoadRequest request; diff --git a/Libraries/LibWeb/HTML/HTMLLinkElement.h b/Libraries/LibWeb/HTML/HTMLLinkElement.h index 66f01dc3ce..691ce9e233 100644 --- a/Libraries/LibWeb/HTML/HTMLLinkElement.h +++ b/Libraries/LibWeb/HTML/HTMLLinkElement.h @@ -61,7 +61,7 @@ private: }; unsigned m_relationship { 0 }; - RefPtr<StyleSheet> m_style_sheet; + RefPtr<CSS::StyleSheet> m_style_sheet; }; } diff --git a/Libraries/LibWeb/HTML/HTMLObjectElement.cpp b/Libraries/LibWeb/HTML/HTMLObjectElement.cpp index ab47676ca7..b793819bda 100644 --- a/Libraries/LibWeb/HTML/HTMLObjectElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLObjectElement.cpp @@ -61,7 +61,7 @@ void HTMLObjectElement::parse_attribute(const FlyString& name, const String& val m_image_loader.load(document().complete_url(value)); } -RefPtr<LayoutNode> HTMLObjectElement::create_layout_node(const StyleProperties* parent_style) +RefPtr<LayoutNode> HTMLObjectElement::create_layout_node(const CSS::StyleProperties* parent_style) { if (m_should_show_fallback_content) return HTMLElement::create_layout_node(parent_style); diff --git a/Libraries/LibWeb/HTML/HTMLObjectElement.h b/Libraries/LibWeb/HTML/HTMLObjectElement.h index e3dddab938..c3dc7e7e8f 100644 --- a/Libraries/LibWeb/HTML/HTMLObjectElement.h +++ b/Libraries/LibWeb/HTML/HTMLObjectElement.h @@ -46,7 +46,7 @@ public: String type() const { return attribute(HTML::AttributeNames::type); } private: - virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) override; + virtual RefPtr<LayoutNode> create_layout_node(const CSS::StyleProperties* parent_style) override; ImageLoader m_image_loader; bool m_should_show_fallback_content { false }; diff --git a/Libraries/LibWeb/HTML/HTMLStyleElement.cpp b/Libraries/LibWeb/HTML/HTMLStyleElement.cpp index 38b1626044..95a27f3f98 100644 --- a/Libraries/LibWeb/HTML/HTMLStyleElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLStyleElement.cpp @@ -52,7 +52,7 @@ void HTMLStyleElement::children_changed() if (m_stylesheet) document().style_sheets().add_sheet(*m_stylesheet); else - document().style_sheets().add_sheet(StyleSheet::create({})); + document().style_sheets().add_sheet(CSS::StyleSheet::create({})); HTMLElement::children_changed(); } diff --git a/Libraries/LibWeb/HTML/HTMLStyleElement.h b/Libraries/LibWeb/HTML/HTMLStyleElement.h index d0a974962c..c4b2b2a9f9 100644 --- a/Libraries/LibWeb/HTML/HTMLStyleElement.h +++ b/Libraries/LibWeb/HTML/HTMLStyleElement.h @@ -30,8 +30,6 @@ namespace Web { -class StyleSheet; - class HTMLStyleElement : public HTMLElement { public: HTMLStyleElement(DOM::Document&, const FlyString& local_name); @@ -41,7 +39,7 @@ public: virtual void removed_from(Node&) override; private: - RefPtr<StyleSheet> m_stylesheet; + RefPtr<CSS::StyleSheet> m_stylesheet; }; } diff --git a/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp b/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp index 2be05a7475..bb1798372f 100644 --- a/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp @@ -38,13 +38,13 @@ HTMLTableCellElement::~HTMLTableCellElement() { } -void HTMLTableCellElement::apply_presentational_hints(StyleProperties& style) const +void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& style) const { for_each_attribute([&](auto& name, auto& value) { if (name == HTML::AttributeNames::bgcolor) { auto color = Color::from_string(value); if (color.has_value()) - style.set_property(CSS::PropertyID::BackgroundColor, ColorStyleValue::create(color.value())); + style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value())); return; } if (name == HTML::AttributeNames::align) { diff --git a/Libraries/LibWeb/HTML/HTMLTableCellElement.h b/Libraries/LibWeb/HTML/HTMLTableCellElement.h index e8e50ce343..3b02504b5c 100644 --- a/Libraries/LibWeb/HTML/HTMLTableCellElement.h +++ b/Libraries/LibWeb/HTML/HTMLTableCellElement.h @@ -36,7 +36,7 @@ public: virtual ~HTMLTableCellElement() override; private: - virtual void apply_presentational_hints(StyleProperties&) const override; + virtual void apply_presentational_hints(CSS::StyleProperties&) const override; }; } diff --git a/Libraries/LibWeb/HTML/HTMLTableElement.cpp b/Libraries/LibWeb/HTML/HTMLTableElement.cpp index 33cfa299f4..ddd7459537 100644 --- a/Libraries/LibWeb/HTML/HTMLTableElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLTableElement.cpp @@ -38,7 +38,7 @@ HTMLTableElement::~HTMLTableElement() { } -void HTMLTableElement::apply_presentational_hints(StyleProperties& style) const +void HTMLTableElement::apply_presentational_hints(CSS::StyleProperties& style) const { for_each_attribute([&](auto& name, auto& value) { if (name == HTML::AttributeNames::width) { @@ -49,7 +49,7 @@ void HTMLTableElement::apply_presentational_hints(StyleProperties& style) const if (name == HTML::AttributeNames::bgcolor) { auto color = Color::from_string(value); if (color.has_value()) - style.set_property(CSS::PropertyID::BackgroundColor, ColorStyleValue::create(color.value())); + style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value())); return; } }); diff --git a/Libraries/LibWeb/HTML/HTMLTableElement.h b/Libraries/LibWeb/HTML/HTMLTableElement.h index 0db486bbb1..12cacc565a 100644 --- a/Libraries/LibWeb/HTML/HTMLTableElement.h +++ b/Libraries/LibWeb/HTML/HTMLTableElement.h @@ -36,7 +36,7 @@ public: virtual ~HTMLTableElement() override; private: - virtual void apply_presentational_hints(StyleProperties&) const override; + virtual void apply_presentational_hints(CSS::StyleProperties&) const override; }; } diff --git a/Libraries/LibWeb/Layout/BoxModelMetrics.h b/Libraries/LibWeb/Layout/BoxModelMetrics.h index 14a3aac60d..5e56433436 100644 --- a/Libraries/LibWeb/Layout/BoxModelMetrics.h +++ b/Libraries/LibWeb/Layout/BoxModelMetrics.h @@ -40,15 +40,14 @@ struct PixelBox { struct BoxModelMetrics { public: - LengthBox margin; - LengthBox padding; - LengthBox border; - LengthBox offset; + CSS::LengthBox margin; + CSS::LengthBox padding; + CSS::LengthBox border; + CSS::LengthBox offset; PixelBox margin_box(const LayoutNode&) const; PixelBox padding_box(const LayoutNode&) const; PixelBox border_box(const LayoutNode&) const; - }; } diff --git a/Libraries/LibWeb/Layout/LayoutBlock.cpp b/Libraries/LibWeb/Layout/LayoutBlock.cpp index e1c88e7958..31f2a9ae80 100644 --- a/Libraries/LibWeb/Layout/LayoutBlock.cpp +++ b/Libraries/LibWeb/Layout/LayoutBlock.cpp @@ -38,7 +38,7 @@ namespace Web { -LayoutBlock::LayoutBlock(DOM::Document& document, const DOM::Node* node, NonnullRefPtr<StyleProperties> style) +LayoutBlock::LayoutBlock(DOM::Document& document, const DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> style) : LayoutBox(document, node, move(style)) { } @@ -69,7 +69,7 @@ void LayoutBlock::layout_absolutely_positioned_descendant(LayoutBox& box) { box.layout(LayoutMode::Default); auto& box_model = box.box_model(); - auto zero_value = Length::make_px(0); + auto zero_value = CSS::Length::make_px(0); auto specified_width = box.style().width().resolved_or_auto(box, width()); @@ -78,10 +78,10 @@ void LayoutBlock::layout_absolutely_positioned_descendant(LayoutBox& box) box_model.margin.right = box.style().margin().right.resolved_or_auto(box, width()); box_model.margin.bottom = box.style().margin().bottom.resolved_or_auto(box, height()); - box_model.border.left = Length::make_px(box.style().border_left().width); - box_model.border.right = Length::make_px(box.style().border_right().width); - box_model.border.top = Length::make_px(box.style().border_top().width); - box_model.border.bottom = Length::make_px(box.style().border_bottom().width); + box_model.border.left = CSS::Length::make_px(box.style().border_left().width); + box_model.border.right = CSS::Length::make_px(box.style().border_right().width); + box_model.border.top = CSS::Length::make_px(box.style().border_top().width); + box_model.border.bottom = CSS::Length::make_px(box.style().border_bottom().width); box_model.offset.left = box.style().offset().left.resolved_or_auto(box, width()); box_model.offset.top = box.style().offset().top.resolved_or_auto(box, height()); @@ -283,10 +283,10 @@ void LayoutBlock::layout_inline_children(LayoutMode layout_mode) void LayoutBlock::compute_width_for_absolutely_positioned_block() { auto& containing_block = *this->containing_block(); - auto zero_value = Length::make_px(0); + auto zero_value = CSS::Length::make_px(0); - auto margin_left = Length::make_auto(); - auto margin_right = Length::make_auto(); + auto margin_left = CSS::Length::make_auto(); + auto margin_right = CSS::Length::make_auto(); const auto border_left = style().border_left().width; const auto border_right = style().border_right().width; const auto padding_left = style().padding().left.resolved(zero_value, *this, containing_block.width()); @@ -301,29 +301,29 @@ void LayoutBlock::compute_width_for_absolutely_positioned_block() auto width = a_width; auto solve_for_left = [&] { - return Length(containing_block.width() - margin_left.to_px(*this) - border_left - padding_left.to_px(*this) - width.to_px(*this) - padding_right.to_px(*this) - border_right - margin_right.to_px(*this) - right.to_px(*this), Length::Type::Px); + return CSS::Length(containing_block.width() - margin_left.to_px(*this) - border_left - padding_left.to_px(*this) - width.to_px(*this) - padding_right.to_px(*this) - border_right - margin_right.to_px(*this) - right.to_px(*this), CSS::Length::Type::Px); }; auto solve_for_width = [&] { - return Length(containing_block.width() - left.to_px(*this) - margin_left.to_px(*this) - border_left - padding_left.to_px(*this) - padding_right.to_px(*this) - border_right - margin_right.to_px(*this) - right.to_px(*this), Length::Type::Px); + return CSS::Length(containing_block.width() - left.to_px(*this) - margin_left.to_px(*this) - border_left - padding_left.to_px(*this) - padding_right.to_px(*this) - border_right - margin_right.to_px(*this) - right.to_px(*this), CSS::Length::Type::Px); }; auto solve_for_right = [&] { - return Length(containing_block.width() - left.to_px(*this) - margin_left.to_px(*this) - border_left - padding_left.to_px(*this) - width.to_px(*this) - padding_right.to_px(*this) - border_right - margin_right.to_px(*this), Length::Type::Px); + return CSS::Length(containing_block.width() - left.to_px(*this) - margin_left.to_px(*this) - border_left - padding_left.to_px(*this) - width.to_px(*this) - padding_right.to_px(*this) - border_right - margin_right.to_px(*this), CSS::Length::Type::Px); }; // If all three of 'left', 'width', and 'right' are 'auto': if (left.is_auto() && width.is_auto() && right.is_auto()) { // First set any 'auto' values for 'margin-left' and 'margin-right' to 0. if (margin_left.is_auto()) - margin_left = Length::make_px(0); + margin_left = CSS::Length::make_px(0); if (margin_right.is_auto()) - margin_right = Length::make_px(0); + margin_right = CSS::Length::make_px(0); // Then, if the 'direction' property of the element establishing the static-position containing block // is 'ltr' set 'left' to the static position and apply rule number three below; // otherwise, set 'right' to the static position and apply rule number one below. // FIXME: This is very hackish. - left = Length::make_px(0); + left = CSS::Length::make_px(0); goto Rule3; } @@ -333,9 +333,9 @@ void LayoutBlock::compute_width_for_absolutely_positioned_block() } if (margin_left.is_auto()) - margin_left = Length::make_px(0); + margin_left = CSS::Length::make_px(0); if (margin_right.is_auto()) - margin_right = Length::make_px(0); + margin_right = CSS::Length::make_px(0); // 1. 'left' and 'width' are 'auto' and 'right' is not 'auto', // then the width is shrink-to-fit. Then solve for 'left' @@ -343,7 +343,7 @@ void LayoutBlock::compute_width_for_absolutely_positioned_block() auto result = calculate_shrink_to_fit_width(); solve_for_left(); auto available_width = solve_for_width(); - width = Length(min(max(result.preferred_minimum_width, available_width.to_px(*this)), result.preferred_width), Length::Type::Px); + width = CSS::Length(min(max(result.preferred_minimum_width, available_width.to_px(*this)), result.preferred_width), CSS::Length::Type::Px); } // 2. 'left' and 'right' are 'auto' and 'width' is not 'auto', @@ -365,7 +365,7 @@ void LayoutBlock::compute_width_for_absolutely_positioned_block() auto result = calculate_shrink_to_fit_width(); right = solve_for_right(); auto available_width = solve_for_width(); - width = Length(min(max(result.preferred_minimum_width, available_width.to_px(*this)), result.preferred_width), Length::Type::Px); + width = CSS::Length(min(max(result.preferred_minimum_width, available_width.to_px(*this)), result.preferred_width), CSS::Length::Type::Px); } // 4. 'left' is 'auto', 'width' and 'right' are not 'auto', then solve for 'left' @@ -413,8 +413,8 @@ void LayoutBlock::compute_width_for_absolutely_positioned_block() box_model().margin.left = margin_left; box_model().margin.right = margin_right; - box_model().border.left = Length::make_px(border_left); - box_model().border.right = Length::make_px(border_right); + box_model().border.left = CSS::Length::make_px(border_left); + box_model().border.right = CSS::Length::make_px(border_right); box_model().padding.left = padding_left; box_model().padding.right = padding_right; } @@ -433,15 +433,15 @@ void LayoutBlock::compute_width() float width_of_containing_block = this->width_of_logical_containing_block(); - auto zero_value = Length::make_px(0); + auto zero_value = CSS::Length::make_px(0); - auto margin_left = Length::make_auto(); - auto margin_right = Length::make_auto(); + auto margin_left = CSS::Length::make_auto(); + auto margin_right = CSS::Length::make_auto(); const auto padding_left = style().padding().left.resolved_or_zero(*this, width_of_containing_block); const auto padding_right = style().padding().right.resolved_or_zero(*this, width_of_containing_block); auto try_compute_width = [&](const auto& a_width) { - Length width = a_width; + CSS::Length width = a_width; margin_left = style().margin().left.resolved_or_zero(*this, width_of_containing_block); margin_right = style().margin().right.resolved_or_zero(*this, width_of_containing_block); @@ -473,20 +473,20 @@ void LayoutBlock::compute_width() if (margin_right.is_auto()) margin_right = zero_value; if (underflow_px >= 0) { - width = Length(underflow_px, Length::Type::Px); + width = CSS::Length(underflow_px, CSS::Length::Type::Px); } else { width = zero_value; - margin_right = Length(margin_right.to_px(*this) + underflow_px, Length::Type::Px); + margin_right = CSS::Length(margin_right.to_px(*this) + underflow_px, CSS::Length::Type::Px); } } else { if (!margin_left.is_auto() && !margin_right.is_auto()) { - margin_right = Length(margin_right.to_px(*this) + underflow_px, Length::Type::Px); + margin_right = CSS::Length(margin_right.to_px(*this) + underflow_px, CSS::Length::Type::Px); } else if (!margin_left.is_auto() && margin_right.is_auto()) { - margin_right = Length(underflow_px, Length::Type::Px); + margin_right = CSS::Length(underflow_px, CSS::Length::Type::Px); } else if (margin_left.is_auto() && !margin_right.is_auto()) { - margin_left = Length(underflow_px, Length::Type::Px); + margin_left = CSS::Length(underflow_px, CSS::Length::Type::Px); } else { // margin_left.is_auto() && margin_right.is_auto() - auto half_of_the_underflow = Length(underflow_px / 2, Length::Type::Px); + auto half_of_the_underflow = CSS::Length(underflow_px / 2, CSS::Length::Type::Px); margin_left = half_of_the_underflow; margin_right = half_of_the_underflow; } @@ -514,7 +514,7 @@ void LayoutBlock::compute_width() auto result = calculate_shrink_to_fit_width(); // Then the shrink-to-fit width is: min(max(preferred minimum width, available width), preferred width). - width = Length(min(max(result.preferred_minimum_width, available_width), result.preferred_width), Length::Type::Px); + width = CSS::Length(min(max(result.preferred_minimum_width, available_width), result.preferred_width), CSS::Length::Type::Px); } } @@ -547,8 +547,8 @@ void LayoutBlock::compute_width() set_width(used_width.to_px(*this)); box_model().margin.left = margin_left; box_model().margin.right = margin_right; - box_model().border.left = Length::make_px(style().border_left().width); - box_model().border.right = Length::make_px(style().border_right().width); + box_model().border.left = CSS::Length::make_px(style().border_left().width); + box_model().border.right = CSS::Length::make_px(style().border_right().width); box_model().padding.left = padding_left; box_model().padding.right = padding_right; } @@ -561,8 +561,8 @@ void LayoutBlock::place_block_level_replaced_element_in_normal_flow(LayoutReplac replaced_element_box_model.margin.top = box.style().margin().top.resolved_or_zero(*this, containing_block.width()); replaced_element_box_model.margin.bottom = box.style().margin().bottom.resolved_or_zero(*this, containing_block.width()); - replaced_element_box_model.border.top = Length::make_px(box.style().border_top().width); - replaced_element_box_model.border.bottom = Length::make_px(box.style().border_bottom().width); + replaced_element_box_model.border.top = CSS::Length::make_px(box.style().border_top().width); + replaced_element_box_model.border.bottom = CSS::Length::make_px(box.style().border_bottom().width); replaced_element_box_model.padding.top = box.style().padding().top.resolved_or_zero(*this, containing_block.width()); replaced_element_box_model.padding.bottom = box.style().padding().bottom.resolved_or_zero(*this, containing_block.width()); @@ -609,15 +609,15 @@ LayoutBlock::ShrinkToFitResult LayoutBlock::calculate_shrink_to_fit_width() void LayoutBlock::place_block_level_non_replaced_element_in_normal_flow(LayoutBlock& block) { - auto zero_value = Length::make_px(0); + auto zero_value = CSS::Length::make_px(0); auto& containing_block = *this; auto& box = block.box_model(); auto& style = block.style(); box.margin.top = style.margin().top.resolved(zero_value, *this, containing_block.width()); box.margin.bottom = style.margin().bottom.resolved(zero_value, *this, containing_block.width()); - box.border.top = Length::make_px(style.border_top().width); - box.border.bottom = Length::make_px(style.border_bottom().width); + box.border.top = CSS::Length::make_px(style.border_top().width); + box.border.bottom = CSS::Length::make_px(style.border_bottom().width); box.padding.top = style.padding().top.resolved(zero_value, *this, containing_block.width()); box.padding.bottom = style.padding().bottom.resolved(zero_value, *this, containing_block.width()); @@ -671,10 +671,10 @@ void LayoutBlock::compute_height() { auto& containing_block = *this->containing_block(); - Length specified_height; + CSS::Length specified_height; if (style().height().is_percentage() && !containing_block.style().height().is_absolute()) { - specified_height = Length::make_auto(); + specified_height = CSS::Length::make_auto(); } else { specified_height = style().height().resolved_or_auto(*this, containing_block.height()); } @@ -683,8 +683,8 @@ void LayoutBlock::compute_height() box_model().margin.top = style().margin().top.resolved_or_zero(*this, containing_block.width()); box_model().margin.bottom = style().margin().bottom.resolved_or_zero(*this, containing_block.width()); - box_model().border.top = Length::make_px(style().border_top().width); - box_model().border.bottom = Length::make_px(style().border_bottom().width); + box_model().border.top = CSS::Length::make_px(style().border_top().width); + box_model().border.bottom = CSS::Length::make_px(style().border_bottom().width); box_model().padding.top = style().padding().top.resolved_or_zero(*this, containing_block.width()); box_model().padding.bottom = style().padding().bottom.resolved_or_zero(*this, containing_block.width()); @@ -742,12 +742,12 @@ HitTestResult LayoutBlock::hit_test(const Gfx::IntPoint& position) const return { absolute_rect().contains(position.x(), position.y()) ? this : nullptr }; } -NonnullRefPtr<StyleProperties> LayoutBlock::style_for_anonymous_block() const +NonnullRefPtr<CSS::StyleProperties> LayoutBlock::style_for_anonymous_block() const { - auto new_style = StyleProperties::create(); + auto new_style = CSS::StyleProperties::create(); specified_style().for_each_property([&](auto property_id, auto& value) { - if (StyleResolver::is_inherited_property(property_id)) + if (CSS::StyleResolver::is_inherited_property(property_id)) new_style->set_property(property_id, value); }); diff --git a/Libraries/LibWeb/Layout/LayoutBlock.h b/Libraries/LibWeb/Layout/LayoutBlock.h index 83a6da4ccd..68f69008a0 100644 --- a/Libraries/LibWeb/Layout/LayoutBlock.h +++ b/Libraries/LibWeb/Layout/LayoutBlock.h @@ -33,7 +33,7 @@ namespace Web { class LayoutBlock : public LayoutBox { public: - LayoutBlock(DOM::Document&, const DOM::Node*, NonnullRefPtr<StyleProperties>); + LayoutBlock(DOM::Document&, const DOM::Node*, NonnullRefPtr<CSS::StyleProperties>); virtual ~LayoutBlock() override; virtual const char* class_name() const override { return "LayoutBlock"; } @@ -87,7 +87,7 @@ private: void place_block_level_replaced_element_in_normal_flow(LayoutReplaced&); void layout_absolutely_positioned_descendant(LayoutBox&); - NonnullRefPtr<StyleProperties> style_for_anonymous_block() const; + NonnullRefPtr<CSS::StyleProperties> style_for_anonymous_block() const; void layout_inline_children(LayoutMode); void layout_contained_boxes(LayoutMode); diff --git a/Libraries/LibWeb/Layout/LayoutBox.cpp b/Libraries/LibWeb/Layout/LayoutBox.cpp index 128f0e1fca..4a5aa6ef4f 100644 --- a/Libraries/LibWeb/Layout/LayoutBox.cpp +++ b/Libraries/LibWeb/Layout/LayoutBox.cpp @@ -186,7 +186,7 @@ void LayoutBox::paint(PaintContext& context, PaintPhase phase) auto bgimage = specified_style().property(CSS::PropertyID::BackgroundImage); if (bgimage.has_value() && bgimage.value()->is_image()) { - auto& image_value = static_cast<const ImageStyleValue&>(*bgimage.value()); + auto& image_value = static_cast<const CSS::ImageStyleValue&>(*bgimage.value()); if (image_value.bitmap()) { context.painter().draw_tiled_bitmap(enclosing_int_rect(padded_rect), *image_value.bitmap()); } diff --git a/Libraries/LibWeb/Layout/LayoutBox.h b/Libraries/LibWeb/Layout/LayoutBox.h index 199249572e..27bb8a8687 100644 --- a/Libraries/LibWeb/Layout/LayoutBox.h +++ b/Libraries/LibWeb/Layout/LayoutBox.h @@ -71,7 +71,7 @@ public: virtual void paint(PaintContext&, PaintPhase) override; protected: - LayoutBox(DOM::Document& document, const DOM::Node* node, NonnullRefPtr<StyleProperties> style) + LayoutBox(DOM::Document& document, const DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> style) : LayoutNodeWithStyleAndBoxModelMetrics(document, node, move(style)) { } diff --git a/Libraries/LibWeb/Layout/LayoutBreak.cpp b/Libraries/LibWeb/Layout/LayoutBreak.cpp index 169c0e6d79..7149c189af 100644 --- a/Libraries/LibWeb/Layout/LayoutBreak.cpp +++ b/Libraries/LibWeb/Layout/LayoutBreak.cpp @@ -30,7 +30,7 @@ namespace Web { LayoutBreak::LayoutBreak(DOM::Document& document, const HTMLBRElement& element) - : LayoutNodeWithStyleAndBoxModelMetrics(document, &element, StyleProperties::create()) + : LayoutNodeWithStyleAndBoxModelMetrics(document, &element, CSS::StyleProperties::create()) { set_inline(true); } diff --git a/Libraries/LibWeb/Layout/LayoutCanvas.cpp b/Libraries/LibWeb/Layout/LayoutCanvas.cpp index 2a34a3a1d5..a778af20c0 100644 --- a/Libraries/LibWeb/Layout/LayoutCanvas.cpp +++ b/Libraries/LibWeb/Layout/LayoutCanvas.cpp @@ -31,7 +31,7 @@ namespace Web { -LayoutCanvas::LayoutCanvas(DOM::Document& document, const HTMLCanvasElement& element, NonnullRefPtr<StyleProperties> style) +LayoutCanvas::LayoutCanvas(DOM::Document& document, const HTMLCanvasElement& element, NonnullRefPtr<CSS::StyleProperties> style) : LayoutReplaced(document, element, move(style)) { } diff --git a/Libraries/LibWeb/Layout/LayoutCanvas.h b/Libraries/LibWeb/Layout/LayoutCanvas.h index 1084b0a023..4e248eb993 100644 --- a/Libraries/LibWeb/Layout/LayoutCanvas.h +++ b/Libraries/LibWeb/Layout/LayoutCanvas.h @@ -35,7 +35,7 @@ class HTMLCanvasElement; class LayoutCanvas : public LayoutReplaced { public: - LayoutCanvas(DOM::Document&, const HTMLCanvasElement&, NonnullRefPtr<StyleProperties>); + LayoutCanvas(DOM::Document&, const HTMLCanvasElement&, NonnullRefPtr<CSS::StyleProperties>); virtual ~LayoutCanvas() override; virtual void layout(LayoutMode = LayoutMode::Default) override; diff --git a/Libraries/LibWeb/Layout/LayoutDocument.cpp b/Libraries/LibWeb/Layout/LayoutDocument.cpp index 03e863b623..ec70d146c8 100644 --- a/Libraries/LibWeb/Layout/LayoutDocument.cpp +++ b/Libraries/LibWeb/Layout/LayoutDocument.cpp @@ -33,7 +33,7 @@ namespace Web { -LayoutDocument::LayoutDocument(DOM::Document& document, NonnullRefPtr<StyleProperties> style) +LayoutDocument::LayoutDocument(DOM::Document& document, NonnullRefPtr<CSS::StyleProperties> style) : LayoutBlock(document, &document, move(style)) { } diff --git a/Libraries/LibWeb/Layout/LayoutDocument.h b/Libraries/LibWeb/Layout/LayoutDocument.h index a5fd15e765..5e6206f13e 100644 --- a/Libraries/LibWeb/Layout/LayoutDocument.h +++ b/Libraries/LibWeb/Layout/LayoutDocument.h @@ -33,7 +33,7 @@ namespace Web { class LayoutDocument final : public LayoutBlock { public: - explicit LayoutDocument(DOM::Document&, NonnullRefPtr<StyleProperties>); + explicit LayoutDocument(DOM::Document&, NonnullRefPtr<CSS::StyleProperties>); virtual ~LayoutDocument() override; const DOM::Document& node() const { return static_cast<const DOM::Document&>(*LayoutNode::node()); } diff --git a/Libraries/LibWeb/Layout/LayoutFrame.cpp b/Libraries/LibWeb/Layout/LayoutFrame.cpp index dd7048c1ee..4af5645b2c 100644 --- a/Libraries/LibWeb/Layout/LayoutFrame.cpp +++ b/Libraries/LibWeb/Layout/LayoutFrame.cpp @@ -37,7 +37,7 @@ namespace Web { -LayoutFrame::LayoutFrame(DOM::Document& document, const DOM::Element& element, NonnullRefPtr<StyleProperties> style) +LayoutFrame::LayoutFrame(DOM::Document& document, const DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style) : LayoutReplaced(document, element, move(style)) { } diff --git a/Libraries/LibWeb/Layout/LayoutFrame.h b/Libraries/LibWeb/Layout/LayoutFrame.h index 269f7e1557..cd7694d6e1 100644 --- a/Libraries/LibWeb/Layout/LayoutFrame.h +++ b/Libraries/LibWeb/Layout/LayoutFrame.h @@ -33,7 +33,7 @@ namespace Web { class LayoutFrame final : public LayoutReplaced { public: - LayoutFrame(DOM::Document&, const DOM::Element&, NonnullRefPtr<StyleProperties>); + LayoutFrame(DOM::Document&, const DOM::Element&, NonnullRefPtr<CSS::StyleProperties>); virtual ~LayoutFrame() override; virtual void paint(PaintContext&, PaintPhase) override; diff --git a/Libraries/LibWeb/Layout/LayoutImage.cpp b/Libraries/LibWeb/Layout/LayoutImage.cpp index 35f3114d32..92a37a5a00 100644 --- a/Libraries/LibWeb/Layout/LayoutImage.cpp +++ b/Libraries/LibWeb/Layout/LayoutImage.cpp @@ -32,7 +32,7 @@ namespace Web { -LayoutImage::LayoutImage(DOM::Document& document, const DOM::Element& element, NonnullRefPtr<StyleProperties> style, const ImageLoader& image_loader) +LayoutImage::LayoutImage(DOM::Document& document, const DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style, const ImageLoader& image_loader) : LayoutReplaced(document, element, move(style)) , m_image_loader(image_loader) { diff --git a/Libraries/LibWeb/Layout/LayoutImage.h b/Libraries/LibWeb/Layout/LayoutImage.h index 464c1341c5..b2001a26b1 100644 --- a/Libraries/LibWeb/Layout/LayoutImage.h +++ b/Libraries/LibWeb/Layout/LayoutImage.h @@ -35,7 +35,7 @@ class HTMLImageElement; class LayoutImage : public LayoutReplaced { public: - LayoutImage(DOM::Document&, const DOM::Element&, NonnullRefPtr<StyleProperties>, const ImageLoader&); + LayoutImage(DOM::Document&, const DOM::Element&, NonnullRefPtr<CSS::StyleProperties>, const ImageLoader&); virtual ~LayoutImage() override; virtual void layout(LayoutMode = LayoutMode::Default) override; diff --git a/Libraries/LibWeb/Layout/LayoutInline.cpp b/Libraries/LibWeb/Layout/LayoutInline.cpp index 9d25c0f916..3b62c35438 100644 --- a/Libraries/LibWeb/Layout/LayoutInline.cpp +++ b/Libraries/LibWeb/Layout/LayoutInline.cpp @@ -30,7 +30,7 @@ namespace Web { -LayoutInline::LayoutInline(DOM::Document& document, const DOM::Element& element, NonnullRefPtr<StyleProperties> style) +LayoutInline::LayoutInline(DOM::Document& document, const DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style) : LayoutNodeWithStyleAndBoxModelMetrics(document, &element, move(style)) { set_inline(true); diff --git a/Libraries/LibWeb/Layout/LayoutInline.h b/Libraries/LibWeb/Layout/LayoutInline.h index b4c8bdf300..1891fee6ca 100644 --- a/Libraries/LibWeb/Layout/LayoutInline.h +++ b/Libraries/LibWeb/Layout/LayoutInline.h @@ -34,7 +34,7 @@ class LayoutBlock; class LayoutInline : public LayoutNodeWithStyleAndBoxModelMetrics { public: - LayoutInline(DOM::Document&, const DOM::Element&, NonnullRefPtr<StyleProperties>); + LayoutInline(DOM::Document&, const DOM::Element&, NonnullRefPtr<CSS::StyleProperties>); virtual ~LayoutInline() override; virtual const char* class_name() const override { return "LayoutInline"; } }; diff --git a/Libraries/LibWeb/Layout/LayoutListItem.cpp b/Libraries/LibWeb/Layout/LayoutListItem.cpp index e05ea7b5eb..fb1565a5cc 100644 --- a/Libraries/LibWeb/Layout/LayoutListItem.cpp +++ b/Libraries/LibWeb/Layout/LayoutListItem.cpp @@ -29,7 +29,7 @@ namespace Web { -LayoutListItem::LayoutListItem(DOM::Document& document, const DOM::Element& element, NonnullRefPtr<StyleProperties> style) +LayoutListItem::LayoutListItem(DOM::Document& document, const DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style) : LayoutBlock(document, &element, move(style)) { } diff --git a/Libraries/LibWeb/Layout/LayoutListItem.h b/Libraries/LibWeb/Layout/LayoutListItem.h index b362f0170e..d4e425b811 100644 --- a/Libraries/LibWeb/Layout/LayoutListItem.h +++ b/Libraries/LibWeb/Layout/LayoutListItem.h @@ -35,7 +35,7 @@ class LayoutListItemMarker; class LayoutListItem final : public LayoutBlock { public: - LayoutListItem(DOM::Document&, const DOM::Element&, NonnullRefPtr<StyleProperties>); + LayoutListItem(DOM::Document&, const DOM::Element&, NonnullRefPtr<CSS::StyleProperties>); virtual ~LayoutListItem() override; virtual void layout(LayoutMode = LayoutMode::Default) override; diff --git a/Libraries/LibWeb/Layout/LayoutListItemMarker.cpp b/Libraries/LibWeb/Layout/LayoutListItemMarker.cpp index 81c0bf92f9..bc51ccdbb3 100644 --- a/Libraries/LibWeb/Layout/LayoutListItemMarker.cpp +++ b/Libraries/LibWeb/Layout/LayoutListItemMarker.cpp @@ -30,7 +30,7 @@ namespace Web { LayoutListItemMarker::LayoutListItemMarker(DOM::Document& document) - : LayoutBox(document, nullptr, StyleProperties::create()) + : LayoutBox(document, nullptr, CSS::StyleProperties::create()) { } diff --git a/Libraries/LibWeb/Layout/LayoutNode.cpp b/Libraries/LibWeb/Layout/LayoutNode.cpp index f687b6f821..215ec77c93 100644 --- a/Libraries/LibWeb/Layout/LayoutNode.cpp +++ b/Libraries/LibWeb/Layout/LayoutNode.cpp @@ -163,7 +163,7 @@ void LayoutNode::set_needs_display() float LayoutNode::font_size() const { // FIXME: This doesn't work right for relative font-sizes - auto length = specified_style().length_or_fallback(CSS::PropertyID::FontSize, Length(10, Length::Type::Px)); + auto length = specified_style().length_or_fallback(CSS::PropertyID::FontSize, CSS::Length(10, CSS::Length::Type::Px)); return length.raw_value(); } @@ -208,7 +208,7 @@ bool LayoutNode::is_fixed_position() const return position == CSS::Position::Fixed; } -LayoutNodeWithStyle::LayoutNodeWithStyle(DOM::Document& document, const DOM::Node* node, NonnullRefPtr<StyleProperties> specified_style) +LayoutNodeWithStyle::LayoutNodeWithStyle(DOM::Document& document, const DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> specified_style) : LayoutNode(document, node) , m_specified_style(move(specified_style)) { @@ -216,7 +216,7 @@ LayoutNodeWithStyle::LayoutNodeWithStyle(DOM::Document& document, const DOM::Nod apply_style(*m_specified_style); } -void LayoutNodeWithStyle::apply_style(const StyleProperties& specified_style) +void LayoutNodeWithStyle::apply_style(const CSS::StyleProperties& specified_style) { auto& style = static_cast<MutableLayoutStyle&>(m_style); diff --git a/Libraries/LibWeb/Layout/LayoutNode.h b/Libraries/LibWeb/Layout/LayoutNode.h index efe5156756..e6b2e55ff3 100644 --- a/Libraries/LibWeb/Layout/LayoutNode.h +++ b/Libraries/LibWeb/Layout/LayoutNode.h @@ -147,7 +147,7 @@ public: virtual LayoutNode& inline_wrapper() { return *this; } - const StyleProperties& specified_style() const; + const CSS::StyleProperties& specified_style() const; const ImmutableLayoutStyle& style() const; LayoutNodeWithStyle* parent(); @@ -214,20 +214,20 @@ class LayoutNodeWithStyle : public LayoutNode { public: virtual ~LayoutNodeWithStyle() override { } - const StyleProperties& specified_style() const { return m_specified_style; } - void set_specified_style(const StyleProperties& style) { m_specified_style = style; } + const CSS::StyleProperties& specified_style() const { return m_specified_style; } + void set_specified_style(const CSS::StyleProperties& style) { m_specified_style = style; } const ImmutableLayoutStyle& style() const { return static_cast<const ImmutableLayoutStyle&>(m_style); } - void apply_style(const StyleProperties&); + void apply_style(const CSS::StyleProperties&); protected: - LayoutNodeWithStyle(DOM::Document&, const DOM::Node*, NonnullRefPtr<StyleProperties>); + LayoutNodeWithStyle(DOM::Document&, const DOM::Node*, NonnullRefPtr<CSS::StyleProperties>); private: LayoutStyle m_style; - NonnullRefPtr<StyleProperties> m_specified_style; + NonnullRefPtr<CSS::StyleProperties> m_specified_style; CSS::Position m_position; CSS::TextAlign m_text_align; }; @@ -238,7 +238,7 @@ public: const BoxModelMetrics& box_model() const { return m_box_model; } protected: - LayoutNodeWithStyleAndBoxModelMetrics(DOM::Document& document, const DOM::Node* node, NonnullRefPtr<StyleProperties> style) + LayoutNodeWithStyleAndBoxModelMetrics(DOM::Document& document, const DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> style) : LayoutNodeWithStyle(document, node, move(style)) { } @@ -247,7 +247,7 @@ private: BoxModelMetrics m_box_model; }; -inline const StyleProperties& LayoutNode::specified_style() const +inline const CSS::StyleProperties& LayoutNode::specified_style() const { if (m_has_style) return static_cast<const LayoutNodeWithStyle*>(this)->specified_style(); diff --git a/Libraries/LibWeb/Layout/LayoutReplaced.cpp b/Libraries/LibWeb/Layout/LayoutReplaced.cpp index ebb98d7c40..a4d13faacf 100644 --- a/Libraries/LibWeb/Layout/LayoutReplaced.cpp +++ b/Libraries/LibWeb/Layout/LayoutReplaced.cpp @@ -30,7 +30,7 @@ namespace Web { -LayoutReplaced::LayoutReplaced(DOM::Document& document, const DOM::Element& element, NonnullRefPtr<StyleProperties> style) +LayoutReplaced::LayoutReplaced(DOM::Document& document, const DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style) : LayoutBox(document, &element, move(style)) { // FIXME: Allow non-inline replaced elements. @@ -45,7 +45,7 @@ float LayoutReplaced::calculate_width() const { // 10.3.2 [Inline,] replaced elements - auto zero_value = Length::make_px(0); + auto zero_value = CSS::Length::make_px(0); auto& containing_block = *this->containing_block(); auto margin_left = style().margin().left.resolved_or_zero(*this, containing_block.width()); diff --git a/Libraries/LibWeb/Layout/LayoutReplaced.h b/Libraries/LibWeb/Layout/LayoutReplaced.h index 2e8a891686..bfe71b5e1c 100644 --- a/Libraries/LibWeb/Layout/LayoutReplaced.h +++ b/Libraries/LibWeb/Layout/LayoutReplaced.h @@ -33,7 +33,7 @@ namespace Web { class LayoutReplaced : public LayoutBox { public: - LayoutReplaced(DOM::Document&, const DOM::Element&, NonnullRefPtr<StyleProperties>); + LayoutReplaced(DOM::Document&, const DOM::Element&, NonnullRefPtr<CSS::StyleProperties>); virtual ~LayoutReplaced() override; const DOM::Element& node() const { return downcast<DOM::Element>(*LayoutNode::node()); } diff --git a/Libraries/LibWeb/Layout/LayoutSVG.cpp b/Libraries/LibWeb/Layout/LayoutSVG.cpp index 1d3228646d..bd0f188ba5 100644 --- a/Libraries/LibWeb/Layout/LayoutSVG.cpp +++ b/Libraries/LibWeb/Layout/LayoutSVG.cpp @@ -31,7 +31,7 @@ namespace Web { -LayoutSVG::LayoutSVG(DOM::Document& document, const SVG::SVGSVGElement& element, NonnullRefPtr<StyleProperties> style) +LayoutSVG::LayoutSVG(DOM::Document& document, const SVG::SVGSVGElement& element, NonnullRefPtr<CSS::StyleProperties> style) : LayoutReplaced(document, element, move(style)) { } diff --git a/Libraries/LibWeb/Layout/LayoutSVG.h b/Libraries/LibWeb/Layout/LayoutSVG.h index a0005b2250..b81e593700 100644 --- a/Libraries/LibWeb/Layout/LayoutSVG.h +++ b/Libraries/LibWeb/Layout/LayoutSVG.h @@ -36,7 +36,7 @@ class SVGSVGElement; class LayoutSVG : public LayoutReplaced { public: - LayoutSVG(DOM::Document&, const SVG::SVGSVGElement&, NonnullRefPtr<StyleProperties>); + LayoutSVG(DOM::Document&, const SVG::SVGSVGElement&, NonnullRefPtr<CSS::StyleProperties>); virtual ~LayoutSVG() override = default; virtual void layout(LayoutMode = LayoutMode::Default) override; virtual void paint(PaintContext&, PaintPhase) override; diff --git a/Libraries/LibWeb/Layout/LayoutStyle.h b/Libraries/LibWeb/Layout/LayoutStyle.h index 5fb42325e1..2c0c4bb96e 100644 --- a/Libraries/LibWeb/Layout/LayoutStyle.h +++ b/Libraries/LibWeb/Layout/LayoutStyle.h @@ -51,16 +51,16 @@ public: CSS::TextAlign text_align() const { return m_text_align; } CSS::Position position() const { return m_position; } CSS::WhiteSpace white_space() const { return m_white_space; } - const Length& width() const { return m_width; } - const Length& min_width() const { return m_min_width; } - const Length& max_width() const { return m_max_width; } - const Length& height() const { return m_height; } - const Length& min_height() const { return m_min_height; } - const Length& max_height() const { return m_max_height; } + const CSS::Length& width() const { return m_width; } + const CSS::Length& min_width() const { return m_min_width; } + const CSS::Length& max_width() const { return m_max_width; } + const CSS::Length& height() const { return m_height; } + const CSS::Length& min_height() const { return m_min_height; } + const CSS::Length& max_height() const { return m_max_height; } - const LengthBox& offset() const { return m_offset; } - const LengthBox& margin() const { return m_margin; } - const LengthBox& padding() const { return m_padding; } + const CSS::LengthBox& offset() const { return m_offset; } + const CSS::LengthBox& margin() const { return m_margin; } + const CSS::LengthBox& padding() const { return m_padding; } const BorderData& border_left() const { return m_border_left; } const BorderData& border_top() const { return m_border_top; } @@ -73,15 +73,15 @@ protected: CSS::TextAlign m_text_align; CSS::Position m_position; CSS::WhiteSpace m_white_space { InitialValues::white_space() }; - Length m_width; - Length m_min_width; - Length m_max_width; - Length m_height; - Length m_min_height; - Length m_max_height; - LengthBox m_offset; - LengthBox m_margin; - LengthBox m_padding; + CSS::Length m_width; + CSS::Length m_min_width; + CSS::Length m_max_width; + CSS::Length m_height; + CSS::Length m_min_height; + CSS::Length m_max_height; + CSS::LengthBox m_offset; + CSS::LengthBox m_margin; + CSS::LengthBox m_padding; BorderData m_border_left; BorderData m_border_top; BorderData m_border_right; @@ -98,15 +98,15 @@ public: void set_text_align(CSS::TextAlign text_align) { m_text_align = text_align; } void set_position(CSS::Position position) { m_position = position; } void set_white_space(CSS::WhiteSpace value) { m_white_space = value; } - void set_width(const Length& width) { m_width = width; } - void set_min_width(const Length& width) { m_min_width = width; } - void set_max_width(const Length& width) { m_max_width = width; } - void set_height(const Length& height) { m_height = height; } - void set_min_height(const Length& height) { m_min_height = height; } - void set_max_height(const Length& height) { m_max_height = height; } - void set_offset(const LengthBox& offset) { m_offset = offset; } - void set_margin(const LengthBox& margin) { m_margin = margin; } - void set_padding(const LengthBox& padding) { m_padding = padding; } + void set_width(const CSS::Length& width) { m_width = width; } + void set_min_width(const CSS::Length& width) { m_min_width = width; } + void set_max_width(const CSS::Length& width) { m_max_width = width; } + void set_height(const CSS::Length& height) { m_height = height; } + void set_min_height(const CSS::Length& height) { m_min_height = height; } + void set_max_height(const CSS::Length& height) { m_max_height = height; } + void set_offset(const CSS::LengthBox& offset) { m_offset = offset; } + void set_margin(const CSS::LengthBox& margin) { m_margin = margin; } + void set_padding(const CSS::LengthBox& padding) { m_padding = padding; } BorderData& border_left() { return m_border_left; } BorderData& border_top() { return m_border_top; } BorderData& border_right() { return m_border_right; } diff --git a/Libraries/LibWeb/Layout/LayoutTable.cpp b/Libraries/LibWeb/Layout/LayoutTable.cpp index 6db50b6c5e..cee79c0de4 100644 --- a/Libraries/LibWeb/Layout/LayoutTable.cpp +++ b/Libraries/LibWeb/Layout/LayoutTable.cpp @@ -30,7 +30,7 @@ namespace Web { -LayoutTable::LayoutTable(DOM::Document& document, const DOM::Element& element, NonnullRefPtr<StyleProperties> style) +LayoutTable::LayoutTable(DOM::Document& document, const DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style) : LayoutBlock(document, &element, move(style)) { } diff --git a/Libraries/LibWeb/Layout/LayoutTable.h b/Libraries/LibWeb/Layout/LayoutTable.h index c5fc58abbd..2b7fa017de 100644 --- a/Libraries/LibWeb/Layout/LayoutTable.h +++ b/Libraries/LibWeb/Layout/LayoutTable.h @@ -34,7 +34,7 @@ class LayoutTableRow; class LayoutTable final : public LayoutBlock { public: - LayoutTable(DOM::Document&, const DOM::Element&, NonnullRefPtr<StyleProperties>); + LayoutTable(DOM::Document&, const DOM::Element&, NonnullRefPtr<CSS::StyleProperties>); virtual ~LayoutTable() override; virtual void layout(LayoutMode = LayoutMode::Default) override; diff --git a/Libraries/LibWeb/Layout/LayoutTableCell.cpp b/Libraries/LibWeb/Layout/LayoutTableCell.cpp index 30e69465be..074552887f 100644 --- a/Libraries/LibWeb/Layout/LayoutTableCell.cpp +++ b/Libraries/LibWeb/Layout/LayoutTableCell.cpp @@ -30,7 +30,7 @@ namespace Web { -LayoutTableCell::LayoutTableCell(DOM::Document& document, const DOM::Element& element, NonnullRefPtr<StyleProperties> style) +LayoutTableCell::LayoutTableCell(DOM::Document& document, const DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style) : LayoutBlock(document, &element, move(style)) { } diff --git a/Libraries/LibWeb/Layout/LayoutTableCell.h b/Libraries/LibWeb/Layout/LayoutTableCell.h index efb4e475d5..681e967978 100644 --- a/Libraries/LibWeb/Layout/LayoutTableCell.h +++ b/Libraries/LibWeb/Layout/LayoutTableCell.h @@ -32,7 +32,7 @@ namespace Web { class LayoutTableCell final : public LayoutBlock { public: - LayoutTableCell(DOM::Document&, const DOM::Element&, NonnullRefPtr<StyleProperties>); + LayoutTableCell(DOM::Document&, const DOM::Element&, NonnullRefPtr<CSS::StyleProperties>); virtual ~LayoutTableCell() override; LayoutTableCell* next_cell() { return next_sibling_of_type<LayoutTableCell>(); } diff --git a/Libraries/LibWeb/Layout/LayoutTableRow.cpp b/Libraries/LibWeb/Layout/LayoutTableRow.cpp index 0936f3e6d4..6e82323453 100644 --- a/Libraries/LibWeb/Layout/LayoutTableRow.cpp +++ b/Libraries/LibWeb/Layout/LayoutTableRow.cpp @@ -31,7 +31,7 @@ namespace Web { -LayoutTableRow::LayoutTableRow(DOM::Document& document, const DOM::Element& element, NonnullRefPtr<StyleProperties> style) +LayoutTableRow::LayoutTableRow(DOM::Document& document, const DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style) : LayoutBox(document, &element, move(style)) { } diff --git a/Libraries/LibWeb/Layout/LayoutTableRow.h b/Libraries/LibWeb/Layout/LayoutTableRow.h index 657f052f17..d289cd6e6d 100644 --- a/Libraries/LibWeb/Layout/LayoutTableRow.h +++ b/Libraries/LibWeb/Layout/LayoutTableRow.h @@ -34,7 +34,7 @@ class LayoutTableCell; class LayoutTableRow final : public LayoutBox { public: - LayoutTableRow(DOM::Document&, const DOM::Element&, NonnullRefPtr<StyleProperties>); + LayoutTableRow(DOM::Document&, const DOM::Element&, NonnullRefPtr<CSS::StyleProperties>); virtual ~LayoutTableRow() override; void layout_row(const Vector<float>& column_widths); diff --git a/Libraries/LibWeb/Layout/LayoutTableRowGroup.cpp b/Libraries/LibWeb/Layout/LayoutTableRowGroup.cpp index 82f3dab7c3..f78195651a 100644 --- a/Libraries/LibWeb/Layout/LayoutTableRowGroup.cpp +++ b/Libraries/LibWeb/Layout/LayoutTableRowGroup.cpp @@ -31,7 +31,7 @@ namespace Web { -LayoutTableRowGroup::LayoutTableRowGroup(DOM::Document& document, const DOM::Element& element, NonnullRefPtr<StyleProperties> style) +LayoutTableRowGroup::LayoutTableRowGroup(DOM::Document& document, const DOM::Element& element, NonnullRefPtr<CSS::StyleProperties> style) : LayoutBlock(document, &element, move(style)) { } diff --git a/Libraries/LibWeb/Layout/LayoutTableRowGroup.h b/Libraries/LibWeb/Layout/LayoutTableRowGroup.h index 54f2b4d128..8a5fe297d1 100644 --- a/Libraries/LibWeb/Layout/LayoutTableRowGroup.h +++ b/Libraries/LibWeb/Layout/LayoutTableRowGroup.h @@ -32,7 +32,7 @@ namespace Web { class LayoutTableRowGroup final : public LayoutBlock { public: - LayoutTableRowGroup(DOM::Document&, const DOM::Element&, NonnullRefPtr<StyleProperties>); + LayoutTableRowGroup(DOM::Document&, const DOM::Element&, NonnullRefPtr<CSS::StyleProperties>); virtual ~LayoutTableRowGroup() override; virtual void layout(LayoutMode = LayoutMode::Default) override; diff --git a/Libraries/LibWeb/Layout/LayoutText.cpp b/Libraries/LibWeb/Layout/LayoutText.cpp index a097f235bf..7d8663f176 100644 --- a/Libraries/LibWeb/Layout/LayoutText.cpp +++ b/Libraries/LibWeb/Layout/LayoutText.cpp @@ -55,7 +55,7 @@ static bool is_all_whitespace(const StringView& string) return true; } -const String& LayoutText::text_for_style(const StyleProperties& style) const +const String& LayoutText::text_for_style(const CSS::StyleProperties& style) const { static String one_space = " "; if (is_all_whitespace(node().data())) { diff --git a/Libraries/LibWeb/Layout/LayoutText.h b/Libraries/LibWeb/Layout/LayoutText.h index 089039def2..3940271c6a 100644 --- a/Libraries/LibWeb/Layout/LayoutText.h +++ b/Libraries/LibWeb/Layout/LayoutText.h @@ -40,7 +40,7 @@ public: const DOM::Text& node() const { return static_cast<const DOM::Text&>(*LayoutNode::node()); } - const String& text_for_style(const StyleProperties&) const; + const String& text_for_style(const CSS::StyleProperties&) const; const String& text_for_rendering() const { return m_text_for_rendering; } virtual const char* class_name() const override { return "LayoutText"; } @@ -50,7 +50,7 @@ public: virtual void split_into_lines(LayoutBlock& container, LayoutMode) override; - const StyleProperties& specified_style() const { return parent()->specified_style(); } + const CSS::StyleProperties& specified_style() const { return parent()->specified_style(); } private: void split_into_lines_by_rules(LayoutBlock& container, LayoutMode, bool do_collapse, bool do_wrap_lines, bool do_wrap_breaks); diff --git a/Libraries/LibWeb/Layout/LayoutTreeBuilder.cpp b/Libraries/LibWeb/Layout/LayoutTreeBuilder.cpp index 12f4212324..9848289260 100644 --- a/Libraries/LibWeb/Layout/LayoutTreeBuilder.cpp +++ b/Libraries/LibWeb/Layout/LayoutTreeBuilder.cpp @@ -37,7 +37,7 @@ LayoutTreeBuilder::LayoutTreeBuilder() { } -static RefPtr<LayoutNode> create_layout_tree(DOM::Node& node, const StyleProperties* parent_style) +static RefPtr<LayoutNode> create_layout_tree(DOM::Node& node, const CSS::StyleProperties* parent_style) { auto layout_node = node.create_layout_node(parent_style); if (!layout_node) diff --git a/Libraries/LibWeb/Layout/LayoutWidget.cpp b/Libraries/LibWeb/Layout/LayoutWidget.cpp index 2a4d56e181..3719c61e6f 100644 --- a/Libraries/LibWeb/Layout/LayoutWidget.cpp +++ b/Libraries/LibWeb/Layout/LayoutWidget.cpp @@ -37,7 +37,7 @@ namespace Web { LayoutWidget::LayoutWidget(DOM::Document& document, const DOM::Element& element, GUI::Widget& widget) - : LayoutReplaced(document, element, StyleProperties::create()) + : LayoutReplaced(document, element, CSS::StyleProperties::create()) , m_widget(widget) { set_has_intrinsic_width(true); diff --git a/Libraries/LibWeb/Parser/CSSParser.cpp b/Libraries/LibWeb/Parser/CSSParser.cpp index 42ac88ee03..4625cec929 100644 --- a/Libraries/LibWeb/Parser/CSSParser.cpp +++ b/Libraries/LibWeb/Parser/CSSParser.cpp @@ -264,31 +264,31 @@ static Optional<float> try_parse_float(const StringView& string) return is_negative ? -value : value; } -static Length parse_length(const CSS::ParsingContext& context, const StringView& view, bool& is_bad_length) +static CSS::Length parse_length(const CSS::ParsingContext& context, const StringView& view, bool& is_bad_length) { - Length::Type type = Length::Type::Undefined; + CSS::Length::Type type = CSS::Length::Type::Undefined; Optional<float> value; if (view.ends_with('%')) { - type = Length::Type::Percentage; + type = CSS::Length::Type::Percentage; value = try_parse_float(view.substring_view(0, view.length() - 1)); } else if (view.to_string().to_lowercase().ends_with("px")) { - type = Length::Type::Px; + type = CSS::Length::Type::Px; value = try_parse_float(view.substring_view(0, view.length() - 2)); } else if (view.to_string().to_lowercase().ends_with("pt")) { - type = Length::Type::Pt; + type = CSS::Length::Type::Pt; value = try_parse_float(view.substring_view(0, view.length() - 2)); } else if (view.to_string().to_lowercase().ends_with("rem")) { - type = Length::Type::Rem; + type = CSS::Length::Type::Rem; value = try_parse_float(view.substring_view(0, view.length() - 3)); } else if (view.to_string().to_lowercase().ends_with("em")) { - type = Length::Type::Em; + type = CSS::Length::Type::Em; value = try_parse_float(view.substring_view(0, view.length() - 2)); } else if (view == "0") { - type = Length::Type::Px; + type = CSS::Length::Type::Px; value = 0; } else if (context.in_quirks_mode()) { - type = Length::Type::Px; + type = CSS::Length::Type::Px; value = try_parse_float(view); } else { value = try_parse_float(view); @@ -299,61 +299,61 @@ static Length parse_length(const CSS::ParsingContext& context, const StringView& if (!value.has_value()) return {}; - return Length(value.value(), type); + return CSS::Length(value.value(), type); } -RefPtr<StyleValue> parse_css_value(const CSS::ParsingContext& context, const StringView& string) +RefPtr<CSS::StyleValue> parse_css_value(const CSS::ParsingContext& context, const StringView& string) { bool is_bad_length = false; auto length = parse_length(context, string, is_bad_length); if (is_bad_length) return nullptr; if (!length.is_undefined()) - return LengthStyleValue::create(length); + return CSS::LengthStyleValue::create(length); if (string.equals_ignoring_case("inherit")) - return InheritStyleValue::create(); + return CSS::InheritStyleValue::create(); if (string.equals_ignoring_case("initial")) - return InitialStyleValue::create(); + return CSS::InitialStyleValue::create(); if (string.equals_ignoring_case("auto")) - return LengthStyleValue::create(Length::make_auto()); + return CSS::LengthStyleValue::create(CSS::Length::make_auto()); auto color = parse_css_color(context, string); if (color.has_value()) - return ColorStyleValue::create(color.value()); + return CSS::ColorStyleValue::create(color.value()); if (string == "-libweb-link") - return IdentifierStyleValue::create(CSS::ValueID::VendorSpecificLink); + return CSS::IdentifierStyleValue::create(CSS::ValueID::VendorSpecificLink); else if (string.starts_with("-libweb-palette-")) { auto value_id = value_id_for_palette_string(string.substring_view(16, string.length() - 16)); - return IdentifierStyleValue::create(value_id); + return CSS::IdentifierStyleValue::create(value_id); } - return StringStyleValue::create(string); + return CSS::StringStyleValue::create(string); } -RefPtr<LengthStyleValue> parse_line_width(const CSS::ParsingContext& context, const StringView& part) +RefPtr<CSS::LengthStyleValue> parse_line_width(const CSS::ParsingContext& context, const StringView& part) { auto value = parse_css_value(context, part); if (value && value->is_length()) - return static_ptr_cast<LengthStyleValue>(value); + return static_ptr_cast<CSS::LengthStyleValue>(value); return nullptr; } -RefPtr<ColorStyleValue> parse_color(const CSS::ParsingContext& context, const StringView& part) +RefPtr<CSS::ColorStyleValue> parse_color(const CSS::ParsingContext& context, const StringView& part) { auto value = parse_css_value(context, part); if (value && value->is_color()) - return static_ptr_cast<ColorStyleValue>(value); + return static_ptr_cast<CSS::ColorStyleValue>(value); return nullptr; } -RefPtr<StringStyleValue> parse_line_style(const CSS::ParsingContext& context, const StringView& part) +RefPtr<CSS::StringStyleValue> parse_line_style(const CSS::ParsingContext& context, const StringView& part) { auto parsed_value = parse_css_value(context, part); if (!parsed_value || !parsed_value->is_string()) return nullptr; - auto value = static_ptr_cast<StringStyleValue>(parsed_value); + auto value = static_ptr_cast<CSS::StringStyleValue>(parsed_value); if (value->to_string() == "dotted") return value; if (value->to_string() == "dashed") @@ -448,7 +448,7 @@ public: return ch == '~' || ch == '>' || ch == '+'; } - Optional<Selector::SimpleSelector> parse_simple_selector() + Optional<CSS::Selector::SimpleSelector> parse_simple_selector() { auto index_at_start = index; @@ -458,34 +458,34 @@ public: if (!peek() || peek() == '{' || peek() == ',' || is_combinator(peek())) return {}; - Selector::SimpleSelector::Type type; + CSS::Selector::SimpleSelector::Type type; if (peek() == '*') { - type = Selector::SimpleSelector::Type::Universal; + type = CSS::Selector::SimpleSelector::Type::Universal; consume_one(); - return Selector::SimpleSelector { + return CSS::Selector::SimpleSelector { type, - Selector::SimpleSelector::PseudoClass::None, + CSS::Selector::SimpleSelector::PseudoClass::None, String(), - Selector::SimpleSelector::AttributeMatchType::None, + CSS::Selector::SimpleSelector::AttributeMatchType::None, String(), String() }; } if (peek() == '.') { - type = Selector::SimpleSelector::Type::Class; + type = CSS::Selector::SimpleSelector::Type::Class; consume_one(); } else if (peek() == '#') { - type = Selector::SimpleSelector::Type::Id; + type = CSS::Selector::SimpleSelector::Type::Id; consume_one(); } else if (isalpha(peek())) { - type = Selector::SimpleSelector::Type::TagName; + type = CSS::Selector::SimpleSelector::Type::TagName; } else { - type = Selector::SimpleSelector::Type::Universal; + type = CSS::Selector::SimpleSelector::Type::Universal; } - if (type != Selector::SimpleSelector::Type::Universal) { + if (type != CSS::Selector::SimpleSelector::Type::Universal) { while (is_valid_selector_char(peek())) buffer.append(consume_one()); PARSE_ASSERT(!buffer.is_null()); @@ -493,23 +493,23 @@ public: auto value = String::copy(buffer); - if (type == Selector::SimpleSelector::Type::TagName) { + if (type == CSS::Selector::SimpleSelector::Type::TagName) { // Some stylesheets use uppercase tag names, so here's a hack to just lowercase them internally. value = value.to_lowercase(); } - Selector::SimpleSelector simple_selector { + CSS::Selector::SimpleSelector simple_selector { type, - Selector::SimpleSelector::PseudoClass::None, + CSS::Selector::SimpleSelector::PseudoClass::None, value, - Selector::SimpleSelector::AttributeMatchType::None, + CSS::Selector::SimpleSelector::AttributeMatchType::None, String(), String() }; buffer.clear(); if (peek() == '[') { - Selector::SimpleSelector::AttributeMatchType attribute_match_type = Selector::SimpleSelector::AttributeMatchType::HasAttribute; + CSS::Selector::SimpleSelector::AttributeMatchType attribute_match_type = CSS::Selector::SimpleSelector::AttributeMatchType::HasAttribute; String attribute_name; String attribute_value; bool in_value = false; @@ -519,10 +519,10 @@ public: char ch = consume_one(); if (ch == '=' || (ch == '~' && peek() == '=')) { if (ch == '=') { - attribute_match_type = Selector::SimpleSelector::AttributeMatchType::ExactValueMatch; + attribute_match_type = CSS::Selector::SimpleSelector::AttributeMatchType::ExactValueMatch; } else if (ch == '~') { consume_one(); - attribute_match_type = Selector::SimpleSelector::AttributeMatchType::Contains; + attribute_match_type = CSS::Selector::SimpleSelector::AttributeMatchType::Contains; } attribute_name = String::copy(buffer); buffer.clear(); @@ -586,23 +586,23 @@ public: return {}; if (pseudo_name.equals_ignoring_case("link")) - simple_selector.pseudo_class = Selector::SimpleSelector::PseudoClass::Link; + simple_selector.pseudo_class = CSS::Selector::SimpleSelector::PseudoClass::Link; else if (pseudo_name.equals_ignoring_case("visited")) - simple_selector.pseudo_class = Selector::SimpleSelector::PseudoClass::Visited; + simple_selector.pseudo_class = CSS::Selector::SimpleSelector::PseudoClass::Visited; else if (pseudo_name.equals_ignoring_case("hover")) - simple_selector.pseudo_class = Selector::SimpleSelector::PseudoClass::Hover; + simple_selector.pseudo_class = CSS::Selector::SimpleSelector::PseudoClass::Hover; else if (pseudo_name.equals_ignoring_case("focus")) - simple_selector.pseudo_class = Selector::SimpleSelector::PseudoClass::Focus; + simple_selector.pseudo_class = CSS::Selector::SimpleSelector::PseudoClass::Focus; else if (pseudo_name.equals_ignoring_case("first-child")) - simple_selector.pseudo_class = Selector::SimpleSelector::PseudoClass::FirstChild; + simple_selector.pseudo_class = CSS::Selector::SimpleSelector::PseudoClass::FirstChild; else if (pseudo_name.equals_ignoring_case("last-child")) - simple_selector.pseudo_class = Selector::SimpleSelector::PseudoClass::LastChild; + simple_selector.pseudo_class = CSS::Selector::SimpleSelector::PseudoClass::LastChild; else if (pseudo_name.equals_ignoring_case("only-child")) - simple_selector.pseudo_class = Selector::SimpleSelector::PseudoClass::OnlyChild; + simple_selector.pseudo_class = CSS::Selector::SimpleSelector::PseudoClass::OnlyChild; else if (pseudo_name.equals_ignoring_case("empty")) - simple_selector.pseudo_class = Selector::SimpleSelector::PseudoClass::Empty; + simple_selector.pseudo_class = CSS::Selector::SimpleSelector::PseudoClass::Empty; else if (pseudo_name.equals_ignoring_case("root")) - simple_selector.pseudo_class = Selector::SimpleSelector::PseudoClass::Root; + simple_selector.pseudo_class = CSS::Selector::SimpleSelector::PseudoClass::Root; } if (index == index_at_start) { @@ -613,9 +613,9 @@ public: return simple_selector; } - Optional<Selector::ComplexSelector> parse_complex_selector() + Optional<CSS::Selector::ComplexSelector> parse_complex_selector() { - auto relation = Selector::ComplexSelector::Relation::Descendant; + auto relation = CSS::Selector::ComplexSelector::Relation::Descendant; if (peek() == '{' || peek() == ',') return {}; @@ -623,13 +623,13 @@ public: if (is_combinator(peek())) { switch (peek()) { case '>': - relation = Selector::ComplexSelector::Relation::ImmediateChild; + relation = CSS::Selector::ComplexSelector::Relation::ImmediateChild; break; case '+': - relation = Selector::ComplexSelector::Relation::AdjacentSibling; + relation = CSS::Selector::ComplexSelector::Relation::AdjacentSibling; break; case '~': - relation = Selector::ComplexSelector::Relation::GeneralSibling; + relation = CSS::Selector::ComplexSelector::Relation::GeneralSibling; break; } consume_one(); @@ -638,7 +638,7 @@ public: consume_whitespace_or_comments(); - Vector<Selector::SimpleSelector> simple_selectors; + Vector<CSS::Selector::SimpleSelector> simple_selectors; for (;;) { auto component = parse_simple_selector(); if (!component.has_value()) @@ -651,12 +651,12 @@ public: if (simple_selectors.is_empty()) return {}; - return Selector::ComplexSelector { relation, move(simple_selectors) }; + return CSS::Selector::ComplexSelector { relation, move(simple_selectors) }; } void parse_selector() { - Vector<Selector::ComplexSelector> complex_selectors; + Vector<CSS::Selector::ComplexSelector> complex_selectors; for (;;) { auto index_before = index; @@ -673,12 +673,12 @@ public: if (complex_selectors.is_empty()) return; - complex_selectors.first().relation = Selector::ComplexSelector::Relation::None; + complex_selectors.first().relation = CSS::Selector::ComplexSelector::Relation::None; - current_rule.selectors.append(Selector(move(complex_selectors))); + current_rule.selectors.append(CSS::Selector(move(complex_selectors))); } - Optional<Selector> parse_individual_selector() + Optional<CSS::Selector> parse_individual_selector() { parse_selector(); if (current_rule.selectors.is_empty()) @@ -785,7 +785,7 @@ public: return { string, important }; } - Optional<StyleProperty> parse_property() + Optional<CSS::StyleProperty> parse_property() { consume_whitespace_or_comments(); if (peek() == ';') { @@ -817,7 +817,7 @@ public: auto value = parse_css_value(m_context, property_value); if (!value) return {}; - return StyleProperty { property_id, value.release_nonnull(), important }; + return CSS::StyleProperty { property_id, value.release_nonnull(), important }; } void parse_declaration() @@ -861,20 +861,20 @@ public: consume_specific('{'); parse_declaration(); consume_specific('}'); - rules.append(StyleRule::create(move(current_rule.selectors), StyleDeclaration::create(move(current_rule.properties)))); + rules.append(CSS::StyleRule::create(move(current_rule.selectors), CSS::StyleDeclaration::create(move(current_rule.properties)))); consume_whitespace_or_comments(); } - RefPtr<StyleSheet> parse_sheet() + RefPtr<CSS::StyleSheet> parse_sheet() { while (index < css.length()) { parse_rule(); } - return StyleSheet::create(move(rules)); + return CSS::StyleSheet::create(move(rules)); } - RefPtr<StyleDeclaration> parse_standalone_declaration() + RefPtr<CSS::StyleDeclaration> parse_standalone_declaration() { consume_whitespace_or_comments(); for (;;) { @@ -885,17 +885,17 @@ public: if (!peek()) break; } - return StyleDeclaration::create(move(current_rule.properties)); + return CSS::StyleDeclaration::create(move(current_rule.properties)); } private: CSS::ParsingContext m_context; - NonnullRefPtrVector<StyleRule> rules; + NonnullRefPtrVector<CSS::StyleRule> rules; struct CurrentRule { - Vector<Selector> selectors; - Vector<StyleProperty> properties; + Vector<CSS::Selector> selectors; + Vector<CSS::StyleProperty> properties; }; CurrentRule current_rule; @@ -906,33 +906,33 @@ private: StringView css; }; -Optional<Selector> parse_selector(const CSS::ParsingContext& context, const StringView& selector_text) +Optional<CSS::Selector> parse_selector(const CSS::ParsingContext& context, const StringView& selector_text) { CSSParser parser(context, selector_text); return parser.parse_individual_selector(); } -RefPtr<StyleSheet> parse_css(const CSS::ParsingContext& context, const StringView& css) +RefPtr<CSS::StyleSheet> parse_css(const CSS::ParsingContext& context, const StringView& css) { if (css.is_empty()) - return StyleSheet::create({}); + return CSS::StyleSheet::create({}); CSSParser parser(context, css); return parser.parse_sheet(); } -RefPtr<StyleDeclaration> parse_css_declaration(const CSS::ParsingContext& context, const StringView& css) +RefPtr<CSS::StyleDeclaration> parse_css_declaration(const CSS::ParsingContext& context, const StringView& css) { if (css.is_empty()) - return StyleDeclaration::create({}); + return CSS::StyleDeclaration::create({}); CSSParser parser(context, css); return parser.parse_standalone_declaration(); } -RefPtr<StyleValue> parse_html_length(const DOM::Document& document, const StringView& string) +RefPtr<CSS::StyleValue> parse_html_length(const DOM::Document& document, const StringView& string) { auto integer = string.to_int(); if (integer.has_value()) - return LengthStyleValue::create(Length::make_px(integer.value())); + return CSS::LengthStyleValue::create(CSS::Length::make_px(integer.value())); return parse_css_value(CSS::ParsingContext(document), string); } diff --git a/Libraries/LibWeb/Parser/CSSParser.h b/Libraries/LibWeb/Parser/CSSParser.h index 95e96a0379..42dd29f2b3 100644 --- a/Libraries/LibWeb/Parser/CSSParser.h +++ b/Libraries/LibWeb/Parser/CSSParser.h @@ -44,15 +44,15 @@ private: namespace Web { -RefPtr<StyleSheet> parse_css(const CSS::ParsingContext&, const StringView&); -RefPtr<StyleDeclaration> parse_css_declaration(const CSS::ParsingContext&, const StringView&); -RefPtr<StyleValue> parse_css_value(const CSS::ParsingContext&, const StringView&); -Optional<Selector> parse_selector(const CSS::ParsingContext&, const StringView&); +RefPtr<CSS::StyleSheet> parse_css(const CSS::ParsingContext&, const StringView&); +RefPtr<CSS::StyleDeclaration> parse_css_declaration(const CSS::ParsingContext&, const StringView&); +RefPtr<CSS::StyleValue> parse_css_value(const CSS::ParsingContext&, const StringView&); +Optional<CSS::Selector> parse_selector(const CSS::ParsingContext&, const StringView&); -RefPtr<LengthStyleValue> parse_line_width(const CSS::ParsingContext&, const StringView&); -RefPtr<ColorStyleValue> parse_color(const CSS::ParsingContext&, const StringView&); -RefPtr<StringStyleValue> parse_line_style(const CSS::ParsingContext&, const StringView&); +RefPtr<CSS::LengthStyleValue> parse_line_width(const CSS::ParsingContext&, const StringView&); +RefPtr<CSS::ColorStyleValue> parse_color(const CSS::ParsingContext&, const StringView&); +RefPtr<CSS::StringStyleValue> parse_line_style(const CSS::ParsingContext&, const StringView&); -RefPtr<StyleValue> parse_html_length(const DOM::Document&, const StringView&); +RefPtr<CSS::StyleValue> parse_html_length(const DOM::Document&, const StringView&); } diff --git a/Libraries/LibWeb/SVG/SVGSVGElement.cpp b/Libraries/LibWeb/SVG/SVGSVGElement.cpp index c70f3afb73..0d6a1f97ac 100644 --- a/Libraries/LibWeb/SVG/SVGSVGElement.cpp +++ b/Libraries/LibWeb/SVG/SVGSVGElement.cpp @@ -43,7 +43,7 @@ SVGSVGElement::SVGSVGElement(DOM::Document& document, const FlyString& tag_name) { } -RefPtr<LayoutNode> SVGSVGElement::create_layout_node(const StyleProperties* parent_style) +RefPtr<LayoutNode> SVGSVGElement::create_layout_node(const CSS::StyleProperties* parent_style) { auto style = document().style_resolver().resolve_style(*this, parent_style); if (style->display() == CSS::Display::None) diff --git a/Libraries/LibWeb/SVG/SVGSVGElement.h b/Libraries/LibWeb/SVG/SVGSVGElement.h index 1540aa3757..f29b0028f0 100644 --- a/Libraries/LibWeb/SVG/SVGSVGElement.h +++ b/Libraries/LibWeb/SVG/SVGSVGElement.h @@ -35,7 +35,7 @@ class SVGSVGElement final : public SVGGraphicsElement { public: SVGSVGElement(DOM::Document&, const FlyString& tag_name); - virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) override; + virtual RefPtr<LayoutNode> create_layout_node(const CSS::StyleProperties* parent_style) override; const RefPtr<Gfx::Bitmap> bitmap() const { return m_bitmap; } bool create_bitmap_as_top_level_svg_element(); diff --git a/Libraries/LibWeb/Scripts/GenerateStyleSheetSource.sh b/Libraries/LibWeb/Scripts/GenerateStyleSheetSource.sh index c529206f4d..aef61fcfae 100755 --- a/Libraries/LibWeb/Scripts/GenerateStyleSheetSource.sh +++ b/Libraries/LibWeb/Scripts/GenerateStyleSheetSource.sh @@ -1,6 +1,6 @@ #!/bin/sh -echo "namespace Web {" +echo "namespace Web::CSS {" echo "extern const char $1[];" echo "const char $1[] = \"\\" grep -v '^ *#' < "$2" | while IFS= read -r line; do diff --git a/Libraries/LibWeb/StylePropertiesModel.cpp b/Libraries/LibWeb/StylePropertiesModel.cpp index c71d0505cc..aaad7c4e75 100644 --- a/Libraries/LibWeb/StylePropertiesModel.cpp +++ b/Libraries/LibWeb/StylePropertiesModel.cpp @@ -32,7 +32,7 @@ namespace Web { -StylePropertiesModel::StylePropertiesModel(const StyleProperties& properties) +StylePropertiesModel::StylePropertiesModel(const CSS::StyleProperties& properties) : m_properties(properties) { properties.for_each_property([&](auto property_id, auto& property_value) { diff --git a/Libraries/LibWeb/StylePropertiesModel.h b/Libraries/LibWeb/StylePropertiesModel.h index bc7d92ad05..78396ab457 100644 --- a/Libraries/LibWeb/StylePropertiesModel.h +++ b/Libraries/LibWeb/StylePropertiesModel.h @@ -41,7 +41,7 @@ public: __Count }; - static NonnullRefPtr<StylePropertiesModel> create(const StyleProperties& properties) { return adopt(*new StylePropertiesModel(properties)); } + static NonnullRefPtr<StylePropertiesModel> create(const CSS::StyleProperties& properties) { return adopt(*new StylePropertiesModel(properties)); } virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return Column::__Count; } @@ -50,10 +50,10 @@ public: virtual void update() override; private: - explicit StylePropertiesModel(const StyleProperties& properties); - const StyleProperties& properties() const { return *m_properties; } + explicit StylePropertiesModel(const CSS::StyleProperties& properties); + const CSS::StyleProperties& properties() const { return *m_properties; } - NonnullRefPtr<StyleProperties> m_properties; + NonnullRefPtr<CSS::StyleProperties> m_properties; struct Value { String name; |