1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:37:36 +00:00

LibWeb: Compute element style in Layout::TreeBuilder

Instead of making each Layout::Node compute style for itself, we now
compute it in TreeBuilder before even calling create_layout_node().

For non-element DOM nodes, we create the style and layout tree node
in TreeBuilder. This allows us to move create_layout_node() from
DOM::Node to DOM::Element.
This commit is contained in:
Andreas Kling 2022-02-05 13:17:01 +01:00
parent 3451673ac8
commit 7e1bf4d300
31 changed files with 48 additions and 91 deletions

View file

@ -90,7 +90,8 @@ public:
String name() const { return attribute(HTML::AttributeNames::name); }
const CSS::StyleProperties* specified_css_values() const { return m_specified_css_values.ptr(); }
CSS::StyleProperties const* specified_css_values() const { return m_specified_css_values.ptr(); }
void set_specified_css_values(RefPtr<CSS::StyleProperties> style) { m_specified_css_values = move(style); }
NonnullRefPtr<CSS::StyleProperties> computed_style();
const CSS::CSSStyleDeclaration* inline_style() const { return m_inline_style; }
@ -128,8 +129,9 @@ public:
NonnullRefPtr<Geometry::DOMRect> get_bounding_client_rect() const;
virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>);
protected:
RefPtr<Layout::Node> create_layout_node() override;
virtual void children_changed() override;
private: