Title: [107988] trunk
Revision
107988
Author
[email protected]
Date
2012-02-16 15:51:00 -0800 (Thu, 16 Feb 2012)

Log Message

[chromium] Clipping/Transforms applied in wrong order in opaque paint tracking
https://bugs.webkit.org/show_bug.cgi?id=78775

Patch by Dana Jansens <[email protected]> on 2012-02-16
Reviewed by Stephen White.

Source/WebCore:

The clip was being applied in device coordinates, before transforming the painted
rect into device coordinates. This made any translations get doubly represented,
and gave incorrect paint tracking results.

Test: compositing/culling/unscrolled-within-boxshadow.html

Unit test: PlatformContextSkiaTest.cpp

* platform/graphics/skia/OpaqueRegionSkia.cpp:
(WebCore::OpaqueRegionSkia::didDraw):

Source/WebKit/chromium:

* tests/PlatformContextSkiaTest.cpp:
(WebCore::TEST):

LayoutTests:

* compositing/culling/unscrolled-within-boxshadow-expected.png: Added.
* compositing/culling/unscrolled-within-boxshadow-expected.txt: Added.
* compositing/culling/unscrolled-within-boxshadow.html: Added.
* compositing/overflow/clip-content-under-overflow-controls-expected.png:
* compositing/scrollbar-painting-expected.png:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (107987 => 107988)


--- trunk/LayoutTests/ChangeLog	2012-02-16 23:35:17 UTC (rev 107987)
+++ trunk/LayoutTests/ChangeLog	2012-02-16 23:51:00 UTC (rev 107988)
@@ -1,3 +1,16 @@
+2012-02-16  Dana Jansens  <[email protected]>
+
+        [chromium] Clipping/Transforms applied in wrong order in opaque paint tracking
+        https://bugs.webkit.org/show_bug.cgi?id=78775
+
+        Reviewed by Stephen White.
+
+        * compositing/culling/unscrolled-within-boxshadow-expected.png: Added.
+        * compositing/culling/unscrolled-within-boxshadow-expected.txt: Added.
+        * compositing/culling/unscrolled-within-boxshadow.html: Added.
+        * compositing/overflow/clip-content-under-overflow-controls-expected.png:
+        * compositing/scrollbar-painting-expected.png:
+
 2012-02-16  Abhishek Arya  <[email protected]>
 
         Crash with tables in multi-column layout.

Added: trunk/LayoutTests/compositing/culling/unscrolled-within-boxshadow-expected.png (0 => 107988)


