LibWeb: Only consider longhand properties when computing invalidation

We only store computed values for longhand properties so checking
shorthand properties is unnecessary
This commit is contained in:
Callum Law 2025-08-24 14:57:26 +12:00 committed by Jelle Raaijmakers
commit c635a43c18
Notes: github-actions[bot] 2025-08-26 10:19:51 +00:00
2 changed files with 6 additions and 6 deletions

View file

@ -634,13 +634,13 @@ void AnimationEffect::visit_edges(JS::Cell::Visitor& visitor)
static CSS::RequiredInvalidationAfterStyleChange compute_required_invalidation_for_animated_properties(HashMap<CSS::PropertyID, NonnullRefPtr<CSS::StyleValue const>> const& old_properties, HashMap<CSS::PropertyID, NonnullRefPtr<CSS::StyleValue const>> const& new_properties)
{
CSS::RequiredInvalidationAfterStyleChange invalidation;
auto old_and_new_properties = MUST(Bitmap::create(to_underlying(CSS::last_property_id) + 1, 0));
auto old_and_new_properties = MUST(Bitmap::create(CSS::number_of_longhand_properties, 0));
for (auto const& [property_id, _] : old_properties)
old_and_new_properties.set(to_underlying(property_id), 1);
old_and_new_properties.set(to_underlying(property_id) - to_underlying(CSS::first_longhand_property_id), 1);
for (auto const& [property_id, _] : new_properties)
old_and_new_properties.set(to_underlying(property_id), 1);
for (auto i = to_underlying(CSS::first_property_id); i <= to_underlying(CSS::last_property_id); ++i) {
if (!old_and_new_properties.get(i))
old_and_new_properties.set(to_underlying(property_id) - to_underlying(CSS::first_longhand_property_id), 1);
for (auto i = to_underlying(CSS::first_longhand_property_id); i <= to_underlying(CSS::last_longhand_property_id); ++i) {
if (!old_and_new_properties.get(i - to_underlying(CSS::first_longhand_property_id)))
continue;
auto property_id = static_cast<CSS::PropertyID>(i);
auto const* old_value = old_properties.get(property_id).value_or({});

View file

@ -674,7 +674,7 @@ static CSS::RequiredInvalidationAfterStyleChange compute_required_invalidation(C
if (!old_style.computed_font_list().equals(new_style.computed_font_list()))
invalidation.relayout = true;
for (auto i = to_underlying(CSS::first_property_id); i <= to_underlying(CSS::last_property_id); ++i) {
for (auto i = to_underlying(CSS::first_longhand_property_id); i <= to_underlying(CSS::last_longhand_property_id); ++i) {
auto property_id = static_cast<CSS::PropertyID>(i);
auto old_value = old_style.maybe_null_property(property_id);
auto new_value = new_style.maybe_null_property(property_id);