Bug 1960687 - clear cached path on zoom r=dholbert

Differential Revision: https://phabricator.services.mozilla.com/D245684
This commit is contained in:
longsonr
2025-04-16 14:05:19 +00:00
parent a2b4f34f80
commit 9d6972ff74
3 changed files with 57 additions and 1 deletions

View File

@@ -121,7 +121,8 @@ void SVGGeometryFrame::DidSetComputedStyle(ComputedStyle* aOldComputedStyle) {
NotifySVGChanged(TRANSFORM_CHANGED);
}
if (element->IsGeometryChangedViaCSS(*Style(), *aOldComputedStyle)) {
if (element->IsGeometryChangedViaCSS(*Style(), *aOldComputedStyle) ||
aOldComputedStyle->EffectiveZoom() != Style()->EffectiveZoom()) {
element->ClearAnyCachedPath();
SVGObserverUtils::InvalidateRenderingObservers(this);
}

View File

@@ -0,0 +1,22 @@
<!doctype html>
<html>
<style type="text/css">
path {
stroke-width: 10px;
stroke: blue;
fill: lime;
}
svg {
width: 100px;
height: 100px;
border: 1px solid black;
background: red;
zoom: 400%;
}
</style>
<body>
<svg>
<path d="m 5 5 h90 v90 h-90 z"></path>
</svg>
</body>
</html>

View File

@@ -0,0 +1,33 @@
<!doctype html>
<html class="reftest-wait">
<title>Test of dynamic zoom on path.</title>
<link rel="help"
href="https://www.w3.org/TR/SVG2/paths.html#PathElement">
<link rel="match" href="path-zoom-ref.html">
<script src="/common/reftest-wait.js"></script>
<script src="/common/rendering-utils.js"></script>
<style type="text/css">
path {
stroke-width: 10px;
stroke: blue;
fill: lime;
}
svg {
width: 100px;
height: 100px;
border: 1px solid black;
background: red;
}
</style>
<script>
function Zoom() {
document.getElementById("changeMyZoom").style.zoom = "400%";
takeScreenshot();
}
</script>
<body onload="waitForAtLeastOneFrame().then(Zoom)">
<svg id="changeMyZoom">
<path d="m 5 5 h90 v90 h-90 z"></path>
</svg>
</body>
</html>