Unreviewed, rolling out r110941.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Mar 2012 05:47:44 +0000 (05:47 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Mar 2012 05:47:44 +0000 (05:47 +0000)
http://trac.webkit.org/changeset/110941
https://bugs.webkit.org/show_bug.cgi?id=81307

the revert looks innocent. (Requested by morrita on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-03-15

Source/WebCore:

* platform/graphics/chromium/Canvas2DLayerChromium.cpp:
(WebCore::Canvas2DLayerChromium::paintContentsIfDirty):
* platform/graphics/chromium/Canvas2DLayerChromium.h:
(Canvas2DLayerChromium):
* platform/graphics/chromium/ContentLayerChromium.cpp:
(WebCore::ContentLayerChromium::paintContentsIfDirty):
(WebCore::ContentLayerChromium::idlePaintContentsIfDirty):
* platform/graphics/chromium/ContentLayerChromium.h:
(WebCore):
(ContentLayerChromium):
* platform/graphics/chromium/ImageLayerChromium.cpp:
(WebCore::ImageLayerChromium::paintContentsIfDirty):
* platform/graphics/chromium/ImageLayerChromium.h:
(WebCore):
(ImageLayerChromium):
* platform/graphics/chromium/LayerChromium.h:
(WebCore::LayerChromium::paintContentsIfDirty):
(WebCore::LayerChromium::idlePaintContentsIfDirty):
* platform/graphics/chromium/TiledLayerChromium.cpp:
(WebCore::TiledLayerChromium::prepareToUpdateTiles):
(WebCore::TiledLayerChromium::prepareToUpdate):
(WebCore::TiledLayerChromium::prepareToUpdateIdle):
* platform/graphics/chromium/TiledLayerChromium.h:
(TiledLayerChromium):
* platform/graphics/chromium/WebGLLayerChromium.cpp:
(WebCore::WebGLLayerChromium::paintContentsIfDirty):
* platform/graphics/chromium/WebGLLayerChromium.h:
(WebGLLayerChromium):
* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::paintContentsIfDirty):
(WebCore::CCLayerTreeHost::paintMaskAndReplicaForRenderSurface):
(WebCore::CCLayerTreeHost::paintLayerContents):
* platform/graphics/chromium/cc/CCLayerTreeHost.h:

Source/WebKit/chromium:

* tests/CCLayerTreeHostTest.cpp:
(WTF::ContentLayerChromiumWithUpdateTracking::paintContentsIfDirty):
(WTF::ContentLayerChromiumWithUpdateTracking::idlePaintContentsIfDirty):
(WTF::TestLayerChromium::paintContentsIfDirty):
* tests/Canvas2DLayerChromiumTest.cpp:
* tests/TiledLayerChromiumTest.cpp:
(TestCCOcclusionTracker):
(WTF::TestCCOcclusionTracker::TestCCOcclusionTracker):
(WTF::TestCCOcclusionTracker::setOcclusion):
(WTF::TestCCOcclusionTracker::layerScissorRectInTargetSurface):
(WTF):
(WTF::FakeTiledLayerChromium::prepareToUpdate):
(WTF::FakeTiledLayerChromium::prepareToUpdateIdle):
(WTF::FakeTiledLayerChromium::paintContentsIfDirty):
(WTF::TEST):

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

18 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp
Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.h
Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h
Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp
Source/WebCore/platform/graphics/chromium/ImageLayerChromium.h
Source/WebCore/platform/graphics/chromium/LayerChromium.h
Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp
Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h
Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.cpp
Source/WebCore/platform/graphics/chromium/WebGLLayerChromium.h
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp
Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp

index dedf727..a523781 100644 (file)
@@ -1,3 +1,45 @@
+2012-03-15  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r110941.
+        http://trac.webkit.org/changeset/110941
+        https://bugs.webkit.org/show_bug.cgi?id=81307
+
+        the revert looks innocent. (Requested by morrita on #webkit).
+
+        * platform/graphics/chromium/Canvas2DLayerChromium.cpp:
+        (WebCore::Canvas2DLayerChromium::paintContentsIfDirty):
+        * platform/graphics/chromium/Canvas2DLayerChromium.h:
+        (Canvas2DLayerChromium):
+        * platform/graphics/chromium/ContentLayerChromium.cpp:
+        (WebCore::ContentLayerChromium::paintContentsIfDirty):
+        (WebCore::ContentLayerChromium::idlePaintContentsIfDirty):
+        * platform/graphics/chromium/ContentLayerChromium.h:
+        (WebCore):
+        (ContentLayerChromium):
+        * platform/graphics/chromium/ImageLayerChromium.cpp:
+        (WebCore::ImageLayerChromium::paintContentsIfDirty):
+        * platform/graphics/chromium/ImageLayerChromium.h:
+        (WebCore):
+        (ImageLayerChromium):
+        * platform/graphics/chromium/LayerChromium.h:
+        (WebCore::LayerChromium::paintContentsIfDirty):
+        (WebCore::LayerChromium::idlePaintContentsIfDirty):
+        * platform/graphics/chromium/TiledLayerChromium.cpp:
+        (WebCore::TiledLayerChromium::prepareToUpdateTiles):
+        (WebCore::TiledLayerChromium::prepareToUpdate):
+        (WebCore::TiledLayerChromium::prepareToUpdateIdle):
+        * platform/graphics/chromium/TiledLayerChromium.h:
+        (TiledLayerChromium):
+        * platform/graphics/chromium/WebGLLayerChromium.cpp:
+        (WebCore::WebGLLayerChromium::paintContentsIfDirty):
+        * platform/graphics/chromium/WebGLLayerChromium.h:
+        (WebGLLayerChromium):
+        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+        (WebCore::CCLayerTreeHost::paintContentsIfDirty):
+        (WebCore::CCLayerTreeHost::paintMaskAndReplicaForRenderSurface):
+        (WebCore::CCLayerTreeHost::paintLayerContents):
+        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+
 2012-03-15  Tommy Widenflycht  <tommyw@google.com>
 
         MediaStream API (JSEP): Introducing SessionDescription
index 3fc6002..5c0af2c 100644 (file)
@@ -97,7 +97,7 @@ void Canvas2DLayerChromium::setCanvas(SkCanvas* canvas)
     m_canvas = canvas;
 }
 
-void Canvas2DLayerChromium::paintContentsIfDirty(const Region& /* occludedScreenSpace */)
+void Canvas2DLayerChromium::paintContentsIfDirty(const CCOcclusionTracker* /* occlusion */)
 {
     TRACE_EVENT("Canvas2DLayerChromium::paintContentsIfDirty", this, 0);
     if (!drawsContent())
index cbd4adc..9302246 100644 (file)
@@ -55,7 +55,7 @@ public:
     virtual void setNeedsDisplayRect(const FloatRect&);
 
     virtual bool drawsContent() const;
-    virtual void paintContentsIfDirty(const Region& occludedScreenSpace);
+    virtual void paintContentsIfDirty(const CCOcclusionTracker*);
 
     virtual void updateCompositorResources(GraphicsContext3D*, CCTextureUpdater&);
     virtual void pushPropertiesTo(CCLayerImpl*);
index 7a66984..c007215 100644 (file)
@@ -93,7 +93,7 @@ bool ContentLayerChromium::drawsContent() const
     return TiledLayerChromium::drawsContent() && m_delegate;
 }
 
-void ContentLayerChromium::paintContentsIfDirty(const Region& occludedScreenSpace)
+void ContentLayerChromium::paintContentsIfDirty(const CCOcclusionTracker* occlusion)
 {
     updateTileSizeAndTilingOption();
     createTextureUpdaterIfNeeded();
@@ -105,11 +105,11 @@ void ContentLayerChromium::paintContentsIfDirty(const Region& occludedScreenSpac
     if (drawsContent())
         layerRect = visibleLayerRect();
 
-    prepareToUpdate(layerRect, occludedScreenSpace);
+    prepareToUpdate(layerRect, occlusion);
     m_needsDisplay = false;
 }
 
-void ContentLayerChromium::idlePaintContentsIfDirty(const Region& occludedScreenSpace)
+void ContentLayerChromium::idlePaintContentsIfDirty(const CCOcclusionTracker* occlusion)
 {
     if (!drawsContent())
         return;
@@ -118,7 +118,7 @@ void ContentLayerChromium::idlePaintContentsIfDirty(const Region& occludedScreen
     if (layerRect.isEmpty())
         return;
 
-    prepareToUpdateIdle(layerRect, occludedScreenSpace);
+    prepareToUpdateIdle(layerRect, occlusion);
     if (needsIdlePaint(layerRect))
         setNeedsCommit();
 }
index fa5901e..e6994a2 100644 (file)
@@ -41,7 +41,6 @@ namespace WebCore {
 
 class LayerTilerChromium;
 class LayerTextureUpdater;
-class Region;
 
 class ContentLayerDelegate {
 public:
@@ -59,8 +58,8 @@ public:
     void clearDelegate() { m_delegate = 0; }
 
     virtual bool drawsContent() const;
-    virtual void paintContentsIfDirty(const Region& occludedScreenSpace);
-    virtual void idlePaintContentsIfDirty(const Region& occludedScreenSpace);
+    virtual void paintContentsIfDirty(const CCOcclusionTracker*);
+    virtual void idlePaintContentsIfDirty(const CCOcclusionTracker*);
 
     virtual void setOpaque(bool);
 
index 611ab2a..3939158 100644 (file)
@@ -158,7 +158,7 @@ void ImageLayerChromium::setContents(Image* contents)
     setNeedsDisplay();
 }
 
-void ImageLayerChromium::paintContentsIfDirty(const Region& occludedScreenSpace)
+void ImageLayerChromium::paintContentsIfDirty(const CCOcclusionTracker* occlusion)
 {
     createTextureUpdaterIfNeeded();
     if (m_needsDisplay) {
@@ -168,7 +168,7 @@ void ImageLayerChromium::paintContentsIfDirty(const Region& occludedScreenSpace)
         m_needsDisplay = false;
     }
 
-    prepareToUpdate(visibleLayerRect(), occludedScreenSpace);
+    prepareToUpdate(visibleLayerRect(), occlusion);
 }
 
 void ImageLayerChromium::createTextureUpdaterIfNeeded()
index deafd37..b01ef29 100644 (file)
@@ -41,7 +41,6 @@ namespace WebCore {
 
 class Image;
 class ImageLayerTextureUpdater;
-class Region;
 
 // A Layer that contains only an Image element.
 class ImageLayerChromium : public TiledLayerChromium {
@@ -50,7 +49,7 @@ public:
     virtual ~ImageLayerChromium();
 
     virtual bool drawsContent() const;
-    virtual void paintContentsIfDirty(const Region& occludedScreenSpace);
+    virtual void paintContentsIfDirty(const CCOcclusionTracker*);
     virtual bool needsContentsScale() const;
 
     void setContents(Image* image);
index 86fdf95..e52ec48 100644 (file)
@@ -43,6 +43,7 @@
 #include "RenderSurfaceChromium.h"
 #include "ShaderChromium.h"
 #include "TransformationMatrix.h"
+#include "cc/CCOcclusionTracker.h"
 
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
@@ -161,8 +162,8 @@ public:
 
     // These methods typically need to be overwritten by derived classes.
     virtual bool drawsContent() const { return m_isDrawable; }
-    virtual void paintContentsIfDirty(const Region& /* occludedScreenSpace */) { }
-    virtual void idlePaintContentsIfDirty(const Region& /* occludedScreenSpace */) { }
+    virtual void paintContentsIfDirty(const CCOcclusionTracker* /* occlusion */) { }
+    virtual void idlePaintContentsIfDirty(const CCOcclusionTracker* /* occlusion */) { }
     virtual void updateCompositorResources(GraphicsContext3D*, CCTextureUpdater&) { }
     virtual void setIsMask(bool) { }
     virtual void unreserveContentsTexture() { }
index 0259a23..853d675 100644 (file)
@@ -397,23 +397,10 @@ bool TiledLayerChromium::tileNeedsBufferedUpdate(UpdatableTile* tile)
     return true;
 }
 
-// FIXME: This gets rolled into CCOcclusionTracker when we stop passing around Region objects.
-static inline TransformationMatrix contentToLayerTransform(const IntSize& boundsInLayerSpace, const IntSize& boundsInContentSpace)
-{
-    TransformationMatrix transform;
-    // Scale from content space to layer space
-    transform.scaleNonUniform(boundsInLayerSpace.width() / static_cast<double>(boundsInContentSpace.width()),
-                              boundsInLayerSpace.height() / static_cast<double>(boundsInContentSpace.height()));
-    return transform;
-}
-
-void TiledLayerChromium::prepareToUpdateTiles(bool idle, int left, int top, int right, int bottom, const Region& occludedScreenSpace)
+void TiledLayerChromium::prepareToUpdateTiles(bool idle, int left, int top, int right, int bottom, const CCOcclusionTracker* occlusion)
 {
     createTextureUpdaterIfNeeded();
 
-    // Tiles are in the layer's content space, the occluded region is in screen space.
-    TransformationMatrix contentToScreenSpace = screenSpaceTransform() * contentToLayerTransform(bounds(), contentBounds());
-
     // Create tiles as needed, expanding a dirty rect to contain all
     // the dirty regions currently being drawn. All dirty tiles that are to be painted
     // get their m_updateRect set to m_dirtyRect and m_dirtyRect cleared. This way if
@@ -428,9 +415,9 @@ void TiledLayerChromium::prepareToUpdateTiles(bool idle, int left, int top, int
             // When not idle painting, if the visible region of the tile is occluded, don't reserve a texture or mark it for update.
             // If any part of the tile is visible, then we need to paint it so the tile is pushed to the impl thread.
             // This will also avoid painting the tile in the next loop, below.
-            if (!idle) {
+            if (!idle && occlusion) {
                 IntRect visibleTileRect = intersection(m_tiler->tileBounds(i, j), visibleLayerRect());
-                if (occludedScreenSpace.contains(contentToScreenSpace.mapRect(visibleTileRect)))
+                if (occlusion->occluded(this, visibleTileRect))
                     continue;
             }
 
@@ -572,7 +559,7 @@ void TiledLayerChromium::resetUpdateState()
     }
 }
 
-void TiledLayerChromium::prepareToUpdate(const IntRect& layerRect, const Region& occludedScreenSpace)
+void TiledLayerChromium::prepareToUpdate(const IntRect& layerRect, const CCOcclusionTracker* occlusion)
 {
     m_skipsDraw = false;
     m_skipsIdlePaint = false;
@@ -589,10 +576,10 @@ void TiledLayerChromium::prepareToUpdate(const IntRect& layerRect, const Region&
     int left, top, right, bottom;
     m_tiler->layerRectToTileIndices(layerRect, left, top, right, bottom);
 
-    prepareToUpdateTiles(false, left, top, right, bottom, occludedScreenSpace);
+    prepareToUpdateTiles(false, left, top, right, bottom, occlusion);
 }
 
-void TiledLayerChromium::prepareToUpdateIdle(const IntRect& layerRect, const Region& occludedScreenSpace)
+void TiledLayerChromium::prepareToUpdateIdle(const IntRect& layerRect, const CCOcclusionTracker* occlusion)
 {
     // Abort if we have already prepared a paint or run out of memory.
     if (m_skipsIdlePaint || !m_paintRect.isEmpty())
@@ -614,7 +601,7 @@ void TiledLayerChromium::prepareToUpdateIdle(const IntRect& layerRect, const Reg
     m_tiler->layerRectToTileIndices(layerRect, left, top, right, bottom);
 
     // Prepaint anything that was occluded but inside the layer's visible region.
-    prepareToUpdateTiles(true, left, top, right, bottom, occludedScreenSpace);
+    prepareToUpdateTiles(true, left, top, right, bottom, 0);
     if (!m_paintRect.isEmpty() || m_skipsIdlePaint)
         return;
 
@@ -624,25 +611,25 @@ void TiledLayerChromium::prepareToUpdateIdle(const IntRect& layerRect, const Reg
     while (!m_skipsIdlePaint && (left > prepaintLeft || top > prepaintTop || right < prepaintRight || bottom < prepaintBottom)) {
         if (bottom < prepaintBottom) {
             ++bottom;
-            prepareToUpdateTiles(true, left, bottom, right, bottom, occludedScreenSpace);
+            prepareToUpdateTiles(true, left, bottom, right, bottom, 0);
             if (!m_paintRect.isEmpty() || m_skipsIdlePaint)
                 break;
         }
         if (top > prepaintTop) {
             --top;
-            prepareToUpdateTiles(true, left, top, right, top, occludedScreenSpace);
+            prepareToUpdateTiles(true, left, top, right, top, 0);
             if (!m_paintRect.isEmpty() || m_skipsIdlePaint)
                 break;
         }
         if (left > prepaintLeft) {
             --left;
-            prepareToUpdateTiles(true, left, top, left, bottom, occludedScreenSpace);
+            prepareToUpdateTiles(true, left, top, left, bottom, 0);
             if (!m_paintRect.isEmpty() || m_skipsIdlePaint)
                 break;
         }
         if (right < prepaintRight) {
             ++right;
-            prepareToUpdateTiles(true, right, top, right, bottom, occludedScreenSpace);
+            prepareToUpdateTiles(true, right, top, right, bottom, 0);
             if (!m_paintRect.isEmpty() || m_skipsIdlePaint)
                 break;
         }
index 6ff901d..643f696 100644 (file)
@@ -33,9 +33,7 @@
 #include "cc/CCTiledLayerImpl.h"
 
 namespace WebCore {
-
 class LayerTextureUpdater;
-class Region;
 class UpdatableTile;
 
 class TiledLayerChromium : public LayerChromium {
@@ -90,10 +88,10 @@ protected:
     void resetUpdateState();
 
     // Prepare data needed to update textures that intersect with layerRect.
-    void prepareToUpdate(const IntRect& layerRect, const Region& occludedTargetSpace);
+    void prepareToUpdate(const IntRect& layerRect, const CCOcclusionTracker*);
 
     // Same as above, but this will try to paint additional surrounding content if idle.
-    void prepareToUpdateIdle(const IntRect& layerRect, const Region& occludedTargetSpace);
+    void prepareToUpdateIdle(const IntRect& layerRect, const CCOcclusionTracker*);
 
     // After preparing an update, returns true if more pre-painting is needed.
     bool needsIdlePaint(const IntRect& layerRect);
@@ -113,7 +111,7 @@ private:
     bool tileOnlyNeedsPartialUpdate(UpdatableTile*);
     bool tileNeedsBufferedUpdate(UpdatableTile*);
 
-    void prepareToUpdateTiles(bool idle, int left, int top, int right, int bottom, const Region& occludedTargetSpace);
+    void prepareToUpdateTiles(bool idle, int left, int top, int right, int bottom, const CCOcclusionTracker*);
     IntRect idlePaintRect(const IntRect& visibleLayerRect);
 
     UpdatableTile* tileAt(int, int) const;
index e3e19e2..80d23d1 100644 (file)
@@ -70,7 +70,7 @@ bool WebGLLayerChromium::drawsContent() const
     return LayerChromium::drawsContent() && !m_contextLost;
 }
 
-void WebGLLayerChromium::paintContentsIfDirty(const Region&)
+void WebGLLayerChromium::paintContentsIfDirty(const CCOcclusionTracker* /* occlusion */)
 {
     if (!drawsContent() || !m_needsDisplay || !m_textureUpdated)
         return;
index af138fa..6509fb3 100644 (file)
@@ -53,7 +53,7 @@ public:
     void setTextureId(unsigned textureId) { m_textureId = textureId; }
 
     virtual bool drawsContent() const;
-    virtual void paintContentsIfDirty(const Region&);
+    virtual void paintContentsIfDirty(const CCOcclusionTracker*);
     virtual void updateCompositorResources(GraphicsContext3D*, CCTextureUpdater&);
     virtual void pushPropertiesTo(CCLayerImpl*);
     virtual void setNeedsDisplayRect(const FloatRect&);
index 34bce11..065902c 100644 (file)
@@ -499,14 +499,14 @@ void CCLayerTreeHost::reserveTextures()
 }
 
 // static
-void CCLayerTreeHost::paintContentsIfDirty(LayerChromium* layer, PaintType paintType, const Region& occludedScreenSpace)
+void CCLayerTreeHost::paintContentsIfDirty(LayerChromium* layer, PaintType paintType, const CCOcclusionTracker* occlusion)
 {
     ASSERT(layer);
     ASSERT(PaintVisible == paintType || PaintIdle == paintType);
     if (PaintVisible == paintType)
-        layer->paintContentsIfDirty(occludedScreenSpace);
+        layer->paintContentsIfDirty(occlusion);
     else
-        layer->idlePaintContentsIfDirty(occludedScreenSpace);
+        layer->idlePaintContentsIfDirty(occlusion);
 }
 
 void CCLayerTreeHost::paintMaskAndReplicaForRenderSurface(LayerChromium* renderSurfaceLayer, PaintType paintType)
@@ -516,20 +516,19 @@ void CCLayerTreeHost::paintMaskAndReplicaForRenderSurface(LayerChromium* renderS
     // mask and replica should be painted.
 
     // FIXME: If the surface has a replica, it should be painted with occlusion that excludes the current target surface subtree.
-    Region noOcclusion;
 
     if (renderSurfaceLayer->maskLayer()) {
         renderSurfaceLayer->maskLayer()->setVisibleLayerRect(IntRect(IntPoint(), renderSurfaceLayer->contentBounds()));
-        paintContentsIfDirty(renderSurfaceLayer->maskLayer(), paintType, noOcclusion);
+        paintContentsIfDirty(renderSurfaceLayer->maskLayer(), paintType, 0);
     }
 
     LayerChromium* replicaLayer = renderSurfaceLayer->replicaLayer();
     if (replicaLayer) {
-        paintContentsIfDirty(replicaLayer, paintType, noOcclusion);
+        paintContentsIfDirty(replicaLayer, paintType, 0);
 
         if (replicaLayer->maskLayer()) {
             replicaLayer->maskLayer()->setVisibleLayerRect(IntRect(IntPoint(), replicaLayer->maskLayer()->contentBounds()));
-            paintContentsIfDirty(replicaLayer->maskLayer(), paintType, noOcclusion);
+            paintContentsIfDirty(replicaLayer->maskLayer(), paintType, 0);
         }
     }
 }
@@ -553,7 +552,7 @@ void CCLayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList
             ASSERT(!it->bounds().isEmpty());
 
             occlusionTracker.enterTargetRenderSurface(it->targetRenderSurface());
-            paintContentsIfDirty(*it, paintType, occlusionTracker.currentOcclusionInScreenSpace());
+            paintContentsIfDirty(*it, paintType, &occlusionTracker);
             occlusionTracker.markOccludedBehindLayer(*it);
         } else
             occlusionTracker.leaveToTargetRenderSurface(it.targetRenderSurfaceLayer()->renderSurface());
index d526226..89f1be3 100644 (file)
@@ -216,7 +216,7 @@ private:
     void initializeLayerRenderer();
 
     enum PaintType { PaintVisible, PaintIdle };
-    static void paintContentsIfDirty(LayerChromium*, PaintType, const Region& occludedScreenSpace);
+    static void paintContentsIfDirty(LayerChromium*, PaintType, const CCOcclusionTracker*);
     void paintLayerContents(const LayerList&, PaintType);
     void paintMaskAndReplicaForRenderSurface(LayerChromium*, PaintType);
 
index 7a83722..28b2fef 100644 (file)
@@ -1,5 +1,29 @@
 2012-03-15  Sheriff Bot  <webkit.review.bot@gmail.com>
 
+        Unreviewed, rolling out r110941.
+        http://trac.webkit.org/changeset/110941
+        https://bugs.webkit.org/show_bug.cgi?id=81307
+
+        the revert looks innocent. (Requested by morrita on #webkit).
+
+        * tests/CCLayerTreeHostTest.cpp:
+        (WTF::ContentLayerChromiumWithUpdateTracking::paintContentsIfDirty):
+        (WTF::ContentLayerChromiumWithUpdateTracking::idlePaintContentsIfDirty):
+        (WTF::TestLayerChromium::paintContentsIfDirty):
+        * tests/Canvas2DLayerChromiumTest.cpp:
+        * tests/TiledLayerChromiumTest.cpp:
+        (TestCCOcclusionTracker):
+        (WTF::TestCCOcclusionTracker::TestCCOcclusionTracker):
+        (WTF::TestCCOcclusionTracker::setOcclusion):
+        (WTF::TestCCOcclusionTracker::layerScissorRectInTargetSurface):
+        (WTF):
+        (WTF::FakeTiledLayerChromium::prepareToUpdate):
+        (WTF::FakeTiledLayerChromium::prepareToUpdateIdle):
+        (WTF::FakeTiledLayerChromium::paintContentsIfDirty):
+        (WTF::TEST):
+
+2012-03-15  Sheriff Bot  <webkit.review.bot@gmail.com>
+
         Unreviewed, rolling out r110929.
         http://trac.webkit.org/changeset/110929
         https://bugs.webkit.org/show_bug.cgi?id=81306
index fe788fb..706b4d0 100644 (file)
@@ -32,7 +32,6 @@
 #include "FilterOperations.h"
 #include "GraphicsContext3DPrivate.h"
 #include "LayerChromium.h"
-#include "Region.h"
 #include "TextureManager.h"
 #include "WebCompositor.h"
 #include "WebKit.h"
@@ -1273,15 +1272,15 @@ public:
     int updateCount() { return m_updateCount; }
     void resetUpdateCount() { m_updateCount = 0; }
 
-    virtual void paintContentsIfDirty(const Region& occludedScreenSpace)
+    virtual void paintContentsIfDirty(const CCOcclusionTracker* occlusion)
     {
-        ContentLayerChromium::paintContentsIfDirty(occludedScreenSpace);
+        ContentLayerChromium::paintContentsIfDirty(occlusion);
         m_paintContentsCount++;
     }
 
-    virtual void idlePaintContentsIfDirty(const Region& occluded)
+    virtual void idlePaintContentsIfDirty(const CCOcclusionTracker* occlusion)
     {
-        ContentLayerChromium::idlePaintContentsIfDirty(occluded);
+        ContentLayerChromium::idlePaintContentsIfDirty(occlusion);
         m_idlePaintContentsCount++;
     }
 
@@ -1633,9 +1632,9 @@ class TestLayerChromium : public LayerChromium {
 public:
     static PassRefPtr<TestLayerChromium> create() { return adoptRef(new TestLayerChromium()); }
 
-    virtual void paintContentsIfDirty(const Region& occludedScreenSpace)
+    virtual void paintContentsIfDirty(const CCOcclusionTracker* occlusion)
     {
-        m_occludedScreenSpace = occludedScreenSpace;
+        m_occludedScreenSpace = occlusion ? occlusion->currentOcclusionInScreenSpace() : Region();
     }
 
     virtual bool drawsContent() const { return true; }
index 6a3db02..03adb3c 100644 (file)
@@ -156,8 +156,7 @@ protected:
 
         canvas->setNeedsDisplay();
         EXPECT_TRUE(canvas->needsDisplay());
-        Region occludedScreenSpace;
-        canvas->paintContentsIfDirty(occludedScreenSpace);
+        canvas->paintContentsIfDirty(0);
         EXPECT_FALSE(canvas->needsDisplay());
         {
             DebugScopedSetImplThread scopedImplThread;
index 2523230..07ceaae 100644 (file)
@@ -48,6 +48,25 @@ 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; }
@@ -150,14 +169,14 @@ public:
         TiledLayerChromium::invalidateRect(rect);
     }
 
-    void prepareToUpdate(const IntRect& rect, const Region& occluded)
+    void prepareToUpdate(const IntRect& rect, const CCOcclusionTracker* occlusion)
     {
-        TiledLayerChromium::prepareToUpdate(rect, occluded);
+        TiledLayerChromium::prepareToUpdate(rect, occlusion);
     }
 
-    void prepareToUpdateIdle(const IntRect& rect, const Region& occluded)
+    void prepareToUpdateIdle(const IntRect& rect, const CCOcclusionTracker* occlusion)
     {
-        TiledLayerChromium::prepareToUpdateIdle(rect, occluded);
+        TiledLayerChromium::prepareToUpdateIdle(rect, occlusion);
     }
 
     bool needsIdlePaint(const IntRect& rect)
@@ -182,9 +201,9 @@ public:
 
     virtual TextureManager* textureManager() const { return m_textureManager; }
 
-    virtual void paintContentsIfDirty(const Region& occludedScreenSpace)
+    virtual void paintContentsIfDirty(const CCOcclusionTracker* occlusion)
     {
-        prepareToUpdate(visibleLayerRect(), occludedScreenSpace);
+        prepareToUpdate(visibleLayerRect(), occlusion);
     }
 
 private:
@@ -240,7 +259,6 @@ 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);
@@ -248,7 +266,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), noOcclusion);
+    layer->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
     layer->updateCompositorResources(0, updater);
     layer->pushPropertiesTo(layerImpl.get());
 
@@ -261,7 +279,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), noOcclusion);
+    layer->prepareToUpdate(IntRect(0, 0, 100, 100), 0);
     layer->updateCompositorResources(0, updater);
     layer->pushPropertiesTo(layerImpl.get());
 
@@ -276,15 +294,17 @@ TEST(TiledLayerChromiumTest, pushOccludedDirtyTiles)
     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
     DebugScopedSetImplThread implThread;
     OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(0)));
-    Region noOcclusion;
+    TestCCOcclusionTracker occluded;
 
     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), noOcclusion);
+    layer->prepareToUpdate(IntRect(0, 0, 100, 200), &occluded);
     layer->updateCompositorResources(0, updater);
     layer->pushPropertiesTo(layerImpl.get());
 
@@ -297,8 +317,8 @@ TEST(TiledLayerChromiumTest, pushOccludedDirtyTiles)
     // Invalidates part of the top tile...
     layer->invalidateRect(IntRect(0, 0, 50, 50));
     // ....but the area is occluded.
-    Region occlusion(IntRect(0, 0, 50, 50));
-    layer->prepareToUpdate(IntRect(0, 0, 100, 100), occlusion);
+    occluded.setOcclusion(IntRect(0, 0, 50, 50));
+    layer->prepareToUpdate(IntRect(0, 0, 100, 100), &occluded);
     layer->updateCompositorResources(0, updater);
     layer->pushPropertiesTo(layerImpl.get());
 
@@ -321,13 +341,12 @@ 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, noOcclusion);
+    layer->prepareToUpdate(visibleRect, 0);
 
     // We should need idle-painting for 3x3 tiles in the center.
     EXPECT_TRUE(layer->needsIdlePaint(visibleRect));
@@ -342,9 +361,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, noOcclusion);
+        layer->prepareToUpdate(visibleRect, 0);
         EXPECT_TRUE(layer->needsIdlePaint(visibleRect));
-        layer->prepareToUpdateIdle(visibleRect, noOcclusion);
+        layer->prepareToUpdateIdle(visibleRect, 0);
         layer->updateCompositorResources(0, updater);
         layer->pushPropertiesTo(layerImpl.get());
         textureManager->unprotectAllTextures();
@@ -374,7 +393,6 @@ 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
@@ -382,7 +400,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), noOcclusion);
+    layer->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
     layer->updateCompositorResources(0, updater);
     layer->pushPropertiesTo(layerImpl.get());
 
