From f8dd3e14bae66bc9b3b26f4f896d9ca43f26e274 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 24 Sep 2021 13:49:57 +0200 Subject: [PATCH] LibWeb: Rename CSS::StyleResolver => StyleComputer Resolved style is a spec concept that refers to the weird mix of computed style and used style reflected by getComputedStyle(). The purpose of this class is to produce the *computed* style for a given element, so let's call it StyleComputer. --- Userland/Libraries/LibWeb/CMakeLists.txt | 2 +- .../CSS/ResolvedCSSStyleDeclaration.cpp | 4 +-- .../{StyleResolver.cpp => StyleComputer.cpp} | 32 +++++++++---------- .../CSS/{StyleResolver.h => StyleComputer.h} | 8 ++--- .../Libraries/LibWeb/CSS/StyleInvalidator.cpp | 12 +++---- .../Libraries/LibWeb/CSS/StyleInvalidator.h | 2 +- .../Libraries/LibWeb/CSS/StyleProperties.h | 2 +- Userland/Libraries/LibWeb/DOM/Document.cpp | 6 ++-- Userland/Libraries/LibWeb/DOM/Document.h | 8 ++--- Userland/Libraries/LibWeb/DOM/Element.cpp | 4 +-- Userland/Libraries/LibWeb/DOM/Element.h | 8 ++--- Userland/Libraries/LibWeb/Forward.h | 2 +- .../Libraries/LibWeb/HTML/HTMLBRElement.cpp | 2 +- .../LibWeb/HTML/HTMLCanvasElement.cpp | 4 +-- .../LibWeb/HTML/HTMLIFrameElement.cpp | 2 +- .../LibWeb/HTML/HTMLImageElement.cpp | 4 +-- .../LibWeb/HTML/HTMLInputElement.cpp | 2 +- .../LibWeb/HTML/HTMLLabelElement.cpp | 2 +- .../LibWeb/HTML/HTMLObjectElement.cpp | 4 +-- Userland/Libraries/LibWeb/SVG/SVGGElement.cpp | 2 +- .../Libraries/LibWeb/SVG/SVGPathElement.cpp | 2 +- .../Libraries/LibWeb/SVG/SVGSVGElement.cpp | 4 +-- 22 files changed, 59 insertions(+), 59 deletions(-) rename Userland/Libraries/LibWeb/CSS/{StyleResolver.cpp => StyleComputer.cpp} (97%) rename Userland/Libraries/LibWeb/CSS/{StyleResolver.h => StyleComputer.h} (93%) diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index 358c4a1ff32..5a6d89af48b 100644 --- a/Userland/Libraries/LibWeb/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/CMakeLists.txt @@ -31,9 +31,9 @@ set(SOURCES CSS/Screen.cpp CSS/Selector.cpp CSS/SelectorEngine.cpp + CSS/StyleComputer.cpp CSS/StyleInvalidator.cpp CSS/StyleProperties.cpp - CSS/StyleResolver.cpp CSS/StyleSheet.cpp CSS/StyleSheetList.cpp CSS/StyleValue.cpp diff --git a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp index 03d0b62a41c..30f79e8df88 100644 --- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include @@ -555,7 +555,7 @@ Optional ResolvedCSSStyleDeclaration::property(PropertyID propert const_cast(m_element->document()).ensure_layout(); if (!m_element->layout_node()) { - auto style = m_element->document().style_resolver().resolve_style(const_cast(*m_element)); + auto style = m_element->document().style_computer().compute_style(const_cast(*m_element)); if (auto maybe_property = style->property(property_id); maybe_property.has_value()) { return StyleProperty { .property_id = property_id, diff --git a/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp similarity index 97% rename from Userland/Libraries/LibWeb/CSS/StyleResolver.cpp rename to Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index 5c7217f6b4f..aa88f855fda 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include #include @@ -24,12 +24,12 @@ namespace Web::CSS { -StyleResolver::StyleResolver(DOM::Document& document) +StyleComputer::StyleComputer(DOM::Document& document) : m_document(document) { } -StyleResolver::~StyleResolver() +StyleComputer::~StyleComputer() { } @@ -56,7 +56,7 @@ static StyleSheet& quirks_mode_stylesheet() } template -void StyleResolver::for_each_stylesheet(CascadeOrigin cascade_origin, Callback callback) const +void StyleComputer::for_each_stylesheet(CascadeOrigin cascade_origin, Callback callback) const { if (cascade_origin == CascadeOrigin::Any || cascade_origin == CascadeOrigin::UserAgent) { callback(default_stylesheet()); @@ -70,7 +70,7 @@ void StyleResolver::for_each_stylesheet(CascadeOrigin cascade_origin, Callback c } } -Vector StyleResolver::collect_matching_rules(DOM::Element const& element, CascadeOrigin declaration_type) const +Vector StyleComputer::collect_matching_rules(DOM::Element const& element, CascadeOrigin declaration_type) const { Vector matching_rules; @@ -94,7 +94,7 @@ Vector StyleResolver::collect_matching_rules(DOM::Element const& e return matching_rules; } -void StyleResolver::sort_matching_rules(Vector& matching_rules) const +void StyleComputer::sort_matching_rules(Vector& matching_rules) const { quick_sort(matching_rules, [&](MatchingRule& a, MatchingRule& b) { auto& a_selector = a.rule->selectors()[a.selector_index]; @@ -473,7 +473,7 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope style.set_property(property_id, value); } -StyleResolver::CustomPropertyResolutionTuple StyleResolver::resolve_custom_property_with_specificity(DOM::Element& element, String const& custom_property_name) const +StyleComputer::CustomPropertyResolutionTuple StyleComputer::resolve_custom_property_with_specificity(DOM::Element& element, String const& custom_property_name) const { if (auto maybe_property = element.resolve_custom_property(custom_property_name); maybe_property.has_value()) return maybe_property.value(); @@ -501,7 +501,7 @@ StyleResolver::CustomPropertyResolutionTuple StyleResolver::resolve_custom_prope return parent_resolved; } -Optional StyleResolver::resolve_custom_property(DOM::Element& element, String const& custom_property_name) const +Optional StyleComputer::resolve_custom_property(DOM::Element& element, String const& custom_property_name) const { auto resolved_with_specificity = resolve_custom_property_with_specificity(element, custom_property_name); @@ -513,7 +513,7 @@ struct MatchingDeclarations { Vector author_rules; }; -void StyleResolver::cascade_declarations(StyleProperties& style, DOM::Element& element, Vector const& matching_rules, CascadeOrigin cascade_origin, bool important) const +void StyleComputer::cascade_declarations(StyleProperties& style, DOM::Element& element, Vector const& matching_rules, CascadeOrigin cascade_origin, bool important) const { for (auto& match : matching_rules) { for (auto& property : verify_cast(match.rule->declaration()).properties()) { @@ -543,7 +543,7 @@ void StyleResolver::cascade_declarations(StyleProperties& style, DOM::Element& e } // https://drafts.csswg.org/css-cascade/#cascading -void StyleResolver::compute_cascaded_values(StyleProperties& style, DOM::Element& element) const +void StyleComputer::compute_cascaded_values(StyleProperties& style, DOM::Element& element) const { // First, we collect all the CSS rules whose selectors match `element`: MatchingRuleSet matching_rule_set; @@ -596,7 +596,7 @@ static NonnullRefPtr get_inherit_value(CSS::PropertyID property_id, return *it->value; }; -void StyleResolver::compute_defaulted_property_value(StyleProperties& style, DOM::Element const* element, CSS::PropertyID property_id) const +void StyleComputer::compute_defaulted_property_value(StyleProperties& style, DOM::Element const* element, CSS::PropertyID property_id) const { // FIXME: If we don't know the correct initial value for a property, we fall back to InitialStyleValue. @@ -621,7 +621,7 @@ void StyleResolver::compute_defaulted_property_value(StyleProperties& style, DOM } // https://drafts.csswg.org/css-cascade/#defaulting -void StyleResolver::compute_defaulted_values(StyleProperties& style, DOM::Element const* element) const +void StyleComputer::compute_defaulted_values(StyleProperties& style, DOM::Element const* element) const { // Walk the list of all known CSS properties and: // - Add them to `style` if they are missing. @@ -632,7 +632,7 @@ void StyleResolver::compute_defaulted_values(StyleProperties& style, DOM::Elemen } } -void StyleResolver::compute_font(StyleProperties& style, DOM::Element const* element) const +void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* element) const { // To compute the font, first ensure that we've defaulted the relevant CSS font properties. // FIXME: This should be more sophisticated. @@ -810,7 +810,7 @@ void StyleResolver::compute_font(StyleProperties& style, DOM::Element const* ele style.set_computed_font(found_font.release_nonnull()); } -void StyleResolver::absolutize_values(StyleProperties& style, DOM::Element const*) const +void StyleComputer::absolutize_values(StyleProperties& style, DOM::Element const*) const { auto viewport_rect = document().browsing_context()->viewport_rect(); auto font_metrics = style.computed_font().metrics('M'); @@ -827,7 +827,7 @@ void StyleResolver::absolutize_values(StyleProperties& style, DOM::Element const } } -NonnullRefPtr StyleResolver::create_document_style() const +NonnullRefPtr StyleComputer::create_document_style() const { auto style = StyleProperties::create(); compute_font(style, nullptr); @@ -836,7 +836,7 @@ NonnullRefPtr StyleResolver::create_document_style() const return style; } -NonnullRefPtr StyleResolver::resolve_style(DOM::Element& element) const +NonnullRefPtr StyleComputer::compute_style(DOM::Element& element) const { auto style = StyleProperties::create(); // 1. Perform the cascade. This produces the "specified style" diff --git a/Userland/Libraries/LibWeb/CSS/StyleResolver.h b/Userland/Libraries/LibWeb/CSS/StyleComputer.h similarity index 93% rename from Userland/Libraries/LibWeb/CSS/StyleResolver.h rename to Userland/Libraries/LibWeb/CSS/StyleComputer.h index b654d70df72..a301b243c04 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleResolver.h +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.h @@ -22,16 +22,16 @@ struct MatchingRule { u32 specificity { 0 }; }; -class StyleResolver { +class StyleComputer { public: - explicit StyleResolver(DOM::Document&); - ~StyleResolver(); + explicit StyleComputer(DOM::Document&); + ~StyleComputer(); DOM::Document& document() { return m_document; } DOM::Document const& document() const { return m_document; } NonnullRefPtr create_document_style() const; - NonnullRefPtr resolve_style(DOM::Element&) const; + NonnullRefPtr compute_style(DOM::Element&) const; // https://www.w3.org/TR/css-cascade/#origin enum class CascadeOrigin { diff --git a/Userland/Libraries/LibWeb/CSS/StyleInvalidator.cpp b/Userland/Libraries/LibWeb/CSS/StyleInvalidator.cpp index 315c7804789..0fc2d4ffcd3 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleInvalidator.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleInvalidator.cpp @@ -16,9 +16,9 @@ StyleInvalidator::StyleInvalidator(DOM::Document& document) { if (!m_document.should_invalidate_styles_on_attribute_changes()) return; - auto& style_resolver = m_document.style_resolver(); + auto& style_computer = m_document.style_computer(); m_document.for_each_in_inclusive_subtree_of_type([&](auto& element) { - m_elements_and_matching_rules_before.set(&element, style_resolver.collect_matching_rules(element)); + m_elements_and_matching_rules_before.set(&element, style_computer.collect_matching_rules(element)); return IterationDecision::Continue; }); } @@ -27,7 +27,7 @@ StyleInvalidator::~StyleInvalidator() { if (!m_document.should_invalidate_styles_on_attribute_changes()) return; - auto& style_resolver = m_document.style_resolver(); + auto& style_computer = m_document.style_computer(); m_document.for_each_in_inclusive_subtree_of_type([&](auto& element) { auto maybe_matching_rules_before = m_elements_and_matching_rules_before.get(&element); if (!maybe_matching_rules_before.has_value()) { @@ -35,13 +35,13 @@ StyleInvalidator::~StyleInvalidator() return IterationDecision::Continue; } auto& matching_rules_before = maybe_matching_rules_before.value(); - auto matching_rules_after = style_resolver.collect_matching_rules(element); + auto matching_rules_after = style_computer.collect_matching_rules(element); if (matching_rules_before.size() != matching_rules_after.size()) { element.set_needs_style_update(true); return IterationDecision::Continue; } - style_resolver.sort_matching_rules(matching_rules_before); - style_resolver.sort_matching_rules(matching_rules_after); + style_computer.sort_matching_rules(matching_rules_before); + style_computer.sort_matching_rules(matching_rules_after); for (size_t i = 0; i < matching_rules_before.size(); ++i) { if (matching_rules_before[i].rule != matching_rules_after[i].rule) { element.set_needs_style_update(true); diff --git a/Userland/Libraries/LibWeb/CSS/StyleInvalidator.h b/Userland/Libraries/LibWeb/CSS/StyleInvalidator.h index 6371a3ebc24..c213d39813e 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleInvalidator.h +++ b/Userland/Libraries/LibWeb/CSS/StyleInvalidator.h @@ -7,7 +7,7 @@ #pragma once #include -#include +#include #include #include diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.h b/Userland/Libraries/LibWeb/CSS/StyleProperties.h index c3bc84807da..36e1e26d562 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleProperties.h +++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.h @@ -91,7 +91,7 @@ public: static NonnullRefPtr font_fallback(bool monospace, bool bold); private: - friend class StyleResolver; + friend class StyleComputer; HashMap> m_property_values; Optional overflow(CSS::PropertyID) const; diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index cb4295322e6..b082c767113 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include @@ -59,7 +59,7 @@ namespace Web::DOM { Document::Document(const AK::URL& url) : ParentNode(*this, NodeType::DOCUMENT_NODE) - , m_style_resolver(make(*this)) + , m_style_computer(make(*this)) , m_style_sheets(CSS::StyleSheetList::create(*this)) , m_url(url) , m_window(Window::create_with_document(*this)) @@ -451,7 +451,7 @@ void Document::update_style() RefPtr Document::create_layout_node() { - return adopt_ref(*new Layout::InitialContainingBlock(*this, style_resolver().create_document_style())); + return adopt_ref(*new Layout::InitialContainingBlock(*this, style_computer().create_document_style())); } void Document::set_link_color(Color color) diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index 28505b270c8..07e9f10d1e5 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include @@ -74,8 +74,8 @@ public: AK::URL parse_url(String const&) const; - CSS::StyleResolver& style_resolver() { return *m_style_resolver; } - const CSS::StyleResolver& style_resolver() const { return *m_style_resolver; } + CSS::StyleComputer& style_computer() { return *m_style_computer; } + const CSS::StyleComputer& style_computer() const { return *m_style_computer; } CSS::StyleSheetList& style_sheets() { return *m_style_sheets; } const CSS::StyleSheetList& style_sheets() const { return *m_style_sheets; } @@ -314,7 +314,7 @@ private: unsigned m_referencing_node_count { 0 }; - OwnPtr m_style_resolver; + OwnPtr m_style_computer; RefPtr m_style_sheets; RefPtr m_hovered_node; RefPtr m_inspected_node; diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index a81fe67d3fd..07f7b40251f 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -103,7 +103,7 @@ bool Element::has_class(const FlyString& class_name, CaseSensitivity case_sensit RefPtr Element::create_layout_node() { - auto style = document().style_resolver().resolve_style(*this); + auto style = document().style_computer().compute_style(*this); const_cast(*this).m_specified_css_values = style; auto display = style->display(); @@ -203,7 +203,7 @@ void Element::recompute_style() set_needs_style_update(false); VERIFY(parent()); auto old_specified_css_values = m_specified_css_values; - auto new_specified_css_values = document().style_resolver().resolve_style(*this); + auto new_specified_css_values = document().style_computer().compute_style(*this); m_specified_css_values = new_specified_css_values; if (!layout_node()) { if (new_specified_css_values->display() == CSS::Display::None) diff --git a/Userland/Libraries/LibWeb/DOM/Element.h b/Userland/Libraries/LibWeb/DOM/Element.h index 10bb8b6f57b..a1f36de6183 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.h +++ b/Userland/Libraries/LibWeb/DOM/Element.h @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include @@ -95,11 +95,11 @@ public: const ShadowRoot* shadow_root() const { return m_shadow_root; } void set_shadow_root(RefPtr); - Optional resolve_custom_property(const String& custom_property_name) const + Optional resolve_custom_property(const String& custom_property_name) const { return m_custom_properties.get(custom_property_name); } - void add_custom_property(const String& custom_property_name, CSS::StyleResolver::CustomPropertyResolutionTuple style_property) + void add_custom_property(const String& custom_property_name, CSS::StyleComputer::CustomPropertyResolutionTuple style_property) { m_custom_properties.set(custom_property_name, style_property); } @@ -125,7 +125,7 @@ private: RefPtr m_inline_style; RefPtr m_specified_css_values; - HashMap m_custom_properties; + HashMap m_custom_properties; Vector m_classes; diff --git a/Userland/Libraries/LibWeb/Forward.h b/Userland/Libraries/LibWeb/Forward.h index 45635fd526a..1690e206460 100644 --- a/Userland/Libraries/LibWeb/Forward.h +++ b/Userland/Libraries/LibWeb/Forward.h @@ -26,7 +26,7 @@ class PropertyOwningCSSStyleDeclaration; class Screen; class Selector; class StyleProperties; -class StyleResolver; +class StyleComputer; class StyleSheet; enum class Display; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp index 015f2462ea3..8d35f793ebf 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp @@ -21,7 +21,7 @@ HTMLBRElement::~HTMLBRElement() RefPtr HTMLBRElement::create_layout_node() { - auto style = document().style_resolver().resolve_style(*this); + auto style = document().style_computer().compute_style(*this); if (style->display() == CSS::Display::None) return nullptr; return adopt_ref(*new Layout::BreakNode(document(), *this, move(style))); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp index cabbf54f755..0b70f6983b3 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include @@ -39,7 +39,7 @@ unsigned HTMLCanvasElement::height() const RefPtr HTMLCanvasElement::create_layout_node() { - auto style = document().style_resolver().resolve_style(*this); + auto style = document().style_computer().compute_style(*this); if (style->display() == CSS::Display::None) return nullptr; return adopt_ref(*new Layout::CanvasBox(document(), *this, move(style))); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp index 1b5edea58c9..8a33217a155 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp @@ -23,7 +23,7 @@ HTMLIFrameElement::~HTMLIFrameElement() RefPtr HTMLIFrameElement::create_layout_node() { - auto style = document().style_resolver().resolve_style(*this); + auto style = document().style_computer().compute_style(*this); return adopt_ref(*new Layout::FrameBox(document(), *this, move(style))); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp index 3cbcca10b7b..14e79b1a875 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include #include @@ -70,7 +70,7 @@ void HTMLImageElement::parse_attribute(const FlyString& name, const String& valu RefPtr HTMLImageElement::create_layout_node() { - auto style = document().style_resolver().resolve_style(*this); + auto style = document().style_computer().compute_style(*this); if (style->display() == CSS::Display::None) return nullptr; return adopt_ref(*new Layout::ImageBox(document(), *this, move(style), m_image_loader)); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp index e00ac668560..52d30e5d6b4 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -46,7 +46,7 @@ RefPtr HTMLInputElement::create_layout_node() if (type() == "hidden") return nullptr; - auto style = document().style_resolver().resolve_style(*this); + auto style = document().style_computer().compute_style(*this); if (style->display() == CSS::Display::None) return nullptr; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp index 316fd8cae61..4907d4ece2f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp @@ -21,7 +21,7 @@ HTMLLabelElement::~HTMLLabelElement() RefPtr HTMLLabelElement::create_layout_node() { - auto style = document().style_resolver().resolve_style(*this); + auto style = document().style_computer().compute_style(*this); if (style->display() == CSS::Display::None) return nullptr; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp index 620955ddf81..eea0acc7a16 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp @@ -5,7 +5,7 @@ */ #include -#include +#include #include #include #include @@ -46,7 +46,7 @@ RefPtr HTMLObjectElement::create_layout_node() if (m_should_show_fallback_content) return HTMLElement::create_layout_node(); - auto style = document().style_resolver().resolve_style(*this); + auto style = document().style_computer().compute_style(*this); if (style->display() == CSS::Display::None) return nullptr; if (m_image_loader.has_image()) diff --git a/Userland/Libraries/LibWeb/SVG/SVGGElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGGElement.cpp index 9b6da36fbcd..ec905ef6cd2 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGGElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGGElement.cpp @@ -18,7 +18,7 @@ SVGGElement::SVGGElement(DOM::Document& document, QualifiedName qualified_name) RefPtr SVGGElement::create_layout_node() { - auto style = document().style_resolver().resolve_style(*this); + auto style = document().style_computer().compute_style(*this); if (style->display() == CSS::Display::None) return nullptr; return adopt_ref(*new Layout::SVGGraphicsBox(document(), *this, move(style))); diff --git a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp index c37b32702a4..e5a2c5e3c95 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp @@ -445,7 +445,7 @@ SVGPathElement::SVGPathElement(DOM::Document& document, QualifiedName qualified_ RefPtr SVGPathElement::create_layout_node() { - auto style = document().style_resolver().resolve_style(*this); + auto style = document().style_computer().compute_style(*this); if (style->display() == CSS::Display::None) return nullptr; return adopt_ref(*new Layout::SVGPathBox(document(), *this, move(style))); diff --git a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp index b687816b7c9..9be889f5c92 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp @@ -5,7 +5,7 @@ */ #include -#include +#include #include #include #include @@ -21,7 +21,7 @@ SVGSVGElement::SVGSVGElement(DOM::Document& document, QualifiedName qualified_na RefPtr SVGSVGElement::create_layout_node() { - auto style = document().style_resolver().resolve_style(*this); + auto style = document().style_computer().compute_style(*this); if (style->display() == CSS::Display::None) return nullptr; return adopt_ref(*new Layout::SVGSVGBox(document(), *this, move(style)));