mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 16:48:12 +00:00
LibWeb: Make DOM::Node::create_layout_node() not need parent's style
The StyleResolver can find the specified CSS values for the parent element via the DOM. Forcing everyone to locate specified values for their parent was completely unnecessary.
This commit is contained in:
parent
d9b2650dcc
commit
29a4da30b7
28 changed files with 40 additions and 39 deletions
|
@ -111,9 +111,9 @@ bool Element::has_class(const FlyString& class_name) const
|
|||
return false;
|
||||
}
|
||||
|
||||
RefPtr<Layout::Node> Element::create_layout_node(const CSS::StyleProperties* parent_style)
|
||||
RefPtr<Layout::Node> Element::create_layout_node()
|
||||
{
|
||||
auto style = document().style_resolver().resolve_style(*this, parent_style);
|
||||
auto style = document().style_resolver().resolve_style(*this);
|
||||
const_cast<Element&>(*this).m_specified_css_values = style;
|
||||
auto display = style->display();
|
||||
|
||||
|
@ -199,8 +199,7 @@ void Element::recompute_style()
|
|||
set_needs_style_update(false);
|
||||
ASSERT(parent());
|
||||
auto old_specified_css_values = m_specified_css_values;
|
||||
auto* parent_specified_css_values = parent()->is_element() ? downcast<Element>(*parent()).specified_css_values() : nullptr;
|
||||
auto new_specified_css_values = document().style_resolver().resolve_style(*this, parent_specified_css_values);
|
||||
auto new_specified_css_values = document().style_resolver().resolve_style(*this);
|
||||
m_specified_css_values = new_specified_css_values;
|
||||
if (!layout_node()) {
|
||||
if (new_specified_css_values->display() == CSS::Display::None)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue