Incorrect pattern scaling
authorfmalita@chromium.org <fmalita@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 20 Oct 2012 02:51:00 +0000 (02:51 +0000)
committerfmalita@chromium.org <fmalita@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 20 Oct 2012 02:51:00 +0000 (02:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=99870

Reviewed by Dirk Schulze.

Source/WebCore:

The pattern space transform scale should reflect the tile_size(user space)
to tile_image_size ratio, instead of tile_size to absolute_tile_size.

Test: svg/custom/pattern-scaling.svg

* rendering/svg/RenderSVGResourcePattern.cpp:
(WebCore::RenderSVGResourcePattern::applyResource):

LayoutTests:

* platform/chromium-linux/svg/custom/js-late-pattern-creation-expected.png:
* platform/chromium-linux/svg/custom/pattern-scaling-expected.png: Added.
* platform/chromium-linux/svg/custom/pattern-scaling-expected.txt: Added.
* platform/chromium-linux/svg/custom/pattern-with-transformation-expected.png:
* platform/chromium-linux/svg/transforms/text-with-pattern-inside-transformed-html-expected.png:
* platform/chromium-win/svg/custom/pattern-skew-transformed-expected.png:
* platform/chromium/TestExpectations:
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/mac/TestExpectations:
* platform/qt/TestExpectations:
* svg/custom/pattern-scaling.svg: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@131974 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/chromium-linux/svg/custom/js-late-pattern-creation-expected.png
LayoutTests/platform/chromium-linux/svg/custom/pattern-scaling-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux/svg/custom/pattern-scaling-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux/svg/custom/pattern-with-transformation-expected.png
LayoutTests/platform/chromium-linux/svg/transforms/text-with-pattern-inside-transformed-html-expected.png
LayoutTests/platform/chromium-win/svg/custom/pattern-skew-transformed-expected.png
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/efl/TestExpectations
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/qt/TestExpectations
LayoutTests/svg/custom/pattern-scaling.svg [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp

index d587df4..21e64dd 100644 (file)
@@ -1,3 +1,23 @@
+2012-10-19  Florin Malita  <fmalita@chromium.org>
+
+        Incorrect pattern scaling
+        https://bugs.webkit.org/show_bug.cgi?id=99870
+
+        Reviewed by Dirk Schulze.
+
+        * platform/chromium-linux/svg/custom/js-late-pattern-creation-expected.png:
+        * platform/chromium-linux/svg/custom/pattern-scaling-expected.png: Added.
+        * platform/chromium-linux/svg/custom/pattern-scaling-expected.txt: Added.
+        * platform/chromium-linux/svg/custom/pattern-with-transformation-expected.png:
+        * platform/chromium-linux/svg/transforms/text-with-pattern-inside-transformed-html-expected.png:
+        * platform/chromium-win/svg/custom/pattern-skew-transformed-expected.png:
+        * platform/chromium/TestExpectations:
+        * platform/efl/TestExpectations:
+        * platform/gtk/TestExpectations:
+        * platform/mac/TestExpectations:
+        * platform/qt/TestExpectations:
+        * svg/custom/pattern-scaling.svg: Added.
+
 2012-10-19  Levi Weintraub  <leviw@chromium.org>
 
         Unreviewed gardening. Marking platform/chromium/virtual/gpu/fast/canvas/webgl/array-bounds-clamping.html
index f4cbeb8..b2054f9 100644 (file)
Binary files a/LayoutTests/platform/chromium-linux/svg/custom/js-late-pattern-creation-expected.png and b/LayoutTests/platform/chromium-linux/svg/custom/js-late-pattern-creation-expected.png differ
diff --git a/LayoutTests/platform/chromium-linux/svg/custom/pattern-scaling-expected.png b/LayoutTests/platform/chromium-linux/svg/custom/pattern-scaling-expected.png
new file mode 100644 (file)
index 0000000..f977d8b
Binary files /dev/null and b/LayoutTests/platform/chromium-linux/svg/custom/pattern-scaling-expected.png differ
diff --git a/LayoutTests/platform/chromium-linux/svg/custom/pattern-scaling-expected.txt b/LayoutTests/platform/chromium-linux/svg/custom/pattern-scaling-expected.txt
new file mode 100644 (file)
index 0000000..a0d6a65
--- /dev/null
@@ -0,0 +1,36 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderSVGRoot {svg} at (10,10) size 692x232
+    RenderSVGHiddenContainer {defs} at (0,0) size 0x0
+      RenderSVGResourcePattern {pattern} [id="pattern"] [patternUnits=userSpaceOnUse] [patternContentUnits=userSpaceOnUse]
+        RenderSVGRect {rect} at (0,0) size 10x10 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=0.00] [width=10.00] [height=10.00]
+        RenderSVGRect {rect} at (10,10) size 10x10 [fill={[type=SOLID] [color=#008000]}] [x=10.00] [y=10.00] [width=10.00] [height=10.00]
+      RenderSVGContainer {g} at (10,10) size 40x40
+        RenderSVGRect {rect} at (10,10) size 40x40 [fill={[type=SOLID] [color=#FFFF00]}] [x=10.00] [y=10.00] [width=40.00] [height=40.00]
+        RenderSVGRect {rect} at (10,10) size 40x40 [fill={[type=PATTERN] [id="pattern"]}] [x=10.00] [y=10.00] [width=40.00] [height=40.00]
+    RenderSVGContainer {g} at (10,10) size 40x40
+      RenderSVGContainer {use} at (10,10) size 40x40
+        RenderSVGContainer {g} at (10,10) size 40x40
+          RenderSVGRect {rect} at (10,10) size 40x40 [fill={[type=SOLID] [color=#FFFF00]}] [x=10.00] [y=10.00] [width=40.00] [height=40.00]
+          RenderSVGRect {rect} at (10,10) size 40x40 [fill={[type=PATTERN] [id="pattern"]}] [x=10.00] [y=10.00] [width=40.00] [height=40.00]
+    RenderSVGContainer {g} at (79,19) size 78x78 [transform={m=((1.93,0.00)(0.00,1.93)) t=(60.00,0.00)}]
+      RenderSVGContainer {use} at (79,19) size 78x78
+        RenderSVGContainer {g} at (79,19) size 78x78
+          RenderSVGRect {rect} at (79,19) size 78x78 [fill={[type=SOLID] [color=#FFFF00]}] [x=10.00] [y=10.00] [width=40.00] [height=40.00]
+          RenderSVGRect {rect} at (79,19) size 78x78 [fill={[type=PATTERN] [id="pattern"]}] [x=10.00] [y=10.00] [width=40.00] [height=40.00]
+    RenderSVGContainer {g} at (187,27) size 110x110 [transform={m=((2.72,0.00)(0.00,2.72)) t=(160.00,0.00)}]
+      RenderSVGContainer {use} at (187,27) size 110x110
+        RenderSVGContainer {g} at (187,27) size 110x110
+          RenderSVGRect {rect} at (187,27) size 110x110 [fill={[type=SOLID] [color=#FFFF00]}] [x=10.00] [y=10.00] [width=40.00] [height=40.00]
+          RenderSVGRect {rect} at (187,27) size 110x110 [fill={[type=PATTERN] [id="pattern"]}] [x=10.00] [y=10.00] [width=40.00] [height=40.00]
+    RenderSVGContainer {g} at (334,34) size 141x141 [transform={m=((3.48,0.00)(0.00,3.48)) t=(300.00,0.00)}]
+      RenderSVGContainer {use} at (334,34) size 141x141
+        RenderSVGContainer {g} at (334,34) size 141x141
+          RenderSVGRect {rect} at (334,34) size 141x141 [fill={[type=SOLID] [color=#FFFF00]}] [x=10.00] [y=10.00] [width=40.00] [height=40.00]
+          RenderSVGRect {rect} at (334,34) size 141x141 [fill={[type=PATTERN] [id="pattern"]}] [x=10.00] [y=10.00] [width=40.00] [height=40.00]
+    RenderSVGContainer {g} at (508,48) size 194x194 [transform={m=((4.82,0.00)(0.00,4.82)) t=(460.00,0.00)}]
+      RenderSVGContainer {use} at (508,48) size 194x194
+        RenderSVGContainer {g} at (508,48) size 194x194
+          RenderSVGRect {rect} at (508,48) size 194x194 [fill={[type=SOLID] [color=#FFFF00]}] [x=10.00] [y=10.00] [width=40.00] [height=40.00]
+          RenderSVGRect {rect} at (508,48) size 194x194 [fill={[type=PATTERN] [id="pattern"]}] [x=10.00] [y=10.00] [width=40.00] [height=40.00]
index c0859f2..e109796 100644 (file)
Binary files a/LayoutTests/platform/chromium-linux/svg/custom/pattern-with-transformation-expected.png and b/LayoutTests/platform/chromium-linux/svg/custom/pattern-with-transformation-expected.png differ
index 72b3e96..47beeda 100644 (file)
Binary files a/LayoutTests/platform/chromium-linux/svg/transforms/text-with-pattern-inside-transformed-html-expected.png and b/LayoutTests/platform/chromium-linux/svg/transforms/text-with-pattern-inside-transformed-html-expected.png differ
index 90bfd1f..3f196b0 100644 (file)
Binary files a/LayoutTests/platform/chromium-win/svg/custom/pattern-skew-transformed-expected.png and b/LayoutTests/platform/chromium-win/svg/custom/pattern-skew-transformed-expected.png differ
index 40b81ea..9a92f5c 100644 (file)
@@ -2797,6 +2797,13 @@ crbug.com/83290 [ Win ] http/tests/misc/link-rel-prefetch-and-subresource.html [
 crbug.com/83504 [ Win ] fast/css/custom-font-xheight.html [ Failure Pass Slow ]
 crbug.com/83504 [ Mac ] fast/css/custom-font-xheight.html [ Failure Pass ]
 
+# Need rebaselining after 99870
+webkit.org/b/99870 svg/custom/js-late-pattern-creation.svg [ Pass ImageOnlyFailure ]
+webkit.org/b/99870 svg/custom/pattern-skew-transformed.svg [ Pass ImageOnlyFailure ]
+webkit.org/b/99870 svg/custom/pattern-with-transformation.svg [ Pass ImageOnlyFailure ]
+webkit.org/b/99870 svg/transforms/text-with-pattern-inside-transformed-html.xhtml [ Pass ImageOnlyFailure ]
+webkit.org/b/99870 svg/custom/pattern-scaling.svg [ Pass ImageOnlyFailure Missing ]
+
 # Need rebaseline
 webkit.org/b/99818 fast/forms/month-multiple-fields/month-multiple-fields-appearance-l10n.html [ Pass ImageOnlyFailure Missing ]
 webkit.org/b/99818 fast/forms/month-multiple-fields/month-multiple-fields-appearance-basic.html [ Pass ImageOnlyFailure ] 
index 86be69b..5812238 100644 (file)
@@ -1978,6 +1978,13 @@ webkit.org/b/97990 mathml/presentation/subsup.xhtml [ Failure ]
 # css3-conditionals support is not yet enabled.
 webkit.org/b/86146 css3/supports.html
 
+# Need rebaselining after 99870
+webkit.org/b/99870 svg/custom/js-late-pattern-creation.svg [ Pass ImageOnlyFailure ]
+webkit.org/b/99870 svg/custom/pattern-skew-transformed.svg [ Pass ImageOnlyFailure ]
+webkit.org/b/99870 svg/custom/pattern-with-transformation.svg [ Pass ImageOnlyFailure ]
+webkit.org/b/99870 svg/transforms/text-with-pattern-inside-transformed-html.xhtml [ Pass ImageOnlyFailure ]
+webkit.org/b/99870 svg/custom/pattern-scaling.svg [ Pass ImageOnlyFailure Missing ]
+
 # Occasionally fails if run after right after
 # fast/selectors/unqualified-hover-quirks.html or itself.
 webkit.org/b/10890 fast/selectors/unqualified-hover-strict.html [ Failure Pass ]
index 6435d9f..34cd65c 100644 (file)
@@ -81,6 +81,13 @@ fast/css/draggable-region-parser.html [ WontFix ]
 inspector/styles/vendor-prefixes.html [ WontFix ]
 fast/css/apple-prefix.html [ WontFix ]
 
+# Need rebaselining after 99870
+webkit.org/b/99870 svg/custom/js-late-pattern-creation.svg [ Pass ImageOnlyFailure ]
+webkit.org/b/99870 svg/custom/pattern-skew-transformed.svg [ Pass ImageOnlyFailure ]
+webkit.org/b/99870 svg/custom/pattern-with-transformation.svg [ Pass ImageOnlyFailure ]
+webkit.org/b/99870 svg/transforms/text-with-pattern-inside-transformed-html.xhtml [ Pass ImageOnlyFailure ]
+webkit.org/b/99870 svg/custom/pattern-scaling.svg [ Pass ImageOnlyFailure Missing ]
+
 # This port doesn't support detecting slow unload handlers.
 fast/dom/Window/slow-unload-handler.html [ WontFix ]
 fast/dom/Window/slow-unload-handler-only-frame-is-stopped.html [ WontFix ]
index 6120f5a..9e555fb 100644 (file)
@@ -1000,6 +1000,13 @@ webkit.org/b/58192 fast/canvas/webgl/gl-teximage.html [ Failure Pass ]
 webkit.org/b/58192 fast/frames/flattening/iframe-flattening-offscreen.html [ Failure Pass ]
 webkit.org/b/58192 svg/dom/SVGScriptElement/script-set-href.svg [ Failure Pass ]
 
+# Need rebaselining after 99870
+webkit.org/b/99870 svg/custom/js-late-pattern-creation.svg [ Pass ImageOnlyFailure ]
+webkit.org/b/99870 svg/custom/pattern-skew-transformed.svg [ Pass ImageOnlyFailure ]
+webkit.org/b/99870 svg/custom/pattern-with-transformation.svg [ Pass ImageOnlyFailure ]
+webkit.org/b/99870 svg/transforms/text-with-pattern-inside-transformed-html.xhtml [ Pass ImageOnlyFailure ]
+webkit.org/b/99870 svg/custom/pattern-scaling.svg [ Pass ImageOnlyFailure Missing ]
+
 # Flakey cookies tests
 webkit.org/b/73694 http/tests/cookies/simple-cookies-expired.html [ Failure Pass ]
 webkit.org/b/73695 http/tests/cookies/simple-cookies-max-age.html [ Failure Pass ]
index 2f56911..5198e18 100644 (file)
@@ -2405,6 +2405,13 @@ webkit.org/b/86441 fast/borders/border-antialiasing.html [ Skip ]
 # Paletted PNG with ICC color profiles not working.
 webkit.org/b/86722 fast/images/paletted-png-with-color-profile.html
 
+# Need rebaselining after 99870
+webkit.org/b/99870 svg/custom/js-late-pattern-creation.svg [ Pass ImageOnlyFailure ]
+webkit.org/b/99870 svg/custom/pattern-skew-transformed.svg [ Pass ImageOnlyFailure ]
+webkit.org/b/99870 svg/custom/pattern-with-transformation.svg [ Pass ImageOnlyFailure ]
+webkit.org/b/99870 svg/transforms/text-with-pattern-inside-transformed-html.xhtml [ Pass ImageOnlyFailure ]
+webkit.org/b/99870 svg/custom/pattern-scaling.svg [ Pass ImageOnlyFailure Missing ]
+
 # Disable webaudio codec tests, including proprietary codecs.
 webkit.org/b/88794 webaudio/codec-tests
 
diff --git a/LayoutTests/svg/custom/pattern-scaling.svg b/LayoutTests/svg/custom/pattern-scaling.svg
new file mode 100644 (file)
index 0000000..eef1872
--- /dev/null
@@ -0,0 +1,31 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="800" height="600">
+  <!-- Test for https://bugs.webkit.org/show_bug.cgi?id=99870 -->
+  <defs>
+    <pattern id="pattern" width="20" height="20" patternUnits="userSpaceOnUse">
+      <rect width="10" height="10" fill="green"/>
+      <rect x="10" y="10" width="10" height="10" fill="green"/>
+    </pattern>
+
+    <g id="grp">
+      <rect x="10" y="10" width="40" height="40" fill="yellow"/>
+      <rect x="10" y="10" width="40" height="40" fill="url(#pattern)"/>
+    </g>
+  </defs>
+
+  <g>
+    <use xlink:href="#grp"/>
+  </g>
+  <g transform="translate(60,0) scale(1.93453)">
+    <use xlink:href="#grp"/>
+  </g>
+  <g transform="translate(160,0) scale(2.72323)">
+    <use xlink:href="#grp"/>
+  </g>
+  <g transform="translate(300,0) scale(3.483432)">
+    <use xlink:href="#grp"/>
+  </g>
+  <g transform="translate(460,0) scale(4.8223434)">
+    <use xlink:href="#grp"/>
+  </g>
+</svg>
+
index 0178074..cf37522 100644 (file)
@@ -1,3 +1,18 @@
+2012-10-19  Florin Malita  <fmalita@chromium.org>
+
+        Incorrect pattern scaling
+        https://bugs.webkit.org/show_bug.cgi?id=99870
+
+        Reviewed by Dirk Schulze.
+
+        The pattern space transform scale should reflect the tile_size(user space)
+        to tile_image_size ratio, instead of tile_size to absolute_tile_size.
+
+        Test: svg/custom/pattern-scaling.svg
+
+        * rendering/svg/RenderSVGResourcePattern.cpp:
+        (WebCore::RenderSVGResourcePattern::applyResource):
+
 2012-10-19  Tony Chang  <tony@chromium.org>
 
         RenderFlexibleBox::preferredMainAxisContentExtentForChild can return a negative value
index 3a1882a..b3c0b0b 100644 (file)
@@ -126,8 +126,9 @@ bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle*
             return false;
 
         // Compute pattern space transformation.
+        const IntSize tileImageSize = tileImage->logicalSize();
         patternData->transform.translate(tileBoundaries.x(), tileBoundaries.y());
-        patternData->transform.scale(tileBoundaries.width() / clampedAbsoluteTileBoundaries.width(), tileBoundaries.height() / clampedAbsoluteTileBoundaries.height());
+        patternData->transform.scale(tileBoundaries.width() / tileImageSize.width(), tileBoundaries.height() / tileImageSize.height());
 
         AffineTransform patternTransform = m_attributes.patternTransform();
         if (!patternTransform.isIdentity())