Title: [113628] trunk/Source/WebKit2
Revision
113628
Author
[email protected]
Date
2012-04-09 14:59:05 -0700 (Mon, 09 Apr 2012)

Log Message

[Qt][WK2] Accelerated and non-accelerated animations need to be synchronized
https://bugs.webkit.org/show_bug.cgi?id=75780

Reviewed by Kenneth Rohde Christiansen.

Remove the ui-side animation code, and return false from addAnimation so that web-side
animations kick in.

* Shared/WebLayerTreeInfo.cpp:
(WebKit):
* Shared/WebLayerTreeInfo.h:
(WebLayerInfo):
* UIProcess/WebLayerTreeRenderer.cpp:
(WebKit::WebLayerTreeRenderer::paintToCurrentGLContext):
(WebKit::WebLayerTreeRenderer::setLayerState):
* WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
(WebCore::WebGraphicsLayer::didChangeGeometry):
(WebCore::WebGraphicsLayer::syncLayerState):
(WebCore::WebGraphicsLayer::computeTransformedVisibleRect):
* WebProcess/WebCoreSupport/WebGraphicsLayer.h:
(WebGraphicsLayer):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (113627 => 113628)


--- trunk/Source/WebKit2/ChangeLog	2012-04-09 21:58:31 UTC (rev 113627)
+++ trunk/Source/WebKit2/ChangeLog	2012-04-09 21:59:05 UTC (rev 113628)
@@ -1,5 +1,29 @@
 2012-04-09  No'am Rosenthal  <[email protected]>
 
+        [Qt][WK2] Accelerated and non-accelerated animations need to be synchronized
+        https://bugs.webkit.org/show_bug.cgi?id=75780
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Remove the ui-side animation code, and return false from addAnimation so that web-side
+        animations kick in.
+
+        * Shared/WebLayerTreeInfo.cpp:
+        (WebKit):
+        * Shared/WebLayerTreeInfo.h:
+        (WebLayerInfo):
+        * UIProcess/WebLayerTreeRenderer.cpp:
+        (WebKit::WebLayerTreeRenderer::paintToCurrentGLContext):
+        (WebKit::WebLayerTreeRenderer::setLayerState):
+        * WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
+        (WebCore::WebGraphicsLayer::didChangeGeometry):
+        (WebCore::WebGraphicsLayer::syncLayerState):
+        (WebCore::WebGraphicsLayer::computeTransformedVisibleRect):
+        * WebProcess/WebCoreSupport/WebGraphicsLayer.h:
+        (WebGraphicsLayer):
+
+2012-04-09  No'am Rosenthal  <[email protected]>
+
         [Qt][WK2] Don't synchronize WebGraphicsLayers to the UI process if the actual layer information wasn't changed
         https://bugs.webkit.org/show_bug.cgi?id=82522
 

Modified: trunk/Source/WebKit2/Shared/WebLayerTreeInfo.cpp (113627 => 113628)


--- trunk/Source/WebKit2/Shared/WebLayerTreeInfo.cpp	2012-04-09 21:58:31 UTC (rev 113627)
+++ trunk/Source/WebKit2/Shared/WebLayerTreeInfo.cpp	2012-04-09 21:59:05 UTC (rev 113628)
@@ -34,7 +34,7 @@
 {
     // We have to divide it to several lines, because CoreIPC::In/Out takes a maximum of 10 arguments.
     encoder->encode(CoreIPC::In(id, name, parent, children, flags, replica, mask, imageBackingStoreID));
-    encoder->encode(CoreIPC::In(pos, size, transform, opacity, anchorPoint, childrenTransform, contentsRect, animations));
+    encoder->encode(CoreIPC::In(pos, size, transform, opacity, anchorPoint, childrenTransform, contentsRect));
 }
 
 bool WebLayerInfo::decode(CoreIPC::ArgumentDecoder* decoder, WebLayerInfo& info)
@@ -42,7 +42,7 @@
     // We have to divide it to several lines, because CoreIPC::In/Out takes a maximum of 10 arguments.
     if (!decoder->decode(CoreIPC::Out(info.id, info.name, info.parent, info.children, info.flags, info.replica, info.mask, info.imageBackingStoreID)))
         return false;
-    if (!decoder->decode(CoreIPC::Out(info.pos, info.size, info.transform, info.opacity, info.anchorPoint, info.childrenTransform, info.contentsRect, info.animations)))
+    if (!decoder->decode(CoreIPC::Out(info.pos, info.size, info.transform, info.opacity, info.anchorPoint, info.childrenTransform, info.contentsRect)))
         return false;
 
     return true;
@@ -67,32 +67,5 @@
 {
     return decoder->decode(CoreIPC::Out(info.layerID, info.rect, info.bitmapHandle));
 }
-
-void WebLayerAnimation::encode(CoreIPC::ArgumentEncoder* encoder) const
-{
-    encoder->encodeEnum(operation);
-    encoder->encode(keyframeList);
-    encoder->encode(CoreIPC::In(name, startTime, boxSize));
-
-    if (operation == WebLayerAnimation::AddAnimation)
-        encoder->encode(animation);
 }
