forked from mirrors/gecko-dev
Automatic update from web-platform-tests [css-variables] Count “--foo: initial” as a style declaration. When the current system of independent inheritance-like behavior for custom properties was written, the ComputedStyle was marked as having a variable declaration from fairly deep down in Resolve(). However, if using “initial” (or “inherit”, but that should be irrelevant for this discussion), Resolve() would never be called, and the ComputedStyle would erroneously be counted as not having a variable declaration. Thus, independent inheritance would not be properly stopped for such elements, leading to wrong results in some recalcs. Fix by setting the property in CustomProperty::Apply* instead, which seems like a more logical place to begin with. (We could also apply it in StyleBuilder::ApplyPhysicalProperty() if we wish to have it only one place, but it would require an extra test there that would be irrelevant for most properties.) Change-Id: Ibd4ecba702ee82232f5093c91904cf4527056694 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5095744 Reviewed-by: Rune Lillesveen <futhark@chromium.org> Commit-Queue: Steinar H Gunderson <sesse@chromium.org> Cr-Commit-Position: refs/heads/main@{#1234453} -- wpt-commits: ec42cbde465a2cae1c641c464bf52dcf6544f805 wpt-pr: 43552
34 lines
897 B
HTML
34 lines
897 B
HTML
<!DOCTYPE html>
|
|
<head>
|
|
<title>Style recalculation picks up “initial” variable declaration</title>
|
|
<link rel="author" title="Steinar H. Gunderson" href="mailto:sesse@chromium.org">
|
|
<link rel="help" href="https://crbug.com/1508841">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<style>
|
|
.a {
|
|
--color: red;
|
|
}
|
|
.b {
|
|
--color: initial;
|
|
}
|
|
.c {
|
|
color: var(--color, green);
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="a">
|
|
<div class="b">
|
|
<div class="c" id="target">Test passes if this text is green.</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
test(() => {
|
|
let target = document.getElementById('target');
|
|
target.offsetTop;
|
|
document.body.style.pointerEvents = 'none';
|
|
assert_equals(getComputedStyle(target).color, 'rgb(0, 128, 0)');
|
|
});
|
|
</script>
|
|
</body>
|