mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-04-19 02:10:26 +00:00
LibWeb: Skip layout update for disconnected elements querying metrics
Introduce Document::update_layout_if_needed_for_node() which only calls update_layout() when the node is connected. Use it at all call sites that query layout metrics (offsets, client dimensions, image size, SVG bounding box, etc.) so disconnected elements no longer trigger an unnecessary layout.
This commit is contained in:
parent
63113cf5c9
commit
8f7bb7dd2e
Notes:
github-actions[bot]
2026-03-05 13:18:27 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 8f7bb7dd2e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8278
7 changed files with 24 additions and 17 deletions
|
|
@ -2352,7 +2352,7 @@ WebIDL::ExceptionOr<void> HTMLInputElement::set_size(WebIDL::UnsignedLong value)
|
|||
// https://html.spec.whatwg.org/multipage/input.html#dom-input-height
|
||||
WebIDL::UnsignedLong HTMLInputElement::height() const
|
||||
{
|
||||
const_cast<DOM::Document&>(document()).update_layout(DOM::UpdateLayoutReason::HTMLInputElementHeight);
|
||||
const_cast<DOM::Document&>(document()).update_layout_if_needed_for_node(*this, DOM::UpdateLayoutReason::HTMLInputElementHeight);
|
||||
|
||||
// When the input element's type attribute is not in the Image Button state, then no image is available.
|
||||
if (type_state() != TypeAttributeState::ImageButton)
|
||||
|
|
@ -2387,7 +2387,7 @@ void HTMLInputElement::set_height(WebIDL::UnsignedLong value)
|
|||
// https://html.spec.whatwg.org/multipage/input.html#dom-input-width
|
||||
WebIDL::UnsignedLong HTMLInputElement::width() const
|
||||
{
|
||||
const_cast<DOM::Document&>(document()).update_layout(DOM::UpdateLayoutReason::HTMLInputElementWidth);
|
||||
const_cast<DOM::Document&>(document()).update_layout_if_needed_for_node(*this, DOM::UpdateLayoutReason::HTMLInputElementWidth);
|
||||
|
||||
// When the input element's type attribute is not in the Image Button state, then no image is available.
|
||||
if (type_state() != TypeAttributeState::ImageButton)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue