Changeset 116899 in webkit


Ignore:
Timestamp:
May 13, 2012 10:00:50 AM (12 years ago)
Author:
igor.o@sisa.samsung.com
Message:

[Texmap] TextureMapperAnimations does not support keyframe with multiple animations
https://bugs.webkit.org/show_bug.cgi?id=86303

Qt and GTK, in WebKit1, use TextureMapper to store AC animations using
TextureMapperAnimations::add(keyframeName, TextureMapperAnimation). And when a
CSS animation animates several CSS properties, TextureMapperAnimations::add is
called more than once with the same keyframeName value. However, currently,
TextureMapperAnimations can not store more than one animated property in the keyframe
because it is using HashMap<String, TextureMapperAnimation>, and WebKit HashMap
does not support add the same key twice.

Reviewed by Noam Rosenthal.

  • platform/graphics/texmap/TextureMapperAnimation.cpp:

(WebCore::TextureMapperAnimations::hasActiveAnimationsOfType):
(WebCore::TextureMapperAnimations::hasRunningAnimations):
(WebCore::TextureMapperAnimations::add):
(WebCore):
(WebCore::TextureMapperAnimations::pause):
(WebCore::TextureMapperAnimations::apply):

  • platform/graphics/texmap/TextureMapperAnimation.h:

(TextureMapperAnimations): Use HashMap<String, Vector<TextureMapperAnimation> >,
so we can support an keyframe with multiple animations.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r116864 r116899  
     12012-05-13  Igor Oliveira  <igor.o@sisa.samsung.com>
     2
     3        [Texmap] TextureMapperAnimations does not support keyframe with multiple animations
     4        https://bugs.webkit.org/show_bug.cgi?id=86303
     5
     6        Qt and GTK, in WebKit1, use TextureMapper to store AC animations using
     7        TextureMapperAnimations::add(keyframeName, TextureMapperAnimation). And when a
     8        CSS animation animates several CSS properties, TextureMapperAnimations::add is
     9        called more than once with the same keyframeName value. However, currently,
     10        TextureMapperAnimations can not store more than one animated property in the keyframe
     11        because it is using HashMap<String, TextureMapperAnimation>, and WebKit HashMap
     12        does not support add the same key twice.
     13
     14        Reviewed by Noam Rosenthal.
     15
     16        * platform/graphics/texmap/TextureMapperAnimation.cpp:
     17        (WebCore::TextureMapperAnimations::hasActiveAnimationsOfType):
     18        (WebCore::TextureMapperAnimations::hasRunningAnimations):
     19        (WebCore::TextureMapperAnimations::add):
     20        (WebCore):
     21        (WebCore::TextureMapperAnimations::pause):
     22        (WebCore::TextureMapperAnimations::apply):
     23        * platform/graphics/texmap/TextureMapperAnimation.h:
     24        (TextureMapperAnimations): Use HashMap<String, Vector<TextureMapperAnimation> >,
     25        so we can support an keyframe with multiple animations.
     26
    1272012-05-12  Abhishek Arya  <inferno@chromium.org>
    228
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp

    r111347 r116899  
    181181bool TextureMapperAnimations::hasActiveAnimationsOfType(AnimatedPropertyID type) const
    182182{
    183     HashMap<String, TextureMapperAnimation>::const_iterator end = m_animations.end();
    184     for (HashMap<String, TextureMapperAnimation>::const_iterator it = m_animations.begin(); it != end; ++it) {
    185         const TextureMapperAnimation& animation = it->second;
    186         if (animation.isActive() && animation.property() == type)
    187             return true;
     183    HashMap<String, Vector<TextureMapperAnimation> >::const_iterator end = m_animations.end();
     184    for (HashMap<String, Vector<TextureMapperAnimation> >::const_iterator it = m_animations.begin(); it != end; ++it) {
     185        const Vector<TextureMapperAnimation>& animations = it->second;
     186        for (size_t i = 0; i < animations.size(); ++i) {
     187            if (animations[i].isActive() && animations[i].property() == type)
     188                return true;
     189        }
    188190    }
    189191    return false;
     
    192194bool TextureMapperAnimations::hasRunningAnimations() const
    193195{
    194     HashMap<String, TextureMapperAnimation>::const_iterator end = m_animations.end();
    195     for (HashMap<String, TextureMapperAnimation>::const_iterator it = m_animations.begin(); it != end; ++it) {
    196         const TextureMapperAnimation& animation = it->second;
    197         if (animation.state() == TextureMapperAnimation::PlayingState)
    198             return true;
     196    HashMap<String, Vector<TextureMapperAnimation> >::const_iterator end = m_animations.end();
     197    for (HashMap<String, Vector<TextureMapperAnimation> >::const_iterator it = m_animations.begin(); it != end; ++it) {
     198        const Vector<TextureMapperAnimation>& animations = it->second;
     199        for (size_t i = 0; i < animations.size(); ++i) {
     200            if (animations[i].state() == TextureMapperAnimation::PlayingState)
     201                return true;
     202        }
    199203    }
    200204
     
    248252}
    249253
     254void TextureMapperAnimations::add(const String& name, const TextureMapperAnimation& animation)
     255{
     256    HashMap<String, Vector<TextureMapperAnimation> >::iterator it = m_animations.find(name);
     257    if (it != m_animations.end()) {
     258        it->second.append(animation);
     259        return;
     260    }
     261
     262    Vector<TextureMapperAnimation> animations;
     263    animations.append(animation);
     264    m_animations.add(name, animations);
     265}
     266
    250267void TextureMapperAnimations::pause(const String& name, double offset)
    251268{
    252     HashMap<String, TextureMapperAnimation>::iterator it = m_animations.find(name);
     269    HashMap<String, Vector<TextureMapperAnimation> >::iterator it = m_animations.find(name);
    253270    if (it == m_animations.end())
    254271        return;
    255     it->second.pause(offset);
     272
     273    for (size_t i = 0; i < it->second.size(); i++)
     274        it->second[i].pause(offset);
    256275}
    257276
    258277void TextureMapperAnimations::apply(TextureMapperAnimationClient* client)
    259278{
    260     HashMap<String, TextureMapperAnimation>::iterator end = m_animations.end();
    261     for (HashMap<String, TextureMapperAnimation>::iterator it = m_animations.begin(); it != end; ++it)
    262         it->second.apply(client);
     279    HashMap<String, Vector<TextureMapperAnimation> >::iterator end = m_animations.end();
     280    for (HashMap<String, Vector<TextureMapperAnimation> >::iterator it = m_animations.begin(); it != end; ++it) {
     281        for (size_t i = 0; i < it->second.size(); ++i)
     282            it->second[i].apply(client);
     283    }
    263284}
    264285
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h

    r111344 r116899  
    6767    TextureMapperAnimations() { }
    6868
    69     void add(const String& name, const TextureMapperAnimation& animation) { m_animations.add(name, animation); }
     69    void add(const String&, const TextureMapperAnimation&);
    7070    void remove(const String& name) { m_animations.remove(name); }
    7171    void pause(const String&, double);
     
    7777
    7878private:
    79     HashMap<String, TextureMapperAnimation> m_animations;
     79    HashMap<String, Vector<TextureMapperAnimation> > m_animations;
    8080};
    8181
Note: See TracChangeset for help on using the changeset viewer.