LibWeb: Don't include changed attribute twice in changed_properties

Changed attribute name is always added into this list right before
`invalidate_style()` is called.
This commit is contained in:
Aliaksandr Kalenik 2025-01-21 16:46:44 +01:00 committed by Andreas Kling
parent 3c41bdbf92
commit c50e89bb73
Notes: github-actions[bot] 2025-01-21 20:08:44 +00:00

View file

@ -1978,7 +1978,6 @@ void Element::invalidate_style_after_attribute_change(FlyString const& attribute
if (attribute_name == HTML::AttributeNames::style) {
force_self_invalidation = ForceSelfStyleInvalidation::Yes;
changed_properties.append({ .type = CSS::InvalidationSet::Property::Type::Attribute, .value = HTML::AttributeNames::style });
} else if (attribute_name == HTML::AttributeNames::class_) {
Vector<StringView> old_classes;
Vector<StringView> new_classes;
@ -1996,13 +1995,11 @@ void Element::invalidate_style_after_attribute_change(FlyString const& attribute
changed_properties.append({ .type = CSS::InvalidationSet::Property::Type::Class, .value = FlyString::from_utf8_without_validation(new_class.bytes()) });
}
}
changed_properties.append({ .type = CSS::InvalidationSet::Property::Type::Attribute, .value = HTML::AttributeNames::class_ });
} else if (attribute_name == HTML::AttributeNames::id) {
if (old_value.has_value())
changed_properties.append({ .type = CSS::InvalidationSet::Property::Type::Id, .value = FlyString(old_value.value()) });
if (new_value.has_value())
changed_properties.append({ .type = CSS::InvalidationSet::Property::Type::Id, .value = FlyString(new_value.value()) });
changed_properties.append({ .type = CSS::InvalidationSet::Property::Type::Attribute, .value = HTML::AttributeNames::id });
} else if (attribute_name == HTML::AttributeNames::disabled) {
changed_properties.append({ .type = CSS::InvalidationSet::Property::Type::PseudoClass, .value = CSS::PseudoClass::Disabled });
changed_properties.append({ .type = CSS::InvalidationSet::Property::Type::PseudoClass, .value = CSS::PseudoClass::Enabled });