Unreviewed, rolling out r110929.
[WebKit-https.git] / Source / WebKit / chromium / tests / TiledLayerChromiumTest.cpp
index 07ceaae..2523230 100644 (file)
@@ -48,25 +48,6 @@ using namespace WTF;
 
 namespace {
 
-class TestCCOcclusionTracker : public CCOcclusionTracker {
-public:
-    TestCCOcclusionTracker()
-        : CCOcclusionTracker(IntRect(0, 0, 1000, 1000))
-        , m_scissorRectInScreen(IntRect(0, 0, 1000, 1000))
-    {
-        // Pretend we have visited a render surface.
-        m_stack.append(StackObject());
-    }
-
-    void setOcclusion(const Region& occlusion) { m_stack.last().occlusionInScreen = occlusion; }
-
-protected:
-    virtual IntRect layerScissorRectInTargetSurface(const LayerChromium* layer) const { return m_scissorRectInScreen; }
-
-private:
-    IntRect m_scissorRectInScreen;
-};
-
 class FakeTextureAllocator : public TextureAllocator {
 public:
     virtual unsigned createTexture(const IntSize&, GC3Denum) { return 0; }
@@ -169,14 +150,14 @@ public:
         TiledLayerChromium::invalidateRect(rect);
     }
 
-    void prepareToUpdate(const IntRect& rect, const CCOcclusionTracker* occlusion)
+    void prepareToUpdate(const IntRect& rect, const Region& occluded)
     {
-        TiledLayerChromium::prepareToUpdate(rect, occlusion);
+        TiledLayerChromium::prepareToUpdate(rect, occluded);
     }
 
-    void prepareToUpdateIdle(const IntRect& rect, const CCOcclusionTracker* occlusion)
+    void prepareToUpdateIdle(const IntRect& rect, const Region& occluded)
     {
-        TiledLayerChromium::prepareToUpdateIdle(rect, occlusion);
+        TiledLayerChromium::prepareToUpdateIdle(rect, occluded);
     }
 
     bool needsIdlePaint(const IntRect& rect)
@@ -201,9 +182,9 @@ public:
 
     virtual TextureManager* textureManager() const { return m_textureManager; }
 
-    virtual void paintContentsIfDirty(const CCOcclusionTracker* occlusion)
+    virtual void paintContentsIfDirty(const Region& occludedScreenSpace)
     {
-        prepareToUpdate(visibleLayerRect(), occlusion);
+        prepareToUpdate(visibleLayerRect(), occludedScreenSpace);
     }
 
 private:
@@ -259,6 +240,7 @@ TEST(TiledLayerChromiumTest, pushDirtyTiles)
     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     DebugScopedSetImplThread implThread;
     OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
+    Region noOcclusion;
 
     FakeTextureAllocator textureAllocator;
     CCTextureUpdater updater(&textureAllocator);
@@ -266,7 +248,7 @@ TEST(TiledLayerChromiumTest, pushDirtyTiles)
     // The tile size is 100x100, so this invalidates and then paints two tiles.
     layer->setBounds(IntSize(100, 200));
     layer->invalidateRect(IntRect(0, 0, 100, 200));
-    layer->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
+    layer->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
     layer->updateCompositorResources(0, updater);
     layer->pushPropertiesTo(layerImpl.get());
 
@@ -279,7 +261,7 @@ TEST(TiledLayerChromiumTest, pushDirtyTiles)
     // Invalidates both tiles...
     layer->invalidateRect(IntRect(0, 0, 100, 200));
     // ....but then only update one of them.
-    layer->prepareToUpdate(IntRect(0, 0, 100, 100), 0);
+    layer->prepareToUpdate(IntRect(0, 0, 100, 100), noOcclusion);
     layer->updateCompositorResources(0, updater);
     layer->pushPropertiesTo(layerImpl.get());
 
@@ -294,17 +276,15 @@ TEST(TiledLayerChromiumTest, pushOccludedDirtyTiles)
     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     DebugScopedSetImplThread implThread;
     OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
-    TestCCOcclusionTracker occluded;
+    Region noOcclusion;
 
     FakeTextureAllocator textureAllocator;
     CCTextureUpdater updater(&textureAllocator);
 
     // The tile size is 100x100, so this invalidates and then paints two tiles.
     layer->setBounds(IntSize(100, 200));
-    layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0));
-    layer->setVisibleLayerRect(IntRect(0, 0, 100, 200));
     layer->invalidateRect(IntRect(0, 0, 100, 200));
