Title: [113668] trunk/Source/WebCore
Revision
113668
Author
[email protected]
Date
2012-04-09 20:11:36 -0700 (Mon, 09 Apr 2012)

Log Message

[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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (113667 => 113668)


--- trunk/Source/WebCore/ChangeLog	2012-04-10 03:05:24 UTC (rev 113667)
+++ trunk/Source/WebCore/ChangeLog	2012-04-10 03:11:36 UTC (rev 113668)
@@ -1,3 +1,32 @@
+2012-04-09  Dana Jansens  <[email protected]>
+
+        [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  <[email protected]>
 
         ShadowRoot should have selection attribute.

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (113667 => 113668)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp	2012-04-10 03:05:24 UTC (rev 113667)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp	2012-04-10 03:11:36 UTC (rev 113668)
@@ -514,27 +514,22 @@
         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 @@
             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());
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h (113667 => 113668)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h	2012-04-10 03:05:24 UTC (rev 113667)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h	2012-04-10 03:11:36 UTC (rev 113668)
@@ -230,7 +230,7 @@
     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"
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to