[chromium] Do not clip root layer's subtree to viewport
authorshawnsingh@chromium.org <shawnsingh@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Aug 2012 17:40:40 +0000 (17:40 +0000)
committershawnsingh@chromium.org <shawnsingh@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Aug 2012 17:40:40 +0000 (17:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=95235

Reviewed by Adrienne Walker.

Source/WebCore:

The root layer's renderSurface already correctly clips everything
to the viewport's bounds.  There are some useful reasons that we
should not cause the root layer itself to clip the subtree any
further, in particular so that surfaces can remain more cacheable,
and to make root layer semantics more homogeneous.

Existing tests updated, and otherwise this change is already
covered by layout and unit tests.

* platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
(WebCore::calculateDrawTransformsInternal):

Source/WebKit/chromium:

Existing tests updated, and otherwise this change is already
covered by layout and unit tests.

* tests/CCLayerTreeHostCommonTest.cpp:
* tests/CCOcclusionTrackerTest.cpp:
(WebKitTests::CCOcclusionTrackerTestChildInRotatedChild::runMyTest):
(WebKitTests::CCOcclusionTrackerTestVisitTargetTwoTimes::runMyTest):
(WebKitTests::CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren::runMyTest):
(WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblings::runMyTest):
(WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms::runMyTest):
(WebKitTests::CCOcclusionTrackerTestFilters::runMyTest):
(WebKitTests::CCOcclusionTrackerTestReplicaWithClipping::runMyTest):
(WebKitTests::CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect::runMyTest):
(WebKitTests::CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping::runMyTest):
(WebKitTests::CCOcclusionTrackerTestSurfaceChildOfClippingSurface::runMyTest):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp
Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp

index 3ef01a2..72ee3b7 100644 (file)
@@ -1,3 +1,22 @@
+2012-08-28  Shawn Singh  <shawnsingh@chromium.org>
+
+        [chromium] Do not clip root layer's subtree to viewport
+        https://bugs.webkit.org/show_bug.cgi?id=95235
+
+        Reviewed by Adrienne Walker.
+
+        The root layer's renderSurface already correctly clips everything
+        to the viewport's bounds.  There are some useful reasons that we
+        should not cause the root layer itself to clip the subtree any
+        further, in particular so that surfaces can remain more cacheable,
+        and to make root layer semantics more homogeneous.
+
+        Existing tests updated, and otherwise this change is already
+        covered by layout and unit tests.
+
+        * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
+        (WebCore::calculateDrawTransformsInternal):
+
 2012-08-28  David Hyatt  <hyatt@apple.com>
 
         [New Multicolumn] Implement column contents painting.
index 6898c97..2140df0 100644 (file)
@@ -613,15 +613,12 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
             // Layers that are not their own renderTarget will render into the target of their nearest ancestor.
             layer->setRenderTarget(layer->parent()->renderTarget());
         } else {
-            // FIXME: This root layer special case code should eventually go away. But before that is truly possible,
-            //        tests (or code) related to CCOcclusionTracker need to be adjusted so that they do not require
-            //        the rootLayer to clip; the root layer's RenderSurface would already clip and should be enough.
+            // FIXME: This root layer special case code should eventually go away. https://bugs.webkit.org/show_bug.cgi?id=92290
             ASSERT(!layer->parent());
             ASSERT(layer->renderSurface());
             ASSERT(ancestorClipsSubtree);
             layer->renderSurface()->setClipRect(clipRectFromAncestor);
-            subtreeShouldBeClipped = true;
-            clipRectForSubtree = clipRectFromAncestor;
+            subtreeShouldBeClipped = false;
         }
     }
 
index 2ec3a22..7d0fa65 100644 (file)
@@ -1,3 +1,26 @@
+2012-08-28  Shawn Singh  <shawnsingh@chromium.org>
+
+        [chromium] Do not clip root layer's subtree to viewport
+        https://bugs.webkit.org/show_bug.cgi?id=95235
+
+        Reviewed by Adrienne Walker.
+
+        Existing tests updated, and otherwise this change is already
+        covered by layout and unit tests.
+
+        * tests/CCLayerTreeHostCommonTest.cpp:
+        * tests/CCOcclusionTrackerTest.cpp:
+        (WebKitTests::CCOcclusionTrackerTestChildInRotatedChild::runMyTest):
+        (WebKitTests::CCOcclusionTrackerTestVisitTargetTwoTimes::runMyTest):
+        (WebKitTests::CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren::runMyTest):
+        (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblings::runMyTest):
+        (WebKitTests::CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms::runMyTest):
+        (WebKitTests::CCOcclusionTrackerTestFilters::runMyTest):
+        (WebKitTests::CCOcclusionTrackerTestReplicaWithClipping::runMyTest):
+        (WebKitTests::CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect::runMyTest):
+        (WebKitTests::CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping::runMyTest):
+        (WebKitTests::CCOcclusionTrackerTestSurfaceChildOfClippingSurface::runMyTest):
+
 2012-08-29  Julien Chaffraix  <jchaffraix@webkit.org>
 
         [Chromium] CCLayerTreeHostTestScrollChildLayer makes the wrong assumptions
