forked from mirrors/gecko-dev
This is a bit less complicated than lengths because there's no cycle possible which could turn the color-scheme declaration invalid afaict. So it's just that we need to defer the colors when color-scheme is specified, which is slightly annoying, but maybe not too bad. I had to tweak a bit the code to defer properties to fix a bug that we were papering over accidentally. We were using the wrong registration here: https://searchfox.org/mozilla-central/rev/f60bb10a5fe6936f9e9f9e8a90d52c18a0ffd818/servo/components/style/custom_properties.rs#1613 That's the registration for reference.name, not for name, which papered over some issues. The fix is simple tho, which is storing a single CustomPropertiesMap. Differential Revision: https://phabricator.services.mozilla.com/D211860
28 lines
1.1 KiB
HTML
28 lines
1.1 KiB
HTML
<!DOCTYPE HTML>
|
|
<link rel="help" href="https://drafts.css-houdini.org/css-properties-values-api/#dom-css-registerproperty" />
|
|
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1899272">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<div id=element></div>
|
|
<script>
|
|
test(function() {
|
|
CSS.registerProperty({
|
|
name: '--length-calc',
|
|
syntax: '<length>',
|
|
initialValue: '0px',
|
|
inherits: true
|
|
});
|
|
CSS.registerProperty({
|
|
name: '--length-calc-reset',
|
|
syntax: '<length>',
|
|
initialValue: '0px',
|
|
inherits: false
|
|
});
|
|
let element = document.getElementById("element");
|
|
element.style = 'font-size: 11px; --length-calc: calc(10em + 10px); --unregistered:var(--length-calc-reset); --length-calc-reset: var(--length-calc)';
|
|
let cs = getComputedStyle(element);
|
|
for (let prop of ["--length-calc", "--length-calc-reset", "--unregistered"]) {
|
|
assert_equals(cs.getPropertyValue(prop), "120px", "Should resolve properly: " + prop);
|
|
}
|
|
}, "Property dependency tracking across inherited and non-inherited properties");
|
|
</script>
|