1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 13:45:07 +00:00

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.
This commit is contained in:
Andreas Kling 2022-03-14 20:23:18 +01:00
parent 511d4951b0
commit 88173648e3
2 changed files with 7 additions and 1 deletions

View file

@ -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();
}
}