index 0b5aa6b..c8d705e 100644 (file)
@@ -672,6 +672,7 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForRenderSurfaceWithClipp
     setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint(30, 30), IntSize(10, 10), false);
 
     parent->addChild(renderSurface1);
+    parent->setMasksToBounds(true);
     renderSurface1->addChild(child);
     renderSurface1->setForceRenderSurface(true);
 
index 4e5f9dc..171676f 100644 (file)
@@ -606,6 +606,7 @@ protected:
         childTransform.translate(-250, -250);
 
         typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+        parent->setMasksToBounds(true);
         typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), IntSize(500, 500));
         child->setMasksToBounds(true);
         typename Types::ContentLayerType* layer = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true);
@@ -685,6 +686,7 @@ protected:
         childTransform.translate(-250, -250);
 
         typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+        parent->setMasksToBounds(true);
         typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), IntSize(500, 500));
         child->setMasksToBounds(true);
         typename Types::ContentLayerType* layer = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true);
@@ -862,6 +864,7 @@ protected:
         childTransform.translate(-250, -250);
 
         typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+        parent->setMasksToBounds(true);
         typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), IntSize(500, 500));
         child->setMasksToBounds(true);
         typename Types::ContentLayerType* layer1 = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true);
@@ -950,6 +953,7 @@ protected:
         childTransform.translate(-250, -250);
 
         typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+        parent->setMasksToBounds(true);
         typename Types::LayerType* child1 = this->createSurface(parent, childTransform, FloatPoint(30, 30), IntSize(10, 10));
         typename Types::LayerType* child2 = this->createSurface(parent, childTransform, FloatPoint(20, 40), IntSize(10, 10));
         typename Types::ContentLayerType* layer1 = this->createDrawingLayer(child1, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true);
@@ -1064,6 +1068,7 @@ protected:
         child2Transform.translate(-250, -250);
 
         typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+        parent->setMasksToBounds(true);
         typename Types::LayerType* child1 = this->createSurface(parent, child1Transform, FloatPoint(30, 20), IntSize(10, 10));
         typename Types::LayerType* child2 = this->createDrawingSurface(parent, child2Transform, FloatPoint(20, 40), IntSize(10, 10), false);
         typename Types::ContentLayerType* layer1 = this->createDrawingLayer(child1, this->identityMatrix, FloatPoint(-10, -20), IntSize(510, 510), true);
@@ -1166,6 +1171,7 @@ protected:
         layerTransform.translate(-250, -250);
 
         typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+        parent->setMasksToBounds(true);
         typename Types::ContentLayerType* blurLayer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true);
         typename Types::ContentLayerType* opaqueLayer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true);
         typename Types::ContentLayerType* opacityLayer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true);
@@ -1275,6 +1281,7 @@ protected:
     void runMyTest()
     {
         typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 170));
+        parent->setMasksToBounds(true);
         typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true);
         this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 50), IntSize());
         this->calcDrawEtc(parent);
@@ -1955,6 +1962,7 @@ protected:
         transform.translate(-50, -50);
 
         typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+        parent->setMasksToBounds(true);
         typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, transform, FloatPoint(0, 0), IntSize(100, 100), true);
         parent->setPreserves3D(true);
         layer->setPreserves3D(true);
@@ -2221,6 +2229,7 @@ protected:
     void runMyTest()
     {
         typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
+        parent->setMasksToBounds(true);
         typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(500, 300), false);
         surface->setOpaqueContentsRect(IntRect(0, 0, 400, 200));
         this->calcDrawEtc(parent);
@@ -2462,6 +2471,7 @@ protected:
         // This test verifies that the surface cliprect does not end up empty and clip away the entire unoccluded rect.
 
         typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(80, 200));
+        parent->setMasksToBounds(true);
         typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true);
         typename Types::LayerType* surfaceChild = this->createDrawingSurface(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), false);
         typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true);