@@ -402,18 +420,17 @@ 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), noOcclusion);
+    layer1->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
 
     // Invalidate a tile on layer1
     layer2->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer1.get());
-    layer2->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
+    layer2->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
 
     layer1->updateCompositorResources(0, updater);
     layer2->updateCompositorResources(0, updater);
@@ -439,7 +456,6 @@ TEST(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer
 
     FakeTextureAllocator textureAllocator;
     CCTextureUpdater updater(&textureAllocator);
-    Region noOcclusion;
 
     layer1->setBounds(IntSize(100, 200));
     layer1->invalidateRect(IntRect(0, 0, 100, 200));
@@ -448,9 +464,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), noOcclusion);
+    layer1->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
 
-    layer2->prepareToUpdate(IntRect(0, 0, 100, 200), noOcclusion);
+    layer2->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
 
     layer1->updateCompositorResources(0, updater);
     layer2->updateCompositorResources(0, updater);
@@ -471,7 +487,6 @@ 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.
@@ -488,7 +503,7 @@ TEST(TiledLayerChromiumTest, idlePaintOutOfMemory)
     layer->setBounds(contentBounds);
     layer->setVisibleLayerRect(visibleRect);
     layer->invalidateRect(contentRect);
-    layer->prepareToUpdate(visibleRect, noOcclusion);
+    layer->prepareToUpdate(visibleRect, 0);
 
     // We should need idle-painting for 3x3 tiles surounding visible tile.
     EXPECT_TRUE(layer->needsIdlePaint(visibleRect));
