LibWeb: Update style attribute when calling attributeStyleMap.set()

We also now invalidate the element
This commit is contained in:
Callum Law 2025-12-02 23:18:26 +13:00 committed by Sam Atkins
parent 4e79d86d03
commit d7d4f90a2c
Notes: github-actions[bot] 2025-12-02 11:38:26 +00:00
4 changed files with 21 additions and 0 deletions

View file

@ -415,6 +415,10 @@ WebIDL::ExceptionOr<void> CSSStyleProperties::set_property_style_value(PropertyN
Important::No,
PropertyID::Custom,
style_value });
update_style_attribute();
invalidate_owners(DOM::StyleInvalidationReason::CSSStylePropertiesSetPropertyStyleValue);
return {};
}
@ -439,6 +443,9 @@ WebIDL::ExceptionOr<void> CSSStyleProperties::set_property_style_value(PropertyN
});
});
update_style_attribute();
invalidate_owners(DOM::StyleInvalidationReason::CSSStylePropertiesSetPropertyStyleValue);
return {};
}

View file

@ -56,6 +56,7 @@ enum class ShouldComputeRole {
X(CSSImportRule) \
X(CSSStylePropertiesRemoveProperty) \
X(CSSStylePropertiesSetProperty) \
X(CSSStylePropertiesSetPropertyStyleValue) \
X(CSSStylePropertiesTextChange) \
X(CustomElementStateChange) \
X(CustomStateSetChange) \

View file

@ -0,0 +1 @@
width: 10px;

View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<div id="foo"></div>
<script src="../include.js"></script>
<script>
test(() => {
foo.attributeStyleMap.set("width", CSS.px(10));
println(foo.getAttribute("style"));
});
</script>
</html>