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
parent faebbbc281
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

@ -46,15 +46,15 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co
// https://html.spec.whatwg.org/multipage/rendering.html#the-page:rules-for-parsing-a-legacy-colour-value
auto color = parse_legacy_color_value(value);
if (color.has_value())
style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()), nullptr);
style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()));
} else if (name.equals_ignoring_ascii_case("text"sv)) {
// https://html.spec.whatwg.org/multipage/rendering.html#the-page:rules-for-parsing-a-legacy-colour-value-2
auto color = parse_legacy_color_value(value);
if (color.has_value())
style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value()), nullptr);
style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value()));
} else if (name.equals_ignoring_ascii_case("background"sv)) {
VERIFY(m_background_style_value);
style.set_property(CSS::PropertyID::BackgroundImage, *m_background_style_value, nullptr);
style.set_property(CSS::PropertyID::BackgroundImage, *m_background_style_value);
}
});
}