--- trunk/LayoutTests/compositing/culling/unscrolled-within-boxshadow-expected.png	                        (rev 0)
+++ trunk/LayoutTests/compositing/culling/unscrolled-within-boxshadow-expected.png	2012-02-16 23:51:00 UTC (rev 107988)
@@ -0,0 +1,8 @@
+\x89PNG
+
+
+IHDR X')tEXtchecksum1964d3ffa0c02063db457594afb2073aR\x8C)
+\x88IDATx\x9C\xEDܱn\xDBh@Q\x92cÁ\x81q\xDEg\xBA\xA9\xF7a\xB7\x9En\xDE'`$\x90#\x89܂A\xBAF\xDA\xEBU<8\xA7\xFA\xF8*\xE3\xE2\xE3O\x8E\xEB\xBAt\xA6[\xF0O#\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b &\xB0b\xFB\xEB~\xB6\xEB0\xEB\xBA\xFE<\x94Cp#\xE38\xC30\xE3\xCFí'\x82w\xE9\x9A\xC0Z\x87uY\x97e]\xCE\xEBy;\xAC[k\xF0\x9E\x8D\xE38\xE34N\xD38\xED\xC6\xDDv\xD0Xp\x85\x8Bk\xD6\xF3r>\xAD\xA7\xE3r\xFC~\xFE~\\x8E\xC7\xE5\xB8˲.o1\xFF7\xD38M\xC34O\xF3<\xCDv\xE6iޏ\xFBݴ\xD3Xp\xA9\xCBk\xDB]\x9D\xD6\xD3\xE1|\xF8v\xFA\xF6\xF5\xF8\xF5\xDB\xE9\xDB\xE1|8.\xC7\xF3z\xB6\xC4x\xBF\xC6q܍\xBBy\x9A\xEFw\xF7\xFB\x87\x8F\xF3LJ\xFD\xC3\xFD\xEE~\G{,\xB8\xD4\xC5\xACe]\x8E\xCB\xF1\xDB\xE9ۗ\xD7/\x9F_??\xBF>\xBF_\xE7\xC3i9Yb\xBC_\xD38\xED\xA7\xFD\xFD\xEE\xFEq~|\xBA{\xFA\xB4|\x86a7\xEE\xB6g\x85\xB7\x9Eޙ7X\xEBz^\xCF\xDF\xCF߿\xBF~~\xFD\xFC\xFB\xBF\xA3\xB1\xB8\xAD\xBF\xFE\xF5\xD7<\xCD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L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@L`\xC4@\xEC?\x89\x90v\xE4t\xF1\xA3IEND\xAEB`\x82
\ No newline at end of file

Added: trunk/LayoutTests/compositing/culling/unscrolled-within-boxshadow-expected.txt (0 => 107988)


--- trunk/LayoutTests/compositing/culling/unscrolled-within-boxshadow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/culling/unscrolled-within-boxshadow-expected.txt	2012-02-16 23:51:00 UTC (rev 107988)
@@ -0,0 +1 @@
+

Added: trunk/LayoutTests/compositing/culling/unscrolled-within-boxshadow.html (0 => 107988)


--- trunk/LayoutTests/compositing/culling/unscrolled-within-boxshadow.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/culling/unscrolled-within-boxshadow.html	2012-02-16 23:51:00 UTC (rev 107988)
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.comp {
+  -webkit-transform: translateZ(0px);
+}
+body {
+  margin:0;
+  padding:0;
+}
+.shadow {
+  position:absolute;
+  left:20px; right:20px;
+  width:500px;
+  height:500px;
+  top:0px; bottom:20px;
+  z-index:120;
+  margin-top:20px;
+  border: 1px solid transparent;
+  -webkit-box-shadow: 0 0 6px #090;
+  background-color: #090;
+}
+#scroll {
+  overflow-y: hidden; /* scrollable but no scrollbars visible. */
+  width:500px;
+  height: 500px;
+}
+.scrollContent {
+  width:100%;
+  height: 1000px; /* make the container scrollable */
+  background-color: #0d0;
+}
+</style>
+<script type="text/_javascript_">
+  if (window.layoutTestController) {
+    layoutTestController.dumpAsText(true);
+    layoutTestController.waitUntilDone();
+  }
+
+  window._onload_ = function() { setTimeout(function() {
+    if (window.layoutTestController) {
+      layoutTestController.notifyDone();
+    }
+  }, 0); };
+</script>
+</head>
+
+<body>
+<!-- If culled incorrectly, the top/left edges outside of the shadowed box end up being culled instead of painted/drawn properly.
+     If clipping/transforms are applied wrongly, outside the right/bottom edges may also end up being culled. -->
+<div class="comp shadow">
+  <div id="scroll">
+    <div class="scrollContent">
+    </div>
+  </div>
+</div>
+</body>
+</html>

Modified: trunk/LayoutTests/compositing/overflow/clip-content-under-overflow-controls-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/compositing/scrollbar-painting-expected.png


(Binary files differ)

Modified: trunk/Source/WebCore/ChangeLog (107987 => 107988)


--- trunk/Source/WebCore/ChangeLog	2012-02-16 23:35:17 UTC (rev 107987)
+++ trunk/Source/WebCore/ChangeLog	2012-02-16 23:51:00 UTC (rev 107988)
@@ -1,3 +1,21 @@
+2012-02-16  Dana Jansens  <[email protected]>
+
+        [chromium] Clipping/Transforms applied in wrong order in opaque paint tracking
+        https://bugs.webkit.org/show_bug.cgi?id=78775
+
+        Reviewed by Stephen White.
+
+        The clip was being applied in device coordinates, before transforming the painted
+        rect into device coordinates. This made any translations get doubly represented,
+        and gave incorrect paint tracking results.
+
+        Test: compositing/culling/unscrolled-within-boxshadow.html
+
+        Unit test: PlatformContextSkiaTest.cpp
+
+        * platform/graphics/skia/OpaqueRegionSkia.cpp:
+        (WebCore::OpaqueRegionSkia::didDraw):
+
 2012-02-16  Abhishek Arya  <[email protected]>
 
         Crash with tables in multi-column layout.

