1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:48:14 +00:00

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.
This commit is contained in:
Andreas Kling 2021-09-24 13:49:57 +02:00
parent 3dc6f0bc47
commit f8dd3e14ba
22 changed files with 59 additions and 59 deletions

View file

@ -31,9 +31,9 @@ set(SOURCES
CSS/Screen.cpp CSS/Screen.cpp
CSS/Selector.cpp CSS/Selector.cpp
CSS/SelectorEngine.cpp CSS/SelectorEngine.cpp
CSS/StyleComputer.cpp
CSS/StyleInvalidator.cpp CSS/StyleInvalidator.cpp
CSS/StyleProperties.cpp CSS/StyleProperties.cpp
CSS/StyleResolver.cpp
CSS/StyleSheet.cpp CSS/StyleSheet.cpp
CSS/StyleSheetList.cpp CSS/StyleSheetList.cpp
CSS/StyleValue.cpp CSS/StyleValue.cpp

View file

@ -7,7 +7,7 @@
#include <AK/NonnullRefPtr.h> #include <AK/NonnullRefPtr.h>
#include <LibWeb/CSS/ResolvedCSSStyleDeclaration.h> #include <LibWeb/CSS/ResolvedCSSStyleDeclaration.h>
#include <LibWeb/CSS/StyleResolver.h> #include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Element.h> #include <LibWeb/DOM/Element.h>
@ -555,7 +555,7 @@ Optional<StyleProperty> ResolvedCSSStyleDeclaration::property(PropertyID propert
const_cast<DOM::Document&>(m_element->document()).ensure_layout(); const_cast<DOM::Document&>(m_element->document()).ensure_layout();
if (!m_element->layout_node()) { if (!m_element->layout_node()) {
auto style = m_element->document().style_resolver().resolve_style(const_cast<DOM::Element&>(*m_element)); auto style = m_element->document().style_computer().compute_style(const_cast<DOM::Element&>(*m_element));
if (auto maybe_property = style->property(property_id); maybe_property.has_value()) { if (auto maybe_property = style->property(property_id); maybe_property.has_value()) {
return StyleProperty { return StyleProperty {
.property_id = property_id, .property_id = property_id,

View file

@ -12,7 +12,7 @@
#include <LibWeb/CSS/CSSStyleRule.h> #include <LibWeb/CSS/CSSStyleRule.h>
#include <LibWeb/CSS/Parser/Parser.h> #include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/SelectorEngine.h> #include <LibWeb/CSS/SelectorEngine.h>
#include <LibWeb/CSS/StyleResolver.h> #include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/CSS/StyleSheet.h> #include <LibWeb/CSS/StyleSheet.h>
#include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Element.h> #include <LibWeb/DOM/Element.h>
@ -24,12 +24,12 @@
namespace Web::CSS { namespace Web::CSS {
StyleResolver::StyleResolver(DOM::Document& document) StyleComputer::StyleComputer(DOM::Document& document)
: m_document(document) : m_document(document)
{ {
} }
StyleResolver::~StyleResolver() StyleComputer::~StyleComputer()
{ {
} }
@ -56,7 +56,7 @@ static StyleSheet& quirks_mode_stylesheet()
} }
template<typename Callback> template<typename Callback>
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) { if (cascade_origin == CascadeOrigin::Any || cascade_origin == CascadeOrigin::UserAgent) {
callback(default_stylesheet()); callback(default_stylesheet());
@ -70,7 +70,7 @@ void StyleResolver::for_each_stylesheet(CascadeOrigin cascade_origin, Callback c
} }
} }
Vector<MatchingRule> StyleResolver::collect_matching_rules(DOM::Element const& element, CascadeOrigin declaration_type) const Vector<MatchingRule> StyleComputer::collect_matching_rules(DOM::Element const& element, CascadeOrigin declaration_type) const
{ {
Vector<MatchingRule> matching_rules; Vector<MatchingRule> matching_rules;
@ -94,7 +94,7 @@ Vector<MatchingRule> StyleResolver::collect_matching_rules(DOM::Element const& e
return matching_rules; return matching_rules;
} }
void StyleResolver::sort_matching_rules(Vector<MatchingRule>& matching_rules) const void StyleComputer::sort_matching_rules(Vector<MatchingRule>& matching_rules) const
{ {
quick_sort(matching_rules, [&](MatchingRule& a, MatchingRule& b) { quick_sort(matching_rules, [&](MatchingRule& a, MatchingRule& b) {
auto& a_selector = a.rule->selectors()[a.selector_index]; 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); 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()) if (auto maybe_property = element.resolve_custom_property(custom_property_name); maybe_property.has_value())
return maybe_property.value(); return maybe_property.value();
@ -501,7 +501,7 @@ StyleResolver::CustomPropertyResolutionTuple StyleResolver::resolve_custom_prope
return parent_resolved; return parent_resolved;
} }
Optional<StyleProperty> StyleResolver::resolve_custom_property(DOM::Element& element, String const& custom_property_name) const Optional<StyleProperty> 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); auto resolved_with_specificity = resolve_custom_property_with_specificity(element, custom_property_name);
@ -513,7 +513,7 @@ struct MatchingDeclarations {
Vector<MatchingRule> author_rules; Vector<MatchingRule> author_rules;
}; };
void StyleResolver::cascade_declarations(StyleProperties& style, DOM::Element& element, Vector<MatchingRule> const& matching_rules, CascadeOrigin cascade_origin, bool important) const void StyleComputer::cascade_declarations(StyleProperties& style, DOM::Element& element, Vector<MatchingRule> const& matching_rules, CascadeOrigin cascade_origin, bool important) const
{ {
for (auto& match : matching_rules) { for (auto& match : matching_rules) {
for (auto& property : verify_cast<PropertyOwningCSSStyleDeclaration>(match.rule->declaration()).properties()) { for (auto& property : verify_cast<PropertyOwningCSSStyleDeclaration>(match.rule->declaration()).properties()) {
@ -543,7 +543,7 @@ void StyleResolver::cascade_declarations(StyleProperties& style, DOM::Element& e
} }
// https://drafts.csswg.org/css-cascade/#cascading // 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`: // First, we collect all the CSS rules whose selectors match `element`:
MatchingRuleSet matching_rule_set; MatchingRuleSet matching_rule_set;
@ -596,7 +596,7 @@ static NonnullRefPtr<StyleValue> get_inherit_value(CSS::PropertyID property_id,
return *it->value; 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. // 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 // 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: // Walk the list of all known CSS properties and:
// - Add them to `style` if they are missing. // - 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. // To compute the font, first ensure that we've defaulted the relevant CSS font properties.
// FIXME: This should be more sophisticated. // 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()); 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 viewport_rect = document().browsing_context()->viewport_rect();
auto font_metrics = style.computed_font().metrics('M'); auto font_metrics = style.computed_font().metrics('M');
@ -827,7 +827,7 @@ void StyleResolver::absolutize_values(StyleProperties& style, DOM::Element const
} }
} }
NonnullRefPtr<StyleProperties> StyleResolver::create_document_style() const NonnullRefPtr<StyleProperties> StyleComputer::create_document_style() const
{ {
auto style = StyleProperties::create(); auto style = StyleProperties::create();
compute_font(style, nullptr); compute_font(style, nullptr);
@ -836,7 +836,7 @@ NonnullRefPtr<StyleProperties> StyleResolver::create_document_style() const
return style; return style;
} }
NonnullRefPtr<StyleProperties> StyleResolver::resolve_style(DOM::Element& element) const NonnullRefPtr<StyleProperties> StyleComputer::compute_style(DOM::Element& element) const
{ {
auto style = StyleProperties::create(); auto style = StyleProperties::create();
// 1. Perform the cascade. This produces the "specified style" // 1. Perform the cascade. This produces the "specified style"

View file

@ -22,16 +22,16 @@ struct MatchingRule {
u32 specificity { 0 }; u32 specificity { 0 };
}; };
class StyleResolver { class StyleComputer {
public: public:
explicit StyleResolver(DOM::Document&); explicit StyleComputer(DOM::Document&);
~StyleResolver(); ~StyleComputer();
DOM::Document& document() { return m_document; } DOM::Document& document() { return m_document; }
DOM::Document const& document() const { return m_document; } DOM::Document const& document() const { return m_document; }
NonnullRefPtr<StyleProperties> create_document_style() const; NonnullRefPtr<StyleProperties> create_document_style() const;
NonnullRefPtr<StyleProperties> resolve_style(DOM::Element&) const; NonnullRefPtr<StyleProperties> compute_style(DOM::Element&) const;
// https://www.w3.org/TR/css-cascade/#origin // https://www.w3.org/TR/css-cascade/#origin
enum class CascadeOrigin { enum class CascadeOrigin {

View file

@ -16,9 +16,9 @@ StyleInvalidator::StyleInvalidator(DOM::Document& document)
{ {
if (!m_document.should_invalidate_styles_on_attribute_changes()) if (!m_document.should_invalidate_styles_on_attribute_changes())
return; return;
auto& style_resolver = m_document.style_resolver(); auto& style_computer = m_document.style_computer();
m_document.for_each_in_inclusive_subtree_of_type<DOM::Element>([&](auto& element) { m_document.for_each_in_inclusive_subtree_of_type<DOM::Element>([&](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; return IterationDecision::Continue;
}); });
} }
@ -27,7 +27,7 @@ StyleInvalidator::~StyleInvalidator()
{ {
if (!m_document.should_invalidate_styles_on_attribute_changes()) if (!m_document.should_invalidate_styles_on_attribute_changes())
return; return;
auto& style_resolver = m_document.style_resolver(); auto& style_computer = m_document.style_computer();
m_document.for_each_in_inclusive_subtree_of_type<DOM::Element>([&](auto& element) { m_document.for_each_in_inclusive_subtree_of_type<DOM::Element>([&](auto& element) {
auto maybe_matching_rules_before = m_elements_and_matching_rules_before.get(&element); auto maybe_matching_rules_before = m_elements_and_matching_rules_before.get(&element);
if (!maybe_matching_rules_before.has_value()) { if (!maybe_matching_rules_before.has_value()) {
@ -35,13 +35,13 @@ StyleInvalidator::~StyleInvalidator()
return IterationDecision::Continue; return IterationDecision::Continue;
} }
auto& matching_rules_before = maybe_matching_rules_before.value(); 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()) { if (matching_rules_before.size() != matching_rules_after.size()) {
element.set_needs_style_update(true); element.set_needs_style_update(true);
return IterationDecision::Continue; return IterationDecision::Continue;
} }
style_resolver.sort_matching_rules(matching_rules_before); style_computer.sort_matching_rules(matching_rules_before);
style_resolver.sort_matching_rules(matching_rules_after); style_computer.sort_matching_rules(matching_rules_after);
for (size_t i = 0; i < matching_rules_before.size(); ++i) { for (size_t i = 0; i < matching_rules_before.size(); ++i) {
if (matching_rules_before[i].rule != matching_rules_after[i].rule) { if (matching_rules_before[i].rule != matching_rules_after[i].rule) {
element.set_needs_style_update(true); element.set_needs_style_update(true);

View file

@ -7,7 +7,7 @@
#pragma once #pragma once
#include <AK/HashMap.h> #include <AK/HashMap.h>
#include <LibWeb/CSS/StyleResolver.h> #include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Element.h> #include <LibWeb/DOM/Element.h>

View file

@ -91,7 +91,7 @@ public:
static NonnullRefPtr<Gfx::Font> font_fallback(bool monospace, bool bold); static NonnullRefPtr<Gfx::Font> font_fallback(bool monospace, bool bold);
private: private:
friend class StyleResolver; friend class StyleComputer;
HashMap<CSS::PropertyID, NonnullRefPtr<StyleValue>> m_property_values; HashMap<CSS::PropertyID, NonnullRefPtr<StyleValue>> m_property_values;
Optional<CSS::Overflow> overflow(CSS::PropertyID) const; Optional<CSS::Overflow> overflow(CSS::PropertyID) const;

View file

@ -15,7 +15,7 @@
#include <LibJS/Runtime/FunctionObject.h> #include <LibJS/Runtime/FunctionObject.h>
#include <LibWeb/Bindings/MainThreadVM.h> #include <LibWeb/Bindings/MainThreadVM.h>
#include <LibWeb/Bindings/WindowObject.h> #include <LibWeb/Bindings/WindowObject.h>
#include <LibWeb/CSS/StyleResolver.h> #include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/Cookie/ParsedCookie.h> #include <LibWeb/Cookie/ParsedCookie.h>
#include <LibWeb/DOM/Comment.h> #include <LibWeb/DOM/Comment.h>
#include <LibWeb/DOM/DOMException.h> #include <LibWeb/DOM/DOMException.h>
@ -59,7 +59,7 @@ namespace Web::DOM {
Document::Document(const AK::URL& url) Document::Document(const AK::URL& url)
: ParentNode(*this, NodeType::DOCUMENT_NODE) : ParentNode(*this, NodeType::DOCUMENT_NODE)
, m_style_resolver(make<CSS::StyleResolver>(*this)) , m_style_computer(make<CSS::StyleComputer>(*this))
, m_style_sheets(CSS::StyleSheetList::create(*this)) , m_style_sheets(CSS::StyleSheetList::create(*this))
, m_url(url) , m_url(url)
, m_window(Window::create_with_document(*this)) , m_window(Window::create_with_document(*this))
@ -451,7 +451,7 @@ void Document::update_style()
RefPtr<Layout::Node> Document::create_layout_node() RefPtr<Layout::Node> 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) void Document::set_link_color(Color color)

View file

@ -19,7 +19,7 @@
#include <LibWeb/Bindings/ScriptExecutionContext.h> #include <LibWeb/Bindings/ScriptExecutionContext.h>
#include <LibWeb/Bindings/WindowObject.h> #include <LibWeb/Bindings/WindowObject.h>
#include <LibWeb/CSS/CSSStyleSheet.h> #include <LibWeb/CSS/CSSStyleSheet.h>
#include <LibWeb/CSS/StyleResolver.h> #include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/CSS/StyleSheetList.h> #include <LibWeb/CSS/StyleSheetList.h>
#include <LibWeb/Cookie/Cookie.h> #include <LibWeb/Cookie/Cookie.h>
#include <LibWeb/DOM/DOMImplementation.h> #include <LibWeb/DOM/DOMImplementation.h>
@ -74,8 +74,8 @@ public:
AK::URL parse_url(String const&) const; AK::URL parse_url(String const&) const;
CSS::StyleResolver& style_resolver() { return *m_style_resolver; } CSS::StyleComputer& style_computer() { return *m_style_computer; }
const CSS::StyleResolver& style_resolver() const { return *m_style_resolver; } const CSS::StyleComputer& style_computer() const { return *m_style_computer; }
CSS::StyleSheetList& style_sheets() { return *m_style_sheets; } CSS::StyleSheetList& style_sheets() { return *m_style_sheets; }
const CSS::StyleSheetList& style_sheets() const { 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 }; unsigned m_referencing_node_count { 0 };
OwnPtr<CSS::StyleResolver> m_style_resolver; OwnPtr<CSS::StyleComputer> m_style_computer;
RefPtr<CSS::StyleSheetList> m_style_sheets; RefPtr<CSS::StyleSheetList> m_style_sheets;
RefPtr<Node> m_hovered_node; RefPtr<Node> m_hovered_node;
RefPtr<Node> m_inspected_node; RefPtr<Node> m_inspected_node;

View file

@ -103,7 +103,7 @@ bool Element::has_class(const FlyString& class_name, CaseSensitivity case_sensit
RefPtr<Layout::Node> Element::create_layout_node() RefPtr<Layout::Node> Element::create_layout_node()
{ {
auto style = document().style_resolver().resolve_style(*this); auto style = document().style_computer().compute_style(*this);
const_cast<Element&>(*this).m_specified_css_values = style; const_cast<Element&>(*this).m_specified_css_values = style;
auto display = style->display(); auto display = style->display();
@ -203,7 +203,7 @@ void Element::recompute_style()
set_needs_style_update(false); set_needs_style_update(false);
VERIFY(parent()); VERIFY(parent());
auto old_specified_css_values = m_specified_css_values; 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; m_specified_css_values = new_specified_css_values;
if (!layout_node()) { if (!layout_node()) {
if (new_specified_css_values->display() == CSS::Display::None) if (new_specified_css_values->display() == CSS::Display::None)

View file

@ -9,7 +9,7 @@
#include <AK/FlyString.h> #include <AK/FlyString.h>
#include <AK/String.h> #include <AK/String.h>
#include <LibWeb/CSS/CSSStyleDeclaration.h> #include <LibWeb/CSS/CSSStyleDeclaration.h>
#include <LibWeb/CSS/StyleResolver.h> #include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/DOM/Attribute.h> #include <LibWeb/DOM/Attribute.h>
#include <LibWeb/DOM/ExceptionOr.h> #include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/DOM/NonDocumentTypeChildNode.h> #include <LibWeb/DOM/NonDocumentTypeChildNode.h>
@ -95,11 +95,11 @@ public:
const ShadowRoot* shadow_root() const { return m_shadow_root; } const ShadowRoot* shadow_root() const { return m_shadow_root; }
void set_shadow_root(RefPtr<ShadowRoot>); void set_shadow_root(RefPtr<ShadowRoot>);
Optional<CSS::StyleResolver::CustomPropertyResolutionTuple> resolve_custom_property(const String& custom_property_name) const Optional<CSS::StyleComputer::CustomPropertyResolutionTuple> resolve_custom_property(const String& custom_property_name) const
{ {
return m_custom_properties.get(custom_property_name); 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); m_custom_properties.set(custom_property_name, style_property);
} }
@ -125,7 +125,7 @@ private:
RefPtr<CSS::CSSStyleDeclaration> m_inline_style; RefPtr<CSS::CSSStyleDeclaration> m_inline_style;
RefPtr<CSS::StyleProperties> m_specified_css_values; RefPtr<CSS::StyleProperties> m_specified_css_values;
HashMap<String, CSS::StyleResolver::CustomPropertyResolutionTuple> m_custom_properties; HashMap<String, CSS::StyleComputer::CustomPropertyResolutionTuple> m_custom_properties;
Vector<FlyString> m_classes; Vector<FlyString> m_classes;

View file

@ -26,7 +26,7 @@ class PropertyOwningCSSStyleDeclaration;
class Screen; class Screen;
class Selector; class Selector;
class StyleProperties; class StyleProperties;
class StyleResolver; class StyleComputer;
class StyleSheet; class StyleSheet;
enum class Display; enum class Display;

View file

@ -21,7 +21,7 @@ HTMLBRElement::~HTMLBRElement()
RefPtr<Layout::Node> HTMLBRElement::create_layout_node() RefPtr<Layout::Node> 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) if (style->display() == CSS::Display::None)
return nullptr; return nullptr;
return adopt_ref(*new Layout::BreakNode(document(), *this, move(style))); return adopt_ref(*new Layout::BreakNode(document(), *this, move(style)));

View file

@ -8,7 +8,7 @@
#include <AK/Checked.h> #include <AK/Checked.h>
#include <LibGfx/Bitmap.h> #include <LibGfx/Bitmap.h>
#include <LibGfx/PNGWriter.h> #include <LibGfx/PNGWriter.h>
#include <LibWeb/CSS/StyleResolver.h> #include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Document.h>
#include <LibWeb/HTML/CanvasRenderingContext2D.h> #include <LibWeb/HTML/CanvasRenderingContext2D.h>
#include <LibWeb/HTML/HTMLCanvasElement.h> #include <LibWeb/HTML/HTMLCanvasElement.h>
@ -39,7 +39,7 @@ unsigned HTMLCanvasElement::height() const
RefPtr<Layout::Node> HTMLCanvasElement::create_layout_node() RefPtr<Layout::Node> 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) if (style->display() == CSS::Display::None)
return nullptr; return nullptr;
return adopt_ref(*new Layout::CanvasBox(document(), *this, move(style))); return adopt_ref(*new Layout::CanvasBox(document(), *this, move(style)));

View file

@ -23,7 +23,7 @@ HTMLIFrameElement::~HTMLIFrameElement()
RefPtr<Layout::Node> HTMLIFrameElement::create_layout_node() RefPtr<Layout::Node> 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))); return adopt_ref(*new Layout::FrameBox(document(), *this, move(style)));
} }

View file

@ -6,7 +6,7 @@
#include <LibGfx/Bitmap.h> #include <LibGfx/Bitmap.h>
#include <LibWeb/CSS/Parser/Parser.h> #include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/StyleResolver.h> #include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Event.h> #include <LibWeb/DOM/Event.h>
#include <LibWeb/HTML/EventNames.h> #include <LibWeb/HTML/EventNames.h>
@ -70,7 +70,7 @@ void HTMLImageElement::parse_attribute(const FlyString& name, const String& valu
RefPtr<Layout::Node> HTMLImageElement::create_layout_node() RefPtr<Layout::Node> 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) if (style->display() == CSS::Display::None)
return nullptr; return nullptr;
return adopt_ref(*new Layout::ImageBox(document(), *this, move(style), m_image_loader)); return adopt_ref(*new Layout::ImageBox(document(), *this, move(style), m_image_loader));

View file

@ -46,7 +46,7 @@ RefPtr<Layout::Node> HTMLInputElement::create_layout_node()
if (type() == "hidden") if (type() == "hidden")
return nullptr; return nullptr;
auto style = document().style_resolver().resolve_style(*this); auto style = document().style_computer().compute_style(*this);
if (style->display() == CSS::Display::None) if (style->display() == CSS::Display::None)
return nullptr; return nullptr;

View file

@ -21,7 +21,7 @@ HTMLLabelElement::~HTMLLabelElement()
RefPtr<Layout::Node> HTMLLabelElement::create_layout_node() RefPtr<Layout::Node> 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) if (style->display() == CSS::Display::None)
return nullptr; return nullptr;

View file

@ -5,7 +5,7 @@
*/ */
#include <LibGfx/Bitmap.h> #include <LibGfx/Bitmap.h>
#include <LibWeb/CSS/StyleResolver.h> #include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Event.h> #include <LibWeb/DOM/Event.h>
#include <LibWeb/HTML/HTMLObjectElement.h> #include <LibWeb/HTML/HTMLObjectElement.h>
@ -46,7 +46,7 @@ RefPtr<Layout::Node> HTMLObjectElement::create_layout_node()
if (m_should_show_fallback_content) if (m_should_show_fallback_content)
return HTMLElement::create_layout_node(); 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) if (style->display() == CSS::Display::None)
return nullptr; return nullptr;
if (m_image_loader.has_image()) if (m_image_loader.has_image())

View file

@ -18,7 +18,7 @@ SVGGElement::SVGGElement(DOM::Document& document, QualifiedName qualified_name)
RefPtr<Layout::Node> SVGGElement::create_layout_node() RefPtr<Layout::Node> 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) if (style->display() == CSS::Display::None)
return nullptr; return nullptr;
return adopt_ref(*new Layout::SVGGraphicsBox(document(), *this, move(style))); return adopt_ref(*new Layout::SVGGraphicsBox(document(), *this, move(style)));

View file

@ -445,7 +445,7 @@ SVGPathElement::SVGPathElement(DOM::Document& document, QualifiedName qualified_
RefPtr<Layout::Node> SVGPathElement::create_layout_node() RefPtr<Layout::Node> 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) if (style->display() == CSS::Display::None)
return nullptr; return nullptr;
return adopt_ref(*new Layout::SVGPathBox(document(), *this, move(style))); return adopt_ref(*new Layout::SVGPathBox(document(), *this, move(style)));

View file

@ -5,7 +5,7 @@
*/ */
#include <LibGfx/Painter.h> #include <LibGfx/Painter.h>
#include <LibWeb/CSS/StyleResolver.h> #include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Event.h> #include <LibWeb/DOM/Event.h>
#include <LibWeb/Layout/SVGSVGBox.h> #include <LibWeb/Layout/SVGSVGBox.h>
@ -21,7 +21,7 @@ SVGSVGElement::SVGSVGElement(DOM::Document& document, QualifiedName qualified_na
RefPtr<Layout::Node> SVGSVGElement::create_layout_node() RefPtr<Layout::Node> 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) if (style->display() == CSS::Display::None)
return nullptr; return nullptr;
return adopt_ref(*new Layout::SVGSVGBox(document(), *this, move(style))); return adopt_ref(*new Layout::SVGSVGBox(document(), *this, move(style)));