LibWeb: Only remember source CSSStyleDeclaration for animation-name

We were saving to source declarations for *every* property, even though
we only ever looked it up for animation-name.

This patch gets rid of the per-property source pointer and we now keep
a single pointer to the animation-name source only.

This shrinks StyleProperties from 6512 bytes to 4368 bytes per instance.
This commit is contained in:
Andreas Kling 2024-08-02 11:58:56 +02:00 committed by Andreas Kling
commit c288bfb404
Notes: github-actions[bot] 2024-08-02 18:38:45 +00:00
7 changed files with 50 additions and 45 deletions

View file

@ -47,9 +47,9 @@ bool StyleProperties::is_property_inherited(CSS::PropertyID property_id) const
return m_property_values[to_underlying(property_id)].style && m_property_values[to_underlying(property_id)].inherited == Inherited::Yes;
}
void StyleProperties::set_property(CSS::PropertyID id, NonnullRefPtr<StyleValue const> value, CSS::CSSStyleDeclaration const* source_declaration, Inherited inherited, Important important)
void StyleProperties::set_property(CSS::PropertyID id, NonnullRefPtr<StyleValue const> value, Inherited inherited, Important important)
{
m_property_values[to_underlying(id)] = StyleAndSourceDeclaration { move(value), source_declaration, important, inherited };
m_property_values[to_underlying(id)] = StyleValueAndMetadata { move(value), important, inherited };
}
void StyleProperties::set_animated_property(CSS::PropertyID id, NonnullRefPtr<StyleValue const> value)
@ -78,11 +78,6 @@ RefPtr<StyleValue const> StyleProperties::maybe_null_property(CSS::PropertyID pr
return m_property_values[to_underlying(property_id)].style;
}
CSS::CSSStyleDeclaration const* StyleProperties::property_source_declaration(CSS::PropertyID property_id) const
{
return m_property_values[to_underlying(property_id)].declaration;
}
CSS::Size StyleProperties::size_value(CSS::PropertyID id) const
{
auto value = property(id);