diff --git a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp index d9816c7e54..fb25b93968 100644 --- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp @@ -520,9 +520,15 @@ Optional ResolvedCSSStyleDeclaration::property(PropertyID propert if (!m_element->layout_node()) { auto style = m_element->document().style_computer().compute_style(const_cast(*m_element)); + // FIXME: This is a stopgap until we implement shorthand -> longhand conversion. + auto value = style->maybe_null_property(property_id); + if (!value) { + dbgln("FIXME: ResolvedCSSStyleDeclaration::property(property_id=0x{:x}) No value for property ID in newly computed style case.", to_underlying(property_id)); + return {}; + } return StyleProperty { .property_id = property_id, - .value = style->property(property_id), + .value = value.release_nonnull(), }; } diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp index 84028bdd9a..96ebd559e7 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp @@ -44,6 +44,11 @@ NonnullRefPtr StyleProperties::property(CSS::PropertyID property_id) return value.release_nonnull(); } +RefPtr StyleProperties::maybe_null_property(CSS::PropertyID property_id) const +{ + return m_property_values[to_underlying(property_id)]; +} + CSS::Size StyleProperties::size_value(CSS::PropertyID id) const { auto value = property(id); diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.h b/Userland/Libraries/LibWeb/CSS/StyleProperties.h index 63c44f4fb7..33be113427 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleProperties.h +++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.h @@ -40,6 +40,7 @@ public: void set_property(CSS::PropertyID, NonnullRefPtr value); NonnullRefPtr property(CSS::PropertyID) const; + RefPtr maybe_null_property(CSS::PropertyID) const; CSS::Size size_value(CSS::PropertyID) const; Length length_or_fallback(CSS::PropertyID, Length const& fallback) const;