diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp index fca351a1060..a45ee1bd61b 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp @@ -112,10 +112,12 @@ void StyleProperties::reset_animated_properties() m_data->m_animated_property_values.clear(); } -NonnullRefPtr StyleProperties::property(CSS::PropertyID property_id) const +NonnullRefPtr StyleProperties::property(CSS::PropertyID property_id, WithAnimationsApplied return_animated_value) const { - if (auto animated_value = m_data->m_animated_property_values.get(property_id).value_or(nullptr)) - return *animated_value; + if (return_animated_value == WithAnimationsApplied::Yes) { + if (auto animated_value = m_data->m_animated_property_values.get(property_id).value_or(nullptr)) + return *animated_value; + } // By the time we call this method, all properties have values assigned. return *m_data->m_property_values[to_underlying(property_id)]; diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.h b/Userland/Libraries/LibWeb/CSS/StyleProperties.h index 56efb7200bf..1f41efb1f3e 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleProperties.h +++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.h @@ -74,7 +74,11 @@ public: void set_property(CSS::PropertyID, NonnullRefPtr value, Inherited = Inherited::No, Important = Important::No); void set_animated_property(CSS::PropertyID, NonnullRefPtr value); - NonnullRefPtr property(CSS::PropertyID) const; + enum class WithAnimationsApplied { + No, + Yes, + }; + NonnullRefPtr property(CSS::PropertyID, WithAnimationsApplied = WithAnimationsApplied::Yes) const; RefPtr maybe_null_property(CSS::PropertyID) const; void revert_property(CSS::PropertyID, StyleProperties const& style_for_revert);