summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-03-14 20:23:18 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-15 19:48:19 +0100
commit88173648e3f2a7f772fdfbaa8643fa02ce0fed50 (patch)
tree14178b861ce3e35ec304c147cf99d96617602169 /Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
parent511d4951b044bcd9316b6935f3fe438cba3bd5e9 (diff)
downloadserenity-88173648e3f2a7f772fdfbaa8643fa02ce0fed50.zip
LibWeb: Create HTMLInputElement UA shadow tree when inserted into DOM
Previously, we were creating a user-agent shadow tree when constructing a layout tree. This meant that we did DOM manipulation (and consequently style invalidation) during layout tree construction, which made things very hard to reason about in Layout::TreeBuilder. Simply everything by simply creating the UA shadow tree when the input element inserted into a parent node instead.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp')
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
index cf7bd2c407..27066a9544 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
@@ -64,7 +64,6 @@ RefPtr<Layout::Node> HTMLInputElement::create_layout_node(NonnullRefPtr<CSS::Sty
if (type() == "radio")
return adopt_ref(*new Layout::RadioButton(document(), *this, move(style)));
- create_shadow_tree_if_needed();
auto layout_node = adopt_ref(*new Layout::BlockContainer(document(), this, move(style)));
layout_node->set_inline(true);
return layout_node;
@@ -284,4 +283,9 @@ String HTMLInputElement::value_sanitization_algorithm(String value) const
return value;
}
+void HTMLInputElement::inserted()
+{
+ create_shadow_tree_if_needed();
+}
+
}