Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-contain/content-visibility/content-visibility-svg-gradient-unlock.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html class="reftest-wait">
<title>CSS Content Visibility: SVG gradient repaints when content-visibility: hidden subtree unlocks</title>
<link rel="match" href="/css/reference/ref-filled-green-100px-square-only.html">
<script src="/common/reftest-wait.js"></script>
<p>Test passes if there is a filled green square.</p>
<div style="position: absolute; top: 0; left: 0; z-index: -2">
<svg width="25" height="25" style="display: block">
<g id="fo_group">
<foreignObject width="25" height="25">
<div id="foreign_locked" style="color: red">
<div style="width: 25px; height: 25px; background: currentColor"></div>
</div>
</foreignObject>
</g>
</svg>
</div>
<div style="position: absolute; top: 0; left: 0; width: 25px; height: 25px; background: white; z-index: -1"></div>
<div id="locked" style="color: red; height: 0">
<svg width="0" height="0" style="display: block">
<linearGradient id="g1">
<stop id="gradientStop" stop-color="currentColor"/>
</linearGradient>
<pattern id="p1" width="1" height="1">
<rect width="50" height="50" fill="currentColor"/>
</pattern>
<filter id="f1" x="0" y="0" width="1" height="1">
<feFlood flood-color="currentColor"/>
</filter>
<linearGradient id="g2">
<stop stop-color="green"/>
</linearGradient>
<clipPath id="c1">
<rect id="clipRect" x="50" y="50" width="0" height="0"/>
</clipPath>
<mask id="m1">
<rect id="maskRect" x="50" y="50" width="50" height="50" fill="black"/>
</mask>
</svg>
</div>
<svg style="display: none">
<filter id="f_fo_hidden" x="0" y="0" width="1" height="1">
<feImage href="#fo_group"/>
</filter>
</svg>
<div style="position: relative; width: 100px; height: 100px">
<svg width="100" height="100" style="display: block">
<defs>
<filter id="f_fo_rendered" x="0" y="0" width="1" height="1">
<feImage href="#fo_group"/>
</filter>
</defs>
<rect x="0" y="0" width="50" height="50" fill="url(#g1)"/>
<rect x="50" y="0" width="50" height="50" fill="url(#p1)"/>
<rect x="0" y="50" width="50" height="25" fill="none" filter="url(#f1)"/>
<rect x="0" y="75" width="50" height="25" fill="red"/>
<rect x="0" y="75" width="25" height="25" fill="none" filter="url(#f_fo_rendered)"/>
<rect x="50" y="50" width="50" height="50" fill="url(#g2)" clip-path="url(#c1)" mask="url(#m1)"/>
</svg>
<div style="position: absolute; top: 75px; left: 25px; width: 25px; height: 25px; background: red; filter: url(#f_fo_hidden)"></div>
</div>
<script>
onload = () => requestAnimationFrame(() => requestAnimationFrame(() => {
locked.style.contentVisibility = 'hidden';
foreign_locked.style.contentVisibility = 'hidden';
locked.style.color = 'green';
foreign_locked.style.color = 'green';
gradientStop.setAttribute('stop-color', 'green');
clipRect.setAttribute('width', '50');
clipRect.setAttribute('height', '50');
maskRect.setAttribute('fill', 'white');
requestAnimationFrame(() => requestAnimationFrame(() => {
locked.style.contentVisibility = 'visible';
foreign_locked.style.contentVisibility = 'visible';
takeScreenshot();
}));
}));
</script>
</html>