Automatic update from web-platform-tests layout: Clear laid out fragments of descendants when `content` is replaced A dynamic change of the `content` property can turn a non-replaced element into replaced. In that case, it's possible that the contents were laid out previously, and now they will be skipped. The problem was that we were still caching the results from the previous layout in some cases. Thus, script queries like `getComputedStyle` could return the wrong value, or Servo could crash. Co-authored-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Oriol Brufau <obrufau@igalia.com> -- wpt-commits: aa133226f042b41a269689ff9072ec91098916cd wpt-pr: 61099
32 lines
1.1 KiB
HTML
32 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<html class="reftest-wait">
|
|
<meta charset="utf-8">
|
|
<title>The content CSS attribute can replace an element's contents dynamically</title>
|
|
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">
|
|
<link rel="help" href="https://drafts.csswg.org/css-content-3/#content-property">
|
|
<meta name="assert" content="
|
|
Descendants of an element that is replaced because of the content property
|
|
shouldn't be laid out. Therefore, the resolved height in getComputedStyle
|
|
should be the computed value (`auto`), not the used amount of pixels from
|
|
the previous layout.
|
|
">
|
|
|
|
<div id="wrapper">
|
|
<div style="display: flow-root">
|
|
<div id="target">Text</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="/css/support/interpolation-testcommon.js"></script>
|
|
<script>
|
|
test(function() {
|
|
// Force layout
|
|
document.body.offsetWidth;
|
|
|
|
wrapper.style.content = "linear-gradient(blue)";
|
|
assert_equals(getComputedStyle(target).height, "auto");
|
|
}, "getComputedStyle().height after ancestor becomes replaced");
|
|
</script>
|