-
-bool WebLayerAnimation::decode(CoreIPC::ArgumentDecoder* decoder, WebLayerAnimation& info)
-{
-    if (!decoder->decodeEnum(info.operation))
-        return false;
-    if (!decoder->decode(info.keyframeList))
-        return false;
-    if (!decoder->decode(CoreIPC::Out(info.name, info.startTime, info.boxSize)))
-        return false;
-
-    if (info.operation == WebLayerAnimation::AddAnimation)
-        if (!decoder->decode(info.animation))
-            return false;
-
-    return true;
-}
-
-}
 #endif

Modified: trunk/Source/WebKit2/Shared/WebLayerTreeInfo.h (113627 => 113628)


--- trunk/Source/WebKit2/Shared/WebLayerTreeInfo.h	2012-04-09 21:58:31 UTC (rev 113627)
+++ trunk/Source/WebKit2/Shared/WebLayerTreeInfo.h	2012-04-09 21:59:05 UTC (rev 113628)
@@ -48,32 +48,6 @@
     static bool decode(CoreIPC::ArgumentDecoder*, WebLayerUpdateInfo&);
 };
 
-struct WebLayerAnimation {
-    WebLayerAnimation()
-        : operation(InvalidAnimation)
-        , keyframeList(WebCore::AnimatedPropertyInvalid)
-        , startTime(0) { }
-    WebLayerAnimation(const WebCore::KeyframeValueList& valueList)
-        : operation(InvalidAnimation)
-        , keyframeList(valueList)
-        , startTime(0) { }
-
-    String name;
-    enum Operation {
-        AddAnimation,
-        RemoveAnimation,
-        PauseAnimation,
-        InvalidAnimation
-    } operation;
-    WebCore::IntSize boxSize;
-    RefPtr<WebCore::Animation> animation;
-    WebCore::KeyframeValueList keyframeList;
-    double startTime;
-
-    void encode(CoreIPC::ArgumentEncoder*) const;
-    static bool decode(CoreIPC::ArgumentDecoder*, WebLayerAnimation&);
-};
-
 struct WebLayerInfo {
     WebLayerInfo()
         : id(InvalidWebLayerID)
@@ -111,7 +85,6 @@
         unsigned int flags;
     };
     Vector<WebLayerID> children;
-    Vector<WebLayerAnimation> animations;
     RefPtr<ShareableBitmap> imageBackingStore;
 
     void encode(CoreIPC::ArgumentEncoder*) const;

Modified: trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp (113627 => 113628)


--- trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp	2012-04-09 21:58:31 UTC (rev 113627)
+++ trunk/Source/WebKit2/UIProcess/WebLayerTreeRenderer.cpp	2012-04-09 21:59:05 UTC (rev 113628)
@@ -121,20 +121,8 @@
     layer->paint();
     m_textureMapper->endClip();
     m_textureMapper->endPainting();
-
-    syncAnimations();
 }
 
-void WebLayerTreeRenderer::syncAnimations()
-{
-    TextureMapperLayer* layer = toTextureMapperLayer(rootLayer());
-    ASSERT(layer);
-
-    layer->syncAnimationsRecursively();
-    if (layer->descendantsOrSelfHaveRunningAnimations())
-        callOnMainThread(bind(&WebLayerTreeRenderer::updateViewport, this));
-}
-
 void WebLayerTreeRenderer::paintToGraphicsContext(QPainter* painter)
 {
     if (!m_textureMapper)
@@ -208,25 +196,6 @@
     }
     layer->setChildren(children);
 
-    for (size_t i = 0; i < layerInfo.animations.size(); ++i) {
-        const WebKit::WebLayerAnimation anim = layerInfo.animations[i];
-
-        switch (anim.operation) {
-        case WebKit::WebLayerAnimation::AddAnimation: {
-            const IntSize boxSize = anim.boxSize;
-            layer->addAnimation(anim.keyframeList, boxSize, anim.animation.get(), anim.name, anim.startTime);
-            break;
-        }
-        case WebKit::WebLayerAnimation::RemoveAnimation:
-            layer->removeAnimation(anim.name);
-            break;
-        case WebKit::WebLayerAnimation::PauseAnimation:
-            double offset = WTF::currentTime() - anim.startTime;
-            layer->pauseAnimation(anim.name, offset);
-            break;
-        }
-    }
-
     if (layerInfo.isRootLayer && m_rootLayerID != id)
         setRootLayerID(id);
 }

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp (113627 => 113628)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp	2012-04-09 21:58:31 UTC (rev 113627)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp	2012-04-09 21:59:05 UTC (rev 113628)
@@ -22,7 +22,6 @@
 #if USE(UI_SIDE_COMPOSITING)
 #include "WebGraphicsLayer.h"
 
