Title: [126993] trunk
Revision
126993
Author
[email protected]
Date
2012-08-29 05:24:49 -0700 (Wed, 29 Aug 2012)

Log Message

Incorrect large-area clipping
https://bugs.webkit.org/show_bug.cgi?id=95197

Reviewed by Nikolas Zimmermann.

Source/WebCore:

ImageBuffers allocated for clipping and masking are clamped to kMaxImageBufferSize max
(4096x4096). In order to properly account for the scaling factor introduced by this
clamping, the repaintRect translation component needs to be pushed after the scaling
transform.

Tests: svg/custom/clamped-masking-clipping-expected.svg
       svg/custom/clamped-masking-clipping.svg

* rendering/svg/SVGRenderingContext.cpp:
(WebCore::SVGRenderingContext::createImageBuffer):

LayoutTests:

* svg/custom/clamped-masking-clipping-expected.svg: Added.
* svg/custom/clamped-masking-clipping.svg: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (126992 => 126993)


--- trunk/LayoutTests/ChangeLog	2012-08-29 12:18:53 UTC (rev 126992)
+++ trunk/LayoutTests/ChangeLog	2012-08-29 12:24:49 UTC (rev 126993)
@@ -1,3 +1,13 @@
+2012-08-29  Florin Malita  <[email protected]>
+
+        Incorrect large-area clipping
+        https://bugs.webkit.org/show_bug.cgi?id=95197
+
+        Reviewed by Nikolas Zimmermann.
+
+        * svg/custom/clamped-masking-clipping-expected.svg: Added.
+        * svg/custom/clamped-masking-clipping.svg: Added.
+
 2012-08-29  Dominik Röttsches  <[email protected]>
 
         [EFL] Move known crash issue to TestExpectations

Added: trunk/LayoutTests/svg/custom/clamped-masking-clipping-expected.svg (0 => 126993)


--- trunk/LayoutTests/svg/custom/clamped-masking-clipping-expected.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/clamped-masking-clipping-expected.svg	2012-08-29 12:24:49 UTC (rev 126993)
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="10000" height="400">
+    <rect x="100" width="100" height="100" fill="green"/>
+    <rect x="300" width="100" height="100" fill="green"/>
+</svg>

Added: trunk/LayoutTests/svg/custom/clamped-masking-clipping.svg (0 => 126993)


--- trunk/LayoutTests/svg/custom/clamped-masking-clipping.svg	                        (rev 0)
+++ trunk/LayoutTests/svg/custom/clamped-masking-clipping.svg	2012-08-29 12:24:49 UTC (rev 126993)
@@ -0,0 +1,33 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="10000" height="400">
+  <!-- test for https://bugs.webkit.org/show_bug.cgi?id=95197 -->
+  <defs>
+    <mask id="mask">
+      <!-- forcing a repaintRect offset -->
+      <rect x="100" width="1" height="1" fill="black"/>
+      <rect x="200" width="8092" height="100" fill="white"/>
+    </mask>
+
+    <clipPath id="clip1">
+      <!-- forcing clipping via masking -->
+      <path d="M 0 0 V 100 H 10000 V 0 Z"/>
+    </clipPath>
+
+    <clipPath id="clip2" clip-path="url(#clip1)">
+      <path d="M 100 0 H 200 V 200 H 8292 V 0 Z"/>
+    </clipPath>
+
+    <mask id="crop">
+      <rect width="300" height="100" fill="white"/>
+    </mask>
+  </defs>
+
+  <g mask="url(#crop)" transform="translate(-100, 0)">
+    <rect width="10000" height="400" fill="red" mask="url(#mask)"/>
+    <rect x="200" width="100" height="100" fill="green"/>
+  </g>
+
+  <g mask="url(#crop)" transform="translate(100, 0)">
+    <rect width="10000" height="400" fill="red" clip-path="url(#clip2)"/>
+    <rect x="200" width="100" height="100" fill="green"/>
+  </g>
+</svg>

Modified: trunk/Source/WebCore/ChangeLog (126992 => 126993)


--- trunk/Source/WebCore/ChangeLog	2012-08-29 12:18:53 UTC (rev 126992)
+++ trunk/Source/WebCore/ChangeLog	2012-08-29 12:24:49 UTC (rev 126993)
@@ -1,3 +1,21 @@
+2012-08-29  Florin Malita  <[email protected]>
+
+        Incorrect large-area clipping
+        https://bugs.webkit.org/show_bug.cgi?id=95197
+
+        Reviewed by Nikolas Zimmermann.
+
+        ImageBuffers allocated for clipping and masking are clamped to kMaxImageBufferSize max
+        (4096x4096). In order to properly account for the scaling factor introduced by this
+        clamping, the repaintRect translation component needs to be pushed after the scaling
+        transform.
+
+        Tests: svg/custom/clamped-masking-clipping-expected.svg
+               svg/custom/clamped-masking-clipping.svg
+
+        * rendering/svg/SVGRenderingContext.cpp:
+        (WebCore::SVGRenderingContext::createImageBuffer):
+
 2012-08-29  Yury Semikhatsky  <[email protected]>
 
         Web Inspector: unsafe static_cast in RetainedDOMInfo::IsEquivalent

Modified: trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp (126992 => 126993)


--- trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp	2012-08-29 12:18:53 UTC (rev 126992)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderingContext.cpp	2012-08-29 12:24:49 UTC (rev 126993)
@@ -205,15 +205,11 @@
     GraphicsContext* imageContext = image->context();
     ASSERT(imageContext);
 
-    // This is done in absolute coordinates.
+    imageContext->scale(FloatSize(static_cast<float>(clampedSize.width()) / paintRect.width(),
+                                  static_cast<float>(clampedSize.height()) / paintRect.height()));
     imageContext->translate(-paintRect.x(), -paintRect.y());
-
     imageContext->concatCTM(absoluteTransform);
 
-    // This happens in local coordinates.
-    imageContext->scale(FloatSize(static_cast<float>(clampedSize.width()) / paintRect.width(),
-                                  static_cast<float>(clampedSize.height()) / paintRect.height()));
-
     imageBuffer = image.release();
     return true;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to