diff --git a/Tests/LibWeb/Text/expected/css/box-shadow-resolves-length-functions.txt b/Tests/LibWeb/Text/expected/css/box-shadow-resolves-length-functions.txt index 284f5c23fb..c6350fa96a 100644 --- a/Tests/LibWeb/Text/expected/css/box-shadow-resolves-length-functions.txt +++ b/Tests/LibWeb/Text/expected/css/box-shadow-resolves-length-functions.txt @@ -1 +1 @@ -0 calc(5px - 10px) 0 calc(2px + 3px) => #000000ff 0px calc(5px + (0 - 10px)) 0px calc(2px + 3px) +0 calc(5px - 10px) 0 calc(2px + 3px) => #000000ff 0px -5px 0px 5px diff --git a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp index ed8f47e272..3f99653111 100644 --- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp @@ -467,7 +467,10 @@ Optional ResolvedCSSStyleDeclaration::property(PropertyID propert if (!m_element->is_connected()) return {}; - if (property_affects_layout(property_id)) { + // 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 (!m_element->layout_node() || property_affects_layout(property_id)) { const_cast(m_element->document()).update_layout(); } else { // FIXME: If we had a way to update style for a single element, this would be a good place to use it.