-    layer->prepareToUpdate(IntRect(0, 0, 100, 200), &occluded);
+    layer->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
     layer->updateCompositorResources(0, updater);
     layer->pushPropertiesTo(layerImpl.get());
 
@@ -317,8 +297,8 @@ TEST(TiledLayerChromiumTest, pushOccludedDirtyTiles)
     // Invalidates part of the top tile...
     layer->invalidateRect(IntRect(0, 0, 50, 50));
     // ....but the area is occluded.
-    occluded.setOcclusion(IntRect(0, 0, 50, 50));
-    layer->prepareToUpdate(IntRect(0, 0, 100, 100), &occluded);
+    Region occlusion(IntRect(0, 0, 50, 50));
+    layer->prepareToUpdate(IntRect(0, 0, 100, 100), occlusion);
     layer->updateCompositorResources(0, updater);
     layer->pushPropertiesTo(layerImpl.get());
 
@@ -341,12 +321,13 @@ TEST(TiledLayerChromiumTest, pushIdlePaintTiles)
     IntSize contentBounds(500, 500);
     IntRect contentRect(IntPoint::zero(), contentBounds);
     IntRect visibleRect(200, 200, 100, 100);
+    Region noOcclusion;
 
     // This invalidates 25 tiles and then paints one visible tile.
     layer->setBounds(contentBounds);
     layer->setVisibleLayerRect(visibleRect);
     layer->invalidateRect(contentRect);
-    layer->prepareToUpdate(visibleRect, 0);
+    layer->prepareToUpdate(visibleRect, noOcclusion);
 
     // We should need idle-painting for 3x3 tiles in the center.
     EXPECT_TRUE(layer->needsIdlePaint(visibleRect));
@@ -361,9 +342,9 @@ TEST(TiledLayerChromiumTest, pushIdlePaintTiles)
 
     // For the next four updates, we should detect we still need idle painting.
     for (int i = 0; i < 4; i++) {
-        layer->prepareToUpdate(visibleRect, 0);
+        layer->prepareToUpdate(visibleRect, noOcclusion);
         EXPECT_TRUE(layer->needsIdlePaint(visibleRect));
-        layer->prepareToUpdateIdle(visibleRect, 0);
+        layer->prepareToUpdateIdle(visibleRect, noOcclusion);
         layer->updateCompositorResources(0, updater);
         layer->pushPropertiesTo(layerImpl.get());
         textureManager->unprotectAllTextures();
@@ -393,6 +374,7 @@ TEST(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint)
 
     FakeTextureAllocator textureAllocator;
     CCTextureUpdater updater(&textureAllocator);
+    Region noOcclusion;
 
     // 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
@@ -400,7 +382,7 @@ TEST(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint)
     layer->setBounds(IntSize(100, 200));
     layer->invalidateRect(IntRect(0, 0, 100, 200));
     layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer.get());
-    layer->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
+    layer->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
     layer->updateCompositorResources(0, updater);
     layer->pushPropertiesTo(layerImpl.get());
 
@@ -420,17 +402,18 @@ TEST(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer)
 
     FakeTextureAllocator textureAllocator;
     CCTextureUpdater updater(&textureAllocator);
+    Region noOcclusion;
 
     layer1->setBounds(IntSize(100, 200));
     layer1->invalidateRect(IntRect(0, 0, 100, 200));
     layer2->setBounds(IntSize(100, 200));
     layer2->invalidateRect(IntRect(0, 0, 100, 200));
 
