Changeset 251158 in webkit


Ignore:
Timestamp:
Oct 15, 2019 2:18:37 PM (5 years ago)
Author:
Simon Fraser
Message:

Add dumping for Animation and AnimationList
https://bugs.webkit.org/show_bug.cgi?id=202973

Reviewed by Dean Jackson.

Make Animation, AnimationList and related enums dumpable.

  • platform/animation/Animation.cpp:

(WebCore::operator<<):

  • platform/animation/Animation.h:
  • platform/animation/AnimationList.cpp:

(WebCore::operator<<):

  • platform/animation/AnimationList.h:
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r251156 r251158  
     12019-10-15  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Add dumping for Animation and AnimationList
     4        https://bugs.webkit.org/show_bug.cgi?id=202973
     5
     6        Reviewed by Dean Jackson.
     7
     8        Make Animation, AnimationList and related enums dumpable.
     9
     10        * platform/animation/Animation.cpp:
     11        (WebCore::operator<<):
     12        * platform/animation/Animation.h:
     13        * platform/animation/AnimationList.cpp:
     14        (WebCore::operator<<):
     15        * platform/animation/AnimationList.h:
     16
    1172019-10-15  Simon Fraser  <simon.fraser@apple.com>
    218
  • trunk/Source/WebCore/platform/animation/Animation.cpp

    r236750 r251158  
    2424
    2525#include <wtf/NeverDestroyed.h>
     26#include <wtf/text/TextStream.h>
    2627
    2728namespace WebCore {
     
    139140}
    140141
     142TextStream& operator<<(TextStream& ts, Animation::AnimationMode mode)
     143{
     144    switch (mode) {
     145    case Animation::AnimateAll: ts << "all"; break;
     146    case Animation::AnimateNone: ts << "none"; break;
     147    case Animation::AnimateSingleProperty: ts << "single property"; break;
     148    case Animation::AnimateUnknownProperty: ts << "unknown property"; break;
     149    }
     150    return ts;
     151}
     152
     153TextStream& operator<<(TextStream& ts, Animation::AnimationDirection direction)
     154{
     155    switch (direction) {
     156    case Animation::AnimationDirectionNormal: ts << "normal"; break;
     157    case Animation::AnimationDirectionAlternate: ts << "alternate"; break;
     158    case Animation::AnimationDirectionReverse: ts << "reverse"; break;
     159    case Animation::AnimationDirectionAlternateReverse: ts << "alternate-reverse"; break;
     160    }
     161    return ts;
     162}
     163
     164TextStream& operator<<(TextStream& ts, const Animation& animation)
     165{
     166    ts.dumpProperty("property", getPropertyName(animation.property()));
     167    ts.dumpProperty("name", animation.name());
     168    ts.dumpProperty("iteration count", animation.iterationCount());
     169    ts.dumpProperty("delay", animation.iterationCount());
     170    ts.dumpProperty("duration", animation.duration());
     171    if (animation.timingFunction())
     172        ts.dumpProperty("timing function", *animation.timingFunction());
     173    ts.dumpProperty("mode", animation.animationMode());
     174    ts.dumpProperty("direction", animation.direction());
     175    ts.dumpProperty("fill-mode", animation.fillMode());
     176    ts.dumpProperty("play-state", animation.playState());
     177
     178    return ts;
     179}
     180
    141181} // namespace WebCore
  • trunk/Source/WebCore/platform/animation/Animation.h

    r236750 r251158  
    200200};
    201201
     202WTF::TextStream& operator<<(WTF::TextStream&, AnimationPlayState);
     203WTF::TextStream& operator<<(WTF::TextStream&, Animation::AnimationMode);
     204WTF::TextStream& operator<<(WTF::TextStream&, Animation::AnimationDirection);
     205WTF::TextStream& operator<<(WTF::TextStream&, const Animation&);
     206
    202207} // namespace WebCore
  • trunk/Source/WebCore/platform/animation/AnimationList.cpp

    r210758 r251158  
    2222#include "config.h"
    2323#include "AnimationList.h"
     24
     25#include <wtf/text/TextStream.h>
    2426
    2527namespace WebCore {
     
    6466}
    6567
     68TextStream& operator<<(TextStream& ts, const AnimationList& animationList)
     69{
     70    ts << "[";
     71    for (size_t i = 0; i < animationList.size(); ++i) {
     72        if (i > 0)
     73            ts << ", ";
     74        ts << animationList.animation(i);
     75    }
     76    ts << "]";
     77    return ts;
     78}
     79
    6680} // namespace WebCore
  • trunk/Source/WebCore/platform/animation/AnimationList.h

    r233020 r251158  
    6161};   
    6262
     63WTF::TextStream& operator<<(WTF::TextStream&, const AnimationList&);
    6364
    6465} // namespace WebCore
Note: See TracChangeset for help on using the changeset viewer.