Title: [105934] trunk/Source/WebKit2
Revision
105934
Author
noam.rosent...@nokia.com
Date
2012-01-25 15:40:41 -0800 (Wed, 25 Jan 2012)

Log Message

[WK2][Qt] REGRESSION: Pages with transform animations sometimes omit some of the layers since r105413
https://bugs.webkit.org/show_bug.cgi?id=76886

Reviewed by Kenneth Rohde Christiansen.

We now render the whole layer if it or one if its ancestors has an active transform
animations. It's possible to optimize further in the future, but not currently necessary.
Also, we make sure that when a WebGraphicsLayer's property that affects transformation is
changed, all its descandants layers are marked as modified so that we re-adjust their
visible rect in the next pass.

* WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
(WebCore::WebGraphicsLayer::notifyChangeRecursively):
(WebCore):
(WebCore::WebGraphicsLayer::setPosition):
(WebCore::WebGraphicsLayer::setAnchorPoint):
(WebCore::WebGraphicsLayer::setSize):
(WebCore::WebGraphicsLayer::setTransform):
(WebCore::WebGraphicsLayer::setChildrenTransform):
(WebCore::WebGraphicsLayer::setPreserves3D):
(WebCore::WebGraphicsLayer::setMasksToBounds):
(WebCore::WebGraphicsLayer::addAnimation):
(WebCore::WebGraphicsLayer::removeAnimation):
(WebCore::WebGraphicsLayer::tiledBackingStoreVisibleRect):
(WebCore::WebGraphicsLayer::selfOrAncestorHasActiveTransformAnimations):
* WebProcess/WebCoreSupport/WebGraphicsLayer.h:
(WebGraphicsLayer):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (105933 => 105934)


--- trunk/Source/WebKit2/ChangeLog	2012-01-25 23:31:26 UTC (rev 105933)
+++ trunk/Source/WebKit2/ChangeLog	2012-01-25 23:40:41 UTC (rev 105934)
@@ -1,3 +1,33 @@
+2012-01-25  No'am Rosenthal  <noam.rosent...@nokia.com>
+
+        [WK2][Qt] REGRESSION: Pages with transform animations sometimes omit some of the layers since r105413
+        https://bugs.webkit.org/show_bug.cgi?id=76886
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        We now render the whole layer if it or one if its ancestors has an active transform
+        animations. It's possible to optimize further in the future, but not currently necessary.
+        Also, we make sure that when a WebGraphicsLayer's property that affects transformation is
+        changed, all its descandants layers are marked as modified so that we re-adjust their
+        visible rect in the next pass.
+
+        * WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
+        (WebCore::WebGraphicsLayer::notifyChangeRecursively):
+        (WebCore):
+        (WebCore::WebGraphicsLayer::setPosition):
+        (WebCore::WebGraphicsLayer::setAnchorPoint):
+        (WebCore::WebGraphicsLayer::setSize):
+        (WebCore::WebGraphicsLayer::setTransform):
+        (WebCore::WebGraphicsLayer::setChildrenTransform):
+        (WebCore::WebGraphicsLayer::setPreserves3D):
+        (WebCore::WebGraphicsLayer::setMasksToBounds):
+        (WebCore::WebGraphicsLayer::addAnimation):
+        (WebCore::WebGraphicsLayer::removeAnimation):
+        (WebCore::WebGraphicsLayer::tiledBackingStoreVisibleRect):
+        (WebCore::WebGraphicsLayer::selfOrAncestorHasActiveTransformAnimations):
+        * WebProcess/WebCoreSupport/WebGraphicsLayer.h:
+        (WebGraphicsLayer):
+
 2012-01-25  Hajime Morita  <morr...@google.com>
 
         ENABLE_SHADOW_DOM should be available via build-webkit --shadow-dom

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp (105933 => 105934)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp	2012-01-25 23:31:26 UTC (rev 105933)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp	2012-01-25 23:40:41 UTC (rev 105934)
@@ -69,6 +69,15 @@
         client()->notifySyncRequired(this);
 }
 
+void WebGraphicsLayer::notifyChangeRecursively()
+{
+    notifyChange();
+    for (size_t i = 0; i < children().size(); ++i)
+        toWebGraphicsLayer(children()[i])->notifyChangeRecursively();
+    if (replicaLayer())
+        toWebGraphicsLayer(replicaLayer())->notifyChange();
+}
+
 WebGraphicsLayer::WebGraphicsLayer(GraphicsLayerClient* client)
     : GraphicsLayer(client)
     , m_maskTarget(0)