-#include "Animation.h"
 #include "BackingStore.h"
 #include "FloatQuad.h"
 #include "Frame.h"
@@ -90,7 +89,6 @@
     : GraphicsLayer(client)
     , m_maskTarget(0)
     , m_modified(true)
-    , m_hasPendingAnimations(false)
     , m_inUpdateMode(false)
     , m_shouldUpdateVisibleRect(true)
     , m_webGraphicsLayerClient(0)
@@ -295,53 +293,6 @@
     notifyChange();
 }
 
-void WebGraphicsLayer::notifyAnimationStarted(double time)
-{
-    if (client())
-        client()->notifyAnimationStarted(this, time);
-}
-
-bool WebGraphicsLayer::addAnimation(const KeyframeValueList& valueList, const IntSize& boxSize, const Animation* anim, const String& keyframesName, double timeOffset)
-{
-    if (!anim || anim->isEmptyOrZeroDuration() || valueList.size() < 2 || (valueList.property() != AnimatedPropertyWebkitTransform && valueList.property() != AnimatedPropertyOpacity))
-        return false;
-
-    WebLayerAnimation webAnimation(valueList);
-    webAnimation.name = keyframesName;
-    webAnimation.operation = WebLayerAnimation::AddAnimation;
-    webAnimation.boxSize = boxSize;
-    webAnimation.animation = Animation::create(anim);
-    webAnimation.startTime = timeOffset;
-    m_layerInfo.animations.append(webAnimation);
-    if (valueList.property() == AnimatedPropertyWebkitTransform)
-        m_transformAnimations.add(keyframesName);
-
-    m_hasPendingAnimations = true;
-    didChangeGeometry();
-
-    return true;
-}
-
-void WebGraphicsLayer::pauseAnimation(const String& animationName, double timeOffset)
-{
-    WebLayerAnimation webAnimation;
-    webAnimation.name = animationName;
-    webAnimation.operation = WebLayerAnimation::PauseAnimation;
-    webAnimation.startTime = WTF::currentTime() - timeOffset;
-    m_layerInfo.animations.append(webAnimation);
-    notifyChange();
-}
-
-void WebGraphicsLayer::removeAnimation(const String& animationName)
-{
-    WebLayerAnimation webAnimation;
-    webAnimation.name = animationName;
-    webAnimation.operation = WebLayerAnimation::RemoveAnimation;
-    m_layerInfo.animations.append(webAnimation);
-    m_transformAnimations.remove(animationName);
-    notifyChange();
-}
-
 void WebGraphicsLayer::setContentsNeedsDisplay()
 {
     RefPtr<Image> image = m_image;
@@ -479,10 +430,6 @@
     updateContentBuffers();
 
     m_modified = false;
-    if (m_hasPendingAnimations)
-        notifyAnimationStarted(WTF::currentTime());
-    m_layerInfo.animations.clear();
-    m_hasPendingAnimations = false;
 }
 
 void WebGraphicsLayer::tiledBackingStorePaintBegin()
@@ -569,8 +516,6 @@
 
 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 (!shouldUseTiledBackingStore())
         return tiledBackingStoreContentsRect();
 
@@ -698,9 +643,6 @@
 
 bool WebGraphicsLayer::selfOrAncestorHaveNonAffineTransforms()
 {
-    if (!m_transformAnimations.isEmpty())
-        return true;
-
     if (!m_layerTransform.combined().isAffine())
         return true;
 

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h (113627 => 113628)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h	2012-04-09 21:58:31 UTC (rev 113627)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h	2012-04-09 21:59:05 UTC (rev 113628)
@@ -91,9 +91,6 @@
     void setBackfaceVisibility(bool);
     void setOpacity(float);
     void setContentsRect(const IntRect&);
-    bool addAnimation(const KeyframeValueList&, const IntSize&, const Animation*, const String&, double);
-    void pauseAnimation(const String&, double);
-    void removeAnimation(const String&);
     void setContentsToImage(Image*);
     void setMaskLayer(GraphicsLayer*);
     void setReplicatedByLayer(GraphicsLayer*);
@@ -111,7 +108,6 @@
     bool isModified() const { return m_modified; }
     void didSynchronize();
     Image* image() { return m_image.get(); }
-    void notifyAnimationStarted(double);
 
     GraphicsLayer* maskTarget() const { return m_maskTarget; }
     void setMaskTarget(GraphicsLayer* layer) { m_maskTarget = layer; }
@@ -147,14 +143,12 @@
     FloatRect m_needsDisplayRect;
     LayerTransform m_layerTransform;
     bool m_modified : 1;
-    bool m_hasPendingAnimations : 1;
     bool m_inUpdateMode : 1;
     bool m_shouldUpdateVisibleRect: 1;
 
     void notifyChange();
     void didChangeGeometry();
     void createBackingStore();
-    HashSet<String> m_transformAnimations;
 
     bool selfOrAncestorHaveNonAffineTransforms();
     bool shouldUseTiledBackingStore();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to