-    layer1->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
+    layer1->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
 
     // Invalidate a tile on layer1
     layer2->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer1.get());
-    layer2->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
+    layer2->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
 
     layer1->updateCompositorResources(0, updater);
     layer2->updateCompositorResources(0, updater);
@@ -456,6 +439,7 @@ TEST(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer
 
     FakeTextureAllocator textureAllocator;
     CCTextureUpdater updater(&textureAllocator);
+    Region noOcclusion;
 
     layer1->setBounds(IntSize(100, 200));
     layer1->invalidateRect(IntRect(0, 0, 100, 200));
@@ -464,9 +448,9 @@ TEST(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer
 
     // Invalidate a tile on layer2
     layer1->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer2.get());
-    layer1->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
+    layer1->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
 
-    layer2->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
+    layer2->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
 
     layer1->updateCompositorResources(0, updater);
     layer2->updateCompositorResources(0, updater);
@@ -487,6 +471,7 @@ TEST(TiledLayerChromiumTest, idlePaintOutOfMemory)
     IntSize contentBounds(300, 300);
     IntRect contentRect(IntPoint::zero(), contentBounds);
     IntRect visibleRect(100, 100, 100, 100);
+    Region noOcclusion;
 
     // 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; // 2 tiles, 4 bytes per pixel.
@@ -503,7 +488,7 @@ TEST(TiledLayerChromiumTest, idlePaintOutOfMemory)
     layer->setBounds(contentBounds);
     layer->setVisibleLayerRect(visibleRect);
     layer->invalidateRect(contentRect);
-    layer->prepareToUpdate(visibleRect, 0);
+    layer->prepareToUpdate(visibleRect, noOcclusion);
 
     // We should need idle-painting for 3x3 tiles surounding visible tile.
     EXPECT_TRUE(layer->needsIdlePaint(visibleRect));
@@ -515,8 +500,8 @@ TEST(TiledLayerChromiumTest, idlePaintOutOfMemory)
     EXPECT_TRUE(layerImpl->hasTileAt(1, 1));
 
     textureManager->unprotectAllTextures();
-    layer->prepareToUpdate(visibleRect, 0);
-    layer->prepareToUpdateIdle(visibleRect, 0);
+    layer->prepareToUpdate(visibleRect, noOcclusion);
+    layer->prepareToUpdateIdle(visibleRect, noOcclusion);
 
     // We shouldn't signal we need another idle paint after we run out of memory.
     EXPECT_FALSE(layer->needsIdlePaint(visibleRect));
@@ -531,6 +516,7 @@ TEST(TiledLayerChromiumTest, invalidateFromPrepare)
     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     DebugScopedSetImplThread implThread;
     OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
+    Region noOcclusion;
 
     FakeTextureAllocator textureAllocator;
     CCTextureUpdater updater(&textureAllocator);
@@ -538,7 +524,7 @@ TEST(TiledLayerChromiumTest, invalidateFromPrepare)
     // The tile size is 100x100, so this invalidates and then paints two tiles.
     layer->setBounds(IntSize(100, 200));
     layer->invalidateRect(IntRect(0, 0, 100, 200));
-    layer->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
+    layer->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
     layer->updateCompositorResources(0, updater);
     layer->pushPropertiesTo(layerImpl.get());
 
@@ -551,18 +537,18 @@ TEST(TiledLayerChromiumTest, invalidateFromPrepare)
     layer->fakeLayerTextureUpdater()->clearPrepareCount();
     // Invoke prepareToUpdate again. As the layer is valid prepareToUpdate shouldn't be invoked on
     // the LayerTextureUpdater.
-    layer->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
+    layer->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
     EXPECT_EQ(0, layer->fakeLayerTextureUpdater()->prepareCount());
 
     layer->invalidateRect(IntRect(0, 0, 50, 50));
     // setRectToInvalidate triggers invalidateRect() being invoked from prepareToUpdate.
     layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(25, 25, 50, 50), layer.get());
     layer->fakeLayerTextureUpdater()->clearPrepareCount();