@@ -173,7 +182,7 @@
         return;
 
     GraphicsLayer::setPosition(p);
-    notifyChange();
+    notifyChangeRecursively();
 }
 
 void WebGraphicsLayer::setAnchorPoint(const FloatPoint3D& p)
@@ -182,7 +191,7 @@
         return;
 
     GraphicsLayer::setAnchorPoint(p);
-    notifyChange();
+    notifyChangeRecursively();
 }
 
 void WebGraphicsLayer::setSize(const FloatSize& size)
@@ -194,7 +203,7 @@
     setNeedsDisplay();
     if (maskLayer())
         maskLayer()->setSize(size);
-    notifyChange();
+    notifyChangeRecursively();
 }
 
 void WebGraphicsLayer::setTransform(const TransformationMatrix& t)
@@ -203,7 +212,7 @@
         return;
 
     GraphicsLayer::setTransform(t);
-    notifyChange();
+    notifyChangeRecursively();
 }
 
 void WebGraphicsLayer::setChildrenTransform(const TransformationMatrix& t)
@@ -212,7 +221,7 @@
         return;
 
     GraphicsLayer::setChildrenTransform(t);
-    notifyChange();
+    notifyChangeRecursively();
 }
 
 void WebGraphicsLayer::setPreserves3D(bool b)
@@ -221,7 +230,7 @@
         return;
 
     GraphicsLayer::setPreserves3D(b);
-    notifyChange();
+    notifyChangeRecursively();
 }
 
 void WebGraphicsLayer::setMasksToBounds(bool b)
@@ -229,7 +238,7 @@
     if (masksToBounds() == b)
         return;
     GraphicsLayer::setMasksToBounds(b);
-    notifyChange();
+    notifyChangeRecursively();
 }
 
 void WebGraphicsLayer::setDrawsContent(bool b)
@@ -296,9 +305,11 @@
     webAnimation.animation = Animation::create(anim);
     webAnimation.startTime = timeOffset;
     m_layerInfo.animations.append(webAnimation);
+    if (valueList.property() == AnimatedPropertyWebkitTransform)
+        m_transformAnimations.add(keyframesName);
 
     m_hasPendingAnimations = true;
-    notifyChange();
+    notifyChangeRecursively();
 
     return true;
 }
@@ -319,6 +330,7 @@
     webAnimation.name = animationName;
     webAnimation.operation = WebLayerAnimation::RemoveAnimation;
     m_layerInfo.animations.append(webAnimation);
+    m_transformAnimations.remove(animationName);
     notifyChange();
 }
 
@@ -535,6 +547,11 @@
 
 IntRect WebGraphicsLayer::tiledBackingStoreVisibleRect()
 {
+    // If this layer is part of an active transform animation, the visible rect might change,
+    // so we rather render the whole layer until some better optimization is available.
+    if (selfOrAncestorHasActiveTransformAnimations())
+        return tiledBackingStoreContentsRect();
+
     // Non-invertible layers are not visible.
     if (!m_layerTransform.combined().isInvertible())
         return IntRect();
@@ -699,5 +716,16 @@
     GraphicsLayer::setGraphicsLayerFactory(createWebGraphicsLayer);
 }
 
+bool WebGraphicsLayer::selfOrAncestorHasActiveTransformAnimations() const
+{
+    if (!m_transformAnimations.isEmpty())
+        return true;
+
+    if (parent())
+        return toWebGraphicsLayer(parent())->selfOrAncestorHasActiveTransformAnimations();
+
+    return false;
 }
+
+}
 #endif

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h (105933 => 105934)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h	2012-01-25 23:31:26 UTC (rev 105933)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h	2012-01-25 23:40:41 UTC (rev 105934)
@@ -35,6 +35,7 @@
 #include "WebLayerTreeInfo.h"
 #include "WebProcess.h"
 #include <WebCore/RunLoop.h>
+#include <wtf/text/StringHash.h>
 
 #if USE(ACCELERATED_COMPOSITING)
 
@@ -152,7 +153,11 @@
     bool m_inUpdateMode : 2;
 
     void notifyChange();
+    void notifyChangeRecursively();
+    HashSet<String> m_transformAnimations;
 
+    bool selfOrAncestorHasActiveTransformAnimations() const;
+
 #if USE(TILED_BACKING_STORE)
     void computeTransformedVisibleRect();
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to