summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/DOM/Document.cpp5
-rw-r--r--Userland/Libraries/LibWeb/DOM/Document.h3
-rw-r--r--Userland/Libraries/LibWeb/DOM/Element.cpp7
-rw-r--r--Userland/Libraries/LibWeb/DOM/Element.h6
-rw-r--r--Userland/Libraries/LibWeb/DOM/Node.cpp7
-rw-r--r--Userland/Libraries/LibWeb/DOM/Node.h4
-rw-r--r--Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp5
-rw-r--r--Userland/Libraries/LibWeb/DOM/ShadowRoot.h1
-rw-r--r--Userland/Libraries/LibWeb/DOM/Text.cpp5
-rw-r--r--Userland/Libraries/LibWeb/DOM/Text.h2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLBRElement.h2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp3
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLImageElement.h2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp6
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLInputElement.h2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp6
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp8
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h2
-rw-r--r--Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp21
-rw-r--r--Userland/Libraries/LibWeb/SVG/SVGGElement.cpp5
-rw-r--r--Userland/Libraries/LibWeb/SVG/SVGGElement.h2
-rw-r--r--Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp5
-rw-r--r--Userland/Libraries/LibWeb/SVG/SVGPathElement.h2
-rw-r--r--Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp5
-rw-r--r--Userland/Libraries/LibWeb/SVG/SVGSVGElement.h2
31 files changed, 48 insertions, 91 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp
index 6689fa5f43..0cbdc93ca7 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Document.cpp
@@ -451,11 +451,6 @@ void Document::update_style()
set_needs_layout();
}
-RefPtr<Layout::Node> Document::create_layout_node()
-{
- return adopt_ref(*new Layout::InitialContainingBlock(*this, style_computer().create_document_style()));
-}
-
void Document::set_link_color(Color color)
{
m_link_color = color;
diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h
index 371b204e39..95d70bc1be 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.h
+++ b/Userland/Libraries/LibWeb/DOM/Document.h
@@ -309,9 +309,6 @@ public:
private:
explicit Document(const AK::URL&);
- // ^DOM::Node
- virtual RefPtr<Layout::Node> create_layout_node() override;
-
// ^HTML::GlobalEventHandlers
virtual EventTarget& global_event_handlers_to_event_target() final { return *this; }
diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp
index 7e85c9263b..85cb637806 100644
--- a/Userland/Libraries/LibWeb/DOM/Element.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Element.cpp
@@ -130,15 +130,10 @@ 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(NonnullRefPtr<CSS::StyleProperties> style)
{
- auto style = document().style_computer().compute_style(*this);
- const_cast<Element&>(*this).m_specified_css_values = style;
auto display = style->display();
- if (display.is_none())
- return nullptr;
-
if (local_name() == "noscript" && document().is_scripting_enabled())
return nullptr;
diff --git a/Userland/Libraries/LibWeb/DOM/Element.h b/Userland/Libraries/LibWeb/DOM/Element.h
index b037e18438..116df2c299 100644
--- a/Userland/Libraries/LibWeb/DOM/Element.h
+++ b/Userland/Libraries/LibWeb/DOM/Element.h
@@ -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:
diff --git a/Userland/Libraries/LibWeb/DOM/Node.cpp b/Userland/Libraries/LibWeb/DOM/Node.cpp
index 2b8b2b88eb..aa49f7bac0 100644
--- a/Userland/Libraries/LibWeb/DOM/Node.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Node.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
* Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
*
@@ -145,11 +145,6 @@ void Node::set_text_content(String const& content)
set_needs_style_update(true);
}
-RefPtr<Layout::Node> Node::create_layout_node()
-{
- return nullptr;
-}
-
void Node::invalidate_style()
{
for_each_in_inclusive_subtree_of_type<Element>([&](auto& element) {
diff --git a/Userland/Libraries/LibWeb/DOM/Node.h b/Userland/Libraries/LibWeb/DOM/Node.h
index d3be7b5b13..d5076f228a 100644
--- a/Userland/Libraries/LibWeb/DOM/Node.h
+++ b/Userland/Libraries/LibWeb/DOM/Node.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -105,8 +105,6 @@ public:
NonnullRefPtr<NodeList> child_nodes();
NonnullRefPtrVector<Node> children_as_vector() const;
- virtual RefPtr<Layout::Node> create_layout_node();
-
virtual FlyString node_name() const = 0;
String descendant_text_content() const;
diff --git a/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp b/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp
index 02f2c02970..03e2ca69af 100644
--- a/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp
+++ b/Userland/Libraries/LibWeb/DOM/ShadowRoot.cpp
@@ -30,11 +30,6 @@ EventTarget* ShadowRoot::get_parent(const Event& event)
return host();
}
-RefPtr<Layout::Node> ShadowRoot::create_layout_node()
-{
- return adopt_ref(*new Layout::BlockContainer(document(), this, CSS::ComputedValues {}));
-}
-
// https://w3c.github.io/DOM-Parsing/#dom-innerhtml-innerhtml
String ShadowRoot::inner_html() const
{
diff --git a/Userland/Libraries/LibWeb/DOM/ShadowRoot.h b/Userland/Libraries/LibWeb/DOM/ShadowRoot.h
index 12532a8eda..7ea5ca32ff 100644
--- a/Userland/Libraries/LibWeb/DOM/ShadowRoot.h
+++ b/Userland/Libraries/LibWeb/DOM/ShadowRoot.h
@@ -34,7 +34,6 @@ public:
private:
// ^Node
virtual FlyString node_name() const override { return "#shadow-root"; }
- virtual RefPtr<Layout::Node> create_layout_node() override;
// NOTE: The specification doesn't seem to specify a default value for closed. Assuming false for now.
bool m_closed { false };
diff --git a/Userland/Libraries/LibWeb/DOM/Text.cpp b/Userland/Libraries/LibWeb/DOM/Text.cpp
index b724891b84..47754603d4 100644
--- a/Userland/Libraries/LibWeb/DOM/Text.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Text.cpp
@@ -19,11 +19,6 @@ Text::~Text()
{
}
-RefPtr<Layout::Node> Text::create_layout_node()
-{
- return adopt_ref(*new Layout::TextNode(document(), *this));
-}
-
// https://dom.spec.whatwg.org/#dom-text-text
NonnullRefPtr<Text> Text::create_with_global_object(Bindings::WindowObject& window, String const& data)
{
diff --git a/Userland/Libraries/LibWeb/DOM/Text.h b/Userland/Libraries/LibWeb/DOM/Text.h
index e6f1d33919..1c298cc371 100644
--- a/Userland/Libraries/LibWeb/DOM/Text.h
+++ b/Userland/Libraries/LibWeb/DOM/Text.h
@@ -28,8 +28,6 @@ public:
void set_always_editable(bool b) { m_always_editable = b; }
private:
- virtual RefPtr<Layout::Node> create_layout_node() override;
-
bool m_always_editable { false };
};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp
index ce8dcd9746..d3cda9ca7c 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp
@@ -19,11 +19,8 @@ HTMLBRElement::~HTMLBRElement()
{
}
-RefPtr<Layout::Node> HTMLBRElement::create_layout_node()
+RefPtr<Layout::Node> HTMLBRElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
{
- auto style = document().style_computer().compute_style(*this);
- if (style->display().is_none())
- return nullptr;
return adopt_ref(*new Layout::BreakNode(document(), *this, move(style)));
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h
index 5e1e36bd40..5348a6f84f 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h
@@ -17,7 +17,7 @@ public:
HTMLBRElement(DOM::Document&, QualifiedName);
virtual ~HTMLBRElement() override;
- virtual RefPtr<Layout::Node> create_layout_node() override;
+ virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
};
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp
index 2dd25930ca..ec27e7b7e2 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp
@@ -47,11 +47,8 @@ void HTMLCanvasElement::set_height(unsigned value)
set_attribute(HTML::AttributeNames::height, String::number(value));
}
-RefPtr<Layout::Node> HTMLCanvasElement::create_layout_node()
+RefPtr<Layout::Node> HTMLCanvasElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
{
- auto style = document().style_computer().compute_style(*this);
- if (style->display().is_none())
- return nullptr;
return adopt_ref(*new Layout::CanvasBox(document(), *this, move(style)));
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h
index e022a67c3f..a80722aa2e 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h
@@ -34,7 +34,7 @@ public:
String to_data_url(const String& type, Optional<double> quality) const;
private:
- virtual RefPtr<Layout::Node> create_layout_node() override;
+ virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
RefPtr<Gfx::Bitmap> m_bitmap;
RefPtr<CanvasRenderingContext2D> m_context;
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp
index 6783e5cce8..816777ce7d 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp
@@ -22,9 +22,8 @@ HTMLIFrameElement::~HTMLIFrameElement()
{
}
-RefPtr<Layout::Node> HTMLIFrameElement::create_layout_node()
+RefPtr<Layout::Node> HTMLIFrameElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
{
- 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/HTMLIFrameElement.h b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h
index 50d22bad7c..c934b6590e 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h
@@ -17,7 +17,7 @@ public:
HTMLIFrameElement(DOM::Document&, QualifiedName);
virtual ~HTMLIFrameElement() override;
- virtual RefPtr<Layout::Node> create_layout_node() override;
+ virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
private:
virtual void inserted() override;
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp
index 5ffc3a2fd1..d4b7463b71 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp
@@ -68,11 +68,8 @@ void HTMLImageElement::parse_attribute(const FlyString& name, const String& valu
m_image_loader.load(document().parse_url(value));
}
-RefPtr<Layout::Node> HTMLImageElement::create_layout_node()
+RefPtr<Layout::Node> HTMLImageElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
{
- auto style = document().style_computer().compute_style(*this);
- if (style->display().is_none())
- return nullptr;
return adopt_ref(*new Layout::ImageBox(document(), *this, move(style), m_image_loader));
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h
index 9bfeda0c9a..d5a9454600 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h
@@ -33,7 +33,7 @@ private:
void animate();
- virtual RefPtr<Layout::Node> create_layout_node() override;
+ virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
ImageLoader m_image_loader;
};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
index 376fbf1199..b5b2d6b33b 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
@@ -41,15 +41,11 @@ void HTMLInputElement::did_click_button(Badge<Layout::ButtonBox>)
}
}
-RefPtr<Layout::Node> HTMLInputElement::create_layout_node()
+RefPtr<Layout::Node> HTMLInputElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
{
if (type() == "hidden")
return nullptr;
- auto style = document().style_computer().compute_style(*this);
- if (style->display().is_none())
- return nullptr;
-
if (type().equals_ignoring_case("submit") || type().equals_ignoring_case("button"))
return adopt_ref(*new Layout::ButtonBox(document(), *this, move(style)));
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h
index d6e50979ff..2ba1ce2009 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h
@@ -20,7 +20,7 @@ public:
HTMLInputElement(DOM::Document&, QualifiedName);
virtual ~HTMLInputElement() override;
- virtual RefPtr<Layout::Node> create_layout_node() override;
+ virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
String type() const { return attribute(HTML::AttributeNames::type); }
String default_value() const { return attribute(HTML::AttributeNames::value); }
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp
index e2e469c321..47190d7087 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp
@@ -19,12 +19,8 @@ HTMLLabelElement::~HTMLLabelElement()
{
}
-RefPtr<Layout::Node> HTMLLabelElement::create_layout_node()
+RefPtr<Layout::Node> HTMLLabelElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
{
- auto style = document().style_computer().compute_style(*this);
- if (style->display().is_none())
- return nullptr;
-
auto layout_node = adopt_ref(*new Layout::Label(document(), this, move(style)));
layout_node->set_inline(true);
return layout_node;
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h
index 1e2182c5ca..bf7982e015 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h
@@ -17,7 +17,7 @@ public:
HTMLLabelElement(DOM::Document&, QualifiedName);
virtual ~HTMLLabelElement() override;
- virtual RefPtr<Layout::Node> create_layout_node() override;
+ virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
String for_() const { return attribute(HTML::AttributeNames::for_); }
};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp
index c8ad1d4dad..1170487f73 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp
@@ -41,14 +41,10 @@ void HTMLObjectElement::parse_attribute(const FlyString& name, const String& val
m_image_loader.load(document().parse_url(value));
}
-RefPtr<Layout::Node> HTMLObjectElement::create_layout_node()
+RefPtr<Layout::Node> HTMLObjectElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
{
if (m_should_show_fallback_content)
- return HTMLElement::create_layout_node();
-
- auto style = document().style_computer().compute_style(*this);
- if (style->display().is_none())
- return nullptr;
+ return HTMLElement::create_layout_node(move(style));
if (m_image_loader.has_image())
return adopt_ref(*new Layout::ImageBox(document(), *this, move(style), m_image_loader));
return nullptr;
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h
index db91a604e5..315a348c83 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h
+++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h
@@ -26,7 +26,7 @@ public:
String type() const { return attribute(HTML::AttributeNames::type); }
private:
- virtual RefPtr<Layout::Node> create_layout_node() override;
+ virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
ImageLoader m_image_loader;
bool m_should_show_fallback_content { false };
diff --git a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
index 11b68c00bd..d5ccbc8ece 100644
--- a/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
+++ b/Userland/Libraries/LibWeb/Layout/TreeBuilder.cpp
@@ -90,7 +90,26 @@ void TreeBuilder::create_layout_tree(DOM::Node& dom_node, TreeBuilder::Context&
return;
}
- auto layout_node = dom_node.create_layout_node();
+ auto& document = dom_node.document();
+ auto& style_computer = document.style_computer();
+ RefPtr<Layout::Node> layout_node;
+
+ if (is<DOM::Element>(dom_node)) {
+ auto& element = static_cast<DOM::Element&>(dom_node);
+ auto style = style_computer.compute_style(element);
+ if (style->display().is_none())
+ return;
+ element.set_specified_css_values(style);
+ layout_node = element.create_layout_node(move(style));
+ } else if (is<DOM::Document>(dom_node)) {
+ auto style = style_computer.create_document_style();
+ layout_node = adopt_ref(*new Layout::InitialContainingBlock(static_cast<DOM::Document&>(dom_node), move(style)));
+ } else if (is<DOM::Text>(dom_node)) {
+ layout_node = adopt_ref(*new Layout::TextNode(document, static_cast<DOM::Text&>(dom_node)));
+ } else if (is<DOM::ShadowRoot>(dom_node)) {
+ layout_node = adopt_ref(*new Layout::BlockContainer(document, &static_cast<DOM::ShadowRoot&>(dom_node), CSS::ComputedValues {}));
+ }
+
if (!layout_node)
return;
diff --git a/Userland/Libraries/LibWeb/SVG/SVGGElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGGElement.cpp
index fc1a7ff177..aebba55ec6 100644
--- a/Userland/Libraries/LibWeb/SVG/SVGGElement.cpp
+++ b/Userland/Libraries/LibWeb/SVG/SVGGElement.cpp
@@ -16,11 +16,8 @@ SVGGElement::SVGGElement(DOM::Document& document, QualifiedName qualified_name)
{
}
-RefPtr<Layout::Node> SVGGElement::create_layout_node()
+RefPtr<Layout::Node> SVGGElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
{
- auto style = document().style_computer().compute_style(*this);
- if (style->display().is_none())
- return nullptr;
return adopt_ref(*new Layout::SVGGraphicsBox(document(), *this, move(style)));
}
diff --git a/Userland/Libraries/LibWeb/SVG/SVGGElement.h b/Userland/Libraries/LibWeb/SVG/SVGGElement.h
index a05a12fc5f..757a491fcf 100644
--- a/Userland/Libraries/LibWeb/SVG/SVGGElement.h
+++ b/Userland/Libraries/LibWeb/SVG/SVGGElement.h
@@ -17,7 +17,7 @@ public:
SVGGElement(DOM::Document&, QualifiedName);
virtual ~SVGGElement() override = default;
- virtual RefPtr<Layout::Node> create_layout_node() override;
+ virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
};
}
diff --git a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp
index 03f9ca48d8..110eed7b3e 100644
--- a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp
+++ b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp
@@ -443,11 +443,8 @@ SVGPathElement::SVGPathElement(DOM::Document& document, QualifiedName qualified_
{
}
-RefPtr<Layout::Node> SVGPathElement::create_layout_node()
+RefPtr<Layout::Node> SVGPathElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
{
- auto style = document().style_computer().compute_style(*this);
- if (style->display().is_none())
- return nullptr;
return adopt_ref(*new Layout::SVGPathBox(document(), *this, move(style)));
}
diff --git a/Userland/Libraries/LibWeb/SVG/SVGPathElement.h b/Userland/Libraries/LibWeb/SVG/SVGPathElement.h
index 7f72a2bfb0..0e90900892 100644
--- a/Userland/Libraries/LibWeb/SVG/SVGPathElement.h
+++ b/Userland/Libraries/LibWeb/SVG/SVGPathElement.h
@@ -89,7 +89,7 @@ public:
SVGPathElement(DOM::Document&, QualifiedName);
virtual ~SVGPathElement() override = default;
- virtual RefPtr<Layout::Node> create_layout_node() override;
+ virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
virtual void parse_attribute(const FlyString& name, const String& value) override;
diff --git a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp
index f001ebd778..f7583076a0 100644
--- a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp
+++ b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp
@@ -19,11 +19,8 @@ SVGSVGElement::SVGSVGElement(DOM::Document& document, QualifiedName qualified_na
{
}
-RefPtr<Layout::Node> SVGSVGElement::create_layout_node()
+RefPtr<Layout::Node> SVGSVGElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
{
- auto style = document().style_computer().compute_style(*this);
- if (style->display().is_none())
- return nullptr;
return adopt_ref(*new Layout::SVGSVGBox(document(), *this, move(style)));
}
diff --git a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h
index cd3ea27ddc..f36b32022b 100644
--- a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h
+++ b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h
@@ -18,7 +18,7 @@ public:
SVGSVGElement(DOM::Document&, QualifiedName);
- virtual RefPtr<Layout::Node> create_layout_node() override;
+ virtual RefPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
unsigned width() const;
unsigned height() const;