[iOS WK2] Animations on vox.com look wrong
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 May 2014 17:29:22 +0000 (17:29 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 May 2014 17:29:22 +0000 (17:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=132462
<rdar://problem/16731884>

Reviewed by Sam Weinig.

PlatformCALayerRemote was managing animations incorrectly; aninations
would stick around in m_properties.addedAnimations and get added a second
time by mistake.

Animations have to be managed a little differently to other properties,
since they are not steady-state things. A given commit has to send over
the added and removed animations, and then clear the layer properties.

Do this by adding PlatformCALayerRemote::didCommit(), which is called
after the layer properties have been encoded, and have it clear the lists
of added and removed animations.

removeAnimationForKey() also has to remove the animation from addedAnimations
so that an add/remove in the same commit doesn't send the animation to the
UI process.

* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
(WebKit::PlatformCALayerRemote::didCommit):
(WebKit::PlatformCALayerRemote::removeAnimationForKey):
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::flushLayers):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@168175 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h
Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm

index 28d6e14..34b56ac 100644 (file)
@@ -1,5 +1,37 @@
 2014-05-01  Simon Fraser  <simon.fraser@apple.com>
 
+        [iOS WK2] Animations on vox.com look wrong
+        https://bugs.webkit.org/show_bug.cgi?id=132462
+        <rdar://problem/16731884>
+
+        Reviewed by Sam Weinig.
+        
+        PlatformCALayerRemote was managing animations incorrectly; aninations
+        would stick around in m_properties.addedAnimations and get added a second
+        time by mistake.
+        
+        Animations have to be managed a little differently to other properties,
+        since they are not steady-state things. A given commit has to send over
+        the added and removed animations, and then clear the layer properties.
+        
+        Do this by adding PlatformCALayerRemote::didCommit(), which is called
+        after the layer properties have been encoded, and have it clear the lists
+        of added and removed animations.
+        
+        removeAnimationForKey() also has to remove the animation from addedAnimations
+        so that an add/remove in the same commit doesn't send the animation to the
+        UI process.
+
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+        (WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
+        (WebKit::PlatformCALayerRemote::didCommit):
+        (WebKit::PlatformCALayerRemote::removeAnimationForKey):
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+        * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
+        (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
+
+2014-05-01  Simon Fraser  <simon.fraser@apple.com>
+
         [iOS WK2] Can't scroll on gatesnotes.com 
         https://bugs.webkit.org/show_bug.cgi?id=132459
         <rdar://problem/16770909>
index 89b1e62..193d25c 100644 (file)
@@ -135,7 +135,7 @@ void PlatformCALayerRemote::recursiveBuildTransaction(RemoteLayerTreeTransaction
 
         if (m_layerType == LayerTypeCustom) {
             RemoteLayerTreePropertyApplier::applyProperties(platformLayer(), nullptr, m_properties, RemoteLayerTreePropertyApplier::RelatedLayerMap());
-            m_properties.resetChangedProperties();
+            didCommit();
             return;
         }
 
@@ -152,6 +152,13 @@ void PlatformCALayerRemote::recursiveBuildTransaction(RemoteLayerTreeTransaction
         m_maskLayer->recursiveBuildTransaction(transaction);
 }
 
+void PlatformCALayerRemote::didCommit()
+{
+    m_properties.addedAnimations.clear();
+    m_properties.keyPathsOfAnimationsToRemove.clear();
+    m_properties.resetChangedProperties();
+}
+
 void PlatformCALayerRemote::animationStarted(CFTimeInterval beginTime)
 {
     if (m_owner)
@@ -297,7 +304,7 @@ void PlatformCALayerRemote::addAnimationForKey(const String& key, PlatformCAAnim
 
 void PlatformCALayerRemote::removeAnimationForKey(const String& key)
 {
-    // FIXME: remove from m_properties.addedAnimations ?
+    m_properties.addedAnimations.remove(key);
     m_properties.keyPathsOfAnimationsToRemove.add(key);
     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::AnimationsChanged);
 }
index 167b18b..58346e0 100644 (file)
@@ -157,6 +157,8 @@ public:
 
     RemoteLayerTreeTransaction::LayerProperties& properties() { return m_properties; }
 
+    void didCommit();
+
     void clearContext() { m_context = nullptr; }
 
 protected:
index 9b123ef..9563625 100644 (file)
@@ -278,7 +278,7 @@ void RemoteLayerTreeDrawingArea::flushLayers()
     for (auto& layer : layerTransaction.changedLayers()) {
         if (layer->properties().changedProperties & RemoteLayerTreeTransaction::LayerChanges::BackingStoreChanged)
             hadAnyChangedBackingStore = true;
-        layer->properties().resetChangedProperties();
+        layer->didCommit();
     }
 
     if (hadAnyChangedBackingStore)