-    layer->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
+    layer->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
     EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount());
     layer->fakeLayerTextureUpdater()->clearPrepareCount();
     // The layer should still be invalid as prepareToUpdate invoked invalidate.
-    layer->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
+    layer->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
     EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount());
 }
 
@@ -573,6 +559,7 @@ TEST(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled)
 
     OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
     RefPtr<FakeTiledLayerWithScaledBounds> layer = adoptRef(new FakeTiledLayerWithScaledBounds(textureManager.get()));
+    Region noOcclusion;
 
     FakeTextureAllocator textureAllocator;
     CCTextureUpdater updater(&textureAllocator);
@@ -587,20 +574,20 @@ TEST(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled)
     // On first update, the updateRect includes all tiles, even beyond the boundaries of the layer.
     // However, it should still be in layer space, not content space.
     layer->invalidateRect(contentBounds);
-    layer->prepareToUpdate(contentBounds, 0);
+    layer->prepareToUpdate(contentBounds, noOcclusion);
     layer->updateCompositorResources(0, updater);
     EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 300, 300 * 0.8), layer->updateRect());
 
     // After the tiles are updated once, another invalidate only needs to update the bounds of the layer.
     layer->invalidateRect(contentBounds);
-    layer->prepareToUpdate(contentBounds, 0);
+    layer->prepareToUpdate(contentBounds, noOcclusion);
     layer->updateCompositorResources(0, updater);
     EXPECT_FLOAT_RECT_EQ(FloatRect(layerBounds), layer->updateRect());
 
     // Partial re-paint should also be represented by the updateRect in layer space, not content space.
     IntRect partialDamage(30, 100, 10, 10);
     layer->invalidateRect(partialDamage);
-    layer->prepareToUpdate(contentBounds, 0);
+    layer->prepareToUpdate(contentBounds, noOcclusion);
     layer->updateCompositorResources(0, updater);
     EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect());
 }
@@ -614,6 +601,7 @@ TEST(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges)
 
     FakeTextureAllocator textureAllocator;
     CCTextureUpdater updater(&textureAllocator);
+    Region noOcclusion;
 
     // Create a layer with one tile.
     layer->setBounds(IntSize(100, 100));
@@ -623,7 +611,7 @@ TEST(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges)
     EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect());
 
     // Push the tiles to the impl side and check that there is exactly one.
-    layer->prepareToUpdate(IntRect(0, 0, 100, 100), 0);
+    layer->prepareToUpdate(IntRect(0, 0, 100, 100), noOcclusion);
     layer->updateCompositorResources(0, updater);
     layer->pushPropertiesTo(layerImpl.get());
     EXPECT_TRUE(layerImpl->hasTileAt(0, 0));
@@ -637,7 +625,7 @@ TEST(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges)
     EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect());
 
     // The impl side should get 2x2 tiles now.
-    layer->prepareToUpdate(IntRect(0, 0, 200, 200), 0);
+    layer->prepareToUpdate(IntRect(0, 0, 200, 200), noOcclusion);
     layer->updateCompositorResources(0, updater);
     layer->pushPropertiesTo(layerImpl.get());
     EXPECT_TRUE(layerImpl->hasTileAt(0, 0));
@@ -648,7 +636,7 @@ TEST(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges)
     // Invalidate the entire layer again, but do not paint. All tiles should be gone now from the
     // impl side.
     layer->setNeedsDisplay();
-    layer->prepareToUpdate(IntRect(1, 0, 0, 1), 0);
+    layer->prepareToUpdate(IntRect(0, 0, 0, 0), noOcclusion);
     layer->updateCompositorResources(0, updater);
     layer->pushPropertiesTo(layerImpl.get());
     EXPECT_FALSE(layerImpl->hasTileAt(0, 0));
