Title: [111144] trunk/Source
Revision
111144
Author
[email protected]
Date
2012-03-18 17:58:34 -0700 (Sun, 18 Mar 2012)

Log Message

[chromium] Animating opacity is not opaque and should create a render surface on main thread
https://bugs.webkit.org/show_bug.cgi?id=81401

Patch by Dana Jansens <[email protected]> on 2012-03-18
Reviewed by James Robinson.

Source/WebCore:

Unit test: CCLayerTreeHostCommonTest.verifyAnimationsForRenderSurfaceHierarchy

* platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
(WebCore::layerOpacityIsOpaque):
(WebCore):
(WebCore::subtreeShouldRenderToSeparateSurface):

Source/WebKit/chromium:

* tests/CCLayerTreeHostCommonTest.cpp:
(WebCore::TEST):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (111143 => 111144)


--- trunk/Source/WebCore/ChangeLog	2012-03-19 00:39:44 UTC (rev 111143)
+++ trunk/Source/WebCore/ChangeLog	2012-03-19 00:58:34 UTC (rev 111144)
@@ -1,3 +1,17 @@
+2012-03-18  Dana Jansens  <[email protected]>
+
+        [chromium] Animating opacity is not opaque and should create a render surface on main thread
+        https://bugs.webkit.org/show_bug.cgi?id=81401
+
+        Reviewed by James Robinson.
+
+        Unit test: CCLayerTreeHostCommonTest.verifyAnimationsForRenderSurfaceHierarchy
+
+        * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
+        (WebCore::layerOpacityIsOpaque):
+        (WebCore):
+        (WebCore::subtreeShouldRenderToSeparateSurface):
+
 2012-03-18  Sam Weinig  <[email protected]>
 
         WebCore::BitmapImage::getCGImageRef should not be used off the main thread.

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


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp	2012-03-19 00:39:44 UTC (rev 111143)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp	2012-03-19 00:58:34 UTC (rev 111144)
@@ -124,6 +124,19 @@
     return !layer->opacity() && !layer->opacityIsAnimating();
 }
 
+static inline bool layerOpacityIsOpaque(CCLayerImpl* layer)
+{
+    return layer->opacity() == 1;
+}
+
+static inline bool layerOpacityIsOpaque(LayerChromium* layer)
+{
+    // If the opacity is being animated then the opacity on the main thread is unreliable
+    // (since the impl thread may be using a different opacity), so it should not be trusted.
+    // In particular, it should not be treated as opaque.
+    return layer->opacity() == 1 && !layer->opacityIsAnimating();
+}
+
 template<typename LayerType>
 static bool subtreeShouldRenderToSeparateSurface(LayerType* layer, bool axisAlignedWithRespectToParent)
 {
@@ -161,7 +174,7 @@
         return true;
 
     // If the layer has opacity != 1 and does not have a preserves-3d transform style.
-    if (layer->opacity() != 1 && !layer->preserves3D() && descendantDrawsContent)
+    if (!layerOpacityIsOpaque(layer) && !layer->preserves3D() && descendantDrawsContent)
         return true;
 
     return false;

Modified: trunk/Source/WebKit/chromium/ChangeLog (111143 => 111144)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-03-19 00:39:44 UTC (rev 111143)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-03-19 00:58:34 UTC (rev 111144)
@@ -1,5 +1,15 @@
 2012-03-18  Dana Jansens  <[email protected]>
 
+        [chromium] Animating opacity is not opaque and should create a render surface on main thread
+        https://bugs.webkit.org/show_bug.cgi?id=81401
+
+        Reviewed by James Robinson.
+
+        * tests/CCLayerTreeHostCommonTest.cpp:
+        (WebCore::TEST):
+
+2012-03-18  Dana Jansens  <[email protected]>
+
         [chromium] Transform animation state should be inherited from parents
         https://bugs.webkit.org/show_bug.cgi?id=81363
 

Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp (111143 => 111144)


--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp	2012-03-19 00:39:44 UTC (rev 111143)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp	2012-03-19 00:58:34 UTC (rev 111144)
@@ -638,8 +638,6 @@
     childOfRS2->addChild(grandChildOfRS2);
 
     // In combination with descendantDrawsContent, opacity != 1 forces the layer to have a new renderSurface.
-    renderSurface1->setOpacity(0.4);
-    renderSurface2->setOpacity(0.5);
     addOpacityAnimationToLayer(renderSurface1.get(), 1, 0, 10);
     addOpacityAnimationToLayer(renderSurface2.get(), 1, 0, 10);
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to