@@ -500,8 +515,8 @@ TEST(TiledLayerChromiumTest, idlePaintOutOfMemory)
     EXPECT_TRUE(layerImpl->hasTileAt(1, 1));
 
     textureManager->unprotectAllTextures();
-    layer->prepareToUpdate(visibleRect, noOcclusion);
-    layer->prepareToUpdateIdle(visibleRect, noOcclusion);
+    layer->prepareToUpdate(visibleRect, 0);
+    layer->prepareToUpdateIdle(visibleRect, 0);
 
     // We shouldn't signal we need another idle paint after we run out of memory.
     EXPECT_FALSE(layer->needsIdlePaint(visibleRect));
@@ -516,7 +531,6 @@ 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);
@@ -524,7 +538,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), noOcclusion);
+    layer->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
     layer->updateCompositorResources(0, updater);
     layer->pushPropertiesTo(layerImpl.get());
 
@@ -537,18 +551,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), noOcclusion);
+    layer->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
     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), noOcclusion);
+    layer->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
     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), noOcclusion);
+    layer->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
     EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount());
 }
 
@@ -559,7 +573,6 @@ 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);
@@ -574,20 +587,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, noOcclusion);
+    layer->prepareToUpdate(contentBounds, 0);
     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, noOcclusion);
+    layer->prepareToUpdate(contentBounds, 0);
     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, noOcclusion);
+    layer->prepareToUpdate(contentBounds, 0);
     layer->updateCompositorResources(0, updater);
     EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect());
 }
@@ -601,7 +614,6 @@ TEST(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges)
 
     FakeTextureAllocator textureAllocator;
     CCTextureUpdater updater(&textureAllocator);
-    Region noOcclusion;
 
     // Create a layer with one tile.
     layer->setBounds(IntSize(100, 100));
@@ -611,7 +623,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), noOcclusion);
+    layer->prepareToUpdate(IntRect(0, 0, 100, 100), 0);
     layer->updateCompositorResources(0, updater);
     layer->pushPropertiesTo(layerImpl.get());
     EXPECT_TRUE(layerImpl->hasTileAt(0, 0));
@@ -625,7 +637,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), noOcclusion);
+    layer->prepareToUpdate(IntRect(0, 0, 200, 200), 0);
     layer->updateCompositorResources(0, updater);
     layer->pushPropertiesTo(layerImpl.get());
     EXPECT_TRUE(layerImpl->hasTileAt(0, 0));
@@ -636,7 +648,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(0, 0, 0, 0), noOcclusion);
+    layer->prepareToUpdate(IntRect(1, 0, 0, 1), 0);
     layer->updateCompositorResources(0, updater);
     layer->pushPropertiesTo(layerImpl.get());
     EXPECT_FALSE(layerImpl->hasTileAt(0, 0));
@@ -702,11 +714,10 @@ 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), noOcclusion);
+    layer->prepareToUpdate(IntRect(0, 0, 700, 700), 0);
 
     layer->setBounds(IntSize(200, 200));
     layer->invalidateRect(IntRect(0, 0, 200, 200));
@@ -787,13 +798,12 @@ 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), occluded);
+    layer->prepareToUpdate(IntRect(0, 0, 100, 200), 0);
     EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->prepareRectCount());
 }
 
@@ -801,30 +811,31 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusion)
 {
     OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
-    Region occluded;
+    TestCCOcclusionTracker 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 = IntRect(200, 200, 300, 100);
+    occluded.setOcclusion(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 = IntRect(250, 200, 300, 100);
+    occluded.setOcclusion(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 = IntRect(250, 250, 300, 100);
+    occluded.setOcclusion(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());
 }
 
@@ -832,58 +843,60 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
 {
     OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
-    Region occluded;
+    TestCCOcclusionTracker 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 = IntRect(200, 200, 300, 150);
+    occluded.setOcclusion(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(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount());
+    layer->prepareToUpdate(IntRect(0, 0, 600, 600), &occluded);
+    EXPECT_EQ(24-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 = IntRect(200, 200, 300, 150);
+    occluded.setOcclusion(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(36-6, layer->fakeLayerTextureUpdater()->prepareRectCount());
+    layer->prepareToUpdate(IntRect(0, 0, 600, 600), &occluded);
+    EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount());
 
     layer->fakeLayerTextureUpdater()->clearPrepareRectCount();
 
     // Now the visible region is even smaller than the occlusion, it should have the same result.
-    occluded = IntRect(200, 200, 300, 150);
+    occluded.setOcclusion(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(36-6, layer->fakeLayerTextureUpdater()->prepareRectCount());
+    layer->prepareToUpdate(IntRect(0, 0, 600, 600), &occluded);
+    EXPECT_EQ(24-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()));
-    Region occluded;
+    TestCCOcclusionTracker 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 = IntRect(200, 200, 300, 100);
+    occluded.setOcclusion(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());
 }
 
@@ -891,7 +904,7 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms)
 {
     OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
-    Region occluded;
+    TestCCOcclusionTracker occluded;
 
     // The tile size is 100x100.
 
@@ -901,11 +914,12 @@ 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 = IntRect(100, 100, 150, 50);
+    occluded.setOcclusion(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());
 }
 
@@ -913,7 +927,7 @@ TEST(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling)
 {
     OwnPtr<TextureManager> textureManager = TextureManager::create(4*1024*1024, 2*1024*1024, 1024);
     RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get()));
-    Region occluded;
+    TestCCOcclusionTracker occluded;
 
     // The tile size is 100x100.
 
@@ -922,11 +936,12 @@ 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 = IntRect(200, 200, 300, 100);
+    occluded.setOcclusion(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.
@@ -937,10 +952,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 = IntRect(200, 200, 300, 200);
+    occluded.setOcclusion(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();
@@ -949,11 +964,12 @@ 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 = IntRect(100, 100, 150, 100);
+    occluded.setOcclusion(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());
 }
 
@@ -966,7 +982,6 @@ TEST(TiledLayerChromiumTest, opaqueContentsRegion)
 
     IntRect opaquePaintRect;
     Region opaqueContents;
-    Region noOcclusion;
 
     IntRect contentBounds = IntRect(0, 0, 100, 200);
     IntRect visibleBounds = IntRect(0, 0, 100, 150);
@@ -978,7 +993,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, noOcclusion);
+    layer->prepareToUpdate(contentBounds, 0);
     opaqueContents = layer->opaqueContentsRegion();
     EXPECT_TRUE(opaqueContents.isEmpty());
 
@@ -986,14 +1001,14 @@ TEST(TiledLayerChromiumTest, opaqueContentsRegion)
     opaquePaintRect = IntRect(10, 10, 90, 190);
     layer->fakeLayerTextureUpdater()->setOpaquePaintRect(opaquePaintRect);
     layer->invalidateRect(contentBounds);
-    layer->prepareToUpdate(contentBounds, noOcclusion);
+    layer->prepareToUpdate(contentBounds, 0);
     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, noOcclusion);
+    layer->prepareToUpdate(contentBounds, 0);
     opaqueContents = layer->opaqueContentsRegion();
     EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds());
     EXPECT_EQ(1u, opaqueContents.rects().size());
@@ -1002,7 +1017,7 @@ TEST(TiledLayerChromiumTest, opaqueContentsRegion)
     // not be affected.
     layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect());
     layer->invalidateRect(IntRect(0, 0, 1, 1));
-    layer->prepareToUpdate(contentBounds, noOcclusion);
+    layer->prepareToUpdate(contentBounds, 0);
     opaqueContents = layer->opaqueContentsRegion();
     EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds());
     EXPECT_EQ(1u, opaqueContents.rects().size());
@@ -1011,7 +1026,7 @@ TEST(TiledLayerChromiumTest, opaqueContentsRegion)
     // not be affected.
     layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect());
     layer->invalidateRect(IntRect(10, 10, 1, 1));
-    layer->prepareToUpdate(contentBounds, noOcclusion);
+    layer->prepareToUpdate(contentBounds, 0);
     opaqueContents = layer->opaqueContentsRegion();
     EXPECT_EQ_RECT(intersection(IntRect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds());
     EXPECT_EQ(1u, opaqueContents.rects().size());