@@ -714,10 +702,11 @@ TEST(TiledLayerChromiumTest, resizeToSmaller)
 {
     OwnPtr<TextureManager> textureManager = TextureManager::create(60*1024*1024, 60*1024*1024, 1024);
     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
+    Region noOcclusion;
 
     layer->setBounds(IntSize(700, 700));
     layer->invalidateRect(IntRect(0, 0, 700, 700));
-    layer->prepareToUpdate(IntRect(0, 0, 700, 700), 0);
+    layer->prepareToUpdate(IntRect(0, 0, 700, 700), noOcclusion);
 
     layer->setBounds(IntSize(200, 200));
     layer->invalidateRect(IntRect(0, 0, 200, 200));
@@ -798,12 +787,13 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion)
 {
     OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
+    Region occluded;
 
     // The tile size is 100x100, so this invalidates and then paints two tiles.
     layer->setBounds(IntSize(100, 200));
 
     layer->invalidateRect(IntRect(0, 0, 100, 200));
-    layer->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
+    layer->prepareToUpdate(IntRect(0, 0, 100, 200), occluded);
     EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->prepareRectCount());
 }
 
@@ -811,31 +801,30 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusion)
 {
     OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
-    TestCCOcclusionTracker occluded;
+    Region occluded;
 
     // The tile size is 100x100.
 
     layer->setBounds(IntSize(600, 600));
-    layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0));
 
-    occluded.setOcclusion(IntRect(200, 200, 300, 100));
+    occluded = IntRect(200, 200, 300, 100);
     layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds()));
     layer->invalidateRect(IntRect(0, 0, 600, 600));
-    layer->prepareToUpdate(IntRect(0, 0, 600, 600), &occluded);
+    layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
     EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount());
 
     layer->fakeLayerTextureUpdater()->clearPrepareRectCount();
 
-    occluded.setOcclusion(IntRect(250, 200, 300, 100));
+    occluded = IntRect(250, 200, 300, 100);
     layer->invalidateRect(IntRect(0, 0, 600, 600));
-    layer->prepareToUpdate(IntRect(0, 0, 600, 600), &occluded);
+    layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
     EXPECT_EQ(36-2, layer->fakeLayerTextureUpdater()->prepareRectCount());
 
     layer->fakeLayerTextureUpdater()->clearPrepareRectCount();
 
-    occluded.setOcclusion(IntRect(250, 250, 300, 100));
+    occluded = IntRect(250, 250, 300, 100);
     layer->invalidateRect(IntRect(0, 0, 600, 600));
-    layer->prepareToUpdate(IntRect(0, 0, 600, 600), &occluded);
+    layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
     EXPECT_EQ(36, layer->fakeLayerTextureUpdater()->prepareRectCount());
 }
 
@@ -843,60 +832,58 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
 {
     OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
-    TestCCOcclusionTracker occluded;
+    Region occluded;
 
     // The tile size is 100x100.
 
     layer->setBounds(IntSize(600, 600));
-    layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0));
 
     // The partially occluded tiles (by the 150 occlusion height) are visible beyond the occlusion, so not culled.
-    occluded.setOcclusion(IntRect(200, 200, 300, 150));
+    occluded = IntRect(200, 200, 300, 150);
     layer->setVisibleLayerRect(IntRect(0, 0, 600, 360));
     layer->invalidateRect(IntRect(0, 0, 600, 600));
-    layer->prepareToUpdate(IntRect(0, 0, 600, 600), &occluded);
-    EXPECT_EQ(24-3, layer->fakeLayerTextureUpdater()->prepareRectCount());
+    layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
+    EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount());
 
     layer->fakeLayerTextureUpdater()->clearPrepareRectCount();
 
     // Now the visible region stops at the edge of the occlusion so the partly visible tiles become fully occluded.
-    occluded.setOcclusion(IntRect(200, 200, 300, 150));
+    occluded = IntRect(200, 200, 300, 150);
     layer->setVisibleLayerRect(IntRect(0, 0, 600, 350));
     layer->invalidateRect(IntRect(0, 0, 600, 600));
