Title: [125758] trunk
Revision
125758
Author
[email protected]
Date
2012-08-16 01:50:21 -0700 (Thu, 16 Aug 2012)

Log Message

[chromium] set scissorRect per quad so that quads are correctly clipped
https://bugs.webkit.org/show_bug.cgi?id=94050

Reviewed by Adrienne Walker.

Source/WebCore:

Certain quad types rely on scissoring to do correct
clipping. Refactoring the quad types to remove this assumption
will be done in a later patch, but for now, we have to apply the
scissor rect to every quad to ensure that those quads are
correctly clipped.

Test: compositing/overflow/overflow-hidden-canvas-layer.html

Also updated two unit tests to reflect the change in semantics.

* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::LayerRendererChromium::drawRenderPass):
(WebCore::LayerRendererChromium::drawQuad):

Source/WebKit/chromium:

Updated two unit tests to reflect that we need to always scissor,
until we refactor so that quads do not depend on scissoring.

* tests/CCLayerTreeHostImplTest.cpp:

LayoutTests:

* compositing/overflow/overflow-hidden-canvas-layer-expected.png: Added.
* compositing/overflow/overflow-hidden-canvas-layer-expected.txt: Added.
* compositing/overflow/overflow-hidden-canvas-layer.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (125757 => 125758)


--- trunk/LayoutTests/ChangeLog	2012-08-16 08:07:51 UTC (rev 125757)
+++ trunk/LayoutTests/ChangeLog	2012-08-16 08:50:21 UTC (rev 125758)
@@ -1,3 +1,14 @@
+2012-08-15  Shawn Singh  <[email protected]>
+
+        [chromium] set scissorRect per quad so that quads are correctly clipped
+        https://bugs.webkit.org/show_bug.cgi?id=94050
+
+        Reviewed by Adrienne Walker.
+
+        * compositing/overflow/overflow-hidden-canvas-layer-expected.png: Added.
+        * compositing/overflow/overflow-hidden-canvas-layer-expected.txt: Added.
+        * compositing/overflow/overflow-hidden-canvas-layer.html: Added.
+
 2012-08-16  Zan Dobersek  <[email protected]>
 
         Unreviewed GTK gardening.

Added: trunk/LayoutTests/compositing/overflow/overflow-hidden-canvas-layer-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/compositing/overflow/overflow-hidden-canvas-layer-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/compositing/overflow/overflow-hidden-canvas-layer-expected.txt (0 => 125758)