Modified: trunk/Source/WebCore/platform/graphics/skia/OpaqueRegionSkia.cpp (107987 => 107988)


--- trunk/Source/WebCore/platform/graphics/skia/OpaqueRegionSkia.cpp	2012-02-16 23:35:17 UTC (rev 107987)
+++ trunk/Source/WebCore/platform/graphics/skia/OpaqueRegionSkia.cpp	2012-02-16 23:51:00 UTC (rev 107988)
@@ -235,7 +235,12 @@
 {
     SkRect targetRect = rect;
 
-    // Apply the current clip.
+    // Apply the transform to device coordinate space.
+    SkMatrix canvasTransform = context->canvas()->getTotalMatrix();
+    if (!canvasTransform.mapRect(&targetRect))
+        fillsBounds = false;
+
+    // Apply the current clip in device coordinate space.
     if (context->canvas()->getClipType() != SkCanvas::kRect_ClipType)
         fillsBounds = false;
     else {
@@ -247,10 +252,7 @@
     if (!context->clippedToImage().isOpaque())
         fillsBounds = false;
 
-    // Apply the transforms.
-    SkMatrix canvasTransform = context->canvas()->getTotalMatrix();
-    if (!canvasTransform.mapRect(&targetRect))
-        fillsBounds = false;
+    // Apply the transform to the tracking space.
     SkMatrix canvasToTargetTransform = transform;
     if (!canvasToTargetTransform.mapRect(&targetRect))
         fillsBounds = false;

Modified: trunk/Source/WebKit/chromium/ChangeLog (107987 => 107988)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-02-16 23:35:17 UTC (rev 107987)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-02-16 23:51:00 UTC (rev 107988)
@@ -1,3 +1,13 @@
+2012-02-16  Dana Jansens  <[email protected]>
+
+        [chromium] Clipping/Transforms applied in wrong order in opaque paint tracking
+        https://bugs.webkit.org/show_bug.cgi?id=78775
+
+        Reviewed by Stephen White.
+
+        * tests/PlatformContextSkiaTest.cpp:
+        (WebCore::TEST):
+
 2012-02-16  Daniel Cheng  <[email protected]>
 
         [chromium] Add WEBKIT_EXPORT to new WebDragData methods.

Modified: trunk/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp (107987 => 107988)


--- trunk/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp	2012-02-16 23:35:17 UTC (rev 107987)
+++ trunk/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp	2012-02-16 23:51:00 UTC (rev 107988)
@@ -163,6 +163,30 @@
     context.clearRect(FloatRect(10, 10, 90, 90));
     EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect());
 
+    // The transform and the clip need to interact correctly (transform first)
+    context.save();
+    context.translate(10, 10);
+    context.clip(FloatRect(20, 20, 10, 10));
+    context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver);
+    EXPECT_EQ_RECT(IntRect(30, 30, 10, 10), platformContext.opaqueRegion().asRect());
+    EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect());
+    context.restore();
+
+    context.clearRect(FloatRect(10, 10, 90, 90));
+    EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect());
+
+    // The transform and the clip need to interact correctly (clip first)
+    context.save();
+    context.clip(FloatRect(20, 20, 10, 10));
+    context.translate(10, 10);
+    context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver);
+    EXPECT_EQ_RECT(IntRect(20, 20, 10, 10), platformContext.opaqueRegion().asRect());
+    EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect());
+    context.restore();
+
+    context.clearRect(FloatRect(10, 10, 90, 90));
+    EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect());
+
     Path path;
     path.moveTo(FloatPoint(0, 0));
     path.addLineTo(FloatPoint(100, 0));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to