-    layer->prepareToUpdate(IntRect(0, 0, 600, 600), &occluded);
-    EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount());
+    layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
+    EXPECT_EQ(36-6, layer->fakeLayerTextureUpdater()->prepareRectCount());
 
     layer->fakeLayerTextureUpdater()->clearPrepareRectCount();
 
     // Now the visible region is even smaller than the occlusion, it should have the same result.
-    occluded.setOcclusion(IntRect(200, 200, 300, 150));
+    occluded = IntRect(200, 200, 300, 150);
     layer->setVisibleLayerRect(IntRect(0, 0, 600, 340));
     layer->invalidateRect(IntRect(0, 0, 600, 600));
-    layer->prepareToUpdate(IntRect(0, 0, 600, 600), &occluded);
-    EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount());
+    layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
+    EXPECT_EQ(36-6, layer->fakeLayerTextureUpdater()->prepareRectCount());
 }
 
 TEST(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation)
 {
     OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
-    TestCCOcclusionTracker occluded;
+    Region occluded;
 
     // The tile size is 100x100.
 
     layer->setBounds(IntSize(600, 600));
-    layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0));
 
-    occluded.setOcclusion(IntRect(200, 200, 300, 100));
+    occluded = IntRect(200, 200, 300, 100);
     layer->setVisibleLayerRect(IntRect(0, 0, 600, 600));
     layer->invalidateRect(IntRect(0, 0, 600, 600));
-    layer->prepareToUpdate(IntRect(0, 0, 600, 600), &occluded);
+    layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
     EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount());
 
     layer->fakeLayerTextureUpdater()->clearPrepareRectCount();
 
     // Repaint without marking it dirty.
-    layer->prepareToUpdate(IntRect(0, 0, 600, 600), &occluded);
+    layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
     EXPECT_EQ(0, layer->fakeLayerTextureUpdater()->prepareRectCount());
 }
 
@@ -904,7 +891,7 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms)
 {
     OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
-    TestCCOcclusionTracker occluded;
+    Region occluded;
 
     // The tile size is 100x100.
 
@@ -914,12 +901,11 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms)
     TransformationMatrix screenTransform;
     screenTransform.scale(0.5);
     layer->setScreenSpaceTransform(screenTransform);
-    layer->setDrawTransform(screenTransform * TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0));
 
-    occluded.setOcclusion(IntRect(100, 100, 150, 50));
+    occluded = IntRect(100, 100, 150, 50);
     layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds()));
     layer->invalidateRect(IntRect(0, 0, 600, 600));
-    layer->prepareToUpdate(IntRect(0, 0, 600, 600), &occluded);
+    layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
     EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount());
 }
 
@@ -927,7 +913,7 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling)
 {
     OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
-    TestCCOcclusionTracker occluded;
+    Region occluded;
 
     // The tile size is 100x100.
 
@@ -936,12 +922,11 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling)
     // pixels, which means none should be occluded.
     layer->setContentsScale(0.5);
     layer->setBounds(IntSize(600, 600));
-    layer->setDrawTransform(TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0));
 
-    occluded.setOcclusion(IntRect(200, 200, 300, 100));
+    occluded = IntRect(200, 200, 300, 100);
     layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds()));
     layer->invalidateRect(IntRect(0, 0, 600, 600));
-    layer->prepareToUpdate(IntRect(0, 0, 600, 600), &occluded);
+    layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
     // The content is half the size of the layer (so the number of tiles is fewer).
     // In this case, the content is 300x300, and since the tile size is 100, the
     // number of tiles 3x3.
@@ -952,10 +937,10 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling)
     // This makes sure the painting works when the content space is scaled to
     // a different layer space. In this case the occluded region catches the
     // blown up tiles.
-    occluded.setOcclusion(IntRect(200, 200, 300, 200));
+    occluded = IntRect(200, 200, 300, 200);
     layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds()));
     layer->invalidateRect(IntRect(0, 0, 600, 600));
