Truly independent web browser
LibWeb: Replace Typed OM declarations in one style mutation
Andreas Kling85d1f0d3ce15
diff --git a/Libraries/LibWeb/CSS/CSSStyleProperties.cpp b/Libraries/LibWeb/CSS/CSSStyleProperties.cppindex db9739b30cc..5f3f107213e 100644--- a/Libraries/LibWeb/CSS/CSSStyleProperties.cpp+++ b/Libraries/LibWeb/CSS/CSSStyleProperties.cpp@@ -467,14 +467,9 @@ WebIDL::ExceptionOr<void> CSSStyleProperties::set_property_style_value(PropertyN}if (property.is_custom_property()) {- if (auto existing_property = custom_property(property.name()); existing_property.has_value()- && existing_property->important == Important::No- && *existing_property->value == *style_value) {- return {};- }-prepare_to_update_style_attribute();+ m_declarations.remove_custom(property.name());m_declarations.set_custom(property.name(),StyleProperty {Important::No,diff --git a/Libraries/LibWeb/CSS/StylePropertyMap.cpp b/Libraries/LibWeb/CSS/StylePropertyMap.cppindex 0344a5ca2c1..07700d6ce84 100644--- a/Libraries/LibWeb/CSS/StylePropertyMap.cpp+++ b/Libraries/LibWeb/CSS/StylePropertyMap.cpp@@ -203,11 +203,8 @@ WebIDL::ExceptionOr<void> StylePropertyMap::set(Utf16FlyString property_name, Re}// 7. If props[property] exists, remove it.- // FIXME: Avoid converting to string and back.- // FIXME: We handle this after creating the internal representations (step 9) so that we maintain the original- // value in the case that fails - see https://github.com/w3c/css-houdini-drafts/issues/1175- auto removed_value = TRY(props.remove_property(property->name()));- (void)removed_value;+ // NB: Removal and replacement happen together in set_property_style_value(), after validation, so observers+ // receive a single style-attribute update.// AD-HOC: To match the behavior of our parser we should store values of list-valued longhands as lists even if// there is only one value, except in some rare circumstances.diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/inline/attribute-changed-callback.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/inline/attribute-changed-callback.txtindex d42ceb89524..77fa8f3e17a 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/inline/attribute-changed-callback.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-typed-om/the-stylepropertymap/inline/attribute-changed-callback.txt@@ -2,10 +2,10 @@ Harness status: OKFound 11 tests-8 Pass-3 Fail+10 Pass+1 FailPass attributeStyleMap.set() triggers attributeChangedCallback-Fail attributeStyleMap.set() triggers attributeChangedCallback with correct old/new values+Pass attributeStyleMap.set() triggers attributeChangedCallback with correct old/new valuesPass attributeStyleMap.delete() triggers attributeChangedCallbackPass attributeStyleMap.clear() triggers attributeChangedCallbackPass attributeStyleMap.append() triggers attributeChangedCallback@@ -13,5 +13,5 @@ Fail attributeStyleMap.append() with no values does not trigger attributeChangedPass attributeStyleMap.set() with custom property triggers attributeChangedCallbackPass attributeStyleMap.delete() with custom property triggers attributeChangedCallbackPass attributeStyleMap.set() with shorthand property triggers attributeChangedCallback-Fail attributeStyleMap and style interleave correctly with attributeChangedCallback+Pass attributeStyleMap and style interleave correctly with attributeChangedCallbackPass attributeStyleMap.set() triggers MutationObserver without duplicates\ No newline at end of file