Changeset 170656 in webkit


Ignore:
Timestamp:
Jul 1, 2014 12:15:39 PM (10 years ago)
Author:
Simon Fraser
Message:

[UI-side compositing] Bad spinner on news.google.com: animations need to be ordered
https://bugs.webkit.org/show_bug.cgi?id=134504
<rdar://problem/17507892>

Reviewed by Tim Horton.

Source/WebKit2:
The layer's addedAnimations property needs to maintain order, since the order
in which transforms are applied is important.

  • Shared/mac/RemoteLayerTreeTransaction.h: Use a Vector<pair<>> for addedAnimations.
  • Shared/mac/RemoteLayerTreeTransaction.mm:

(WebKit::dumpChangedLayers):

  • WebProcess/WebPage/mac/PlatformCAAnimationRemote.h:
  • WebProcess/WebPage/mac/PlatformCAAnimationRemote.mm:

(WebKit::PlatformCAAnimationRemote::updateLayerAnimations):

  • WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:

(WebKit::PlatformCALayerRemote::addAnimationForKey): If this is a new entry, we
can just append to addedAnimations, otherwise we have to find the existing one
and update its properties.
(WebKit::PlatformCALayerRemote::removeAnimationForKey): Do linear search to
find the animation to remove (this list will normally be short).

