Title: [251158] trunk/Source/WebCore
Revision
251158
Author
simon.fra...@apple.com
Date
2019-10-15 14:18:37 -0700 (Tue, 15 Oct 2019)

Log 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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (251157 => 251158)


--- trunk/Source/WebCore/ChangeLog	2019-10-15 21:16:16 UTC (rev 251157)
+++ trunk/Source/WebCore/ChangeLog	2019-10-15 21:18:37 UTC (rev 251158)
@@ -1,5 +1,21 @@
 2019-10-15  Simon Fraser  <simon.fra...@apple.com>
 
+        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:
+
+2019-10-15  Simon Fraser  <simon.fra...@apple.com>
+
         Don't mutate a NinePieceImage to create a mask default image
         https://bugs.webkit.org/show_bug.cgi?id=202967
 

Modified: trunk/Source/WebCore/platform/animation/Animation.cpp (251157 => 251158)


--- trunk/Source/WebCore/platform/animation/Animation.cpp	2019-10-15 21:16:16 UTC (rev 251157)
+++ trunk/Source/WebCore/platform/animation/Animation.cpp	2019-10-15 21:18:37 UTC (rev 251158)
@@ -23,6 +23,7 @@
 #include "Animation.h"
 
 #include <wtf/NeverDestroyed.h>
+#include <wtf/text/TextStream.h>
 
 namespace WebCore {
 
@@ -138,4 +139,43 @@
     return initialValue;
 }
 
+TextStream& operator<<(TextStream& ts, Animation::AnimationMode mode)
+{
+    switch (mode) {
+    case Animation::AnimateAll: ts << "all"; break;
+    case Animation::AnimateNone: ts << "none"; break;
+    case Animation::AnimateSingleProperty: ts << "single property"; break;
+    case Animation::AnimateUnknownProperty: ts << "unknown property"; break;
+    }
+    return ts;
+}
+
+TextStream& operator<<(TextStream& ts, Animation::AnimationDirection direction)
+{
+    switch (direction) {
+    case Animation::AnimationDirectionNormal: ts << "normal"; break;
+    case Animation::AnimationDirectionAlternate: ts << "alternate"; break;
+    case Animation::AnimationDirectionReverse: ts << "reverse"; break;
+    case Animation::AnimationDirectionAlternateReverse: ts << "alternate-reverse"; break;
+    }
+    return ts;
+}
+
+TextStream& operator<<(TextStream& ts, const Animation& animation)
+{
+    ts.dumpProperty("property", getPropertyName(animation.property()));
+    ts.dumpProperty("name", animation.name());
+    ts.dumpProperty("iteration count", animation.iterationCount());
+    ts.dumpProperty("delay", animation.iterationCount());
+    ts.dumpProperty("duration", animation.duration());
+    if (animation.timingFunction())
+        ts.dumpProperty("timing function", *animation.timingFunction());
+    ts.dumpProperty("mode", animation.animationMode());
+    ts.dumpProperty("direction", animation.direction());
+    ts.dumpProperty("fill-mode", animation.fillMode());
+    ts.dumpProperty("play-state", animation.playState());
+
+    return ts;
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/animation/Animation.h (251157 => 251158)


--- trunk/Source/WebCore/platform/animation/Animation.h	2019-10-15 21:16:16 UTC (rev 251157)
+++ trunk/Source/WebCore/platform/animation/Animation.h	2019-10-15 21:18:37 UTC (rev 251158)
@@ -199,4 +199,9 @@
     static Ref<TimingFunction> initialTimingFunction() { return CubicBezierTimingFunction::create(); }
 };
 
+WTF::TextStream& operator<<(WTF::TextStream&, AnimationPlayState);
+WTF::TextStream& operator<<(WTF::TextStream&, Animation::AnimationMode);
+WTF::TextStream& operator<<(WTF::TextStream&, Animation::AnimationDirection);
+WTF::TextStream& operator<<(WTF::TextStream&, const Animation&);
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/animation/AnimationList.cpp (251157 => 251158)


--- trunk/Source/WebCore/platform/animation/AnimationList.cpp	2019-10-15 21:16:16 UTC (rev 251157)
+++ trunk/Source/WebCore/platform/animation/AnimationList.cpp	2019-10-15 21:18:37 UTC (rev 251158)
@@ -22,6 +22,8 @@
 #include "config.h"
 #include "AnimationList.h"
 
+#include <wtf/text/TextStream.h>
+
 namespace WebCore {
 
 #define FILL_UNSET_PROPERTY(test, propGet, propSet) \
@@ -63,4 +65,16 @@
     return true;
 }
 
+TextStream& operator<<(TextStream& ts, const AnimationList& animationList)
+{
+    ts << "[";
+    for (size_t i = 0; i < animationList.size(); ++i) {
+        if (i > 0)
+            ts << ", ";
+        ts << animationList.animation(i);
+    }
+    ts << "]";
+    return ts;
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/animation/AnimationList.h (251157 => 251158)


--- trunk/Source/WebCore/platform/animation/AnimationList.h	2019-10-15 21:16:16 UTC (rev 251157)
+++ trunk/Source/WebCore/platform/animation/AnimationList.h	2019-10-15 21:18:37 UTC (rev 251158)
@@ -60,5 +60,6 @@
     Vector<Ref<Animation>, 0, CrashOnOverflow, 0> m_animations;
 };    
 
+WTF::TextStream& operator<<(WTF::TextStream&, const AnimationList&);
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to