Diff
Modified: branches/safari-534.54-branch/LayoutTests/ChangeLog (106834 => 106835)
--- branches/safari-534.54-branch/LayoutTests/ChangeLog 2012-02-06 20:48:10 UTC (rev 106834)
+++ branches/safari-534.54-branch/LayoutTests/ChangeLog 2012-02-06 20:54:02 UTC (rev 106835)
@@ -1,3 +1,23 @@
+2011-02-06 Lucas Forschler <[email protected]>
+
+ Merge 104356
+
+ 2012-01-06 Tim Horton <[email protected]>
+
+ [cg] userSpaceOnUse SVG Patterns have the wrong origin
+ https://bugs.webkit.org/show_bug.cgi?id=75741
+ <rdar://problem/9383222>
+
+ Reviewed by Simon Fraser.
+
+ Add a test that ensures that userSpaceOnUse patterns are rendered in the
+ correct orientation and location in both the accelerated compositing and
+ regular cases, as well as with SVG translation.
+
+ * platform/mac/svg/custom/pattern-userSpaceOnUse-userToBaseTransform-expected.png: Added.
+ * platform/mac/svg/custom/pattern-userSpaceOnUse-userToBaseTransform-expected.txt: Added.
+ * svg/custom/pattern-userSpaceOnUse-userToBaseTransform.xhtml: Added.
+
2011-01-27 Lucas Forschler <[email protected]>
Merge 106067
Copied: branches/safari-534.54-branch/LayoutTests/platform/mac/svg/custom/pattern-userSpaceOnUse-userToBaseTransform-expected.png (from rev 104356, trunk/LayoutTests/platform/mac/svg/custom/pattern-userSpaceOnUse-userToBaseTransform-expected.png)
(Binary files differ)
Copied: branches/safari-534.54-branch/LayoutTests/platform/mac/svg/custom/pattern-userSpaceOnUse-userToBaseTransform-expected.txt (from rev 104356, trunk/LayoutTests/platform/mac/svg/custom/pattern-userSpaceOnUse-userToBaseTransform-expected.txt) (0 => 106835)
--- branches/safari-534.54-branch/LayoutTests/platform/mac/svg/custom/pattern-userSpaceOnUse-userToBaseTransform-expected.txt (rev 0)
+++ branches/safari-534.54-branch/LayoutTests/platform/mac/svg/custom/pattern-userSpaceOnUse-userToBaseTransform-expected.txt 2012-02-06 20:54:02 UTC (rev 106835)
@@ -0,0 +1,42 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x358
+ RenderBlock {html} at (0,0) size 800x358
+ RenderBody {body} at (8,8) size 784x342
+ RenderText {#text} at (0,0) size 762x18
+ text run at (0,0) width 762: "There should be no red displayed on the screen, and the patterns should not change when the browser window is resized."
+ RenderBR {br} at (762,0) size 0x18
+ RenderBR {br} at (0,18) size 0x18
+ RenderSVGRoot {svg} at (8,44) size 202x203
+ RenderSVGContainer {g} at (9,45) size 200x200
+ RenderSVGRect {rect} at (9,145) size 100x50 [fill={[type=SOLID] [color=#FF0000]}] [x=0.00] [y=100.00] [width=100.00] [height=50.00]
+ RenderSVGRect {rect} at (109,45) size 100x50 [fill={[type=SOLID] [color=#FF0000]}] [x=100.00] [y=0.00] [width=100.00] [height=50.00]
+ RenderSVGRect {rect} at (9,145) size 100x100 [fill={[type=PATTERN] [id="pattern"]}] [x=0.00] [y=100.00] [width=100.00] [height=100.00]
+ RenderSVGRect {rect} at (109,45) size 100x100 [fill={[type=PATTERN] [id="pattern"]}] [x=100.00] [y=0.00] [width=100.00] [height=100.00]
+ RenderText {#text} at (202,324) size 4x18
+ text run at (202,324) width 4: " "
+ RenderSVGRoot {svg} at (214,44) size 202x287
+ RenderSVGText {text} at (5,266) size 81x18 contains 1 chunk(s)
+ RenderSVGInlineText {#text} at (0,0) size 81x18
+ chunk 1 text run 1 at (5.00,280.00) startOffset 0 endOffset 11 width 81.00: "+Transforms"
+ RenderSVGContainer {g} at (215,145) size 100x100 [transform={m=((1.00,0.00)(0.00,1.00)) t=(0.00,100.00)}]
+ RenderSVGRect {rect} at (215,145) size 100x50 [fill={[type=SOLID] [color=#FF0000]}] [x=0.00] [y=0.00] [width=100.00] [height=50.00]
+ RenderSVGRect {rect} at (215,145) size 100x100 [fill={[type=PATTERN] [id="pattern"]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]
+ RenderSVGContainer {g} at (315,45) size 100x100 [transform={m=((1.00,0.00)(0.00,1.00)) t=(100.00,0.00)}]
+ RenderSVGRect {rect} at (315,45) size 100x50 [fill={[type=SOLID] [color=#FF0000]}] [x=0.00] [y=0.00] [width=100.00] [height=50.00]
+ RenderSVGRect {rect} at (315,45) size 100x100 [fill={[type=PATTERN] [id="pattern"]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]
+ RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+ RenderSVGResourcePattern {pattern} [id="pattern"] [patternUnits=userSpaceOnUse] [patternContentUnits=userSpaceOnUse]
+ RenderSVGRect {rect} at (215,45) size 100x25 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=0.00] [width=100.00] [height=25.00]
+ RenderSVGRect {rect} at (215,70) size 100x25 [fill={[type=SOLID] [color=#0000FF]}] [x=0.00] [y=25.00] [width=100.00] [height=25.00]
+ RenderText {#text} at (408,324) size 4x18
+ text run at (408,324) width 4: " "
+ RenderText {#text} at (0,0) size 0x0
+layer at (420,44) size 202x302
+ RenderSVGRoot {svg} at (420,44) size 202x287
+ RenderSVGText {text} at (5,266) size 169x18 contains 1 chunk(s)
+ RenderSVGInlineText {#text} at (0,0) size 169x18
+ chunk 1 text run 1 at (5.00,280.00) startOffset 0 endOffset 24 width 169.00: "+Accelerated Compositing"
+ RenderSVGContainer {g} at (421,45) size 200x200
+ RenderSVGRect {rect} at (421,145) size 100x100 [fill={[type=PATTERN] [id="pattern"]}] [x=0.00] [y=100.00] [width=100.00] [height=100.00]
+ RenderSVGRect {rect} at (521,45) size 100x100 [fill={[type=PATTERN] [id="pattern"]}] [x=100.00] [y=0.00] [width=100.00] [height=100.00]
Copied: branches/safari-534.54-branch/LayoutTests/svg/custom/pattern-userSpaceOnUse-userToBaseTransform.xhtml (from rev 104356, trunk/LayoutTests/svg/custom/pattern-userSpaceOnUse-userToBaseTransform.xhtml) (0 => 106835)
--- branches/safari-534.54-branch/LayoutTests/svg/custom/pattern-userSpaceOnUse-userToBaseTransform.xhtml (rev 0)
+++ branches/safari-534.54-branch/LayoutTests/svg/custom/pattern-userSpaceOnUse-userToBaseTransform.xhtml 2012-02-06 20:54:02 UTC (rev 106835)
@@ -0,0 +1,42 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" >
+<head>
+ <title>userSpaceOnUse SVG Patterns</title>
+</head>
+<body>
+There should be no red displayed on the screen, and the patterns should not change when the browser window is resized.<br/><br/>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg" width="200" height="300" style="border: solid 1px black;">
+ <g>
+ <rect x="0" y="100" width="100" height="50" fill="red"/>
+ <rect x="100" y="0" width="100" height="50" fill="red"/>
+ <rect x="0" y="100" width="100" height="100" fill="url(#pattern)"/>
+ <rect x="100" y="0" width="100" height="100" fill="url(#pattern)"/>
+ </g>
+</svg>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg" width="200" height="300" style="border: solid 1px black;">
+ <text x="5" y="280">+Transforms</text>
+ <g transform="translate(0, 100)">
+ <rect width="100" height="50" fill="red"/>
+ <rect width="100" height="100" fill="url(#pattern)"/>
+
+ </g>
+ <g transform="translate(100, 0)">
+ <rect width="100" height="50" fill="red"/>
+ <rect width="100" height="100" fill="url(#pattern)"/>
+ </g>
+ <defs>
+ <pattern id="pattern" patternUnits="userSpaceOnUse" patternContentUnits="userSpaceOnUse" x="0" y="0" width="100" height="100">
+ <rect width="100" height="25" preserveAspectRatio="none" fill="green"/>
+ <rect width="100" y="25" height="25" preserveAspectRatio="none" fill="blue"/>
+ </pattern>
+ </defs>
+</svg>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="svg" width="200" height="300" style="border: solid 1px black; -webkit-transform: translateZ(0px); -moz-transform: translateZ(0px); -o-transform: translateZ(0px);">
+ <text x="5" y="280">+Accelerated Compositing</text>
+ <g>
+ <rect x="0" y="100" width="100" height="100" fill="url(#pattern)"/>
+ <rect x="100" y="0" width="100" height="100" fill="url(#pattern)"/>
+ </g>
+</svg>
+</body>
+</html>
Modified: branches/safari-534.54-branch/Source/WebCore/ChangeLog (106834 => 106835)
--- branches/safari-534.54-branch/Source/WebCore/ChangeLog 2012-02-06 20:48:10 UTC (rev 106834)
+++ branches/safari-534.54-branch/Source/WebCore/ChangeLog 2012-02-06 20:54:02 UTC (rev 106835)
@@ -1,5 +1,30 @@
2011-02-06 Lucas Forschler <[email protected]>
+ Merge 104356
+
+ 2012-01-06 Tim Horton <[email protected]>
+
+ [cg] userSpaceOnUse SVG Patterns have the wrong origin
+ https://bugs.webkit.org/show_bug.cgi?id=75741
+ <rdar://problem/9383222>
+
+ Reviewed by Simon Fraser.
+
+ The transformation from pattern space to user space should use the userToBase CTM,
+ not the current CTM.
+
+ Test: svg/custom/pattern-userSpaceOnUse-userToBaseTransform.xhtml
+
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::GraphicsContext::applyStrokePattern):
+ (WebCore::GraphicsContext::applyFillPattern):
+ (WebCore::GraphicsContext::getCTM):
+ * platform/graphics/cg/TransformationMatrixCG.cpp:
+ (WebCore::AffineTransform::AffineTransform): Add a AffineTransform(CGAffineTransform) constructor
+ * platform/graphics/transforms/AffineTransform.h:
+
+2011-02-06 Lucas Forschler <[email protected]>
+
Merge 106678
2012-02-03 Beth Dakin <[email protected]>
Modified: branches/safari-534.54-branch/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (106834 => 106835)
--- branches/safari-534.54-branch/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2012-02-06 20:48:10 UTC (rev 106834)
+++ branches/safari-534.54-branch/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2012-02-06 20:54:02 UTC (rev 106835)
@@ -454,8 +454,9 @@
void GraphicsContext::applyStrokePattern()
{
CGContextRef cgContext = platformContext();
+ AffineTransform userToBaseCTM = AffineTransform(wkGetUserToBaseCTM(cgContext));
- RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_state.strokePattern->createPlatformPattern(getCTM()));
+ RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_state.strokePattern->createPlatformPattern(userToBaseCTM));
if (!platformPattern)
return;
@@ -469,8 +470,9 @@
void GraphicsContext::applyFillPattern()
{
CGContextRef cgContext = platformContext();
+ AffineTransform userToBaseCTM = AffineTransform(wkGetUserToBaseCTM(cgContext));
- RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_state.fillPattern->createPlatformPattern(getCTM()));
+ RetainPtr<CGPatternRef> platformPattern(AdoptCF, m_state.fillPattern->createPlatformPattern(userToBaseCTM));
if (!platformPattern)
return;
@@ -1170,8 +1172,7 @@
AffineTransform GraphicsContext::getCTM() const
{
- CGAffineTransform t = CGContextGetCTM(platformContext());
- return AffineTransform(t.a, t.b, t.c, t.d, t.tx, t.ty);
+ return AffineTransform(CGContextGetCTM(platformContext()));
}
FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect, RoundingMode roundingMode)
Modified: branches/safari-534.54-branch/Source/WebCore/platform/graphics/cg/TransformationMatrixCG.cpp (106834 => 106835)
--- branches/safari-534.54-branch/Source/WebCore/platform/graphics/cg/TransformationMatrixCG.cpp 2012-02-06 20:48:10 UTC (rev 106834)
+++ branches/safari-534.54-branch/Source/WebCore/platform/graphics/cg/TransformationMatrixCG.cpp 2012-02-06 20:54:02 UTC (rev 106835)
@@ -54,6 +54,11 @@
narrowPrecisionToCGFloat(f()));
}
+AffineTransform::AffineTransform(const CGAffineTransform& t)
+{
+ setMatrix(t.a, t.b, t.c, t.d, t.tx, t.ty);
+}
+
AffineTransform::operator CGAffineTransform() const
{
return CGAffineTransformMake(narrowPrecisionToCGFloat(a()),
Modified: branches/safari-534.54-branch/Source/WebCore/platform/graphics/transforms/AffineTransform.h (106834 => 106835)
--- branches/safari-534.54-branch/Source/WebCore/platform/graphics/transforms/AffineTransform.h 2012-02-06 20:48:10 UTC (rev 106834)
+++ branches/safari-534.54-branch/Source/WebCore/platform/graphics/transforms/AffineTransform.h 2012-02-06 20:54:02 UTC (rev 106835)
@@ -63,6 +63,10 @@
AffineTransform();
AffineTransform(double a, double b, double c, double d, double e, double f);
+#if USE(CG)
+ AffineTransform(const CGAffineTransform&);
+#endif
+
void setMatrix(double a, double b, double c, double d, double e, double f);
void map(double x, double y, double& x2, double& y2) const;