-    layer->prepareToUpdate(IntRect(0, 0, 600, 600), &occluded);
+    layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
     EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount());
 
     layer->fakeLayerTextureUpdater()->clearPrepareRectCount();
@@ -964,12 +949,11 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling)
     TransformationMatrix screenTransform;
     screenTransform.scale(0.5);
     layer->setScreenSpaceTransform(screenTransform);
-    layer->setDrawTransform(screenTransform * TransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0));
 
-    occluded.setOcclusion(IntRect(100, 100, 150, 100));
+    occluded = IntRect(100, 100, 150, 100);
     layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds()));
     layer->invalidateRect(IntRect(0, 0, 600, 600));
-    layer->prepareToUpdate(IntRect(0, 0, 600, 600), &occluded);
+    layer->prepareToUpdate(IntRect(0, 0, 600, 600), occluded);
     EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount());
 }
 
@@ -982,6 +966,7 @@ TEST(TiledLayerChromiumTest, opaqueContentsRegion)
 
     IntRect opaquePaintRect;
     Region opaqueContents;
+    Region noOcclusion;
 
     IntRect contentBounds = IntRect(0, 0, 100, 200);
     IntRect visibleBounds = IntRect(0, 0, 100, 150);
@@ -993,7 +978,7 @@ TEST(TiledLayerChromiumTest, opaqueContentsRegion)
     // If the layer doesn't paint opaque content, then the opaqueContentsRegion should be empty.
     layer->fakeLayerTextureUpdater()->setOpaquePaintRect(opaquePaintRect);
     layer->invalidateRect(contentBounds);
-    layer->prepareToUpdate(contentBounds, 0);
+    layer->prepareToUpdate(contentBounds, noOcclusion);
     opaqueContents = layer->opaqueContentsRegion();
     EXPECT_TRUE(opaqueContents.isEmpty());
 
@@ -1001,14 +986,14 @@ TEST(TiledLayerChromiumTest, opaqueContentsRegion)
     opaquePaintRect = IntRect(10, 10, 90, 190);
     layer->fakeLayerTextureUpdater()->setOpaquePaintRect(opaquePaintRect);
     layer->invalidateRect(contentBounds);
-    layer->prepareToUpdate(contentBounds, 0);
+    layer->prepareToUpdate(contentBounds, noOcclusion);
     opaqueContents = layer->opaqueContentsRegion();
     EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds());
     EXPECT_EQ(1u, opaqueContents.rects().size());
 
     // If we paint again without invalidating, the same stuff should be opaque.
     layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect());
-    layer->prepareToUpdate(contentBounds, 0);
+    layer->prepareToUpdate(contentBounds, noOcclusion);
     opaqueContents = layer->opaqueContentsRegion();
     EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds());
     EXPECT_EQ(1u, opaqueContents.rects().size());
@@ -1017,7 +1002,7 @@ TEST(TiledLayerChromiumTest, opaqueContentsRegion)
     // not be affected.
     layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect());
     layer->invalidateRect(IntRect(0, 0, 1, 1));
-    layer->prepareToUpdate(contentBounds, 0);
+    layer->prepareToUpdate(contentBounds, noOcclusion);
     opaqueContents = layer->opaqueContentsRegion();
     EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds());
     EXPECT_EQ(1u, opaqueContents.rects().size());
@@ -1026,7 +1011,7 @@ TEST(TiledLayerChromiumTest, opaqueContentsRegion)
     // not be affected.
     layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect());
     layer->invalidateRect(IntRect(10, 10, 1, 1));
-    layer->prepareToUpdate(contentBounds, 0);
+    layer->prepareToUpdate(contentBounds, noOcclusion);
     opaqueContents = layer->opaqueContentsRegion();
     EXPECT_EQ_RECT(intersection(IntRect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds());
     EXPECT_EQ(1u, opaqueContents.rects().size());