diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp index 3448fcf2ab5..51460257c8d 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp @@ -62,19 +62,17 @@ void StyleProperties::set_property(CSS::PropertyID id, NonnullRefPtr value) { - m_animated_property_values[to_underlying(id)] = move(value); + m_animated_property_values.set(id, move(value)); } void StyleProperties::reset_animated_properties() { - for (auto& animated_property : m_animated_property_values) - animated_property.clear(); + m_animated_property_values.clear(); } NonnullRefPtr StyleProperties::property(CSS::PropertyID property_id) const { - auto animated_value = m_animated_property_values[to_underlying(property_id)]; - if (animated_value.has_value()) + if (auto animated_value = m_animated_property_values.get(property_id).value_or(nullptr)) return *animated_value; auto value = m_property_values[to_underlying(property_id)]; @@ -85,8 +83,7 @@ NonnullRefPtr StyleProperties::property(CSS::PropertyID proper RefPtr StyleProperties::maybe_null_property(CSS::PropertyID property_id) const { - auto animated_value = m_animated_property_values[to_underlying(property_id)]; - if (animated_value.has_value()) + if (auto animated_value = m_animated_property_values.get(property_id).value_or(nullptr)) return *animated_value; auto value = m_property_values[to_underlying(property_id)]; diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.h b/Userland/Libraries/LibWeb/CSS/StyleProperties.h index 8f04378d355..8bf8707e111 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleProperties.h +++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.h @@ -186,7 +186,7 @@ private: friend class StyleComputer; PropertyValues m_property_values; - Array>, to_underlying(CSS::last_property_id) + 1> m_animated_property_values; + HashMap> m_animated_property_values; Optional overflow(CSS::PropertyID) const; Vector shadow(CSS::PropertyID, Layout::Node const&) const;