Skip to content

Commit 78bcff6

Browse files
committed
Bug 1969782 - Account for the aToMarkedFrameUserSpace transform when setting up contextPaint for an SVG marker. r=longsonr
This makes the context-fill gradient used in the marker match how it's painted in the context, regardless of the zoom or other transforms present. (This also matches the rendering I see in Chrome.) Includes a test that fails without the patch. Differential Revision: https://phabricator.services.mozilla.com/D252021
1 parent 1f4e8c1 commit 78bcff6

File tree

5 files changed

+91
-1
lines changed

5 files changed

+91
-1
lines changed

layout/svg/SVGMarkerFrame.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ void SVGMarkerFrame::PaintMark(gfxContext& aContext,
135135
// The CTM of each frame referencing us may be different.
136136
SVGFrame->NotifySVGChanged(ISVGDisplayableFrame::TRANSFORM_CHANGED);
137137
auto contextPaint = MakeRefPtr<SVGContextPaintImpl>();
138-
contextPaint->Init(aContext.GetDrawTarget(), aContext.CurrentMatrixDouble(),
138+
contextPaint->Init(aContext.GetDrawTarget(),
139+
aToMarkedFrameUserSpace * aContext.CurrentMatrixDouble(),
139140
aMarkedFrame, SVGContextPaint::GetContextPaint(marker),
140141
aImgParams);
141142
AutoSetRestoreSVGContextPaint autoSetRestore(contextPaint,
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
3+
<style>
4+
iframe {
5+
display: block;
6+
border: none;
7+
}
8+
</style>
9+
10+
<p>None of the marker rects should be visible as disruptions in the gradient, regardless of transforms:</p>
11+
<iframe width=300 height=150 src='support/svg-marker-ref.svg'></iframe>
12+
<iframe width=300 height=150 src='support/svg-marker-ref.svg'></iframe>
13+
<iframe width=300 height=150 src='support/svg-marker-ref.svg'></iframe>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE html>
2+
3+
<title>SVG rendering test: context-fill in markers with transform</title>
4+
5+
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1969782">
6+
<link rel="match" href="marker-context-fill-transform-ref.html">
7+
8+
<style>
9+
iframe {
10+
display: block;
11+
border: none;
12+
}
13+
#a {
14+
zoom: 1;
15+
}
16+
#b {
17+
zoom: 2;
18+
}
19+
#c {
20+
zoom: 0.25;
21+
}
22+
</style>
23+
24+
<p>None of the marker rects should be visible as disruptions in the gradient, regardless of transforms:</p>
25+
<iframe id=a width=300 height=150 src='support/svg-marker-context-paint.svg'></iframe>
26+
<iframe id=b width=150 height=75 src='support/svg-marker-context-paint.svg'></iframe>
27+
<iframe id=c width=1200 height=600 src='support/svg-marker-context-paint.svg'></iframe>
Lines changed: 29 additions & 0 deletions
Loading
Lines changed: 20 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)