LibWeb: Keep custom properties from all cascade layers

Before this change, we were cascading custom properties for each layer,
and then replacing any previously cascaded properties for the element
with only the set from this latest layer.

The patch fixes the issue by making each pass of the custom property
cascade add to the same set, and then finally assigning that set of
properties to the element.
This commit is contained in:
Andreas Kling 2024-09-07 11:07:04 +02:00 committed by Andreas Kling
commit 95bd0602ba
Notes: github-actions[bot] 2024-09-07 10:38:06 +00:00
3 changed files with 33 additions and 6 deletions

View file

@ -0,0 +1,23 @@
<style>
:root { --top: 1px; }
@layer foo { :root { --left: 2px; } }
@layer bar { :root { --bottom: 3px; } }
@layer baz { :root { --right: 4px; } }
#testDiv {
padding-top: var(--top, 0);
padding-left: var(--left, 0);
padding-bottom: var(--bottom, 0);
padding-right: var(--right, 0);
}
</style><div id="testDiv"></div>
<script src="../include.js"></script>
<script>
test(() => {
const s = getComputedStyle(testDiv);
println(s.paddingTop);
println(s.paddingLeft);
println(s.paddingBottom);
println(s.paddingRight);
testDiv.remove();
});
</script>