mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:38:11 +00:00
LibWeb: Make DOM::Node::set_needs_style_update() schedule the update
After you mark a node as needing new style, there's no situation in which we don't want a style update to happen, so just take care of scheduling it automatically.
This commit is contained in:
parent
b9b7b2b28a
commit
6af55a234f
4 changed files with 10 additions and 4 deletions
|
@ -267,7 +267,6 @@ void Element::set_inner_html(StringView markup)
|
||||||
}
|
}
|
||||||
|
|
||||||
set_needs_style_update(true);
|
set_needs_style_update(true);
|
||||||
document().schedule_style_update();
|
|
||||||
document().invalidate_layout();
|
document().invalidate_layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,6 @@ void Node::set_text_content(const String& content)
|
||||||
}
|
}
|
||||||
|
|
||||||
set_needs_style_update(true);
|
set_needs_style_update(true);
|
||||||
document().schedule_style_update();
|
|
||||||
document().invalidate_layout();
|
document().invalidate_layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,4 +249,13 @@ EventTarget* Node::get_parent(const Event&)
|
||||||
return parent();
|
return parent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Node::set_needs_style_update(bool value)
|
||||||
|
{
|
||||||
|
if (m_needs_style_update == value)
|
||||||
|
return;
|
||||||
|
m_needs_style_update = value;
|
||||||
|
if (m_needs_style_update)
|
||||||
|
document().schedule_style_update();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,7 +138,7 @@ public:
|
||||||
virtual bool is_child_allowed(const Node&) const { return true; }
|
virtual bool is_child_allowed(const Node&) const { return true; }
|
||||||
|
|
||||||
bool needs_style_update() const { return m_needs_style_update; }
|
bool needs_style_update() const { return m_needs_style_update; }
|
||||||
void set_needs_style_update(bool value) { m_needs_style_update = value; }
|
void set_needs_style_update(bool);
|
||||||
|
|
||||||
void invalidate_style();
|
void invalidate_style();
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,6 @@ void HTMLElement::set_inner_text(StringView text)
|
||||||
append_child(document().create_text_node(text));
|
append_child(document().create_text_node(text));
|
||||||
|
|
||||||
set_needs_style_update(true);
|
set_needs_style_update(true);
|
||||||
document().schedule_style_update();
|
|
||||||
document().invalidate_layout();
|
document().invalidate_layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue