Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 42bbfc3

Browse files
committed
Bug 1883285 - ensure non-scaling-stroke animates when scaling starts from 0 r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D212352
1 parent 7c1f634 commit 42bbfc3

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

layout/svg/SVGUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ bool SVGUtils::GetNonScalingStrokeTransform(const nsIFrame* aFrame,
10841084
*aUserToOuterSVG = ThebesMatrix(
10851085
SVGContentUtils::GetCTM(static_cast<SVGElement*>(aFrame->GetContent())));
10861086

1087-
return aUserToOuterSVG->HasNonTranslation();
1087+
return aUserToOuterSVG->HasNonTranslation() && !aUserToOuterSVG->IsSingular();
10881088
}
10891089

10901090
// The logic here comes from _cairo_stroke_style_max_distance_from_path
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!DOCTYPE html>
2+
<html class="reftest-wait">
3+
<title>non-scaling-stroke with scaling</title>
4+
<link rel="help" href="https://svgwg.org/svg2-draft/painting.html#PaintingVectorEffects" />
5+
<link rel="match" href="green-100x100.svg" />
6+
<script src="/common/reftest-wait.js"></script>
7+
<body>
8+
<style>
9+
body {
10+
border: none;
11+
margin: 0;
12+
width: 200px;
13+
height: 200px;
14+
transform: scale(2);
15+
}
16+
svg {
17+
width: 100px;
18+
height: 100px;
19+
}
20+
rect {
21+
fill: red;
22+
stroke: green;
23+
stroke-width: 50px;
24+
transform: scale(0);
25+
animation: reset 0.01s ease-in-out 1 both;
26+
vector-effect: non-scaling-stroke;
27+
}
28+
@keyframes reset { to { transform: none; }}
29+
</style>
30+
<svg>
31+
<rect width="75" height="75"/>
32+
<script>
33+
onload = () => {
34+
requestAnimationFrame(() => { requestAnimationFrame(() => {
35+
requestAnimationFrame(() => { takeScreenshot() });
36+
})});
37+
};
38+
</script>
39+
</svg>
40+
</body>
41+
</html>

0 commit comments

Comments
 (0)