[chromium] A unit test to verify clipping is honored when moving occlusion to parent...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Mar 2012 22:29:21 +0000 (22:29 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Mar 2012 22:29:21 +0000 (22:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=81783

Patch by Dana Jansens <danakj@chromium.org> on 2012-03-27
Reviewed by Adrienne Walker.

* tests/CCOcclusionTrackerTest.cpp:
(WebCore::CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent::runMyTest):
(WebCore):
(CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping):
(WebCore::CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping::runMyTest):

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

Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp

index 411e46342bc6b7223381bb7b7b3b69f7a43d6557..d7259864117262476b8d58607d311f48c1242f9e 100644 (file)
@@ -1,3 +1,16 @@
+2012-03-27  Dana Jansens  <danakj@chromium.org>
+
+        [chromium] A unit test to verify clipping is honored when moving occlusion to parent surface
+        https://bugs.webkit.org/show_bug.cgi?id=81783
+
+        Reviewed by Adrienne Walker.
+
+        * tests/CCOcclusionTrackerTest.cpp:
+        (WebCore::CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent::runMyTest):
+        (WebCore):
+        (CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping):
+        (WebCore::CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping::runMyTest):
+
 2012-03-27  James Robinson  <jamesr@chromium.org>
 
         Scrollable plugins not registered properly in ScrollingCoordinator
 2012-03-27  James Robinson  <jamesr@chromium.org>
 
         Scrollable plugins not registered properly in ScrollingCoordinator
index 8d40d24ab01d37b09b66cd5f809753dd2f22c338..48fcf505b411ce462b65ad9407aec840acee797f 100644 (file)
@@ -1889,13 +1889,35 @@ protected:
         EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
         EXPECT_EQ_RECT(IntRect(0, 0, 400, 400), occlusion.occlusionInTargetSurface().bounds());
         EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
         EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
         EXPECT_EQ_RECT(IntRect(0, 0, 400, 400), occlusion.occlusionInTargetSurface().bounds());
         EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
+    }
+};
 
 
-        EXPECT_EQ_RECT(occlusion.occlusionInScreenSpace().bounds(), occlusion.occlusionInTargetSurface().bounds());
+MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent);
+
+template<class Types, bool opaqueLayers>
+class CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public CCOcclusionTrackerTest<Types, opaqueLayers> {
+protected:
+    void runMyTest()
+    {
+        typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
+        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);
+
+        TestCCOcclusionTrackerBase<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+
+        occlusion.enterTargetRenderSurface(surface->renderSurface());
+        occlusion.markOccludedBehindLayer(surface);
+        occlusion.finishedTargetRenderSurface(surface, surface->renderSurface());
+        occlusion.leaveToTargetRenderSurface(parent->renderSurface());
+
+        EXPECT_EQ_RECT(IntRect(0, 0, 300, 200), occlusion.occlusionInScreenSpace().bounds());
         EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
         EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
+        EXPECT_EQ_RECT(IntRect(0, 0, 300, 200), occlusion.occlusionInTargetSurface().bounds());
         EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
     }
 };
 
         EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
     }
 };
 
-MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent);
+MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping);
 
 } // namespace
 
 } // namespace