mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-02 14:48:15 +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:
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user