mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-16 21:20:18 +00:00
LibWeb: Require layout update for less properties in getComputedStyle()
Some properties like `justify-items`, `grid`, or `display` do affect layout, but their used values can be obtained without performing a layout calculation. This change introduces a new helper, `property_needs_layout_for_getcomputedstyle()`, specifically for use by `CSSStyleProperties::property()`. It returns true only for properties such as `width`, `height`, `margin`, `padding`, `top`, and `left`, where an up-to-date layout is required to return the correct used value.
This commit is contained in:
parent
815e77c04d
commit
db5fd614ac
Notes:
github-actions[bot]
2025-09-12 09:07:24 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: db5fd614ac
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6158
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/Zaggy1024
4 changed files with 135 additions and 54 deletions
|
@ -169,7 +169,7 @@ Optional<StyleProperty> CSSStyleProperties::property(PropertyID property_id) con
|
|||
// FIXME: Be smarter about updating layout if there's no layout node.
|
||||
// We may legitimately have no layout node if we're not visible, but this protects against situations
|
||||
// where we're requesting the computed style before layout has happened.
|
||||
if (!layout_node || property_affects_layout(property_id)) {
|
||||
if (!layout_node || property_needs_layout_for_getcomputedstyle(property_id)) {
|
||||
abstract_element.document().update_layout(DOM::UpdateLayoutReason::ResolvedCSSStyleDeclarationProperty);
|
||||
layout_node = abstract_element.layout_node();
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue