Title: [108426] trunk/Source/WebCore
Revision
108426
Author
shawnsi...@chromium.org
Date
2012-02-21 17:49:36 -0800 (Tue, 21 Feb 2012)

Log Message

[chromium] Refactor CCLayerTreeHostCommon: merge scattered setTargetRenderSurface logic
https://bugs.webkit.org/show_bug.cgi?id=78936

Reviewed by James Robinson.

No change in behavior, the code moved around already covered by existing tests.

In calculateDrawTransformsAndVisibility(), there are two separate
if-else statements where setTargetRenderSurface logic is
performed, and this makes the code less readable and more error
prone. This patch merges the logic, removing the redundant if-else
statements.

This code also merges one other set of if-statements that are
equivalent, if (layer->parent()) and if (layer!=rootLayer).

* platform/graphics/chromium/LayerChromium.cpp:
(WebCore::LayerChromium::createRenderSurface):
* platform/graphics/chromium/cc/CCLayerImpl.cpp:
(WebCore::CCLayerImpl::createRenderSurface):
* platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
(WebCore::calculateDrawTransformsAndVisibilityInternal):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (108425 => 108426)


--- trunk/Source/WebCore/ChangeLog	2012-02-22 01:36:11 UTC (rev 108425)
+++ trunk/Source/WebCore/ChangeLog	2012-02-22 01:49:36 UTC (rev 108426)
@@ -1,3 +1,28 @@
+2012-02-21  Shawn Singh  <shawnsi...@chromium.org>
+
+        [chromium] Refactor CCLayerTreeHostCommon: merge scattered setTargetRenderSurface logic
+        https://bugs.webkit.org/show_bug.cgi?id=78936
+
+        Reviewed by James Robinson.
+
+        No change in behavior, the code moved around already covered by existing tests.
+
+        In calculateDrawTransformsAndVisibility(), there are two separate
+        if-else statements where setTargetRenderSurface logic is
+        performed, and this makes the code less readable and more error
+        prone. This patch merges the logic, removing the redundant if-else
+        statements.
+
+        This code also merges one other set of if-statements that are
+        equivalent, if (layer->parent()) and if (layer!=rootLayer).
+
+        * platform/graphics/chromium/LayerChromium.cpp:
+        (WebCore::LayerChromium::createRenderSurface):
+        * platform/graphics/chromium/cc/CCLayerImpl.cpp:
+        (WebCore::CCLayerImpl::createRenderSurface):
+        * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
+        (WebCore::calculateDrawTransformsAndVisibilityInternal):
+
 2012-02-21  Kentaro Hara  <hara...@chromium.org>
 
         Remove FIXME from resolve-supplemental.pl

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp (108425 => 108426)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp	2012-02-22 01:36:11 UTC (rev 108425)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp	2012-02-22 01:49:36 UTC (rev 108426)
@@ -503,6 +503,7 @@
 {
     ASSERT(!m_renderSurface);
     m_renderSurface = adoptPtr(new RenderSurfaceChromium(this));
+    setTargetRenderSurface(m_renderSurface.get());
 }
 
 bool LayerChromium::descendantDrawsContent()

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp (108425 => 108426)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp	2012-02-22 01:36:11 UTC (rev 108425)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp	2012-02-22 01:49:36 UTC (rev 108426)
@@ -104,6 +104,7 @@
 {
     ASSERT(!m_renderSurface);
     m_renderSurface = adoptPtr(new CCRenderSurface(this));
+    setTargetRenderSurface(m_renderSurface.get());
 }
 
 bool CCLayerImpl::descendantDrawsContent()

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp (108425 => 108426)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp	2012-02-22 01:36:11 UTC (rev 108425)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp	2012-02-22 01:49:36 UTC (rev 108426)
@@ -323,18 +323,19 @@
 
         layer->setDrawOpacity(drawOpacity);
 
-        if (layer->parent()) {
+        if (layer != rootLayer) {
+            ASSERT(layer->parent());
+            layer->clearRenderSurface();
+
             // Layers inherit the clip rect from their parent.
             layer->setClipRect(layer->parent()->clipRect());
             if (layer->parent()->usesLayerClipping())
                 layer->setUsesLayerClipping(true);
 
+            // Layers without their own renderSurface will render into the nearest ancestor surface.
             layer->setTargetRenderSurface(layer->parent()->targetRenderSurface());
         }
 
-        if (layer != rootLayer)
-            layer->clearRenderSurface();
-
         if (layer->masksToBounds()) {
             IntRect clipRect = transformedLayerRect;
             clipRect.intersect(layer->clipRect());
@@ -350,13 +351,6 @@
     layerScreenSpaceTransform.translate3d(-0.5 * bounds.width(), -0.5 * bounds.height(), 0);
     layer->setScreenSpaceTransform(layerScreenSpaceTransform);
 
-    if (layer->renderSurface())
-        layer->setTargetRenderSurface(layer->renderSurface());
-    else {
-        ASSERT(layer->parent());
-        layer->setTargetRenderSurface(layer->parent()->targetRenderSurface());
-    }
-
     // drawableContentRect() is always stored in the coordinate system of the
     // RenderSurface the layer draws into.
     if (layer->drawsContent()) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to