diff options
37 files changed, 705 insertions, 637 deletions
diff --git a/cc/CCDamageTrackerTest.cpp b/cc/CCDamageTrackerTest.cpp index cc1d0ba..fe44683 100644 --- a/cc/CCDamageTrackerTest.cpp +++ b/cc/CCDamageTrackerTest.cpp @@ -6,10 +6,10 @@ #include "CCDamageTracker.h" +#include "CCGeometryTestUtils.h" #include "CCLayerImpl.h" #include "CCLayerSorter.h" #include "CCLayerTreeHostCommon.h" -#include "CCLayerTreeTestCommon.h" #include "CCMathUtil.h" #include "CCSingleThreadProxy.h" #include <gtest/gtest.h> diff --git a/cc/CCLayerTreeHostCommonTest.cpp b/cc/CCLayerTreeHostCommonTest.cpp index 34c9940..02df09f 100644 --- a/cc/CCLayerTreeHostCommonTest.cpp +++ b/cc/CCLayerTreeHostCommonTest.cpp @@ -7,10 +7,10 @@ #include "CCLayerTreeHostCommon.h" #include "CCAnimationTestCommon.h" +#include "CCGeometryTestUtils.h" #include "CCLayerAnimationController.h" #include "CCLayerImpl.h" #include "CCLayerSorter.h" -#include "CCLayerTreeTestCommon.h" #include "CCMathUtil.h" #include "CCProxy.h" #include "CCSingleThreadProxy.h" @@ -27,27 +27,6 @@ using namespace WebCore; using namespace WebKitTests; using WebKit::WebTransformationMatrix; -void WebKitTests::ExpectTransformationMatrixEq(WebTransformationMatrix expected, - WebTransformationMatrix actual) -{ - EXPECT_FLOAT_EQ((expected).m11(), (actual).m11()); - EXPECT_FLOAT_EQ((expected).m12(), (actual).m12()); - EXPECT_FLOAT_EQ((expected).m13(), (actual).m13()); - EXPECT_FLOAT_EQ((expected).m14(), (actual).m14()); - EXPECT_FLOAT_EQ((expected).m21(), (actual).m21()); - EXPECT_FLOAT_EQ((expected).m22(), (actual).m22()); - EXPECT_FLOAT_EQ((expected).m23(), (actual).m23()); - EXPECT_FLOAT_EQ((expected).m24(), (actual).m24()); - EXPECT_FLOAT_EQ((expected).m31(), (actual).m31()); - EXPECT_FLOAT_EQ((expected).m32(), (actual).m32()); - EXPECT_FLOAT_EQ((expected).m33(), (actual).m33()); - EXPECT_FLOAT_EQ((expected).m34(), (actual).m34()); - EXPECT_FLOAT_EQ((expected).m41(), (actual).m41()); - EXPECT_FLOAT_EQ((expected).m42(), (actual).m42()); - EXPECT_FLOAT_EQ((expected).m43(), (actual).m43()); - EXPECT_FLOAT_EQ((expected).m44(), (actual).m44()); -} - namespace { template<typename LayerType> @@ -1459,9 +1438,9 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableContentRectForLayers) CCLayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, dummyMaxTextureSize, renderSurfaceLayerList); CCLayerTreeHostCommon::calculateVisibleRects(renderSurfaceLayerList); - EXPECT_INT_RECT_EQ(IntRect(IntPoint(5, 5), IntSize(10, 10)), grandChild1->drawableContentRect()); - EXPECT_INT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawableContentRect()); - EXPECT_INT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(IntPoint(5, 5), IntSize(10, 10)), grandChild1->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawableContentRect()); EXPECT_TRUE(grandChild4->drawableContentRect().isEmpty()); } @@ -1531,9 +1510,9 @@ TEST(CCLayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces) EXPECT_FALSE(grandChild4->renderSurface()); // Because grandChild4 is entirely clipped, it is expected to not have a renderSurface. // Surfaces are clipped by their parent, but un-affected by the owning layer's masksToBounds. - EXPECT_INT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild1->renderSurface()->clipRect()); - EXPECT_INT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild2->renderSurface()->clipRect()); - EXPECT_INT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild3->renderSurface()->clipRect()); + EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild1->renderSurface()->clipRect()); + EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild2->renderSurface()->clipRect()); + EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild3->renderSurface()->clipRect()); } TEST(CCLayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy) @@ -1688,7 +1667,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForIdentityTransform) IntRect layerContentRect = IntRect(IntPoint(10, 10), IntSize(30, 30)); IntRect expected = IntRect(IntPoint(10, 10), IntSize(30, 30)); IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); // Case 2: Layer is outside the surface rect. layerContentRect = IntRect(IntPoint(120, 120), IntSize(30, 30)); @@ -1699,7 +1678,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForIdentityTransform) layerContentRect = IntRect(IntPoint(80, 80), IntSize(30, 30)); expected = IntRect(IntPoint(80, 80), IntSize(20, 20)); actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); } TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForTranslations) @@ -1715,7 +1694,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForTranslations) layerToSurfaceTransform.translate(10, 10); IntRect expected = IntRect(IntPoint(0, 0), IntSize(30, 30)); IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); // Case 2: Layer is outside the surface rect. layerToSurfaceTransform.makeIdentity(); @@ -1728,7 +1707,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForTranslations) layerToSurfaceTransform.translate(80, 80); expected = IntRect(IntPoint(0, 0), IntSize(20, 20)); actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); } TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor2DRotations) @@ -1746,7 +1725,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor2DRotations) layerToSurfaceTransform.rotate(45); IntRect expected = IntRect(IntPoint(0, 0), IntSize(30, 30)); IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); // Case 2: Layer is outside the surface rect. layerToSurfaceTransform.makeIdentity(); @@ -1764,7 +1743,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor2DRotations) layerToSurfaceTransform.rotate(45); expected = IntRect(IntPoint(0, 0), IntSize(30, 30)); actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); // Case 4: The layer is rotated about its top-left corner, and translated upwards. In // surface space, the layer is oriented diagonally, with only the top corner @@ -1776,7 +1755,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor2DRotations) layerToSurfaceTransform.rotate(45); expected = IntRect(IntPoint(15, 0), IntSize(15, 30)); // right half of layer bounds. actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); } TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform) @@ -1792,7 +1771,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform) layerToSurfaceTransform.rotate3d(0, 45, 0); IntRect expected = IntRect(IntPoint(0, 0), IntSize(100, 100)); IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); // Case 2: Orthographic projection of a layer rotated about y-axis by 45 degrees, but // shifted to the side so only the right-half the layer would be visible on @@ -1803,7 +1782,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform) layerToSurfaceTransform.rotate3d(0, 45, 0); // rotates about the left edge of the layer expected = IntRect(IntPoint(50, 0), IntSize(50, 100)); // right half of the layer. actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); } TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveTransform) @@ -1830,7 +1809,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveTransform) IntRect expected = IntRect(IntPoint(-50, -50), IntSize(200, 200)); IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); // Case 2: same projection as before, except that the layer is also translated to the // side, so that only the right half of the layer should be visible. @@ -1843,7 +1822,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveTransform) layerToSurfaceTransform.translate3d(-200, 0, 0); expected = IntRect(IntPoint(50, -50), IntSize(100, 200)); // The right half of the layer's bounding rect. actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); } TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicIsNotClippedBehindSurface) @@ -1866,7 +1845,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicIsNotClippedBe IntRect expected = IntRect(IntPoint(0, 0), IntSize(100, 100)); IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); } TEST(CCLayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveWhenClippedByW) @@ -1932,7 +1911,7 @@ TEST(CCLayerTreeHostCommonTest, verifyVisibleRectForPerspectiveUnprojection) // that the entire layer should still be considered visible. IntRect expected = IntRect(IntPoint(-10, -10), IntSize(20, 20)); IntRect actual = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform); - EXPECT_INT_RECT_EQ(expected, actual); + EXPECT_RECT_EQ(expected, actual); } TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSimpleLayers) @@ -1953,21 +1932,21 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSimpleLay executeCalculateDrawTransformsAndVisibility(root.get()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); // Layers that do not draw content should have empty visibleContentRects. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); // layer visibleContentRects are clipped by their targetSurface - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 25, 25), child2->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 25, 25), child2->visibleContentRect()); EXPECT_TRUE(child3->visibleContentRect().isEmpty()); // layer drawableContentRects are not clipped. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), child1->drawableContentRect()); - EXPECT_INT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect()); - EXPECT_INT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect()); } TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersClippedByLayer) @@ -1994,21 +1973,21 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersCli ASSERT_FALSE(child->renderSurface()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); // Layers that do not draw content should have empty visibleContentRects. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), child->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), child->visibleContentRect()); // All grandchild visibleContentRects should be clipped by child. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), grandChild1->visibleContentRect()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 25, 25), grandChild2->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), grandChild1->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 25, 25), grandChild2->visibleContentRect()); EXPECT_TRUE(grandChild3->visibleContentRect().isEmpty()); // All grandchild drawableContentRects should also be clipped by child. - EXPECT_INT_RECT_EQ(IntRect(5, 5, 50, 50), grandChild1->drawableContentRect()); - EXPECT_INT_RECT_EQ(IntRect(75, 75, 25, 25), grandChild2->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(5, 5, 50, 50), grandChild1->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(75, 75, 25, 25), grandChild2->drawableContentRect()); EXPECT_TRUE(grandChild3->drawableContentRect().isEmpty()); } @@ -2036,24 +2015,24 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInU ASSERT_TRUE(renderSurface1->renderSurface()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); // Layers that do not draw content should have empty visibleContentRects. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect()); // An unclipped surface grows its drawableContentRect to include all drawable regions of the subtree. - EXPECT_INT_RECT_EQ(IntRect(5, 5, 170, 170), renderSurface1->renderSurface()->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(5, 5, 170, 170), renderSurface1->renderSurface()->drawableContentRect()); // All layers that draw content into the unclipped surface are also unclipped. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), child2->visibleContentRect()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), child3->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child2->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child3->visibleContentRect()); - EXPECT_INT_RECT_EQ(IntRect(5, 5, 50, 50), child1->drawableContentRect()); - EXPECT_INT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect()); - EXPECT_INT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(5, 5, 50, 50), child1->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect()); } TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInClippedRenderSurface) @@ -2081,26 +2060,26 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInC ASSERT_TRUE(renderSurface1->renderSurface()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); // Layers that do not draw content should have empty visibleContentRects. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect()); // A clipped surface grows its drawableContentRect to include all drawable regions of the subtree, // but also gets clamped by the ancestor's clip. - EXPECT_INT_RECT_EQ(IntRect(5, 5, 95, 95), renderSurface1->renderSurface()->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(5, 5, 95, 95), renderSurface1->renderSurface()->drawableContentRect()); // All layers that draw content into the surface have their visibleContentRect clipped by the surface clipRect. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 25, 25), child2->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 25, 25), child2->visibleContentRect()); EXPECT_TRUE(child3->visibleContentRect().isEmpty()); // But the drawableContentRects are unclipped. - EXPECT_INT_RECT_EQ(IntRect(5, 5, 50, 50), child1->drawableContentRect()); - EXPECT_INT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect()); - EXPECT_INT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(5, 5, 50, 50), child1->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect()); } TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSurfaceHierarchy) @@ -2134,32 +2113,32 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSurfaceHi ASSERT_TRUE(renderSurface1->renderSurface()); ASSERT_TRUE(renderSurface2->renderSurface()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); // Layers that do not draw content should have empty visibleContentRects. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface2->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface2->visibleContentRect()); // A clipped surface grows its drawableContentRect to include all drawable regions of the subtree, // but also gets clamped by the ancestor's clip. - EXPECT_INT_RECT_EQ(IntRect(5, 5, 95, 95), renderSurface1->renderSurface()->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(5, 5, 95, 95), renderSurface1->renderSurface()->drawableContentRect()); // renderSurface1 lives in the "unclipped universe" of renderSurface1, and is only // implicitly clipped by renderSurface1's contentRect. So, renderSurface2 grows to // enclose all drawable content of its subtree. - EXPECT_INT_RECT_EQ(IntRect(5, 5, 170, 170), renderSurface2->renderSurface()->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(5, 5, 170, 170), renderSurface2->renderSurface()->drawableContentRect()); // All layers that draw content into renderSurface2 think they are unclipped. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), child2->visibleContentRect()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), child3->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child2->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child3->visibleContentRect()); // drawableContentRects are also unclipped. - EXPECT_INT_RECT_EQ(IntRect(5, 5, 50, 50), child1->drawableContentRect()); - EXPECT_INT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect()); - EXPECT_INT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(5, 5, 50, 50), child1->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect()); } TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransformOnUnclippedSurface) @@ -2185,21 +2164,21 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransfor ASSERT_TRUE(renderSurface1->renderSurface()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect()); // Layers that do not draw content should have empty visibleContentRects. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect()); // The unclipped surface grows its drawableContentRect to include all drawable regions of the subtree. int diagonalRadius = ceil(sqrt(2.0) * 25); IntRect expectedSurfaceDrawableContent = IntRect(50 - diagonalRadius, 50 - diagonalRadius, diagonalRadius * 2, diagonalRadius * 2); - EXPECT_INT_RECT_EQ(expectedSurfaceDrawableContent, renderSurface1->renderSurface()->drawableContentRect()); + EXPECT_RECT_EQ(expectedSurfaceDrawableContent, renderSurface1->renderSurface()->drawableContentRect()); // All layers that draw content into the unclipped surface are also unclipped. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); - EXPECT_INT_RECT_EQ(expectedSurfaceDrawableContent, child1->drawableContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect()); + EXPECT_RECT_EQ(expectedSurfaceDrawableContent, child1->drawableContentRect()); } TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransformOnClippedSurface) @@ -2230,15 +2209,15 @@ TEST(CCLayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransfor int diagonalRadius = ceil(sqrt(2.0) * 25); IntRect unclippedSurfaceContent = IntRect(50 - diagonalRadius, 50 - diagonalRadius, diagonalRadius * 2, diagonalRadius * 2); IntRect expectedSurfaceDrawableContent = intersection(unclippedSurfaceContent, IntRect(0, 0, 50, 50)); - EXPECT_INT_RECT_EQ(expectedSurfaceDrawableContent, renderSurface1->renderSurface()->drawableContentRect()); + EXPECT_RECT_EQ(expectedSurfaceDrawableContent, renderSurface1->renderSurface()->drawableContentRect()); // On the clipped surface, only a quarter of the child1 is visible, but when rotating // it back to child1's content space, the actual enclosing rect ends up covering the // full left half of child1. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 26, 50), child1->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 26, 50), child1->visibleContentRect()); // The child's drawableContentRect is unclipped. - EXPECT_INT_RECT_EQ(unclippedSurfaceContent, child1->drawableContentRect()); + EXPECT_RECT_EQ(unclippedSurfaceContent, child1->drawableContentRect()); } TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d) @@ -2881,7 +2860,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents // Sanity check the scenario we just created. // The visibleContentRect for testLayer is actually 100x100, even though its layout size is 50x50, positioned at 25x25. CCLayerImpl* testLayer = root->children()[0].get(); - EXPECT_INT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), testLayer->visibleContentRect()); + EXPECT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), testLayer->visibleContentRect()); ASSERT_EQ(1u, renderSurfaceLayerList.size()); ASSERT_EQ(1u, root->renderSurface()->layerList().size()); @@ -3502,7 +3481,7 @@ TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI) WebTransformationMatrix expectedDuplicateChildDrawTransform = child->drawTransform(); EXPECT_TRANSFORMATION_MATRIX_EQ(child->drawTransform(), duplicateChildNonOwner->drawTransform()); EXPECT_TRANSFORMATION_MATRIX_EQ(child->screenSpaceTransform(), duplicateChildNonOwner->screenSpaceTransform()); - EXPECT_INT_RECT_EQ(child->drawableContentRect(), duplicateChildNonOwner->drawableContentRect()); + EXPECT_RECT_EQ(child->drawableContentRect(), duplicateChildNonOwner->drawableContentRect()); EXPECT_EQ(child->contentBounds(), duplicateChildNonOwner->contentBounds()); WebTransformationMatrix expectedRenderSurfaceDrawTransform; diff --git a/cc/CCLayerTreeHostImplTest.cpp b/cc/CCLayerTreeHostImplTest.cpp index bad5782..f46cfda 100644 --- a/cc/CCLayerTreeHostImplTest.cpp +++ b/cc/CCLayerTreeHostImplTest.cpp @@ -7,12 +7,12 @@ #include "CCLayerTreeHostImpl.h" #include "CCAnimationTestCommon.h" +#include "CCGeometryTestUtils.h" #include "CCHeadsUpDisplayLayerImpl.h" #include "CCIOSurfaceLayerImpl.h" #include "CCLayerImpl.h" #include "CCLayerTestCommon.h" #include "CCLayerTilingData.h" -#include "CCLayerTreeTestCommon.h" #include "CCQuadSink.h" #include "CCRenderPassDrawQuad.h" #include "CCRendererGL.h" @@ -2800,7 +2800,7 @@ TEST_F(CCLayerTreeHostImplTest, textureCachingWithClipping) EXPECT_LT(quadVisibleRect.width(), 100); // Verify that the render surface texture is *not* clipped. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), frame.renderPasses[0]->outputRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), frame.renderPasses[0]->outputRect()); EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get()); diff --git a/cc/CCLayerTreeHostTest.cpp b/cc/CCLayerTreeHostTest.cpp index 794760f..4debcb1 100644 --- a/cc/CCLayerTreeHostTest.cpp +++ b/cc/CCLayerTreeHostTest.cpp @@ -6,6 +6,7 @@ #include "CCLayerTreeHost.h" +#include "CCGeometryTestUtils.h" #include "CCGraphicsContext.h" #include "CCLayerTreeHostImpl.h" #include "CCOcclusionTrackerTestCommon.h" @@ -27,12 +28,6 @@ using namespace WebCore; using namespace WebKit; using namespace WebKitTests; -#define EXPECT_EQ_RECT(a, b) \ - EXPECT_EQ(a.x(), b.x()); \ - EXPECT_EQ(a.y(), b.y()); \ - EXPECT_EQ(a.width(), b.width()); \ - EXPECT_EQ(a.height(), b.height()); - namespace { class CCLayerTreeHostTest : public CCThreadedTest { }; @@ -1326,7 +1321,7 @@ public: ASSERT_EQ(2u, root->renderSurface()->layerList().size()); // The root render surface is the size of the viewport. - EXPECT_EQ_RECT(IntRect(0, 0, 60, 60), root->renderSurface()->contentRect()); + EXPECT_RECT_EQ(IntRect(0, 0, 60, 60), root->renderSurface()->contentRect()); WebTransformationMatrix scaleTransform; scaleTransform.scale(impl->deviceScaleFactor()); @@ -1666,11 +1661,11 @@ public: m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); - EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), rootLayer->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), rootLayer->occludedScreenSpace().bounds()); EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); // If the child layer is opaque, then it adds to the occlusion seen by the rootLayer. @@ -1683,11 +1678,11 @@ public: m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); - EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 170, 170), rootLayer->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 170, 170), rootLayer->occludedScreenSpace().bounds()); EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); // Add a second child to the root layer and the regions should merge @@ -1701,13 +1696,13 @@ public: m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); - EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 170, 170), child2->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 170, 170), child2->occludedScreenSpace().bounds()); EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 20, 170, 180), rootLayer->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 20, 170, 180), rootLayer->occludedScreenSpace().bounds()); EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size()); // Move the second child to be sure. @@ -1721,13 +1716,13 @@ public: m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); - EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 30, 170, 170), child2->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 170, 170), child2->occludedScreenSpace().bounds()); EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 30, 190, 170), rootLayer->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 30, 190, 170), rootLayer->occludedScreenSpace().bounds()); EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size()); // If the child layer has a mask on it, then it shouldn't contribute to occlusion on stuff below it @@ -1743,13 +1738,13 @@ public: m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); - EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); // If the child layer with a mask is below child2, then child2 should contribute to occlusion on everything, and child shouldn't contribute to the rootLayer @@ -1765,13 +1760,13 @@ public: m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); - EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds()); EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 40, 190, 160), child->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 40, 190, 160), child->occludedScreenSpace().bounds()); EXPECT_EQ(2u, child->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); // If the child layer has a non-opaque drawOpacity, then it shouldn't contribute to occlusion on stuff below it @@ -1788,13 +1783,13 @@ public: m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); - EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); // If the child layer with non-opaque drawOpacity is below child2, then child2 should contribute to occlusion on everything, and child shouldn't contribute to the rootLayer @@ -1811,13 +1806,13 @@ public: m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); - EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds()); EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 40, 190, 160), child->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 40, 190, 160), child->occludedScreenSpace().bounds()); EXPECT_EQ(2u, child->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); // Kill the layerTreeHost immediately. @@ -1874,13 +1869,13 @@ public: m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); - EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds()); EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 40, 190, 160), child->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 40, 190, 160), child->occludedScreenSpace().bounds()); EXPECT_EQ(2u, child->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); // If the child layer has a filter that moves pixels/changes alpha, and is below child2, then child should not inherit occlusion from outside its subtree, @@ -1901,13 +1896,13 @@ public: m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); m_layerTreeHost->commitComplete(); - EXPECT_EQ_RECT(IntRect(), child2->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds()); EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(), grandChild->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds()); EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds()); EXPECT_EQ(1u, child->occludedScreenSpace().rects().size()); - EXPECT_EQ_RECT(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds()); EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size()); // Kill the layerTreeHost immediately. @@ -1966,7 +1961,7 @@ public: for (int i = 0; i < numSurfaces-1; ++i) { IntRect expectedOcclusion(i+1, i+1, 200-i-1, 200-i-1); - EXPECT_EQ_RECT(expectedOcclusion, layers[i]->occludedScreenSpace().bounds()); + EXPECT_RECT_EQ(expectedOcclusion, layers[i]->occludedScreenSpace().bounds()); EXPECT_EQ(1u, layers[i]->occludedScreenSpace().rects().size()); } diff --git a/cc/CCMathUtilTest.cpp b/cc/CCMathUtilTest.cpp index e56fa3c..663731f 100644 --- a/cc/CCMathUtilTest.cpp +++ b/cc/CCMathUtilTest.cpp @@ -6,7 +6,7 @@ #include "CCMathUtil.h" -#include "CCLayerTreeTestCommon.h" +#include "CCGeometryTestUtils.h" #include "FloatRect.h" #include <gmock/gmock.h> #include <gtest/gtest.h> diff --git a/cc/CCOcclusionTrackerTest.cpp b/cc/CCOcclusionTrackerTest.cpp index f52ce09..e5155da 100644 --- a/cc/CCOcclusionTrackerTest.cpp +++ b/cc/CCOcclusionTrackerTest.cpp @@ -7,10 +7,10 @@ #include "CCOcclusionTracker.h" #include "CCAnimationTestCommon.h" +#include "CCGeometryTestUtils.h" #include "CCLayerAnimationController.h" #include "CCLayerImpl.h" #include "CCLayerTreeHostCommon.h" -#include "CCLayerTreeTestCommon.h" #include "CCMathUtil.h" #include "CCOcclusionTrackerTestCommon.h" #include "CCOverdrawMetrics.h" @@ -426,9 +426,9 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 70, 70))); @@ -446,14 +446,14 @@ protected: occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70, 70)).isEmpty()); - EXPECT_INT_RECT_EQ(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 29, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 29, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 31, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 31, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 31, 70, 70))); + EXPECT_RECT_EQ(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 70, 70))); + EXPECT_RECT_EQ(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 29, 70, 70))); + EXPECT_RECT_EQ(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); + EXPECT_RECT_EQ(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 29, 70, 70))); + EXPECT_RECT_EQ(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 70, 70))); + EXPECT_RECT_EQ(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 31, 70, 70))); + EXPECT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 31, 70, 70))); + EXPECT_RECT_EQ(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 31, 70, 70))); } }; @@ -479,9 +479,9 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 70, 70))); @@ -499,14 +499,14 @@ protected: occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70, 70)).isEmpty()); - EXPECT_INT_RECT_EQ(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 29, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 29, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 31, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 31, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 31, 70, 70))); + EXPECT_RECT_EQ(IntRect(29, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 70, 70))); + EXPECT_RECT_EQ(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 29, 70, 70))); + EXPECT_RECT_EQ(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); + EXPECT_RECT_EQ(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 29, 70, 70))); + EXPECT_RECT_EQ(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 70, 70))); + EXPECT_RECT_EQ(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(31, 31, 70, 70))); + EXPECT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 31, 70, 70))); + EXPECT_RECT_EQ(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(parent, IntRect(29, 31, 70, 70))); } }; @@ -530,9 +530,9 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(50, 50, 50, 50))); @@ -550,25 +550,25 @@ protected: occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 50, 50, 50)).isEmpty()); - EXPECT_INT_RECT_EQ(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 50, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 49, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 49, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(51, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 49, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(100, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 50, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(51, 51, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 51, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(50, 100, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 51, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(49, 51, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 51, 50, 50))); + EXPECT_RECT_EQ(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 50, 50, 50))); + EXPECT_RECT_EQ(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 49, 50, 50))); + EXPECT_RECT_EQ(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 49, 50, 50))); + EXPECT_RECT_EQ(IntRect(51, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 49, 50, 50))); + EXPECT_RECT_EQ(IntRect(100, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 50, 50, 50))); + EXPECT_RECT_EQ(IntRect(51, 51, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(51, 51, 50, 50))); + EXPECT_RECT_EQ(IntRect(50, 100, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 51, 50, 50))); + EXPECT_RECT_EQ(IntRect(49, 51, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 51, 50, 50))); occlusion.useDefaultLayerClipRect(); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 50, 50, 50)).isEmpty()); - EXPECT_INT_RECT_EQ(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 50, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 49, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 49, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(51, 49, 49, 1), occlusion.unoccludedContentRect(parent, IntRect(51, 49, 50, 50))); + EXPECT_RECT_EQ(IntRect(49, 50, 1, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 50, 50, 50))); + EXPECT_RECT_EQ(IntRect(49, 49, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(49, 49, 50, 50))); + EXPECT_RECT_EQ(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(parent, IntRect(50, 49, 50, 50))); + EXPECT_RECT_EQ(IntRect(51, 49, 49, 1), occlusion.unoccludedContentRect(parent, IntRect(51, 49, 50, 50))); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(51, 50, 50, 50)).isEmpty()); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(51, 51, 50, 50)).isEmpty()); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 51, 50, 50)).isEmpty()); - EXPECT_INT_RECT_EQ(IntRect(49, 51, 1, 49), occlusion.unoccludedContentRect(parent, IntRect(49, 51, 50, 50))); + EXPECT_RECT_EQ(IntRect(49, 51, 1, 49), occlusion.unoccludedContentRect(parent, IntRect(49, 51, 50, 50))); occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); } }; @@ -598,17 +598,17 @@ protected: this->visitLayer(layer, occlusion); this->enterContributingSurface(child, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->leaveContributingSurface(child, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 40, 70, 60))); @@ -680,36 +680,36 @@ protected: this->visitLayer(child2, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(layer, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->enterContributingSurface(child, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // Occlusion in |child2| should get merged with the |child| surface we are leaving now. this->leaveContributingSurface(child, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 30, 70, 70))); - EXPECT_INT_RECT_EQ(IntRect(90, 30, 10, 10), occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70, 70))); + EXPECT_RECT_EQ(IntRect(90, 30, 10, 10), occlusion.unoccludedContentRect(parent, IntRect(30, 30, 70, 70))); EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 30, 60, 10))); EXPECT_FALSE(occlusion.occluded(parent, IntRect(29, 30, 60, 10))); @@ -722,21 +722,21 @@ protected: EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 39, 70, 60))); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 30, 60, 10)).isEmpty()); - EXPECT_INT_RECT_EQ(IntRect(29, 30, 1, 10), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 60, 10))); - EXPECT_INT_RECT_EQ(IntRect(30, 29, 60, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 60, 10))); - EXPECT_INT_RECT_EQ(IntRect(90, 30, 1, 10), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 60, 10))); + EXPECT_RECT_EQ(IntRect(29, 30, 1, 10), occlusion.unoccludedContentRect(parent, IntRect(29, 30, 60, 10))); + EXPECT_RECT_EQ(IntRect(30, 29, 60, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 60, 10))); + EXPECT_RECT_EQ(IntRect(90, 30, 1, 10), occlusion.unoccludedContentRect(parent, IntRect(31, 30, 60, 10))); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 31, 60, 10)).isEmpty()); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 40, 70, 60)).isEmpty()); - EXPECT_INT_RECT_EQ(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(29, 40, 70, 60))); + EXPECT_RECT_EQ(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(29, 40, 70, 60))); // This rect is mostly occluded by |child2|. - EXPECT_INT_RECT_EQ(IntRect(90, 39, 10, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 39, 70, 60))); + EXPECT_RECT_EQ(IntRect(90, 39, 10, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 39, 70, 60))); // This rect extends past top/right ends of |child2|. - EXPECT_INT_RECT_EQ(IntRect(30, 29, 70, 11), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); + EXPECT_RECT_EQ(IntRect(30, 29, 70, 11), occlusion.unoccludedContentRect(parent, IntRect(30, 29, 70, 70))); // This rect extends past left/right ends of |child2|. - EXPECT_INT_RECT_EQ(IntRect(20, 39, 80, 60), occlusion.unoccludedContentRect(parent, IntRect(20, 39, 80, 60))); - EXPECT_INT_RECT_EQ(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(31, 40, 70, 60))); - EXPECT_INT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 41, 70, 60))); + EXPECT_RECT_EQ(IntRect(20, 39, 80, 60), occlusion.unoccludedContentRect(parent, IntRect(20, 39, 80, 60))); + EXPECT_RECT_EQ(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(31, 40, 70, 60))); + EXPECT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 41, 70, 60))); /* Justification for the above occlusion from |layer|: 100 @@ -794,9 +794,9 @@ protected: this->visitLayer(layer, occlusion); this->enterContributingSurface(child, occlusion); - EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(clippedLayerInChild, occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(clippedLayerInChild, occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child, clippedLayerInChild)); @@ -821,13 +821,13 @@ protected: this->leaveContributingSurface(child, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(75, 55, 1, 1))); - EXPECT_INT_RECT_EQ(IntRect(75, 55, 1, 1), occlusion.unoccludedContentRect(parent, IntRect(75, 55, 1, 1))); + EXPECT_RECT_EQ(IntRect(75, 55, 1, 1), occlusion.unoccludedContentRect(parent, IntRect(75, 55, 1, 1))); } }; @@ -858,9 +858,9 @@ protected: this->visitLayer(layer1, occlusion); this->enterContributingSurface(child, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child, IntRect(10, 430, 60, 70))); @@ -870,17 +870,17 @@ protected: EXPECT_FALSE(occlusion.occluded(child, IntRect(10, 431, 60, 70))); EXPECT_TRUE(occlusion.unoccludedContentRect(child, IntRect(10, 430, 60, 70)).isEmpty()); - EXPECT_INT_RECT_EQ(IntRect(9, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 70))); - EXPECT_INT_RECT_EQ(IntRect(10, 429, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 429, 60, 70))); - EXPECT_INT_RECT_EQ(IntRect(70, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(11, 430, 60, 70))); - EXPECT_INT_RECT_EQ(IntRect(10, 500, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 431, 60, 70))); + EXPECT_RECT_EQ(IntRect(9, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 70))); + EXPECT_RECT_EQ(IntRect(10, 429, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 429, 60, 70))); + EXPECT_RECT_EQ(IntRect(70, 430, 1, 70), occlusion.unoccludedContentRect(child, IntRect(11, 430, 60, 70))); + EXPECT_RECT_EQ(IntRect(10, 500, 60, 1), occlusion.unoccludedContentRect(child, IntRect(10, 431, 60, 70))); this->leaveContributingSurface(child, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(30, 40, 70, 60))); @@ -888,10 +888,10 @@ protected: EXPECT_FALSE(occlusion.occluded(parent, IntRect(30, 39, 70, 60))); EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(30, 40, 70, 60)).isEmpty()); - EXPECT_INT_RECT_EQ(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(29, 40, 70, 60))); - EXPECT_INT_RECT_EQ(IntRect(30, 39, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 39, 70, 60))); - EXPECT_INT_RECT_EQ(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(31, 40, 70, 60))); - EXPECT_INT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 41, 70, 60))); + EXPECT_RECT_EQ(IntRect(29, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(29, 40, 70, 60))); + EXPECT_RECT_EQ(IntRect(30, 39, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 39, 70, 60))); + EXPECT_RECT_EQ(IntRect(100, 40, 1, 60), occlusion.unoccludedContentRect(parent, IntRect(31, 40, 70, 60))); + EXPECT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(parent, IntRect(30, 41, 70, 60))); /* Justification for the above occlusion from |layer1| and |layer2|: @@ -946,9 +946,9 @@ protected: this->visitLayer(layer2, occlusion); this->enterContributingSurface(child2, occlusion); - EXPECT_INT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 70, 80))); @@ -966,15 +966,15 @@ protected: occlusion.setLayerClipRect(IntRect(-20, -20, 1000, 1000)); // There is nothing above child2's surface in the z-order. - EXPECT_INT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2, false, IntRect(-10, 420, 70, 80))); + EXPECT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2, false, IntRect(-10, 420, 70, 80))); this->leaveContributingSurface(child2, occlusion); this->visitLayer(layer1, occlusion); this->enterContributingSurface(child1, occlusion); - EXPECT_INT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(-10, 430, 80, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(-10, 430, 80, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child1, IntRect(-10, 430, 80, 70))); @@ -984,14 +984,14 @@ protected: EXPECT_FALSE(occlusion.occluded(child1, IntRect(-10, 430, 80, 71))); // child2's contents will occlude child1 below it. - EXPECT_INT_RECT_EQ(IntRect(-10, 430, 10, 70), occlusion.unoccludedContributingSurfaceContentRect(child1, false, IntRect(-10, 430, 80, 70))); + EXPECT_RECT_EQ(IntRect(-10, 430, 10, 70), occlusion.unoccludedContributingSurfaceContentRect(child1, false, IntRect(-10, 430, 80, 70))); this->leaveContributingSurface(child1, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(20, 20, 80, 80))); @@ -1061,9 +1061,9 @@ protected: this->visitLayer(layer2, occlusion); this->enterLayer(child2, occlusion); - EXPECT_INT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child2, IntRect(-10, 420, 70, 80))); @@ -1076,15 +1076,15 @@ protected: this->enterContributingSurface(child2, occlusion); // There is nothing above child2's surface in the z-order. - EXPECT_INT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2, false, IntRect(-10, 420, 70, 80))); + EXPECT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2, false, IntRect(-10, 420, 70, 80))); this->leaveContributingSurface(child2, occlusion); this->visitLayer(layer1, occlusion); this->enterContributingSurface(child1, occlusion); - EXPECT_INT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(420, -20, 80, 90), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(420, -20, 80, 90), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(child1, IntRect(420, -20, 80, 90))); @@ -1094,16 +1094,16 @@ protected: EXPECT_FALSE(occlusion.occluded(child1, IntRect(421, -20, 80, 90))); // child2's contents will occlude child1 below it. - EXPECT_INT_RECT_EQ(IntRect(420, -20, 80, 90), occlusion.unoccludedContributingSurfaceContentRect(child1, false, IntRect(420, -20, 80, 90))); - EXPECT_INT_RECT_EQ(IntRect(490, -10, 10, 80), occlusion.unoccludedContributingSurfaceContentRect(child1, false, IntRect(420, -10, 80, 90))); - EXPECT_INT_RECT_EQ(IntRect(420, -20, 70, 10), occlusion.unoccludedContributingSurfaceContentRect(child1, false, IntRect(420, -20, 70, 90))); + EXPECT_RECT_EQ(IntRect(420, -20, 80, 90), occlusion.unoccludedContributingSurfaceContentRect(child1, false, IntRect(420, -20, 80, 90))); + EXPECT_RECT_EQ(IntRect(490, -10, 10, 80), occlusion.unoccludedContributingSurfaceContentRect(child1, false, IntRect(420, -10, 80, 90))); + EXPECT_RECT_EQ(IntRect(420, -20, 70, 10), occlusion.unoccludedContributingSurfaceContentRect(child1, false, IntRect(420, -20, 70, 90))); this->leaveContributingSurface(child1, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); EXPECT_TRUE(occlusion.occluded(parent, IntRect(10, 20, 90, 80))); @@ -1189,16 +1189,16 @@ protected: this->visitLayer(opaqueLayer, occlusion); this->enterContributingSurface(opaqueLayer, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 430, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 430, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // And it gets translated to the parent surface. this->leaveContributingSurface(opaqueLayer, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // The blur layer needs to throw away any occlusion from outside its subtree. @@ -1215,9 +1215,9 @@ protected: // But the opaque layer's occlusion is preserved on the parent. this->leaveContributingSurface(blurLayer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -1239,16 +1239,16 @@ protected: this->visitLayer(surface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitContributingSurface(surface, occlusion); this->enterLayer(parent, occlusion); // The surface and replica should both be occluding the parent. - EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -1271,16 +1271,16 @@ protected: this->visitLayer(surface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitContributingSurface(surface, occlusion); this->enterLayer(parent, occlusion); // The surface and replica should both be occluding the parent. - EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 70), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 100, 100, 70), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -1303,16 +1303,16 @@ protected: this->visitLayer(surface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitContributingSurface(surface, occlusion); this->enterLayer(parent, occlusion); // The replica should not be occluding the parent, since it has a mask applied to it. - EXPECT_INT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -1357,7 +1357,7 @@ protected: EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -1401,7 +1401,7 @@ protected: EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -1518,11 +1518,11 @@ protected: EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); - EXPECT_INT_RECT_EQ(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 100))); - EXPECT_INT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300, 100))); - EXPECT_INT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(200, 100, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent, IntRect(100, 200, 100, 100))); + EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 100))); + EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300, 100))); + EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(200, 100, 100, 100))); + EXPECT_RECT_EQ(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent, IntRect(100, 200, 100, 100))); } }; @@ -1561,11 +1561,11 @@ protected: EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); - EXPECT_INT_RECT_EQ(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 100))); - EXPECT_INT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300, 100))); - EXPECT_INT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(200, 100, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent, IntRect(100, 200, 100, 100))); + EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 100))); + EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300, 100))); + EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRect(parent, IntRect(200, 100, 100, 100))); + EXPECT_RECT_EQ(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRect(parent, IntRect(100, 200, 100, 100))); } }; @@ -1734,7 +1734,7 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(100, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(100, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); @@ -1750,7 +1750,7 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(120, 120, 180, 180), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(120, 120, 180, 180), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); @@ -1766,7 +1766,7 @@ protected: this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(250, 250, 50, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(250, 250, 50, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); @@ -1795,7 +1795,7 @@ protected: this->enterLayer(layer, occlusion); // The layer is rotated in 3d but without preserving 3d, so it only gets resized. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200))); + EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200))); } }; @@ -1860,7 +1860,7 @@ protected: TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); this->enterLayer(layer, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200))); + EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(layer, IntRect(0, 0, 200, 200))); } }; @@ -1954,9 +1954,9 @@ protected: // Ensure that those pixels don't occlude things outside the clipRect. this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); } }; @@ -1990,27 +1990,27 @@ protected: this->visitLayer(topmost, occlusion); this->enterLayer(parent2, occlusion); // This occlusion will affect all surfaces. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent2, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent2, IntRect(0, 0, 300, 300))); this->leaveLayer(parent2, occlusion); this->visitLayer(surfaceChild2, occlusion); this->enterLayer(surfaceChild, occlusion); - EXPECT_INT_RECT_EQ(IntRect(100, 0, 100, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(100, 0, 100, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); this->leaveLayer(surfaceChild, occlusion); this->enterLayer(surface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); this->leaveLayer(surface, occlusion); this->enterContributingSurface(surface, occlusion); // Occlusion within the surface is lost when leaving the animating surface. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 300, 300))); this->leaveContributingSurface(surface, occlusion); this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); // Occlusion is not added for the animating |layer|. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -2042,27 +2042,27 @@ protected: this->visitLayer(topmost, occlusion); this->enterLayer(parent2, occlusion); // This occlusion will affect all surfaces. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); this->leaveLayer(parent2, occlusion); this->visitLayer(surfaceChild2, occlusion); this->enterLayer(surfaceChild, occlusion); - EXPECT_INT_RECT_EQ(IntRect(100, 0, 100, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(100, 0, 100, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 300, 300))); this->leaveLayer(surfaceChild, occlusion); this->enterLayer(surface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); this->leaveLayer(surface, occlusion); this->enterContributingSurface(surface, occlusion); // Occlusion within the surface is lost when leaving the animating surface. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 300, 300))); this->leaveContributingSurface(surface, occlusion); this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); // Occlusion is not added for the animating |layer|. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -2100,7 +2100,7 @@ protected: this->visitLayer(surface2, occlusion); this->enterContributingSurface(surface2, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); this->leaveContributingSurface(surface2, occlusion); @@ -2108,53 +2108,53 @@ protected: // surfaceChild2 is moving in screen space but not relative to its target, so occlusion should happen in its target space only. // It also means that things occluding in screen space (e.g. surface2) cannot occlude this layer. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.unoccludedContentRect(surfaceChild2, IntRect(0, 0, 100, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.unoccludedContentRect(surfaceChild2, IntRect(0, 0, 100, 300))); EXPECT_FALSE(occlusion.occluded(surfaceChild, IntRect(0, 0, 50, 300))); this->leaveLayer(surfaceChild2, occlusion); this->enterLayer(surfaceChild, occlusion); EXPECT_FALSE(occlusion.occluded(surfaceChild, IntRect(0, 0, 100, 300))); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(100, 0, 200, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(100, 0, 200, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); // The surfaceChild is occluded by the surfaceChild2, but is moving relative its target and the screen, so it // can't be occluded. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 200, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 200, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 200, 300), occlusion.unoccludedContentRect(surfaceChild, IntRect(0, 0, 200, 300))); EXPECT_FALSE(occlusion.occluded(surfaceChild, IntRect(0, 0, 50, 300))); this->leaveLayer(surfaceChild, occlusion); this->enterLayer(surface, occlusion); // The surfaceChild is moving in screen space but not relative to its target, so occlusion should happen in its target space only. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(100, 0, 200, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(100, 0, 200, 300), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); this->leaveLayer(surface, occlusion); // The surface's owning layer is moving in screen space but not relative to its target, so occlusion should happen in its target space only. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 300), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 300), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.unoccludedContentRect(surface, IntRect(0, 0, 300, 300))); this->enterContributingSurface(surface, occlusion); // The contributing |surface| is animating so it can't be occluded. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 300), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 300), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 300, 300))); this->leaveContributingSurface(surface, occlusion); this->enterLayer(layer, occlusion); // The |surface| is moving in the screen and in its target, so all occlusion within the surface is lost when leaving it. - EXPECT_INT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); this->leaveLayer(layer, occlusion); this->enterLayer(parent, occlusion); // The |layer| is animating in the screen and in its target, so no occlusion is added. - EXPECT_INT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); + EXPECT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 300))); } }; @@ -2182,9 +2182,9 @@ protected: this->visitLayer(surface2, occlusion); this->visitContributingSurface(surface2, occlusion); - EXPECT_INT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // Clear any stored occlusion. @@ -2194,9 +2194,9 @@ protected: this->visitLayer(surface, occlusion); this->visitContributingSurface(surface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -2219,9 +2219,9 @@ protected: this->visitLayer(surface, occlusion); this->visitContributingSurface(surface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -2245,22 +2245,22 @@ protected: // |topmost| occludes the replica, but not the surface itself. this->visitLayer(topmost, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(surface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->enterContributingSurface(surface, occlusion); // Surface is not occluded so it shouldn't think it is. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); } }; @@ -2283,23 +2283,23 @@ protected: // |topmost| occludes the surface, but not the entire surface's replica. this->visitLayer(topmost, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(surface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->enterContributingSurface(surface, occlusion); // Surface is occluded, but only the top 10px of the replica. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(0, 10, 100, 90), occlusion.unoccludedContributingSurfaceContentRect(surface, true, IntRect(0, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(0, 10, 100, 90), occlusion.unoccludedContributingSurfaceContentRect(surface, true, IntRect(0, 0, 100, 100))); } }; @@ -2324,23 +2324,23 @@ protected: this->visitLayer(overReplica, occlusion); this->visitLayer(overSurface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(surface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->enterContributingSurface(surface, occlusion); // Surface and replica are occluded different amounts. - EXPECT_INT_RECT_EQ(IntRect(40, 0, 60, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(50, 0, 50, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, true, IntRect(0, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(40, 0, 60, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(50, 0, 50, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, true, IntRect(0, 0, 100, 100))); } }; @@ -2364,18 +2364,18 @@ protected: // |topmost| occludes everything partially so we know occlusion is happening at all. this->visitLayer(topmost, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(surfaceChild, occlusion); // surfaceChild increases the occlusion in the screen by a narrow sliver. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); // In its own surface, surfaceChild is at 0,0 as is its occlusion. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // The root layer always has a clipRect. So the parent of |surface| has a clipRect. However, the owning layer for |surface| does not @@ -2385,20 +2385,20 @@ protected: this->enterContributingSurface(surfaceChild, occlusion); // The surfaceChild's parent does not have a clipRect as it owns a render surface. Make sure the unoccluded rect // does not get clipped away inappropriately. - EXPECT_INT_RECT_EQ(IntRect(0, 40, 100, 10), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild, false, IntRect(0, 0, 100, 50))); + EXPECT_RECT_EQ(IntRect(0, 40, 100, 10), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild, false, IntRect(0, 0, 100, 50))); this->leaveContributingSurface(surfaceChild, occlusion); // When the surfaceChild's occlusion is transformed up to its parent, make sure it is not clipped away inappropriately also. this->enterLayer(surface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 10, 100, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 10, 100, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->leaveLayer(surface, occlusion); this->enterContributingSurface(surface, occlusion); // The surface's parent does have a clipRect as it is the root layer. - EXPECT_INT_RECT_EQ(IntRect(0, 50, 100, 50), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(0, 50, 100, 50), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); } }; @@ -2424,7 +2424,7 @@ protected: // The root layer always has a clipRect. So the parent of |surface| has a clipRect giving the surface itself a clipRect. this->enterContributingSurface(surface, occlusion); // Make sure the parent's clipRect clips the unoccluded region of the child surface. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 300))); } this->resetLayerIterator(); { @@ -2436,7 +2436,7 @@ protected: // The root layer always has a clipRect. So the parent of |surface| has a clipRect giving the surface itself a clipRect. this->enterContributingSurface(surface, occlusion); // Make sure the viewport rect clips the unoccluded region of the child surface. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 300))); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 300))); } } }; @@ -2463,17 +2463,17 @@ protected: // |topmost| occludes everything partially so we know occlusion is happening at all. this->visitLayer(topmost, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); // surfaceChild is not opaque and does not occlude, so we have a non-empty unoccluded area on surface. this->visitLayer(surfaceChild, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); // The root layer always has a clipRect. So the parent of |surface| has a clipRect. However, the owning layer for |surface| does not @@ -2482,13 +2482,13 @@ protected: this->enterContributingSurface(surfaceChild, occlusion); // The surfaceChild's parent does not have a clipRect as it owns a render surface. - EXPECT_INT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild, false, IntRect(0, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild, false, IntRect(0, 0, 100, 100))); this->leaveContributingSurface(surfaceChild, occlusion); this->visitLayer(surface, occlusion); this->enterContributingSurface(surface, occlusion); // The surface's parent does have a clipRect as it is the root layer. - EXPECT_INT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); } }; @@ -2536,28 +2536,28 @@ protected: this->visitLayer(occludingLayer2, occlusion); this->visitLayer(occludingLayer1, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); // Everything outside the surface/replica is occluded but the surface/replica itself is not. this->enterLayer(filteredSurface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(1, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(1, 0, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(0, 1, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, 1, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(-1, 0, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, -1, 100, 100))); - - EXPECT_INT_RECT_EQ(IntRect(300 + 1, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 1, 0, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(300 + 0, 1, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 0, 1, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(300 + 0, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 - 1, 0, 100, 100))); - EXPECT_INT_RECT_EQ(IntRect(300 + 0, 0, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 0, -1, 100, 100))); + EXPECT_RECT_EQ(IntRect(1, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(1, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(0, 1, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, 1, 100, 100))); + EXPECT_RECT_EQ(IntRect(0, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(-1, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(0, 0, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, -1, 100, 100))); + + EXPECT_RECT_EQ(IntRect(300 + 1, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 1, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(300 + 0, 1, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 0, 1, 100, 100))); + EXPECT_RECT_EQ(IntRect(300 + 0, 0, 99, 100), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 - 1, 0, 100, 100))); + EXPECT_RECT_EQ(IntRect(300 + 0, 0, 100, 99), occlusion.unoccludedContentRect(filteredSurface, IntRect(300 + 0, -1, 100, 100))); this->leaveLayer(filteredSurface, occlusion); // The filtered layer/replica does not occlude. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); // The surface has a background blur, so it needs pixels that are currently considered occluded in order to be drawn. So the pixels @@ -2565,9 +2565,9 @@ protected: this->visitContributingSurface(filteredSurface, occlusion); this->enterLayer(parent, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); IntRect outsetRect; @@ -2576,44 +2576,44 @@ protected: // Nothing in the blur outsets for the filteredSurface is occluded. outsetRect = IntRect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom); testRect = outsetRect; - EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); // Stuff outside the blur outsets is still occluded though. testRect = outsetRect; testRect.expand(1, 0); - EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.expand(0, 1); - EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.move(-1, 0); testRect.expand(1, 0); - EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.move(0, -1); testRect.expand(0, 1); - EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); // Nothing in the blur outsets for the filteredSurface's replica is occluded. outsetRect = IntRect(200 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom); testRect = outsetRect; - EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); // Stuff outside the blur outsets is still occluded though. testRect = outsetRect; testRect.expand(1, 0); - EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.expand(0, 1); - EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.move(-1, 0); testRect.expand(1, 0); - EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); testRect = outsetRect; testRect.move(0, -1); testRect.expand(0, 1); - EXPECT_INT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); + EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testRect)); } }; @@ -2651,9 +2651,9 @@ protected: occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); this->visitLayer(occludingLayerAbove, occlusion); - EXPECT_INT_RECT_EQ(IntRect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(100, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(100, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); this->visitLayer(filteredSurface2, occlusion); @@ -2666,7 +2666,7 @@ protected: // Test expectations in the target. IntRect expectedOcclusion = IntRect(100 + outsetRight * 2, 100 + outsetBottom * 2, 50 - (outsetLeft + outsetRight) * 2, 50 - (outsetTop + outsetBottom) * 2); - EXPECT_INT_RECT_EQ(expectedOcclusion, occlusion.occlusionInTargetSurface().rects()[0]); + EXPECT_RECT_EQ(expectedOcclusion, occlusion.occlusionInTargetSurface().rects()[0]); // Test expectations in the screen. Take the ceiling of half of the outsets. outsetTop = (outsetTop + 1) / 2; @@ -2675,7 +2675,7 @@ protected: outsetLeft = (outsetLeft + 1) / 2; expectedOcclusion = IntRect(100 / 2 + outsetRight * 2, 100 / 2 + outsetBottom * 2, 50 / 2 - (outsetLeft + outsetRight) * 2, 50 /2 - (outsetTop + outsetBottom) * 2); - EXPECT_INT_RECT_EQ(expectedOcclusion, occlusion.occlusionInScreenSpace().rects()[0]); + EXPECT_RECT_EQ(expectedOcclusion, occlusion.occlusionInScreenSpace().rects()[0]); } }; @@ -2722,28 +2722,28 @@ protected: this->visitLayer(occludingLayer2, occlusion); this->visitLayer(occludingLayer1, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size()); // Everything outside the surface/replica is occluded but the surface/replica itself is not. this->enterLayer(filteredSurface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(1, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(1, 0, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(0, 1, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, 1, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(-1, 0, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, -1, 50, 50))); - - EXPECT_INT_RECT_EQ(IntRect(150 + 1, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 1, 0, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(150 + 0, 1, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 0, 1, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(150 + 0, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 - 1, 0, 50, 50))); - EXPECT_INT_RECT_EQ(IntRect(150 + 0, 0, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 0, -1, 50, 50))); + EXPECT_RECT_EQ(IntRect(1, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(1, 0, 50, 50))); + EXPECT_RECT_EQ(IntRect(0, 1, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, 1, 50, 50))); + EXPECT_RECT_EQ(IntRect(0, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(-1, 0, 50, 50))); + EXPECT_RECT_EQ(IntRect(0, 0, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(0, -1, 50, 50))); + + EXPECT_RECT_EQ(IntRect(150 + 1, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 1, 0, 50, 50))); + EXPECT_RECT_EQ(IntRect(150 + 0, 1, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 0, 1, 50, 50))); + EXPECT_RECT_EQ(IntRect(150 + 0, 0, 49, 50), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 - 1, 0, 50, 50))); + EXPECT_RECT_EQ(IntRect(150 + 0, 0, 50, 49), occlusion.unoccludedContentRect(filteredSurface, IntRect(150 + 0, -1, 50, 50))); this->leaveLayer(filteredSurface, occlusion); // The filtered layer/replica does not occlude. - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); // The surface has a background blur, so it needs pixels that are currently considered occluded in order to be drawn. So the pixels @@ -2751,7 +2751,7 @@ protected: this->visitContributingSurface(filteredSurface, occlusion); this->enterContributingSurface(clippingSurface, occlusion); - EXPECT_INT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size()); IntRect outsetRect; @@ -2762,45 +2762,45 @@ protected: outsetRect = IntRect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom); clippedOutsetRect = intersection(outsetRect, IntRect(0 - outsetLeft, 0 - outsetTop, 300 + outsetLeft + outsetRight, 70 + outsetTop + outsetBottom)); testRect = outsetRect; - EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); // Stuff outside the (clipped) blur outsets is still occluded though. testRect = outsetRect; testRect.expand(1, 0); - EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.expand(0, 1); - EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.move(-1, 0); testRect.expand(1, 0); - EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.move(0, -1); testRect.expand(0, 1); - EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); // Nothing in the (clipped) blur outsets for the filteredSurface's replica is occluded. outsetRect = IntRect(200 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom); clippedOutsetRect = intersection(outsetRect, IntRect(0 - outsetLeft, 0 - outsetTop, 300 + outsetLeft + outsetRight, 70 + outsetTop + outsetBottom)); testRect = outsetRect; - EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); // Stuff outside the (clipped) blur outsets is still occluded though. testRect = outsetRect; testRect.expand(1, 0); - EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.expand(0, 1); - EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.move(-1, 0); testRect.expand(1, 0); - EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); testRect = outsetRect; testRect.move(0, -1); testRect.expand(0, 1); - EXPECT_INT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); + EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippingSurface, testRect)); } }; @@ -2846,9 +2846,9 @@ protected: IntRect occlusionBehindReplica = IntRect(210, 60, 30, 30); IntRect expectedOpaqueBounds = unionRect(occlusionBehindSurface, occlusionBehindReplica); - EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -2894,9 +2894,9 @@ protected: IntRect occlusionAboveReplica = IntRect(200, 50, 50, 50); IntRect expectedOpaqueBounds = unionRect(occlusionAboveSurface, occlusionAboveReplica); - EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); } }; @@ -2995,17 +2995,17 @@ protected: // The small layer is not tracked because it is too small. this->visitLayer(small, occlusion); - EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); // The large layer is tracked as it is large enough. this->visitLayer(large, occlusion); - EXPECT_INT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInScreenSpace().bounds()); + EXPECT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInScreenSpace().bounds()); EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); - EXPECT_INT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInTargetSurface().bounds()); + EXPECT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInTargetSurface().bounds()); EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); } }; diff --git a/cc/CCPrioritizedTextureManager.cpp b/cc/CCPrioritizedTextureManager.cpp index 2678ec9..3089d00 100644 --- a/cc/CCPrioritizedTextureManager.cpp +++ b/cc/CCPrioritizedTextureManager.cpp @@ -8,6 +8,7 @@ #include "CCPrioritizedTexture.h" #include "CCPriorityCalculator.h" +#include "CCProxy.h" #include "TraceEvent.h" #include <algorithm> @@ -38,6 +39,7 @@ CCPrioritizedTextureManager::~CCPrioritizedTextureManager() void CCPrioritizedTextureManager::prioritizeTextures() { TRACE_EVENT0("cc", "CCPrioritizedTextureManager::prioritizeTextures"); + ASSERT(CCProxy::isMainThread()); #if !ASSERT_DISABLED assertInvariants(); @@ -117,6 +119,7 @@ void CCPrioritizedTextureManager::prioritizeTextures() void CCPrioritizedTextureManager::clearPriorities() { + ASSERT(CCProxy::isMainThread()); for (TextureSet::iterator it = m_textures.begin(); it != m_textures.end(); ++it) { // FIXME: We should remove this and just set all priorities to // CCPriorityCalculator::lowestPriority() once we have priorities @@ -128,6 +131,8 @@ void CCPrioritizedTextureManager::clearPriorities() bool CCPrioritizedTextureManager::requestLate(CCPrioritizedTexture* texture) { + ASSERT(CCProxy::isMainThread()); + // This is already above cutoff, so don't double count it's memory below. if (texture->isAbovePriorityCutoff()) return true; @@ -150,6 +155,7 @@ bool CCPrioritizedTextureManager::requestLate(CCPrioritizedTexture* texture) void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTexture* texture, CCResourceProvider* resourceProvider) { + ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); ASSERT(!texture->isSelfManaged()); ASSERT(texture->isAbovePriorityCutoff()); if (texture->backing() || !texture->isAbovePriorityCutoff()) @@ -184,6 +190,7 @@ void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTex void CCPrioritizedTextureManager::reduceMemory(size_t limitBytes, CCResourceProvider* resourceProvider) { + ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); if (memoryUseBytes() <= limitBytes) return; // Destroy backings until we are below the limit, @@ -198,6 +205,7 @@ void CCPrioritizedTextureManager::reduceMemory(size_t limitBytes, CCResourceProv void CCPrioritizedTextureManager::reduceMemory(CCResourceProvider* resourceProvider) { + ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); reduceMemory(m_memoryAvailableBytes, resourceProvider); ASSERT(memoryUseBytes() <= maxMemoryLimitBytes()); @@ -239,6 +247,7 @@ void CCPrioritizedTextureManager::allBackingTexturesWereDeleted() void CCPrioritizedTextureManager::registerTexture(CCPrioritizedTexture* texture) { + ASSERT(CCProxy::isMainThread()); ASSERT(texture); ASSERT(!texture->textureManager()); ASSERT(!texture->backing()); @@ -251,6 +260,7 @@ void CCPrioritizedTextureManager::registerTexture(CCPrioritizedTexture* texture) void CCPrioritizedTextureManager::unregisterTexture(CCPrioritizedTexture* texture) { + ASSERT(CCProxy::isMainThread() || (CCProxy::isImplThread() && CCProxy::isMainThreadBlocked())); ASSERT(texture); ASSERT(m_textures.find(texture) != m_textures.end()); @@ -260,9 +270,9 @@ void CCPrioritizedTextureManager::unregisterTexture(CCPrioritizedTexture* textur texture->setAbovePriorityCutoff(false); } - void CCPrioritizedTextureManager::returnBackingTexture(CCPrioritizedTexture* texture) { + ASSERT(CCProxy::isMainThread() || (CCProxy::isImplThread() && CCProxy::isMainThreadBlocked())); if (texture->backing()) { // Move the backing texture to the front for eviction/recycling and unlink it. m_backings.remove(texture->backing()); @@ -273,8 +283,8 @@ void CCPrioritizedTextureManager::returnBackingTexture(CCPrioritizedTexture* tex CCPrioritizedTexture::Backing* CCPrioritizedTextureManager::createBacking(IntSize size, GC3Denum format, CCResourceProvider* resourceProvider) { + ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); ASSERT(resourceProvider); - CCResourceProvider::ResourceId resourceId = resourceProvider->createResource(m_pool, size, format, CCResourceProvider::TextureUsageAny); CCPrioritizedTexture::Backing* backing = new CCPrioritizedTexture::Backing(resourceId, size, format); m_memoryUseBytes += backing->bytes(); @@ -304,6 +314,8 @@ void CCPrioritizedTextureManager::destroyBacking(CCPrioritizedTexture::Backing* #if !ASSERT_DISABLED void CCPrioritizedTextureManager::assertInvariants() { + ASSERT(CCProxy::isMainThread()); + // If we hit any of these asserts, there is a bug in this class. To see // where the bug is, call this function at the beginning and end of // every public function. diff --git a/cc/CCPrioritizedTextureTest.cpp b/cc/CCPrioritizedTextureTest.cpp index 0594d6b..1fec393 100644 --- a/cc/CCPrioritizedTextureTest.cpp +++ b/cc/CCPrioritizedTextureTest.cpp @@ -12,6 +12,7 @@ #include "CCTiledLayerTestCommon.h" #include "FakeCCGraphicsContext.h" #include <gtest/gtest.h> +#include <public/WebCompositor.h> using namespace WebCore; using namespace WebKitTests; @@ -26,14 +27,18 @@ public: , m_textureFormat(GraphicsContext3D::RGBA) , m_context(WebKit::createFakeCCGraphicsContext()) { + WebKit::WebCompositor::initialize(0); DebugScopedSetImplThread implThread; m_resourceProvider = CCResourceProvider::create(m_context.get()); } virtual ~CCPrioritizedTextureTest() { - DebugScopedSetImplThread implThread; - m_resourceProvider.clear(); + { + DebugScopedSetImplThread implThread; + m_resourceProvider.clear(); + } + WebKit::WebCompositor::shutdown(); } size_t texturesMemorySize(size_t textureCount) @@ -48,12 +53,12 @@ public: bool validateTexture(OwnPtr<CCPrioritizedTexture>& texture, bool requestLate) { - DebugScopedSetImplThread implThread; #if !ASSERT_DISABLED texture->textureManager()->assertInvariants(); #endif if (requestLate) texture->requestLate(); + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; bool success = texture->canAcquireBackingTexture(); if (success) texture->acquireBackingTexture(resourceProvider()); @@ -108,7 +113,7 @@ TEST_F(CCPrioritizedTextureTest, requestTextureExceedingMaxLimit) EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->memoryAboveCutoffBytes()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->clearAllMemory(resourceProvider()); } @@ -129,7 +134,7 @@ TEST_F(CCPrioritizedTextureTest, changeMemoryLimits) for (size_t i = 0; i < maxTextures; ++i) validateTexture(textures[i], false); { - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->reduceMemory(resourceProvider()); } @@ -142,7 +147,7 @@ TEST_F(CCPrioritizedTextureTest, changeMemoryLimits) for (size_t i = 0; i < maxTextures; ++i) EXPECT_EQ(validateTexture(textures[i], false), i < 5); { - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->reduceMemory(resourceProvider()); } @@ -155,14 +160,14 @@ TEST_F(CCPrioritizedTextureTest, changeMemoryLimits) for (size_t i = 0; i < maxTextures; ++i) EXPECT_EQ(validateTexture(textures[i], false), i < 4); { - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->reduceMemory(resourceProvider()); } EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->clearAllMemory(resourceProvider()); } @@ -222,7 +227,7 @@ TEST_F(CCPrioritizedTextureTest, textureManagerPartialUpdateTextures) EXPECT_FALSE(textures[2]->haveBackingTexture()); EXPECT_FALSE(textures[3]->haveBackingTexture()); - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->clearAllMemory(resourceProvider()); } @@ -262,7 +267,7 @@ TEST_F(CCPrioritizedTextureTest, textureManagerPrioritiesAreEqual) EXPECT_EQ(texturesMemorySize(8), textureManager->memoryAboveCutoffBytes()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->clearAllMemory(resourceProvider()); } @@ -282,7 +287,7 @@ TEST_F(CCPrioritizedTextureTest, textureManagerDestroyedFirst) EXPECT_TRUE(texture->haveBackingTexture()); { - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->clearAllMemory(resourceProvider()); } textureManager.clear(); @@ -310,7 +315,7 @@ TEST_F(CCPrioritizedTextureTest, textureMovedToNewManager) texture->setTextureManager(0); { - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManagerOne->clearAllMemory(resourceProvider()); } textureManagerOne.clear(); @@ -326,7 +331,7 @@ TEST_F(CCPrioritizedTextureTest, textureMovedToNewManager) EXPECT_TRUE(texture->canAcquireBackingTexture()); EXPECT_TRUE(texture->haveBackingTexture()); - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManagerTwo->clearAllMemory(resourceProvider()); } @@ -372,7 +377,7 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableOutsideRootS EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForSelfManagedTextures()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->clearAllMemory(resourceProvider()); } @@ -409,7 +414,7 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableForRequestLa EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForSelfManagedTextures()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->clearAllMemory(resourceProvider()); } @@ -449,7 +454,7 @@ TEST_F(CCPrioritizedTextureTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAva EXPECT_EQ(texturesMemorySize(2), textureManager->memoryForSelfManagedTextures()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); - DebugScopedSetImplThread implThread; + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; textureManager->clearAllMemory(resourceProvider()); } diff --git a/cc/CCSingleThreadProxy.h b/cc/CCSingleThreadProxy.h index 37a970c..02981d1 100644 --- a/cc/CCSingleThreadProxy.h +++ b/cc/CCSingleThreadProxy.h @@ -82,7 +82,7 @@ private: }; // For use in the single-threaded case. In debug builds, it pretends that the -// code is running on the thread to satisfy assertion checks. +// code is running on the impl thread to satisfy assertion checks. class DebugScopedSetImplThread { public: DebugScopedSetImplThread() @@ -117,6 +117,15 @@ public: } }; +// For use in the single-threaded case. In debug builds, it pretends that the +// code is running on the impl thread and that the main thread is blocked to +// satisfy assertion checks +class DebugScopedSetImplThreadAndMainThreadBlocked { +private: + DebugScopedSetImplThread m_implThread; + DebugScopedSetMainThreadBlocked m_mainThreadBlocked; +}; + } // namespace WebCore #endif diff --git a/cc/CCThreadProxy.cpp b/cc/CCThreadProxy.cpp index 394b286..9255010 100644 --- a/cc/CCThreadProxy.cpp +++ b/cc/CCThreadProxy.cpp @@ -89,9 +89,12 @@ bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) // Perform a synchronous commit. - CCCompletionEvent beginFrameCompletion; - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::forceBeginFrameOnImplThread, &beginFrameCompletion)); - beginFrameCompletion.wait(); + { + DebugScopedSetMainThreadBlocked mainThreadBlocked; + CCCompletionEvent beginFrameCompletion; + CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::forceBeginFrameOnImplThread, &beginFrameCompletion)); + beginFrameCompletion.wait(); + } m_inCompositeAndReadback = true; beginFrame(); m_inCompositeAndReadback = false; @@ -100,8 +103,11 @@ bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) ReadbackRequest request; request.rect = rect; request.pixels = pixels; - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::requestReadbackOnImplThread, &request)); - request.completion.wait(); + { + DebugScopedSetMainThreadBlocked mainThreadBlocked; + CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::requestReadbackOnImplThread, &request)); + request.completion.wait(); + } return request.success; } @@ -138,6 +144,7 @@ void CCThreadProxy::finishAllRendering() ASSERT(CCProxy::isMainThread()); // Make sure all GL drawing is finished on the impl thread. + DebugScopedSetMainThreadBlocked mainThreadBlocked; CCCompletionEvent completion; CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::finishAllRenderingOnImplThread, &completion)); completion.wait(); @@ -176,6 +183,7 @@ void CCThreadProxy::setSurfaceReadyOnImplThread() void CCThreadProxy::setVisible(bool visible) { TRACE_EVENT0("cc", "CCThreadProxy::setVisible"); + DebugScopedSetMainThreadBlocked mainThreadBlocked; CCCompletionEvent completion; CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::setVisibleOnImplThread, &completion, visible)); completion.wait(); @@ -197,6 +205,7 @@ bool CCThreadProxy::initializeRenderer() CCCompletionEvent completion; bool initializeSucceeded = false; RendererCapabilities capabilities; + DebugScopedSetMainThreadBlocked mainThreadBlocked; CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::initializeRendererOnImplThread, &completion, &initializeSucceeded, @@ -229,6 +238,7 @@ bool CCThreadProxy::recreateContext() CCCompletionEvent completion; bool recreateSucceeded = false; RendererCapabilities capabilities; + DebugScopedSetMainThreadBlocked mainThreadBlocked; CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::recreateContextOnImplThread, &completion, context.leakPtr(), @@ -251,6 +261,7 @@ void CCThreadProxy::implSideRenderingStats(CCRenderingStats& stats) { ASSERT(isMainThread()); + DebugScopedSetMainThreadBlocked mainThreadBlocked; CCCompletionEvent completion; CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::implSideRenderingStatsOnImplThread, &completion, @@ -369,6 +380,7 @@ void CCThreadProxy::start() ASSERT(isMainThread()); ASSERT(CCProxy::implThread()); // Create LayerTreeHostImpl. + DebugScopedSetMainThreadBlocked mainThreadBlocked; CCCompletionEvent completion; CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::initializeImplOnImplThread, &completion)); completion.wait(); @@ -400,6 +412,7 @@ void CCThreadProxy::stop() void CCThreadProxy::forceSerializeOnSwapBuffers() { + DebugScopedSetMainThreadBlocked mainThreadBlocked; CCCompletionEvent completion; CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::forceSerializeOnSwapBuffersOnImplThread, &completion)); completion.wait(); @@ -721,6 +734,7 @@ void CCThreadProxy::acquireLayerTextures() return; TRACE_EVENT0("cc", "CCThreadProxy::acquireLayerTextures"); + DebugScopedSetMainThreadBlocked mainThreadBlocked; CCCompletionEvent completion; CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::acquireLayerTexturesForMainThreadOnImplThread, &completion)); completion.wait(); // Block until it is safe to write to layer textures from the main thread. diff --git a/cc/cc_tests.gyp b/cc/cc_tests.gyp index e24b71d..ac2520e 100644 --- a/cc/cc_tests.gyp +++ b/cc/cc_tests.gyp @@ -44,13 +44,12 @@ 'cc_tests_support_files': [ 'test/CCAnimationTestCommon.cpp', 'test/CCAnimationTestCommon.h', + 'test/CCGeometryTestUtils.cpp', + 'test/CCGeometryTestUtils.h', 'test/CCLayerTestCommon.cpp', 'test/CCLayerTestCommon.h', - 'test/CCLayerTreeTestCommon.h', - 'test/CCLayerTreeTestCommon.h', 'test/CCOcclusionTrackerTestCommon.h', 'test/CCSchedulerTestCommon.h', - 'test/CCSchedulerTestCommon.h', 'test/CCTestCommon.h', 'test/CCTiledLayerTestCommon.cpp', 'test/CCTiledLayerTestCommon.h', diff --git a/cc/test/CCGeometryTestUtils.cpp b/cc/test/CCGeometryTestUtils.cpp new file mode 100644 index 0000000..ced302c --- /dev/null +++ b/cc/test/CCGeometryTestUtils.cpp @@ -0,0 +1,36 @@ +// Copyright 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "config.h" + +#include "CCGeometryTestUtils.h" + +#include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> + +namespace WebKitTests { + +void ExpectTransformationMatrixEq(const WebKit::WebTransformationMatrix& expected, + const WebKit::WebTransformationMatrix& actual) +{ + EXPECT_FLOAT_EQ((expected).m11(), (actual).m11()); + EXPECT_FLOAT_EQ((expected).m12(), (actual).m12()); + EXPECT_FLOAT_EQ((expected).m13(), (actual).m13()); + EXPECT_FLOAT_EQ((expected).m14(), (actual).m14()); + EXPECT_FLOAT_EQ((expected).m21(), (actual).m21()); + EXPECT_FLOAT_EQ((expected).m22(), (actual).m22()); + EXPECT_FLOAT_EQ((expected).m23(), (actual).m23()); + EXPECT_FLOAT_EQ((expected).m24(), (actual).m24()); + EXPECT_FLOAT_EQ((expected).m31(), (actual).m31()); + EXPECT_FLOAT_EQ((expected).m32(), (actual).m32()); + EXPECT_FLOAT_EQ((expected).m33(), (actual).m33()); + EXPECT_FLOAT_EQ((expected).m34(), (actual).m34()); + EXPECT_FLOAT_EQ((expected).m41(), (actual).m41()); + EXPECT_FLOAT_EQ((expected).m42(), (actual).m42()); + EXPECT_FLOAT_EQ((expected).m43(), (actual).m43()); + EXPECT_FLOAT_EQ((expected).m44(), (actual).m44()); +} + +} // namespace WebKitTests + diff --git a/cc/test/CCGeometryTestUtils.h b/cc/test/CCGeometryTestUtils.h new file mode 100644 index 0000000..4696660 --- /dev/null +++ b/cc/test/CCGeometryTestUtils.h @@ -0,0 +1,42 @@ +// Copyright 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CCGeometryTestUtils_h +#define CCGeometryTestUtils_h + +namespace WebKit { +class WebTransformationMatrix; +} + +namespace WebKitTests { + +// These are macros instead of functions so that we get useful line numbers where a test failed. +#define EXPECT_FLOAT_RECT_EQ(expected, actual) \ + EXPECT_FLOAT_EQ((expected).location().x(), (actual).location().x()); \ + EXPECT_FLOAT_EQ((expected).location().y(), (actual).location().y()); \ + EXPECT_FLOAT_EQ((expected).size().width(), (actual).size().width()); \ + EXPECT_FLOAT_EQ((expected).size().height(), (actual).size().height()) + +#define EXPECT_RECT_EQ(expected, actual) \ + EXPECT_EQ((expected).location().x(), (actual).location().x()); \ + EXPECT_EQ((expected).location().y(), (actual).location().y()); \ + EXPECT_EQ((expected).size().width(), (actual).size().width()); \ + EXPECT_EQ((expected).size().height(), (actual).size().height()) + +// This is a function rather than a macro because when this is included as a macro +// in bulk, it causes a significant slow-down in compilation time. This problem +// exists with both gcc and clang, and bugs have been filed at +// http://llvm.org/bugs/show_bug.cgi?id=13651 and http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54337 +void ExpectTransformationMatrixEq(const WebKit::WebTransformationMatrix& expected, + const WebKit::WebTransformationMatrix& actual); + +#define EXPECT_TRANSFORMATION_MATRIX_EQ(expected, actual) \ + { \ + SCOPED_TRACE(""); \ + WebKitTests::ExpectTransformationMatrixEq(expected, actual); \ + } + +} // namespace WebKitTests + +#endif // CCGeometryTestUtils_h diff --git a/webkit/compositor/LayerChromiumTest.cpp b/webkit/compositor/LayerChromiumTest.cpp index 4317d69..4838f84 100644 --- a/webkit/compositor/LayerChromiumTest.cpp +++ b/webkit/compositor/LayerChromiumTest.cpp @@ -6,9 +6,9 @@ #include "LayerChromium.h" +#include "CCGeometryTestUtils.h" #include "CCLayerImpl.h" #include "CCLayerTreeHost.h" -#include "CCLayerTreeTestCommon.h" #include "CCSingleThreadProxy.h" #include "FakeCCLayerTreeHostClient.h" #include "LayerPainterChromium.h" diff --git a/webkit/compositor/TiledLayerChromiumTest.cpp b/webkit/compositor/TiledLayerChromiumTest.cpp index 67a7254..029a8a7 100644 --- a/webkit/compositor/TiledLayerChromiumTest.cpp +++ b/webkit/compositor/TiledLayerChromiumTest.cpp @@ -8,7 +8,7 @@ #include "BitmapCanvasLayerTextureUpdater.h" #include "CCAnimationTestCommon.h" -#include "CCLayerTreeTestCommon.h" +#include "CCGeometryTestUtils.h" #include "CCOverdrawMetrics.h" #include "CCRenderingStats.h" #include "CCSingleThreadProxy.h" // For DebugScopedSetImplThread @@ -26,12 +26,6 @@ using namespace WebKitTests; using namespace WTF; using WebKit::WebTransformationMatrix; -#define EXPECT_EQ_RECT(a, b) \ - EXPECT_EQ(a.x(), b.x()); \ - EXPECT_EQ(a.y(), b.y()); \ - EXPECT_EQ(a.width(), b.width()); \ - EXPECT_EQ(a.height(), b.height()); - namespace { class TestCCOcclusionTracker : public CCOcclusionTracker { @@ -60,25 +54,71 @@ public: , m_textureManager(CCPrioritizedTextureManager::create(60*1024*1024, 1024, CCRenderer::ContentPool)) , m_occlusion(0) { - DebugScopedSetImplThread implThread; + WebKit::WebCompositor::initialize(0); + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; m_resourceProvider = CCResourceProvider::create(m_context.get()); } virtual ~TiledLayerChromiumTest() { - DebugScopedSetImplThread implThread; - m_resourceProvider.clear(); + textureManagerClearAllMemory(m_textureManager.get(), m_resourceProvider.get()); + { + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; + m_resourceProvider.clear(); + } + WebKit::WebCompositor::shutdown(); } + // Helper classes and functions that set the current thread to be the impl thread + // before doing the action that they wrap. + class ScopedFakeCCTiledLayerImpl { + public: + ScopedFakeCCTiledLayerImpl(int id) + { + DebugScopedSetImplThread implThread; + m_layerImpl = new FakeCCTiledLayerImpl(id); + } + ~ScopedFakeCCTiledLayerImpl() + { + DebugScopedSetImplThread implThread; + delete m_layerImpl; + } + FakeCCTiledLayerImpl* get() + { + return m_layerImpl; + } + FakeCCTiledLayerImpl* operator->() + { + return m_layerImpl; + } + private: + FakeCCTiledLayerImpl* m_layerImpl; + }; + void textureManagerClearAllMemory(CCPrioritizedTextureManager* textureManager, CCResourceProvider* resourceProvider) + { + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; + textureManager->clearAllMemory(resourceProvider); + } void updateTextures(int count = 500) { + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; CCTextureUpdateController::updateTextures(m_resourceProvider.get(), &m_copier, &m_uploader, &m_queue, count); } + void layerPushPropertiesTo(FakeTiledLayerChromium* layer, FakeCCTiledLayerImpl* layerImpl) + { + DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; + layer->pushPropertiesTo(layerImpl); + } + void layerUpdate(FakeTiledLayerChromium* layer, TestCCOcclusionTracker* occluded) + { + DebugScopedSetMainThread mainThread; + layer->update(m_queue, occluded, m_stats); + } bool updateAndPush(FakeTiledLayerChromium* layer1, - CCLayerImpl* layerImpl1, + FakeCCTiledLayerImpl* layerImpl1, FakeTiledLayerChromium* layer2 = 0, - CCLayerImpl* layerImpl2 = 0) + FakeCCTiledLayerImpl* layerImpl2 = 0) { // Get textures m_textureManager->clearPriorities(); @@ -103,9 +143,9 @@ public: // Update textures and push. updateTextures(); if (layer1) - layer1->pushPropertiesTo(layerImpl1); + layerPushPropertiesTo(layer1, layerImpl1); if (layer2) - layer2->pushPropertiesTo(layerImpl2); + layerPushPropertiesTo(layer2, layerImpl2); return needsUpdate; } @@ -125,8 +165,7 @@ public: TEST_F(TiledLayerChromiumTest, pushDirtyTiles) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); @@ -152,8 +191,7 @@ TEST_F(TiledLayerChromiumTest, pushDirtyTiles) TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); TestCCOcclusionTracker occluded; m_occlusion = &occluded; @@ -189,8 +227,7 @@ TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) TEST_F(TiledLayerChromiumTest, pushDeletedTiles) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); @@ -203,11 +240,11 @@ TEST_F(TiledLayerChromiumTest, pushDeletedTiles) EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); m_textureManager->clearPriorities(); - m_textureManager->clearAllMemory(m_resourceProvider.get()); + textureManagerClearAllMemory(m_textureManager.get(), m_resourceProvider.get()); m_textureManager->setMaxMemoryLimitBytes(4*1024*1024); // This should drop the tiles on the impl thread. - layer->pushPropertiesTo(layerImpl.get()); + layerPushPropertiesTo(layer.get(), layerImpl.get()); // We should now have no textures on the impl thread. EXPECT_FALSE(layerImpl->hasTileAt(0, 0)); @@ -225,8 +262,7 @@ TEST_F(TiledLayerChromiumTest, pushDeletedTiles) TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); // The tile size is 100x100. Setup 5x5 tiles with one visible tile in the center. // This paints 1 visible of the 25 invalid tiles. @@ -263,11 +299,10 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) { // Start with 2mb of memory, but the test is going to try to use just more than 1mb, so we reduce to 1mb later. m_textureManager->setMaxMemoryLimitBytes(2 * 1024 * 1024); - DebugScopedSetImplThread implThread; RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - OwnPtr<FakeCCTiledLayerImpl> layerImpl1(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl1(1); RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - OwnPtr<FakeCCTiledLayerImpl> layerImpl2(adoptPtr(new FakeCCTiledLayerImpl(2))); + ScopedFakeCCTiledLayerImpl layerImpl2(2); // For this test we have two layers. layer1 exhausts most texture memory, leaving room for 2 more tiles from // layer2, but not all three tiles. First we paint layer1, and one tile from layer2. Then when we idle paint @@ -317,8 +352,7 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) TEST_F(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); TestCCOcclusionTracker occluded; m_occlusion = &occluded; @@ -337,8 +371,7 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles) TEST_F(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); // The tile size is 100x100, so this invalidates and then paints two tiles. // However, during the paint, we invalidate one of the tiles. This should @@ -357,9 +390,8 @@ TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer) { RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layer1Impl(adoptPtr(new FakeCCTiledLayerImpl(1))); - OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(2))); + ScopedFakeCCTiledLayerImpl layer1Impl(1); + ScopedFakeCCTiledLayerImpl layer2Impl(2); // Invalidate a tile on layer1, during update of layer 2. layer2->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer1.get()); @@ -381,9 +413,8 @@ TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLay { RefPtr<FakeTiledLayerChromium> layer1 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); RefPtr<FakeTiledLayerChromium> layer2 = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layer1Impl(adoptPtr(new FakeCCTiledLayerImpl(1))); - OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(2))); + ScopedFakeCCTiledLayerImpl layer1Impl(1); + ScopedFakeCCTiledLayerImpl layer2Impl(2); layer1->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer2.get()); layer1->setBounds(IntSize(100, 200)); @@ -404,7 +435,6 @@ TEST_F(TiledLayerChromiumTest, paintSmallAnimatedLayersImmediately) { // Create a CCLayerTreeHost that has the right viewportsize, // so the layer is considered small enough. - WebKit::WebCompositor::initialize(0); FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient; OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, CCLayerTreeSettings()); @@ -422,10 +452,9 @@ TEST_F(TiledLayerChromiumTest, paintSmallAnimatedLayersImmediately) layerWidth *= 2; m_textureManager->setMaxMemoryLimitBytes(memoryForLayer); - DebugScopedSetImplThread implThread; RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); // Full size layer with half being visible. IntSize contentBounds(layerWidth, layerHeight); @@ -445,7 +474,7 @@ TEST_F(TiledLayerChromiumTest, paintSmallAnimatedLayersImmediately) m_textureManager->prioritizeTextures(); layer->update(m_queue, 0, m_stats); updateTextures(); - layer->pushPropertiesTo(layerImpl.get()); + layerPushPropertiesTo(layer.get(), layerImpl.get()); // We should have all the tiles for the small animated layer. // We should still have the visible tiles when we didn't @@ -463,14 +492,12 @@ TEST_F(TiledLayerChromiumTest, paintSmallAnimatedLayersImmediately) } } ccLayerTreeHost.clear(); - WebKit::WebCompositor::shutdown(); } TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); // We have enough memory for only the visible rect, so we will run out of memory in first idle paint. int memoryLimit = 4 * 100 * 100; // 1 tiles, 4 bytes per pixel. @@ -493,8 +520,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedLayer) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); bool animating[2] = {false, true}; for (int i = 0; i < 2; i++) { @@ -521,8 +547,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedLayer) TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); // Alternate between not visible and visible. IntRect v(0, 0, 100, 100); @@ -552,8 +577,7 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers) TEST_F(TiledLayerChromiumTest, invalidateFromPrepare) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); @@ -588,7 +612,6 @@ TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) // The updateRect (that indicates what was actually painted) should be in // layer space, not the content space. RefPtr<FakeTiledLayerWithScaledBounds> layer = adoptRef(new FakeTiledLayerWithScaledBounds(m_textureManager.get())); - DebugScopedSetImplThread implThread; IntRect layerBounds(0, 0, 300, 200); IntRect contentBounds(0, 0, 200, 250); @@ -627,8 +650,7 @@ TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); // Create a layer with one tile. layer->setBounds(IntSize(100, 100)); @@ -643,7 +665,7 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) m_textureManager->prioritizeTextures(); layer->update(m_queue, 0, m_stats); updateTextures(); - layer->pushPropertiesTo(layerImpl.get()); + layerPushPropertiesTo(layer.get(), layerImpl.get()); EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); EXPECT_FALSE(layerImpl->hasTileAt(0, 1)); EXPECT_FALSE(layerImpl->hasTileAt(1, 0)); @@ -660,7 +682,7 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) m_textureManager->prioritizeTextures(); layer->update(m_queue, 0, m_stats); updateTextures(); - layer->pushPropertiesTo(layerImpl.get()); + layerPushPropertiesTo(layer.get(), layerImpl.get()); EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); EXPECT_TRUE(layerImpl->hasTileAt(1, 0)); @@ -672,7 +694,7 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) layer->setTexturePriorities(m_priorityCalculator); m_textureManager->prioritizeTextures(); - layer->pushPropertiesTo(layerImpl.get()); + layerPushPropertiesTo(layer.get(), layerImpl.get()); EXPECT_FALSE(layerImpl->hasTileAt(0, 0)); EXPECT_FALSE(layerImpl->hasTileAt(0, 1)); EXPECT_FALSE(layerImpl->hasTileAt(1, 0)); @@ -681,8 +703,6 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) TEST_F(TiledLayerChromiumTest, skipsDrawGetsReset) { - // Initialize without threading support. - WebKit::WebCompositor::initialize(0); FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient; OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, CCLayerTreeSettings()); ASSERT_TRUE(ccLayerTreeHost->initializeRendererIfNeeded()); @@ -724,10 +744,9 @@ TEST_F(TiledLayerChromiumTest, skipsDrawGetsReset) ccLayerTreeHost->updateLayers(m_queue, memoryLimit); EXPECT_FALSE(rootLayer->skipsDraw()); - ccLayerTreeHost->contentsTextureManager()->clearAllMemory(m_resourceProvider.get()); + textureManagerClearAllMemory(ccLayerTreeHost->contentsTextureManager(), m_resourceProvider.get()); ccLayerTreeHost->setRootLayer(0); ccLayerTreeHost.clear(); - WebKit::WebCompositor::shutdown(); } TEST_F(TiledLayerChromiumTest, resizeToSmaller) @@ -763,9 +782,6 @@ TEST_F(TiledLayerChromiumTest, hugeLayerUpdateCrash) TEST_F(TiledLayerChromiumTest, partialUpdates) { - // Initialize without threading support. - WebKit::WebCompositor::initialize(0); - CCLayerTreeSettings settings; settings.maxPartialTextureUpdates = 4; @@ -789,8 +805,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) // Full update of all 6 tiles. ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); { - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); updateTextures(4); EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); EXPECT_TRUE(m_queue.hasMoreUpdates()); @@ -799,7 +814,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount()); EXPECT_FALSE(m_queue.hasMoreUpdates()); layer->fakeLayerTextureUpdater()->clearUpdateCount(); - layer->pushPropertiesTo(layerImpl.get()); + layerPushPropertiesTo(layer.get(), layerImpl.get()); } ccLayerTreeHost->commitComplete(); @@ -807,8 +822,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) layer->invalidateContentRect(IntRect(0, 0, 300, 150)); ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); { - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); updateTextures(4); EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->updateCount()); EXPECT_TRUE(m_queue.hasMoreUpdates()); @@ -817,15 +831,14 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->updateCount()); EXPECT_FALSE(m_queue.hasMoreUpdates()); layer->fakeLayerTextureUpdater()->clearUpdateCount(); - layer->pushPropertiesTo(layerImpl.get()); + layerPushPropertiesTo(layer.get(), layerImpl.get()); } ccLayerTreeHost->commitComplete(); // Partial update of 6 tiles. layer->invalidateContentRect(IntRect(50, 50, 200, 100)); { - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); updateTextures(4); EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount()); @@ -835,24 +848,22 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); EXPECT_FALSE(m_queue.hasMoreUpdates()); layer->fakeLayerTextureUpdater()->clearUpdateCount(); - layer->pushPropertiesTo(layerImpl.get()); + layerPushPropertiesTo(layer.get(), layerImpl.get()); } ccLayerTreeHost->commitComplete(); // Checkerboard all tiles. layer->invalidateContentRect(IntRect(0, 0, 300, 200)); { - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); - layer->pushPropertiesTo(layerImpl.get()); + ScopedFakeCCTiledLayerImpl layerImpl(1); + layerPushPropertiesTo(layer.get(), layerImpl.get()); } ccLayerTreeHost->commitComplete(); // Partial update of 6 checkerboard tiles. layer->invalidateContentRect(IntRect(50, 50, 200, 100)); { - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); updateTextures(4); EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); @@ -862,31 +873,26 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount()); EXPECT_FALSE(m_queue.hasMoreUpdates()); layer->fakeLayerTextureUpdater()->clearUpdateCount(); - layer->pushPropertiesTo(layerImpl.get()); + layerPushPropertiesTo(layer.get(), layerImpl.get()); } ccLayerTreeHost->commitComplete(); // Partial update of 4 tiles. layer->invalidateContentRect(IntRect(50, 50, 100, 100)); { - DebugScopedSetImplThread implThread; - OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); + ScopedFakeCCTiledLayerImpl layerImpl(1); ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); updateTextures(4); EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); EXPECT_FALSE(m_queue.hasMoreUpdates()); layer->fakeLayerTextureUpdater()->clearUpdateCount(); - layer->pushPropertiesTo(layerImpl.get()); + layerPushPropertiesTo(layer.get(), layerImpl.get()); } ccLayerTreeHost->commitComplete(); - { - DebugScopedSetImplThread implThread; - ccLayerTreeHost->contentsTextureManager()->clearAllMemory(m_resourceProvider.get()); - } + textureManagerClearAllMemory(ccLayerTreeHost->contentsTextureManager(), m_resourceProvider.get()); ccLayerTreeHost->setRootLayer(0); ccLayerTreeHost.clear(); - WebKit::WebCompositor::shutdown(); } TEST_F(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion) @@ -1031,7 +1037,6 @@ TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) layer->update(m_queue, &occluded, m_stats); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); { - DebugScopedSetImplThread implThread; updateTextures(); } @@ -1158,7 +1163,6 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); TestCCOcclusionTracker occluded; - DebugScopedSetImplThread implThread; // The tile size is 100x100, so this invalidates and then paints two tiles in various ways. @@ -1195,7 +1199,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) layer->update(m_queue, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); - EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); + EXPECT_RECT_EQ(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); EXPECT_EQ(1u, opaqueContents.rects().size()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2, 1); @@ -1208,7 +1212,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) layer->update(m_queue, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); - EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); + EXPECT_RECT_EQ(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); EXPECT_EQ(1u, opaqueContents.rects().size()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2, 1); @@ -1223,7 +1227,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) layer->update(m_queue, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); - EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); + EXPECT_RECT_EQ(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); EXPECT_EQ(1u, opaqueContents.rects().size()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2 + 1, 1); @@ -1238,7 +1242,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) layer->update(m_queue, &occluded, m_stats); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); - EXPECT_EQ_RECT(intersection(IntRect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds()); + EXPECT_RECT_EQ(intersection(IntRect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds()); EXPECT_EQ(1u, opaqueContents.rects().size()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2 + 1 + 1, 1); @@ -1251,7 +1255,6 @@ TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) { RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(m_textureManager.get())); TestCCOcclusionTracker occluded; - DebugScopedSetImplThread implThread; // The tile size is 100x100, so this invalidates and then paints two tiles in various ways. @@ -1302,9 +1305,6 @@ TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated) { - // Initialize without threading support. - WebKit::WebCompositor::initialize(0); - // Tile size is 100x100. IntRect rootRect(0, 0, 300, 200); IntRect childRect(0, 0, 300, 100); @@ -1353,7 +1353,6 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca child2->invalidateContentRect(child2Rect); ccLayerTreeHost->updateLayers(m_queue, std::numeric_limits<size_t>::max()); { - DebugScopedSetImplThread implThread; updateTextures(1000); EXPECT_EQ(6, root->fakeLayerTextureUpdater()->updateCount()); EXPECT_EQ(3, child->fakeLayerTextureUpdater()->updateCount()); @@ -1364,12 +1363,12 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca child->fakeLayerTextureUpdater()->clearUpdateCount(); child2->fakeLayerTextureUpdater()->clearUpdateCount(); - OwnPtr<FakeCCTiledLayerImpl> rootImpl(adoptPtr(new FakeCCTiledLayerImpl(root->id()))); - OwnPtr<FakeCCTiledLayerImpl> childImpl(adoptPtr(new FakeCCTiledLayerImpl(child->id()))); - OwnPtr<FakeCCTiledLayerImpl> child2Impl(adoptPtr(new FakeCCTiledLayerImpl(child2->id()))); - root->pushPropertiesTo(rootImpl.get()); - child->pushPropertiesTo(childImpl.get()); - child2->pushPropertiesTo(child2Impl.get()); + ScopedFakeCCTiledLayerImpl rootImpl(root->id()); + ScopedFakeCCTiledLayerImpl childImpl(child->id()); + ScopedFakeCCTiledLayerImpl child2Impl(child2->id()); + layerPushPropertiesTo(root.get(), rootImpl.get()); + layerPushPropertiesTo(child.get(), childImpl.get()); + layerPushPropertiesTo(child2.get(), child2Impl.get()); for (unsigned i = 0; i < 3; ++i) { for (unsigned j = 0; j < 2; ++j) @@ -1388,7 +1387,6 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca child2->invalidateContentRect(child2Rect); ccLayerTreeHost->updateLayers(m_queue, (3 * 2 + 3 * 1) * (100 * 100) * 4); { - DebugScopedSetImplThread implThread; updateTextures(1000); EXPECT_EQ(6, root->fakeLayerTextureUpdater()->updateCount()); EXPECT_EQ(0, child->fakeLayerTextureUpdater()->updateCount()); @@ -1399,12 +1397,12 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca child->fakeLayerTextureUpdater()->clearUpdateCount(); child2->fakeLayerTextureUpdater()->clearUpdateCount(); - OwnPtr<FakeCCTiledLayerImpl> rootImpl(adoptPtr(new FakeCCTiledLayerImpl(root->id()))); - OwnPtr<FakeCCTiledLayerImpl> childImpl(adoptPtr(new FakeCCTiledLayerImpl(child->id()))); - OwnPtr<FakeCCTiledLayerImpl> child2Impl(adoptPtr(new FakeCCTiledLayerImpl(child2->id()))); - root->pushPropertiesTo(rootImpl.get()); - child->pushPropertiesTo(childImpl.get()); - child2->pushPropertiesTo(child2Impl.get()); + ScopedFakeCCTiledLayerImpl rootImpl(root->id()); + ScopedFakeCCTiledLayerImpl childImpl(child->id()); + ScopedFakeCCTiledLayerImpl child2Impl(child2->id()); + layerPushPropertiesTo(root.get(), rootImpl.get()); + layerPushPropertiesTo(child.get(), childImpl.get()); + layerPushPropertiesTo(child2.get(), child2Impl.get()); for (unsigned i = 0; i < 3; ++i) { for (unsigned j = 0; j < 2; ++j) @@ -1424,7 +1422,6 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca child2->invalidateContentRect(child2Rect); ccLayerTreeHost->updateLayers(m_queue, (3 * 1) * (100 * 100) * 4); { - DebugScopedSetImplThread implThread; updateTextures(1000); EXPECT_EQ(0, root->fakeLayerTextureUpdater()->updateCount()); EXPECT_EQ(0, child->fakeLayerTextureUpdater()->updateCount()); @@ -1435,12 +1432,12 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca child->fakeLayerTextureUpdater()->clearUpdateCount(); child2->fakeLayerTextureUpdater()->clearUpdateCount(); - OwnPtr<FakeCCTiledLayerImpl> rootImpl(adoptPtr(new FakeCCTiledLayerImpl(root->id()))); - OwnPtr<FakeCCTiledLayerImpl> childImpl(adoptPtr(new FakeCCTiledLayerImpl(child->id()))); - OwnPtr<FakeCCTiledLayerImpl> child2Impl(adoptPtr(new FakeCCTiledLayerImpl(child2->id()))); - root->pushPropertiesTo(rootImpl.get()); - child->pushPropertiesTo(childImpl.get()); - child2->pushPropertiesTo(child2Impl.get()); + ScopedFakeCCTiledLayerImpl rootImpl(root->id()); + ScopedFakeCCTiledLayerImpl childImpl(child->id()); + ScopedFakeCCTiledLayerImpl child2Impl(child2->id()); + layerPushPropertiesTo(root.get(), rootImpl.get()); + layerPushPropertiesTo(child.get(), childImpl.get()); + layerPushPropertiesTo(child2.get(), child2Impl.get()); for (unsigned i = 0; i < 3; ++i) { for (unsigned j = 0; j < 2; ++j) @@ -1451,13 +1448,9 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca } ccLayerTreeHost->commitComplete(); - { - DebugScopedSetImplThread implThread; - ccLayerTreeHost->contentsTextureManager()->clearAllMemory(m_resourceProvider.get()); - } + textureManagerClearAllMemory(ccLayerTreeHost->contentsTextureManager(), m_resourceProvider.get()); ccLayerTreeHost->setRootLayer(0); ccLayerTreeHost.clear(); - WebKit::WebCompositor::shutdown(); } class TrackingLayerPainter : public LayerPainterChromium { @@ -1520,18 +1513,14 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) layer->update(m_queue, 0, m_stats); layer->trackingLayerPainter()->resetPaintedRect(); - EXPECT_INT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); - - { - DebugScopedSetImplThread implThread; - updateTextures(); - } + EXPECT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); + updateTextures(); // Invalidate the entire layer in content space. When painting, the rect given to webkit should match the layer's bounds. layer->invalidateContentRect(contentRect); layer->update(m_queue, 0, m_stats); - EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); + EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); } TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvalidation) @@ -1554,18 +1543,14 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvali layer->update(m_queue, 0, m_stats); layer->trackingLayerPainter()->resetPaintedRect(); - EXPECT_INT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); - - { - DebugScopedSetImplThread implThread; - updateTextures(); - } + EXPECT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); + updateTextures(); // Invalidate the entire layer in layer space. When painting, the rect given to webkit should match the layer's bounds. layer->setNeedsDisplayRect(layerRect); layer->update(m_queue, 0, m_stats); - EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); + EXPECT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); } } // namespace diff --git a/webkit/compositor/WebAnimationImpl.cpp b/webkit/compositor/WebAnimationImpl.cpp index e7cc459..bbae89b 100644 --- a/webkit/compositor/WebAnimationImpl.cpp +++ b/webkit/compositor/WebAnimationImpl.cpp @@ -21,13 +21,18 @@ namespace WebKit { WebAnimation* WebAnimation::create(const WebAnimationCurve& curve, TargetProperty targetProperty, int animationId) { - static int nextGroupId = 1; - static int nextAnimationId = 1; - return new WebAnimationImpl(curve, targetProperty, animationId ? animationId : nextAnimationId++, nextGroupId++); + return new WebAnimationImpl(curve, targetProperty, animationId, 0); } WebAnimationImpl::WebAnimationImpl(const WebAnimationCurve& webCurve, TargetProperty targetProperty, int animationId, int groupId) { + static int nextAnimationId = 1; + static int nextGroupId = 1; + if (!animationId) + animationId = nextAnimationId++; + if (!groupId) + groupId = nextGroupId++; + WebAnimationCurve::AnimationCurveType curveType = webCurve.type(); OwnPtr<WebCore::CCAnimationCurve> curve; switch (curveType) { diff --git a/webkit/compositor/WebAnimationImpl.h b/webkit/compositor/WebAnimationImpl.h index a80fe18..e549650 100644 --- a/webkit/compositor/WebAnimationImpl.h +++ b/webkit/compositor/WebAnimationImpl.h @@ -17,7 +17,7 @@ namespace WebKit { class WebAnimationImpl : public WebAnimation { public: - WebAnimationImpl(const WebAnimationCurve&, TargetProperty, int animationId, int groupId); + WebAnimationImpl(const WebAnimationCurve&, TargetProperty, int animationId, int groupId = 0); virtual ~WebAnimationImpl(); // WebAnimation implementation diff --git a/webkit/compositor/WebContentLayerImpl.cpp b/webkit/compositor/WebContentLayerImpl.cpp index ae0722b..05775a3 100644 --- a/webkit/compositor/WebContentLayerImpl.cpp +++ b/webkit/compositor/WebContentLayerImpl.cpp @@ -23,40 +23,40 @@ WebContentLayer* WebContentLayer::create(WebContentLayerClient* client) } WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* client) - : m_webLayerImpl(adoptPtr(new WebLayerImpl(ContentLayerChromium::create(this)))) + : m_layer(adoptPtr(new WebLayerImpl(ContentLayerChromium::create(this)))) , m_client(client) { - m_webLayerImpl->layer()->setIsDrawable(true); + m_layer->layer()->setIsDrawable(true); } WebContentLayerImpl::~WebContentLayerImpl() { - static_cast<ContentLayerChromium*>(m_webLayerImpl->layer())->clearClient(); + static_cast<ContentLayerChromium*>(m_layer->layer())->clearClient(); } WebLayer* WebContentLayerImpl::layer() { - return m_webLayerImpl.get(); + return m_layer.get(); } void WebContentLayerImpl::setDoubleSided(bool doubleSided) { - m_webLayerImpl->layer()->setDoubleSided(doubleSided); + m_layer->layer()->setDoubleSided(doubleSided); } void WebContentLayerImpl::setContentsScale(float scale) { - m_webLayerImpl->layer()->setContentsScale(scale); + m_layer->layer()->setContentsScale(scale); } void WebContentLayerImpl::setUseLCDText(bool enable) { - m_webLayerImpl->layer()->setUseLCDText(enable); + m_layer->layer()->setUseLCDText(enable); } void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) { - m_webLayerImpl->layer()->setDrawCheckerboardForMissingTiles(enable); + m_layer->layer()->setDrawCheckerboardForMissingTiles(enable); } diff --git a/webkit/compositor/WebContentLayerImpl.h b/webkit/compositor/WebContentLayerImpl.h index dd06a99..f11a0f3 100644 --- a/webkit/compositor/WebContentLayerImpl.h +++ b/webkit/compositor/WebContentLayerImpl.h @@ -8,7 +8,7 @@ #include "ContentLayerChromiumClient.h" #include "WebLayerImpl.h" #include <public/WebContentLayer.h> -#include <wtf/PassRefPtr.h> +#include <wtf/OwnPtr.h> namespace WebKit { class WebContentLayerClient; @@ -31,7 +31,7 @@ protected: // ContentLayerChromiumClient implementation. virtual void paintContents(SkCanvas*, const WebCore::IntRect& clip, WebCore::FloatRect& opaque) OVERRIDE; - OwnPtr<WebLayerImpl> m_webLayerImpl; + OwnPtr<WebLayerImpl> m_layer; WebContentLayerClient* m_client; bool m_drawsContent; }; diff --git a/webkit/compositor/WebFloatAnimationCurveImpl.cpp b/webkit/compositor/WebFloatAnimationCurveImpl.cpp index 7ea8a89..cc1ad35 100644 --- a/webkit/compositor/WebFloatAnimationCurveImpl.cpp +++ b/webkit/compositor/WebFloatAnimationCurveImpl.cpp @@ -17,11 +17,11 @@ namespace WebKit { WebFloatAnimationCurve* WebFloatAnimationCurve::create() { - return new WebFloatAnimationCurveImpl(WebCore::CCKeyframedFloatAnimationCurve::create()); + return new WebFloatAnimationCurveImpl(); } -WebFloatAnimationCurveImpl::WebFloatAnimationCurveImpl(PassOwnPtr<WebCore::CCKeyframedFloatAnimationCurve> curve) - : m_curve(curve) +WebFloatAnimationCurveImpl::WebFloatAnimationCurveImpl() + : m_curve(WebCore::CCKeyframedFloatAnimationCurve::create()) { } diff --git a/webkit/compositor/WebFloatAnimationCurveImpl.h b/webkit/compositor/WebFloatAnimationCurveImpl.h index 6a05608..04c3c9a 100644 --- a/webkit/compositor/WebFloatAnimationCurveImpl.h +++ b/webkit/compositor/WebFloatAnimationCurveImpl.h @@ -18,7 +18,7 @@ namespace WebKit { class WebFloatAnimationCurveImpl : public WebFloatAnimationCurve { public: - explicit WebFloatAnimationCurveImpl(PassOwnPtr<WebCore::CCKeyframedFloatAnimationCurve>); + WebFloatAnimationCurveImpl(); virtual ~WebFloatAnimationCurveImpl(); // WebAnimationCurve implementation. diff --git a/webkit/compositor/WebIOSurfaceLayerImpl.cpp b/webkit/compositor/WebIOSurfaceLayerImpl.cpp index 1ce29ef..251f06a 100644 --- a/webkit/compositor/WebIOSurfaceLayerImpl.cpp +++ b/webkit/compositor/WebIOSurfaceLayerImpl.cpp @@ -14,14 +14,13 @@ namespace WebKit { WebIOSurfaceLayer* WebIOSurfaceLayer::create() { - RefPtr<IOSurfaceLayerChromium> layer = IOSurfaceLayerChromium::create(); - layer->setIsDrawable(true); - return new WebIOSurfaceLayerImpl(layer.release()); + return new WebIOSurfaceLayerImpl(); } -WebIOSurfaceLayerImpl::WebIOSurfaceLayerImpl(PassRefPtr<IOSurfaceLayerChromium> layer) - : m_layer(adoptPtr(new WebLayerImpl(layer))) +WebIOSurfaceLayerImpl::WebIOSurfaceLayerImpl() + : m_layer(adoptPtr(new WebLayerImpl(IOSurfaceLayerChromium::create()))) { + m_layer->layer()->setIsDrawable(true); } WebIOSurfaceLayerImpl::~WebIOSurfaceLayerImpl() diff --git a/webkit/compositor/WebIOSurfaceLayerImpl.h b/webkit/compositor/WebIOSurfaceLayerImpl.h index c7dc3d7..d2d3a87 100644 --- a/webkit/compositor/WebIOSurfaceLayerImpl.h +++ b/webkit/compositor/WebIOSurfaceLayerImpl.h @@ -8,15 +8,11 @@ #include <public/WebIOSurfaceLayer.h> #include <wtf/OwnPtr.h> -namespace WebCore { -class IOSurfaceLayerChromium; -} - namespace WebKit { class WebIOSurfaceLayerImpl : public WebIOSurfaceLayer { public: - explicit WebIOSurfaceLayerImpl(PassRefPtr<WebCore::IOSurfaceLayerChromium>); + WebIOSurfaceLayerImpl(); virtual ~WebIOSurfaceLayerImpl(); // WebIOSurfaceLayer implementation. diff --git a/webkit/compositor/WebImageLayerImpl.cpp b/webkit/compositor/WebImageLayerImpl.cpp index e77b972..bb1b56b 100644 --- a/webkit/compositor/WebImageLayerImpl.cpp +++ b/webkit/compositor/WebImageLayerImpl.cpp @@ -14,11 +14,11 @@ namespace WebKit { WebImageLayer* WebImageLayer::create() { - return new WebImageLayerImpl(WebCore::ImageLayerChromium::create()); + return new WebImageLayerImpl(); } -WebImageLayerImpl::WebImageLayerImpl(PassRefPtr<WebCore::ImageLayerChromium> layer) - : m_layer(adoptPtr(new WebLayerImpl(layer))) +WebImageLayerImpl::WebImageLayerImpl() + : m_layer(adoptPtr(new WebLayerImpl(ImageLayerChromium::create()))) { } diff --git a/webkit/compositor/WebImageLayerImpl.h b/webkit/compositor/WebImageLayerImpl.h index 3c16b0e..242edf4 100644 --- a/webkit/compositor/WebImageLayerImpl.h +++ b/webkit/compositor/WebImageLayerImpl.h @@ -17,7 +17,7 @@ class WebLayerImpl; class WebImageLayerImpl : public WebImageLayer { public: - explicit WebImageLayerImpl(PassRefPtr<WebCore::ImageLayerChromium>); + WebImageLayerImpl(); virtual ~WebImageLayerImpl(); // WebImageLayer implementation. diff --git a/webkit/compositor/WebLayerImpl.cpp b/webkit/compositor/WebLayerImpl.cpp index 0c913f9..4b25479 100644 --- a/webkit/compositor/WebLayerImpl.cpp +++ b/webkit/compositor/WebLayerImpl.cpp @@ -58,7 +58,12 @@ SkMatrix44 skMatrix44FromTransformationMatrix(const WebTransformationMatrix& mat WebLayer* WebLayer::create() { - return new WebLayerImpl(LayerChromium::create()); + return new WebLayerImpl(); +} + +WebLayerImpl::WebLayerImpl() + : m_layer(LayerChromium::create()) +{ } WebLayerImpl::WebLayerImpl(PassRefPtr<LayerChromium> layer) @@ -66,6 +71,7 @@ WebLayerImpl::WebLayerImpl(PassRefPtr<LayerChromium> layer) { } + WebLayerImpl::~WebLayerImpl() { m_layer->clearRenderSurface(); diff --git a/webkit/compositor/WebLayerImpl.h b/webkit/compositor/WebLayerImpl.h index b499a30..71f83db 100644 --- a/webkit/compositor/WebLayerImpl.h +++ b/webkit/compositor/WebLayerImpl.h @@ -6,6 +6,7 @@ #define WebLayerImpl_h #include <public/WebLayer.h> +#include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> namespace WebCore { @@ -16,6 +17,7 @@ namespace WebKit { class WebLayerImpl : public WebLayer { public: + WebLayerImpl(); explicit WebLayerImpl(PassRefPtr<WebCore::LayerChromium>); virtual ~WebLayerImpl(); diff --git a/webkit/compositor/WebScrollbarLayerImpl.cpp b/webkit/compositor/WebScrollbarLayerImpl.cpp index 45fdc43..6aa6978 100644 --- a/webkit/compositor/WebScrollbarLayerImpl.cpp +++ b/webkit/compositor/WebScrollbarLayerImpl.cpp @@ -14,12 +14,12 @@ namespace WebKit { WebScrollbarLayer* WebScrollbarLayer::create(WebScrollbar* scrollbar, WebScrollbarThemePainter painter, WebScrollbarThemeGeometry* geometry) { - return new WebScrollbarLayerImpl(ScrollbarLayerChromium::create(adoptPtr(scrollbar), painter, adoptPtr(geometry), 0)); + return new WebScrollbarLayerImpl(scrollbar, painter, geometry); } -WebScrollbarLayerImpl::WebScrollbarLayerImpl(PassRefPtr<WebCore::ScrollbarLayerChromium> layer) - : m_layer(adoptPtr(new WebLayerImpl(layer))) +WebScrollbarLayerImpl::WebScrollbarLayerImpl(WebScrollbar* scrollbar, WebScrollbarThemePainter painter, WebScrollbarThemeGeometry* geometry) + : m_layer(adoptPtr(new WebLayerImpl(ScrollbarLayerChromium::create(adoptPtr(scrollbar), painter, adoptPtr(geometry), 0)))) { } diff --git a/webkit/compositor/WebScrollbarLayerImpl.h b/webkit/compositor/WebScrollbarLayerImpl.h index 3af38f2..d4a33a1 100644 --- a/webkit/compositor/WebScrollbarLayerImpl.h +++ b/webkit/compositor/WebScrollbarLayerImpl.h @@ -7,18 +7,13 @@ #include <public/WebScrollbarLayer.h> #include <wtf/OwnPtr.h> -#include <wtf/PassRefPtr.h> - -namespace WebCore { -class ScrollbarLayerChromium; -} namespace WebKit { class WebLayerImpl; class WebScrollbarLayerImpl : public WebScrollbarLayer { public: - explicit WebScrollbarLayerImpl(PassRefPtr<WebCore::ScrollbarLayerChromium>); + WebScrollbarLayerImpl(WebScrollbar*, WebScrollbarThemePainter, WebScrollbarThemeGeometry*); virtual ~WebScrollbarLayerImpl(); // WebScrollbarLayer implementation. diff --git a/webkit/compositor/WebSolidColorLayerImpl.cpp b/webkit/compositor/WebSolidColorLayerImpl.cpp index 51be974..ff4cf4e 100644 --- a/webkit/compositor/WebSolidColorLayerImpl.cpp +++ b/webkit/compositor/WebSolidColorLayerImpl.cpp @@ -14,11 +14,11 @@ namespace WebKit { WebSolidColorLayer* WebSolidColorLayer::create() { - return new WebSolidColorLayerImpl(SolidColorLayerChromium::create()); + return new WebSolidColorLayerImpl(); } -WebSolidColorLayerImpl::WebSolidColorLayerImpl(PassRefPtr<SolidColorLayerChromium> layer) - : m_layer(adoptPtr(new WebLayerImpl(layer))) +WebSolidColorLayerImpl::WebSolidColorLayerImpl() + : m_layer(adoptPtr(new WebLayerImpl(SolidColorLayerChromium::create()))) { m_layer->layer()->setIsDrawable(true); } diff --git a/webkit/compositor/WebSolidColorLayerImpl.h b/webkit/compositor/WebSolidColorLayerImpl.h index b4a83dc..db15d19 100644 --- a/webkit/compositor/WebSolidColorLayerImpl.h +++ b/webkit/compositor/WebSolidColorLayerImpl.h @@ -7,18 +7,13 @@ #include <public/WebSolidColorLayer.h> #include <wtf/OwnPtr.h> -#include <wtf/PassRefPtr.h> - -namespace WebCore { -class SolidColorLayerChromium; -} namespace WebKit { class WebLayerImpl; class WebSolidColorLayerImpl : public WebSolidColorLayer { public: - explicit WebSolidColorLayerImpl(PassRefPtr<WebCore::SolidColorLayerChromium>); + WebSolidColorLayerImpl(); virtual ~WebSolidColorLayerImpl(); // WebSolidColorLayer implementation. diff --git a/webkit/compositor/WebTransformAnimationCurveImpl.cpp b/webkit/compositor/WebTransformAnimationCurveImpl.cpp index f1efd1f..2cdf000 100644 --- a/webkit/compositor/WebTransformAnimationCurveImpl.cpp +++ b/webkit/compositor/WebTransformAnimationCurveImpl.cpp @@ -16,11 +16,11 @@ namespace WebKit { WebTransformAnimationCurve* WebTransformAnimationCurve::create() { - return new WebTransformAnimationCurveImpl(WebCore::CCKeyframedTransformAnimationCurve::create()); + return new WebTransformAnimationCurveImpl(); } -WebTransformAnimationCurveImpl::WebTransformAnimationCurveImpl(PassOwnPtr<WebCore::CCKeyframedTransformAnimationCurve> curve) - : m_curve(curve) +WebTransformAnimationCurveImpl::WebTransformAnimationCurveImpl() + : m_curve(WebCore::CCKeyframedTransformAnimationCurve::create()) { } diff --git a/webkit/compositor/WebTransformAnimationCurveImpl.h b/webkit/compositor/WebTransformAnimationCurveImpl.h index e65e163..b7d7018 100644 --- a/webkit/compositor/WebTransformAnimationCurveImpl.h +++ b/webkit/compositor/WebTransformAnimationCurveImpl.h @@ -18,7 +18,7 @@ namespace WebKit { class WebTransformAnimationCurveImpl : public WebTransformAnimationCurve { public: - explicit WebTransformAnimationCurveImpl(PassOwnPtr<WebCore::CCKeyframedTransformAnimationCurve>); + WebTransformAnimationCurveImpl(); virtual ~WebTransformAnimationCurveImpl(); // WebAnimationCurve implementation. diff --git a/webkit/compositor/WebTransformOperationsTest.cpp b/webkit/compositor/WebTransformOperationsTest.cpp index dac5c84..efc0003 100644 --- a/webkit/compositor/WebTransformOperationsTest.cpp +++ b/webkit/compositor/WebTransformOperationsTest.cpp @@ -6,11 +6,9 @@ #include <public/WebTransformOperations.h> -#include <public/WebTransformationMatrix.h> - -#include "CCLayerTreeTestCommon.h" - +#include "CCGeometryTestUtils.h" #include <gtest/gtest.h> +#include <public/WebTransformationMatrix.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> diff --git a/webkit/compositor/WebTransformationMatrixTest.cpp b/webkit/compositor/WebTransformationMatrixTest.cpp index 8202366..f0b09fc 100644 --- a/webkit/compositor/WebTransformationMatrixTest.cpp +++ b/webkit/compositor/WebTransformationMatrixTest.cpp @@ -6,7 +6,7 @@ #include <public/WebTransformationMatrix.h> -#include "CCLayerTreeTestCommon.h" +#include "CCGeometryTestUtils.h" #include <gtest/gtest.h> #include <wtf/MathExtras.h> diff --git a/webkit/compositor/WebVideoLayerImpl.cpp b/webkit/compositor/WebVideoLayerImpl.cpp index bddba88..b1f6751 100644 --- a/webkit/compositor/WebVideoLayerImpl.cpp +++ b/webkit/compositor/WebVideoLayerImpl.cpp @@ -12,11 +12,11 @@ namespace WebKit { WebVideoLayer* WebVideoLayer::create(WebVideoFrameProvider* provider) { - return new WebVideoLayerImpl(WebCore::VideoLayerChromium::create(provider)); + return new WebVideoLayerImpl(provider); } -WebVideoLayerImpl::WebVideoLayerImpl(PassRefPtr<WebCore::VideoLayerChromium> layer) - : m_layer(adoptPtr(new WebLayerImpl(layer))) +WebVideoLayerImpl::WebVideoLayerImpl(WebVideoFrameProvider* provider) + : m_layer(adoptPtr(new WebLayerImpl(WebCore::VideoLayerChromium::create(provider)))) { } diff --git a/webkit/compositor/WebVideoLayerImpl.h b/webkit/compositor/WebVideoLayerImpl.h index d8935bd5..b9e9d7f 100644 --- a/webkit/compositor/WebVideoLayerImpl.h +++ b/webkit/compositor/WebVideoLayerImpl.h @@ -7,16 +7,12 @@ #include <public/WebVideoLayer.h> -namespace WebCore { -class VideoLayerChromium; -} - namespace WebKit { class WebLayerImpl; class WebVideoLayerImpl : public WebVideoLayer { public: - explicit WebVideoLayerImpl(PassRefPtr<WebCore::VideoLayerChromium>); + explicit WebVideoLayerImpl(WebVideoFrameProvider*); virtual ~WebVideoLayerImpl(); // WebVideoLayer implementation. |