Diff
Modified: trunk/LayoutTests/ChangeLog (94337 => 94338)
--- trunk/LayoutTests/ChangeLog 2011-09-01 20:09:39 UTC (rev 94337)
+++ trunk/LayoutTests/ChangeLog 2011-09-01 20:27:29 UTC (rev 94338)
@@ -1,3 +1,22 @@
+2011-09-01 Tim Horton <timothy_hor...@apple.com>
+
+ REGRESSION: Rendering artifacts on a rotated, pattern filled SVG shape
+ https://bugs.webkit.org/show_bug.cgi?id=53055
+ <rdar://problem/8910917>
+
+ Reviewed by Simon Fraser.
+
+ Add a test that makes pixel cracking in transformed SVG patterns quite blatant,
+ and rebaseline some other tests affected by the change.
+
+ * platform/mac/svg/W3C-SVG-1.1/pservers-grad-06-b-expected.png:
+ * platform/mac/svg/custom/pattern-rotate-expected.png:
+ * platform/mac/svg/custom/pattern-rotate-gaps-expected.png: Added.
+ * platform/mac/svg/custom/pattern-rotate-gaps-expected.txt: Added.
+ * platform/mac/svg/transforms/text-with-pattern-inside-transformed-html-expected.png:
+ * platform/mac/svg/transforms/text-with-pattern-with-svg-transform-expected.png:
+ * svg/custom/pattern-rotate-gaps.svg: Added.
+
2011-09-01 James Robinson <jam...@chromium.org>
[chromium] Update expectations and baselines
Modified: trunk/LayoutTests/platform/mac/svg/W3C-SVG-1.1/pservers-grad-06-b-expected.png
(Binary files differ)
Modified: trunk/LayoutTests/platform/mac/svg/custom/pattern-rotate-expected.png
(Binary files differ)
Added: trunk/LayoutTests/platform/mac/svg/custom/pattern-rotate-gaps-expected.png
(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/svg/custom/pattern-rotate-gaps-expected.png
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/platform/mac/svg/custom/pattern-rotate-gaps-expected.txt (0 => 94338)
--- trunk/LayoutTests/platform/mac/svg/custom/pattern-rotate-gaps-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/svg/custom/pattern-rotate-gaps-expected.txt 2011-09-01 20:27:29 UTC (rev 94338)
@@ -0,0 +1,29 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderSVGRoot {svg} at (0,0) size 297x333
+ RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+ RenderSVGResourcePattern {pattern} [id="squares"] [patternUnits=userSpaceOnUse] [patternContentUnits=userSpaceOnUse]
+ RenderSVGPath {rect} at (0,0) size 2x2 [fill={[type=SOLID] [color=#FFFFFF]}] [x=0.00] [y=0.00] [width=2.00] [height=2.00]
+ RenderSVGPath {rect} at (0,2) size 2x2 [fill={[type=SOLID] [color=#FFFFFF]}] [x=0.00] [y=2.00] [width=2.00] [height=2.00]
+ RenderSVGPath {rect} at (2,0) size 2x2 [fill={[type=SOLID] [color=#FFFFFF]}] [x=2.00] [y=0.00] [width=2.00] [height=2.00]
+ RenderSVGPath {rect} at (2,2) size 2x2 [fill={[type=SOLID] [color=#FFFFFF]}] [x=2.00] [y=2.00] [width=2.00] [height=2.00]
+ RenderSVGPath {rect} at (0,0) size 200x200 [fill={[type=SOLID] [color=#000000]}] [x=0.00] [y=0.00] [width=200.00] [height=200.00]
+ RenderSVGContainer {g} at (37,20) size 134x133 [transform={m=((1.00,0.00)(0.00,1.00)) t=(80.00,20.00)}]
+ RenderSVGPath {rect} at (37,20) size 134x133 [transform={m=((0.91,0.42)(-0.42,0.91)) t=(0.00,0.00)}] [fill={[type=PATTERN] [id="squares"]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]
+ RenderSVGContainer {g} at (10,288) size 287x45 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,300.00)}]
+ RenderSVGText {text} at (0,-12) size 287x45 contains 1 chunk(s)
+ RenderSVGTSpan {tspan} at (0,0) size 280x15
+ RenderSVGInlineText {#text} at (0,0) size 280x15
+ chunk 1 text run 1 at (0.00,0.00) startOffset 0 endOffset 40 width 280.00: "For this test case to be successful, the"
+ RenderSVGInlineText {#text} at (280,0) size 7x15
+ chunk 1 text run 1 at (280.00,0.00) startOffset 0 endOffset 1 width 7.00: " "
+ RenderSVGTSpan {tspan} at (0,0) size 252x15
+ RenderSVGInlineText {#text} at (0,15) size 252x15
+ chunk 1 text run 1 at (0.00,15.00) startOffset 0 endOffset 36 width 252.00: "rotated square inside the black area"
+ RenderSVGInlineText {#text} at (252,15) size 7x15
+ chunk 1 text run 1 at (252.00,15.00) startOffset 0 endOffset 1 width 7.00: " "
+ RenderSVGTSpan {tspan} at (0,0) size 147x15
+ RenderSVGInlineText {#text} at (0,30) size 147x15
+ chunk 1 text run 1 at (0.00,30.00) startOffset 0 endOffset 21 width 147.00: "should be pure white."
+ RenderSVGInlineText {#text} at (0,0) size 0x0
Modified: trunk/LayoutTests/platform/mac/svg/transforms/text-with-pattern-inside-transformed-html-expected.png
(Binary files differ)
Modified: trunk/LayoutTests/platform/mac/svg/transforms/text-with-pattern-with-svg-transform-expected.png
(Binary files differ)
Added: trunk/LayoutTests/svg/custom/pattern-rotate-gaps.svg (0 => 94338)
--- trunk/LayoutTests/svg/custom/pattern-rotate-gaps.svg (rev 0)
+++ trunk/LayoutTests/svg/custom/pattern-rotate-gaps.svg 2011-09-01 20:27:29 UTC (rev 94338)
@@ -0,0 +1,27 @@
+<?xml version="1.0" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%">
+ <title>SVG Rendering artifacts on a rotated, pattern filled shape (Bug 53055)</title>
+
+ <defs>
+ <pattern id="squares" x="0" y="0" width="4" height="4" patternUnits="userSpaceOnUse" patternContentUnits="userSpaceOnUse">
+ <rect x="0" y="0" width="2" height="2" style="fill: white;"/>
+ <rect x="0" y="2" width="2" height="2" style="fill: white;"/>
+ <rect x="2" y="0" width="2" height="2" style="fill: white;"/>
+ <rect x="2" y="2" width="2" height="2" style="fill: white;"/>
+ </pattern>
+ </defs>
+
+ <rect x="0" y="0" width="200" height="200" />
+ <g transform="translate(80, 20)">
+ <rect x="0" y="0" width="100" height="100" fill="url(#squares)" transform="rotate(25)" />
+ </g>
+
+ <g transform="matrix(1 0 0 1 10 300)">
+ <text font-family="'Courier'" font-size="12">
+ <tspan x="0" y="0">For this test case to be successful, the</tspan>
+ <tspan x="0" y="15">rotated square inside the black area</tspan>
+ <tspan x="0" y="30">should be pure white.</tspan>
+ </text>
+ </g>
+
+</svg>
Modified: trunk/Source/WebCore/ChangeLog (94337 => 94338)
--- trunk/Source/WebCore/ChangeLog 2011-09-01 20:09:39 UTC (rev 94337)
+++ trunk/Source/WebCore/ChangeLog 2011-09-01 20:27:29 UTC (rev 94338)
@@ -1,3 +1,28 @@
+2011-09-01 Tim Horton <timothy_hor...@apple.com>
+
+ REGRESSION: Rendering artifacts on a rotated, pattern filled SVG shape
+ https://bugs.webkit.org/show_bug.cgi?id=53055
+ <rdar://problem/8910917>
+
+ Reviewed by Simon Fraser.
+
+ Make use of wkCGPatternCreateWithImageAndTransform
+ when tiling patterns in both directions. This helps to avoid
+ pixel-cracking along pattern tiling boundaries.
+
+ Ignore 2D rotation when computing the size of a pattern's tile image,
+ as it artificially inflates the size of the tile, which can cause
+ pixel-cracking.
+
+ Test: svg/custom/pattern-rotate-gaps.svg
+
+ * platform/graphics/cg/PatternCG.cpp:
+ (WebCore::Pattern::createPlatformPattern):
+ * rendering/svg/RenderSVGResourcePattern.cpp:
+ * rendering/svg/SVGImageBufferTools.cpp:
+ (WebCore::SVGImageBufferTools::roundedImageBufferSize):
+ * rendering/svg/SVGImageBufferTools.h:
+
2011-09-01 Patrick Gansterer <par...@webkit.org>
Unreviewed, rolling out r94284.
Modified: trunk/Source/WebCore/platform/graphics/cg/PatternCG.cpp (94337 => 94338)
--- trunk/Source/WebCore/platform/graphics/cg/PatternCG.cpp 2011-09-01 20:09:39 UTC (rev 94337)
+++ trunk/Source/WebCore/platform/graphics/cg/PatternCG.cpp 2011-09-01 20:27:29 UTC (rev 94338)
@@ -32,6 +32,14 @@
#include <ApplicationServices/ApplicationServices.h>
#include <wtf/MainThread.h>
+#if PLATFORM(MAC) || PLATFORM(CHROMIUM)
+#include "WebCoreSystemInterface.h"
+#endif
+
+#if PLATFORM(WIN)
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#endif
+
namespace WebCore {
static void patternCallback(void* info, CGContextRef context)
@@ -63,6 +71,11 @@
patternTransform.scaleNonUniform(1, -1);
patternTransform.translate(0, -tileRect.height());
+ // If we're repeating in both directions, we can use image-backed patterns
+ // instead of custom patterns, and avoid tiling-edge pixel cracks.
+ if (m_repeatX && m_repeatY)
+ return wkCGPatternCreateWithImageAndTransform(tileImage()->getCGImageRef(), patternTransform, wkPatternTilingConstantSpacing);
+
// If FLT_MAX should also be used for xStep or yStep, nothing is rendered. Using fractions of FLT_MAX also
// result in nothing being rendered.
// INT_MAX is almost correct, but there seems to be some number wrapping occurring making the fill
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp (94337 => 94338)
--- trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp 2011-09-01 20:09:39 UTC (rev 94337)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp 2011-09-01 20:27:29 UTC (rev 94338)
@@ -114,10 +114,12 @@
if (!buildTileImageTransform(object, m_attributes, patternElement, tileBoundaries, tileImageTransform))
return false;
- AffineTransform absoluteTransform;
- SVGImageBufferTools::calculateTransformationToOutermostSVGCoordinateSystem(object, absoluteTransform);
+ AffineTransform absoluteTransformIgnoringRotation;
+ SVGImageBufferTools::calculateTransformationToOutermostSVGCoordinateSystem(object, absoluteTransformIgnoringRotation);
- FloatRect absoluteTileBoundaries = absoluteTransform.mapRect(tileBoundaries);
+ // Ignore 2D rotation, as it doesn't affect the size of the tile.
+ SVGImageBufferTools::clear2DRotation(absoluteTransformIgnoringRotation);
+ FloatRect absoluteTileBoundaries = absoluteTransformIgnoringRotation.mapRect(tileBoundaries);
// Build tile image.
OwnPtr<ImageBuffer> tileImage = createTileImage(object, m_attributes, tileBoundaries, absoluteTileBoundaries, tileImageTransform);
Modified: trunk/Source/WebCore/rendering/svg/SVGImageBufferTools.cpp (94337 => 94338)
--- trunk/Source/WebCore/rendering/svg/SVGImageBufferTools.cpp 2011-09-01 20:09:39 UTC (rev 94337)
+++ trunk/Source/WebCore/rendering/svg/SVGImageBufferTools.cpp 2011-09-01 20:27:29 UTC (rev 94338)
@@ -123,6 +123,16 @@
return clampedAbsoluteTargetRect;
}
+void SVGImageBufferTools::clear2DRotation(AffineTransform& transform)
+{
+ TransformationMatrix::DecomposedType decomposition;
+ TransformationMatrix tm = transform.toTransformationMatrix();
+ tm.decompose(decomposition);
+ decomposition.quaternionZ = 0.0;
+ tm.recompose(decomposition);
+ transform = tm.toAffineTransform();
}
+}
+
#endif // ENABLE(SVG)
Modified: trunk/Source/WebCore/rendering/svg/SVGImageBufferTools.h (94337 => 94338)
--- trunk/Source/WebCore/rendering/svg/SVGImageBufferTools.h 2011-09-01 20:09:39 UTC (rev 94337)
+++ trunk/Source/WebCore/rendering/svg/SVGImageBufferTools.h 2011-09-01 20:27:29 UTC (rev 94338)
@@ -42,6 +42,7 @@
static void calculateTransformationToOutermostSVGCoordinateSystem(const RenderObject*, AffineTransform& absoluteTransform);
static FloatRect clampedAbsoluteTargetRectForRenderer(const RenderObject*, const FloatRect& absoluteTargetRect);
static IntSize roundedImageBufferSize(const FloatSize&);
+ static void clear2DRotation(AffineTransform&);
private:
SVGImageBufferTools() { }