--- trunk/LayoutTests/compositing/overflow/overflow-hidden-canvas-layer-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/overflow/overflow-hidden-canvas-layer-expected.txt	2012-08-16 08:50:21 UTC (rev 125758)
@@ -0,0 +1,10 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x216
+  RenderBlock {HTML} at (0,0) size 800x216
+    RenderBody {BODY} at (8,8) size 784x200
+layer at (8,8) size 200x200 scrollWidth 400 scrollHeight 404
+  RenderBlock {DIV} at (0,0) size 200x200
+    RenderText {#text} at (0,0) size 0x0
+layer at (8,8) size 400x400 backgroundClip at (8,8) size 200x200 clip at (8,8) size 200x200 outlineClip at (8,8) size 200x200
+  RenderHTMLCanvas {CANVAS} at (0,0) size 400x400

Added: trunk/LayoutTests/compositing/overflow/overflow-hidden-canvas-layer.html (0 => 125758)


--- trunk/LayoutTests/compositing/overflow/overflow-hidden-canvas-layer.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/overflow/overflow-hidden-canvas-layer.html	2012-08-16 08:50:21 UTC (rev 125758)
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <style type="text/css">
+      .clippingContainer {
+        width: 200px;
+        height: 200px;
+        overflow: hidden;
+      }
+
+  </style>
+
+  <script>
+    function drawCanvas()
+    {
+        var canvas = document.getElementById("clippedCanvas");
+        var context = canvas.getContext("2d");
+        context.fillStyle = "red";
+        context.fillRect(0, 0, 400, 400);
+        context.fillStyle = "green";
+        context.fillRect(0, 0, 200, 200);
+    }
+  </script>
+</head>
+
+<body _onload_="drawCanvas()">
+  <div class="clippingContainer">
+    <canvas id="clippedCanvas" width="400" height="400">
+    </canvas>
+  </div>
+</body>
+
+</html>

Added: trunk/LayoutTests/platform/chromium-linux/compositing/overflow/overflow-hidden-canvas-layer-expected.txt (0 => 125758)


--- trunk/LayoutTests/platform/chromium-linux/compositing/overflow/overflow-hidden-canvas-layer-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium-linux/compositing/overflow/overflow-hidden-canvas-layer-expected.txt	2012-08-16 08:50:21 UTC (rev 125758)
@@ -0,0 +1,10 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x216
+  RenderBlock {HTML} at (0,0) size 800x216
+    RenderBody {BODY} at (8,8) size 784x200
+layer at (8,8) size 200x200 scrollWidth 400 scrollHeight 405
+  RenderBlock {DIV} at (0,0) size 200x200
+    RenderText {#text} at (0,0) size 0x0
+layer at (8,8) size 400x400 backgroundClip at (8,8) size 200x200 clip at (8,8) size 200x200 outlineClip at (8,8) size 200x200
+  RenderHTMLCanvas {CANVAS} at (0,0) size 400x400

Modified: trunk/Source/WebCore/ChangeLog (125757 => 125758)


--- trunk/Source/WebCore/ChangeLog	2012-08-16 08:07:51 UTC (rev 125757)
+++ trunk/Source/WebCore/ChangeLog	2012-08-16 08:50:21 UTC (rev 125758)
@@ -1,3 +1,24 @@
+2012-08-15  Shawn Singh  <[email protected]>
+
+        [chromium] set scissorRect per quad so that quads are correctly clipped
+        https://bugs.webkit.org/show_bug.cgi?id=94050
+
+        Reviewed by Adrienne Walker.
+
+        Certain quad types rely on scissoring to do correct
+        clipping. Refactoring the quad types to remove this assumption
+        will be done in a later patch, but for now, we have to apply the
+        scissor rect to every quad to ensure that those quads are
+        correctly clipped.
+
+        Test: compositing/overflow/overflow-hidden-canvas-layer.html
+
+        Also updated two unit tests to reflect the change in semantics.
+
+        * platform/graphics/chromium/LayerRendererChromium.cpp:
+        (WebCore::LayerRendererChromium::drawRenderPass):
+        (WebCore::LayerRendererChromium::drawQuad):
+
 2012-08-16  Yoshifumi Inoue  <[email protected]>
 
         [Forms] Wheel event support in multiple fields time input UI

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp (125757 => 125758)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2012-08-16 08:07:51 UTC (rev 125757)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2012-08-16 08:50:21 UTC (rev 125758)
@@ -420,11 +420,7 @@
         scissorRect.intersect(CCMathUtil::projectClippedRect(inverseTransformToRoot, frame.rootDamageRect));
     }
 
-    if (scissorRect != renderPass->outputRect())
-        setScissorToRect(frame, enclosingIntRect(scissorRect));
-    else
-        GLC(m_context, m_context->disable(GraphicsContext3D::SCISSOR_TEST));
-
+    setScissorToRect(frame, enclosingIntRect(scissorRect));
     clearFramebuffer(frame);
 
     const CCQuadList& quadList = renderPass->quadList();
@@ -442,6 +438,10 @@
     if (scissorRect.isEmpty())
         return;
 
+    // For now, we always do per-quad scissoring because some quad types draw their
+    // un-clipped bounds, relying on scissoring for correct clipping.
+    setScissorToRect(frame, enclosingIntRect(scissorRect));
+
     if (quad->needsBlending())
         GLC(m_context, m_context->enable(GraphicsContext3D::BLEND));
     else

Modified: trunk/Source/WebKit/chromium/ChangeLog (125757 => 125758)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-08-16 08:07:51 UTC (rev 125757)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-08-16 08:50:21 UTC (rev 125758)
@@ -1,3 +1,15 @@
+2012-08-15  Shawn Singh  <[email protected]>
+
+        [chromium] set scissorRect per quad so that quads are correctly clipped
+        https://bugs.webkit.org/show_bug.cgi?id=94050
+
+        Reviewed by Adrienne Walker.
+
+        Updated two unit tests to reflect that we need to always scissor,
+        until we refactor so that quads do not depend on scissoring.
+
+        * tests/CCLayerTreeHostImplTest.cpp:
+
 2012-08-16  Hironori Bono  <[email protected]>
 
         Prevent showing suggestions when right-clicking a selection range.

Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp (125757 => 125758)


--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp	2012-08-16 08:07:51 UTC (rev 125757)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp	2012-08-16 08:50:21 UTC (rev 125758)
@@ -1840,7 +1840,7 @@
     MockContextHarness harness(mockContext);
 
     harness.mustDrawSolidQuad();
-    harness.mustSetNoScissor();
+    harness.mustSetScissor(0, 0, 10, 10);
 
     // Run test case
     OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(false, context.release(), FakeLayerWithQuads::create(1));
@@ -1861,7 +1861,7 @@
     OwnPtr<CCLayerTreeHostImpl> myHostImpl = createLayerTreeHost(true, context.release(), FakeLayerWithQuads::create(1));
 
     // The first frame is not a partially-swapped one.
-    harness.mustSetNoScissor();
+    harness.mustSetScissor(0, 0, 10, 10);
     harness.mustDrawSolidQuad();
     {
         CCLayerTreeHostImpl::FrameData frame;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to