mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-25 11:48:06 +00:00
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:
parent
237bcbff36
commit
95bd0602ba
Notes:
github-actions[bot]
2024-09-07 10:38:06 +00:00
Author: https://github.com/awesomekling
Commit: 95bd0602ba
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1310
3 changed files with 33 additions and 6 deletions
|
@ -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>
|
Loading…
Add table
Add a link
Reference in a new issue