Skip to content

Commit d7d4f90

Browse files
Calme1709AtkinsSJ
authored andcommitted
LibWeb: Update style attribute when calling attributeStyleMap.set()
We also now invalidate the element
1 parent 4e79d86 commit d7d4f90

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

Libraries/LibWeb/CSS/CSSStyleProperties.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,10 @@ WebIDL::ExceptionOr<void> CSSStyleProperties::set_property_style_value(PropertyN
415415
Important::No,
416416
PropertyID::Custom,
417417
style_value });
418+
419+
update_style_attribute();
420+
invalidate_owners(DOM::StyleInvalidationReason::CSSStylePropertiesSetPropertyStyleValue);
421+
418422
return {};
419423
}
420424

@@ -439,6 +443,9 @@ WebIDL::ExceptionOr<void> CSSStyleProperties::set_property_style_value(PropertyN
439443
});
440444
});
441445

446+
update_style_attribute();
447+
invalidate_owners(DOM::StyleInvalidationReason::CSSStylePropertiesSetPropertyStyleValue);
448+
442449
return {};
443450
}
444451

Libraries/LibWeb/DOM/Node.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ enum class ShouldComputeRole {
5656
X(CSSImportRule) \
5757
X(CSSStylePropertiesRemoveProperty) \
5858
X(CSSStylePropertiesSetProperty) \
59+
X(CSSStylePropertiesSetPropertyStyleValue) \
5960
X(CSSStylePropertiesTextChange) \
6061
X(CustomElementStateChange) \
6162
X(CustomStateSetChange) \
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
width: 10px;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<div id="foo"></div>
4+
<script src="../include.js"></script>
5+
<script>
6+
test(() => {
7+
foo.attributeStyleMap.set("width", CSS.px(10));
8+
9+
println(foo.getAttribute("style"));
10+
});
11+
</script>
12+
</html>

0 commit comments

Comments
 (0)