LayoutTests:
Test that the transforms from the animation are applied in the correct order.

  • compositing/animation/keyframe-order-expected.html: Added.
  • compositing/animation/keyframe-order.html: Added.
Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r170646 r170656  
     12014-07-01  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [UI-side compositing] Bad spinner on news.google.com: animations need to be ordered
     4        https://bugs.webkit.org/show_bug.cgi?id=134504
     5        <rdar://problem/17507892>
     6
     7        Reviewed by Tim Horton.
     8       
     9        Test that the transforms from the animation are applied in the correct order.
     10
     11        * compositing/animation/keyframe-order-expected.html: Added.
     12        * compositing/animation/keyframe-order.html: Added.
     13
    1142014-07-01  Zalan Bujtas  <zalan@apple.com>
    215
  • trunk/Source/WebKit2/ChangeLog

    r170654 r170656  
     12014-07-01  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [UI-side compositing] Bad spinner on news.google.com: animations need to be ordered
     4        https://bugs.webkit.org/show_bug.cgi?id=134504
     5        <rdar://problem/17507892>
     6
     7        Reviewed by Tim Horton.
     8       
     9        The layer's addedAnimations property needs to maintain order, since the order
     10        in which transforms are applied is important.
     11
     12        * Shared/mac/RemoteLayerTreeTransaction.h: Use a Vector<pair<>> for addedAnimations.
     13        * Shared/mac/RemoteLayerTreeTransaction.mm:
     14        (WebKit::dumpChangedLayers):
     15        * WebProcess/WebPage/mac/PlatformCAAnimationRemote.h:
     16        * WebProcess/WebPage/mac/PlatformCAAnimationRemote.mm:
     17        (WebKit::PlatformCAAnimationRemote::updateLayerAnimations):
     18        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
     19        (WebKit::PlatformCALayerRemote::addAnimationForKey): If this is a new entry, we
     20        can just append to addedAnimations, otherwise we have to find the existing one
     21        and update its properties.
     22        (WebKit::PlatformCALayerRemote::removeAnimationForKey): Do linear search to
     23        find the animation to remove (this list will normally be short).
     24
    1252014-07-01  Anders Carlsson  <andersca@apple.com>
    226
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h

    r170274 r170656  
    124124        Vector<WebCore::GraphicsLayer::PlatformLayerID> children;
    125125
    126         HashMap<String, PlatformCAAnimationRemote::Properties> addedAnimations;
     126        Vector<std::pair<String, PlatformCAAnimationRemote::Properties>> addedAnimations;
    127127        HashSet<String> keyPathsOfAnimationsToRemove;
    128128
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm

    r170274 r170656  
    11041104
    11051105        if (layerProperties.changedProperties & RemoteLayerTreeTransaction::AnimationsChanged) {
    1106             for (const auto& keyValuePair : layerProperties.addedAnimations)
    1107                 dumpProperty(ts, "animation " +  keyValuePair.key, keyValuePair.value);
     1106            for (const auto& keyAnimationPair : layerProperties.addedAnimations)
     1107                dumpProperty(ts, "animation " +  keyAnimationPair.first, keyAnimationPair.second);
    11081108
    11091109            for (const auto& name : layerProperties.keyPathsOfAnimationsToRemove)
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCAAnimationRemote.h

    r168901 r170656  
    295295    const Properties& properties() const { return m_properties; }
    296296
    297     typedef HashMap<String, Properties> AnimationsMap;
    298     static void updateLayerAnimations(CALayer *, RemoteLayerTreeHost*, const AnimationsMap& animationsToAdd, const HashSet<String>& animationsToRemove);
     297    typedef Vector<std::pair<String, Properties>> AnimationsList;
     298    static void updateLayerAnimations(CALayer *, RemoteLayerTreeHost*, const AnimationsList& animationsToAdd, const HashSet<String>& animationsToRemove);
    299299
    300300private:
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCAAnimationRemote.mm

    r169995 r170656  
    776776}
    777777
    778 void PlatformCAAnimationRemote::updateLayerAnimations(CALayer *layer, RemoteLayerTreeHost* layerTreeHost, const AnimationsMap& animationsToAdd, const HashSet<String>& animationsToRemove)
     778void PlatformCAAnimationRemote::updateLayerAnimations(CALayer *layer, RemoteLayerTreeHost* layerTreeHost, const AnimationsList& animationsToAdd, const HashSet<String>& animationsToRemove)
    779779{
    780780    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     
    783783        [layer removeAnimationForKey:value];
    784784
    785     for (const auto& keyValuePair : animationsToAdd)
    786         addAnimationToLayer(layer, layerTreeHost, keyValuePair.key, keyValuePair.value);
     785    for (const auto& keyAnimationPair : animationsToAdd)
     786        addAnimationToLayer(layer, layerTreeHost, keyAnimationPair.first, keyAnimationPair.second);
    787787
    788788    END_BLOCK_OBJC_EXCEPTIONS;
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp

    r170274 r170656  
    302302void PlatformCALayerRemote::addAnimationForKey(const String& key, PlatformCAAnimation* animation)
    303303{
    304     m_animations.set(key, animation);
    305     m_properties.addedAnimations.set(key, toPlatformCAAnimationRemote(animation)->properties());
     304    auto addResult = m_animations.set(key, animation);
     305    if (addResult.isNewEntry)
     306        m_properties.addedAnimations.append(std::pair<String, PlatformCAAnimationRemote::Properties>(key, toPlatformCAAnimationRemote(animation)->properties()));
     307    else {
     308        for (auto& keyAnimationPair : m_properties.addedAnimations) {
     309            if (keyAnimationPair.first == key) {
     310                keyAnimationPair.second = toPlatformCAAnimationRemote(animation)->properties();
     311                break;
     312            }
     313        }
     314    }
     315   
    306316    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::AnimationsChanged);
    307317
     
    312322void PlatformCALayerRemote::removeAnimationForKey(const String& key)
    313323{
    314     m_animations.remove(key);
    315     m_properties.addedAnimations.remove(key);
     324    if (m_animations.remove(key)) {
     325        for (size_t i = 0; i < m_properties.addedAnimations.size(); ++i) {
     326            if (m_properties.addedAnimations[i].first == key) {
     327                m_properties.addedAnimations.remove(i);
     328                break;
     329            }
     330        }
     331    }
    316332    m_properties.keyPathsOfAnimationsToRemove.add(key);
    317333    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::AnimationsChanged);
Note: See TracChangeset for help on using the changeset viewer.