mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-25 12:32:53 +00:00
LibWeb: Only invalidate style/layout on mutation for connected DOM nodes
If a DOM node isn't connected, there's no need to invalidate, since it's not going to be visible anyway. The node will be automatically inserted if/when it becomes connected in the future.
This commit is contained in:
parent
2fbcaadef0
commit
24157e4d1b
Notes:
sideshowbarker
2024-07-16 20:39:14 +09:00
Author: https://github.com/awesomekling
Commit: 24157e4d1b
Pull-request: https://github.com/SerenityOS/serenity/pull/23970
2 changed files with 21 additions and 13 deletions
|
@ -52,9 +52,10 @@ WebIDL::ExceptionOr<void> inner_html_setter(JS::NonnullGCPtr<DOM::Node> context_
|
|||
if (!is<HTML::HTMLTemplateElement>(*context_object)) {
|
||||
context_object->set_needs_style_update(true);
|
||||
|
||||
// NOTE: Since the DOM has changed, we have to rebuild the layout tree.
|
||||
context_object->document().invalidate_layout();
|
||||
context_object->document().set_needs_layout();
|
||||
if (context_object->is_connected()) {
|
||||
// NOTE: Since the DOM has changed, we have to rebuild the layout tree.
|
||||
context_object->document().invalidate_layout();
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue