[chromium] Replica layers are not drawn, so should not be painted
authordanakj@chromium.org <danakj@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Apr 2012 03:11:36 +0000 (03:11 +0000)
committerdanakj@chromium.org <danakj@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Apr 2012 03:11:36 +0000 (03:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=83504

Reviewed by James Robinson.

We attempt to paint replica layers when we are painting the mask layers
in CCLayerTreeHost.cpp.

This is useless code, replica layers have drawsContent() == false, and
have an empty visibleLayerRect, so the paint functions end up early-
outting. But it is a waste of time to try, and confusing to have
this attempted in the code at all, since the replica layers are never
drawn. They exist only for their transforms.

Also the dimensions used for the replica mask are different from the
surface mask, which is confusing and unnecessary as well. The mask is
applied to the same surface contents as the surface mask would be, so
only the surface's contentBounds need to be painted in the replica
mask.

Covered by existing tests.

* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::paintMasksForRenderSurface):
(WebCore::CCLayerTreeHost::paintLayerContents):
* platform/graphics/chromium/cc/CCLayerTreeHost.h:

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h

index 0fd811c..492eb1c 100644 (file)
@@ -1,3 +1,32 @@
+2012-04-09  Dana Jansens  <danakj@chromium.org>
+
+        [chromium] Replica layers are not drawn, so should not be painted
+        https://bugs.webkit.org/show_bug.cgi?id=83504
+
+        Reviewed by James Robinson.
+
+        We attempt to paint replica layers when we are painting the mask layers
+        in CCLayerTreeHost.cpp.
+
+        This is useless code, replica layers have drawsContent() == false, and
+        have an empty visibleLayerRect, so the paint functions end up early-
+        outting. But it is a waste of time to try, and confusing to have
+        this attempted in the code at all, since the replica layers are never
+        drawn. They exist only for their transforms.
+
+        Also the dimensions used for the replica mask are different from the
+        surface mask, which is confusing and unnecessary as well. The mask is
+        applied to the same surface contents as the surface mask would be, so
+        only the surface's contentBounds need to be painted in the replica
+        mask.
+
+        Covered by existing tests.
+
+        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+        (WebCore::CCLayerTreeHost::paintMasksForRenderSurface):
+        (WebCore::CCLayerTreeHost::paintLayerContents):
+        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+
 2012-04-09  Shinya Kawanaka  <shinyak@chromium.org>
 
         ShadowRoot should have selection attribute.
index 6be578c..35817a9 100644 (file)
@@ -514,27 +514,22 @@ void CCLayerTreeHost::paintContentsIfDirty(LayerChromium* layer, PaintType paint
         layer->idlePaintContentsIfDirty(occlusion);
 }
 
-void CCLayerTreeHost::paintMaskAndReplicaForRenderSurface(LayerChromium* renderSurfaceLayer, PaintType paintType)
+void CCLayerTreeHost::paintMasksForRenderSurface(LayerChromium* renderSurfaceLayer, PaintType paintType)
 {
     // Note: Masks and replicas only exist for layers that own render surfaces. If we reach this point
     // in code, we already know that at least something will be drawn into this render surface, so the
     // 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.
-
-    if (renderSurfaceLayer->maskLayer()) {
-        renderSurfaceLayer->maskLayer()->setVisibleLayerRect(IntRect(IntPoint(), renderSurfaceLayer->contentBounds()));
-        paintContentsIfDirty(renderSurfaceLayer->maskLayer(), paintType, 0);
+    LayerChromium* maskLayer = renderSurfaceLayer->maskLayer();
+    if (maskLayer) {
+        maskLayer->setVisibleLayerRect(IntRect(IntPoint(), renderSurfaceLayer->contentBounds()));
+        paintContentsIfDirty(maskLayer, paintType, 0);
     }
 
-    LayerChromium* replicaLayer = renderSurfaceLayer->replicaLayer();
-    if (replicaLayer) {
-        paintContentsIfDirty(replicaLayer, paintType, 0);
-
-        if (replicaLayer->maskLayer()) {
-            replicaLayer->maskLayer()->setVisibleLayerRect(IntRect(IntPoint(), replicaLayer->maskLayer()->contentBounds()));
-            paintContentsIfDirty(replicaLayer->maskLayer(), paintType, 0);
-        }
+    LayerChromium* replicaMaskLayer = renderSurfaceLayer->replicaLayer() ? renderSurfaceLayer->replicaLayer()->maskLayer() : 0;
+    if (replicaMaskLayer) {
+        replicaMaskLayer->setVisibleLayerRect(IntRect(IntPoint(), renderSurfaceLayer->contentBounds()));
+        paintContentsIfDirty(replicaMaskLayer, paintType, 0);
     }
 }
 
@@ -553,7 +548,7 @@ void CCLayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList
             ASSERT(it->renderSurface()->drawOpacity() || it->renderSurface()->drawOpacityIsAnimating());
 
             occlusionTracker.finishedTargetRenderSurface(*it, it->renderSurface());
-            paintMaskAndReplicaForRenderSurface(*it, paintType);
+            paintMasksForRenderSurface(*it, paintType);
         } else if (it.representsItself()) {
             ASSERT(!it->bounds().isEmpty());
 
index 1c22a4d..024898f 100644 (file)
@@ -230,7 +230,7 @@ private:
     enum PaintType { PaintVisible, PaintIdle };
     static void paintContentsIfDirty(LayerChromium*, PaintType, const CCOcclusionTracker*);
     void paintLayerContents(const LayerList&, PaintType);
-    void paintMaskAndReplicaForRenderSurface(LayerChromium*, PaintType);
+    void paintMasksForRenderSurface(LayerChromium*, PaintType);
 
     void updateLayers(LayerChromium*);
     // Pre-reserve textures for any layer marked "always reserve textures"