Add to the Animations log channel output about which properties are being blended
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 May 2016 22:19:23 +0000 (22:19 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 May 2016 22:19:23 +0000 (22:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=157271

Reviewed by Dean Jackson.

Make the Animations log channel dump information as CSS properties are being blended.
Sample output:

  blending left from 0px to 400px at 0.57 -> 227.76px
  blending transform from translate(0px, 0px, 0px) to translate(400px, 0px, 0px) at 0.74 -> translate(294.97px, 0px, 0px)

This makes it easier to see, for example, transitions to or from "auto" values.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::PropertyWrapperGetter::value):
(WebCore::PropertyWrapperMaybeInvalidColor::value):
(WebCore::CSSPropertyAnimationWrapperMap::wrapperForProperty):
(WebCore::CSSPropertyAnimation::blendProperties):
* platform/Length.cpp:
(WebCore::operator<<):
* platform/LengthBox.h:
* platform/graphics/transforms/IdentityTransformOperation.h:
* platform/graphics/transforms/Matrix3DTransformOperation.cpp:
(WebCore::Matrix3DTransformOperation::dump):
* platform/graphics/transforms/Matrix3DTransformOperation.h:
* platform/graphics/transforms/MatrixTransformOperation.cpp:
(WebCore::MatrixTransformOperation::dump):
* platform/graphics/transforms/MatrixTransformOperation.h:
* platform/graphics/transforms/PerspectiveTransformOperation.cpp:
(WebCore::PerspectiveTransformOperation::dump):
* platform/graphics/transforms/PerspectiveTransformOperation.h:
* platform/graphics/transforms/RotateTransformOperation.cpp:
(WebCore::RotateTransformOperation::dump):
* platform/graphics/transforms/RotateTransformOperation.h:
* platform/graphics/transforms/ScaleTransformOperation.cpp:
(WebCore::ScaleTransformOperation::dump):
* platform/graphics/transforms/ScaleTransformOperation.h:
* platform/graphics/transforms/SkewTransformOperation.cpp:
(WebCore::SkewTransformOperation::dump):
* platform/graphics/transforms/SkewTransformOperation.h:
* platform/graphics/transforms/TransformOperation.h:
* platform/graphics/transforms/TransformOperations.cpp:
(WebCore::operator<<):
* platform/graphics/transforms/TransformOperations.h:
* platform/graphics/transforms/TranslateTransformOperation.cpp:
(WebCore::TranslateTransformOperation::dump):
* platform/graphics/transforms/TranslateTransformOperation.h:
* rendering/style/NinePieceImage.cpp:
(WebCore::operator<<):
* rendering/style/NinePieceImage.h:
* svg/SVGLength.cpp:
(WebCore::operator<<):
* svg/SVGLength.h:

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

30 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/page/animation/CSSPropertyAnimation.cpp
Source/WebCore/platform/Length.cpp
Source/WebCore/platform/LengthBox.cpp [new file with mode: 0644]
Source/WebCore/platform/LengthBox.h
Source/WebCore/platform/graphics/transforms/IdentityTransformOperation.h
Source/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.cpp
Source/WebCore/platform/graphics/transforms/Matrix3DTransformOperation.h
Source/WebCore/platform/graphics/transforms/MatrixTransformOperation.cpp
Source/WebCore/platform/graphics/transforms/MatrixTransformOperation.h
Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.cpp
Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.h
Source/WebCore/platform/graphics/transforms/RotateTransformOperation.cpp
Source/WebCore/platform/graphics/transforms/RotateTransformOperation.h
Source/WebCore/platform/graphics/transforms/ScaleTransformOperation.cpp
Source/WebCore/platform/graphics/transforms/ScaleTransformOperation.h
Source/WebCore/platform/graphics/transforms/SkewTransformOperation.cpp
Source/WebCore/platform/graphics/transforms/SkewTransformOperation.h
Source/WebCore/platform/graphics/transforms/TransformOperation.cpp [new file with mode: 0644]
Source/WebCore/platform/graphics/transforms/TransformOperation.h
Source/WebCore/platform/graphics/transforms/TransformOperations.cpp
Source/WebCore/platform/graphics/transforms/TransformOperations.h
Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.cpp
Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h
Source/WebCore/rendering/style/NinePieceImage.cpp
Source/WebCore/rendering/style/NinePieceImage.h
Source/WebCore/svg/SVGLength.cpp
Source/WebCore/svg/SVGLength.h

index 78a0b1f..9f1958b 100644 (file)
@@ -2109,6 +2109,7 @@ set(WebCore_SOURCES
     platform/FileSystem.cpp
     platform/Language.cpp
     platform/Length.cpp
+    platform/LengthBox.cpp
     platform/LengthPoint.cpp
     platform/LengthSize.cpp
     platform/LinkHash.cpp
@@ -2282,6 +2283,7 @@ set(WebCore_SOURCES
     platform/graphics/transforms/RotateTransformOperation.cpp
     platform/graphics/transforms/ScaleTransformOperation.cpp
     platform/graphics/transforms/SkewTransformOperation.cpp
+    platform/graphics/transforms/TransformOperation.cpp
     platform/graphics/transforms/TransformOperations.cpp
     platform/graphics/transforms/TransformState.cpp
     platform/graphics/transforms/TransformationMatrix.cpp
index b4cecc1..cdb36a3 100644 (file)
@@ -1,3 +1,61 @@
+2016-05-02  Simon Fraser  <simon.fraser@apple.com>
+
+        Add to the Animations log channel output about which properties are being blended
+        https://bugs.webkit.org/show_bug.cgi?id=157271
+
+        Reviewed by Dean Jackson.
+
+        Make the Animations log channel dump information as CSS properties are being blended.
+        Sample output:
+
+          blending left from 0px to 400px at 0.57 -> 227.76px
+          blending transform from translate(0px, 0px, 0px) to translate(400px, 0px, 0px) at 0.74 -> translate(294.97px, 0px, 0px)
+
+        This makes it easier to see, for example, transitions to or from "auto" values.
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * page/animation/CSSPropertyAnimation.cpp:
+        (WebCore::PropertyWrapperGetter::value):
+        (WebCore::PropertyWrapperMaybeInvalidColor::value):
+        (WebCore::CSSPropertyAnimationWrapperMap::wrapperForProperty):
+        (WebCore::CSSPropertyAnimation::blendProperties):
+        * platform/Length.cpp:
+        (WebCore::operator<<):
+        * platform/LengthBox.h:
+        * platform/graphics/transforms/IdentityTransformOperation.h:
+        * platform/graphics/transforms/Matrix3DTransformOperation.cpp:
+        (WebCore::Matrix3DTransformOperation::dump):
+        * platform/graphics/transforms/Matrix3DTransformOperation.h:
+        * platform/graphics/transforms/MatrixTransformOperation.cpp:
+        (WebCore::MatrixTransformOperation::dump):
+        * platform/graphics/transforms/MatrixTransformOperation.h:
+        * platform/graphics/transforms/PerspectiveTransformOperation.cpp:
+        (WebCore::PerspectiveTransformOperation::dump):
+        * platform/graphics/transforms/PerspectiveTransformOperation.h:
+        * platform/graphics/transforms/RotateTransformOperation.cpp:
+        (WebCore::RotateTransformOperation::dump):
+        * platform/graphics/transforms/RotateTransformOperation.h:
+        * platform/graphics/transforms/ScaleTransformOperation.cpp:
+        (WebCore::ScaleTransformOperation::dump):
+        * platform/graphics/transforms/ScaleTransformOperation.h:
+        * platform/graphics/transforms/SkewTransformOperation.cpp:
+        (WebCore::SkewTransformOperation::dump):
+        * platform/graphics/transforms/SkewTransformOperation.h:
+        * platform/graphics/transforms/TransformOperation.h:
+        * platform/graphics/transforms/TransformOperations.cpp:
+        (WebCore::operator<<):
+        * platform/graphics/transforms/TransformOperations.h:
+        * platform/graphics/transforms/TranslateTransformOperation.cpp:
+        (WebCore::TranslateTransformOperation::dump):
+        * platform/graphics/transforms/TranslateTransformOperation.h:
+        * rendering/style/NinePieceImage.cpp:
+        (WebCore::operator<<):
+        * rendering/style/NinePieceImage.h:
+        * svg/SVGLength.cpp:
+        (WebCore::operator<<):
+        * svg/SVGLength.h:
+
 2016-05-02  Chris Dumez  <cdumez@apple.com>
 
         Modernize HTMLConstructionSite
index 19ccef1..1ad435d 100644 (file)
                0FE5FBD91C3DD51E0007A2CA /* DisplayListReplayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE5FBD11C3DD51E0007A2CA /* DisplayListReplayer.h */; };
                0FE71405142170B800DB33BA /* ScrollbarThemeMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FE71403142170B800DB33BA /* ScrollbarThemeMock.cpp */; };
                0FE71406142170B800DB33BA /* ScrollbarThemeMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FE71404142170B800DB33BA /* ScrollbarThemeMock.h */; };
+               0FE95F1B1CD540D000D2F45A /* LengthBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FE95F1A1CD540D000D2F45A /* LengthBox.cpp */; };
+               0FE95F1D1CD543DF00D2F45A /* TransformOperation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FE95F1C1CD543DF00D2F45A /* TransformOperation.cpp */; };
                0FEA3E7B191B2FC5000F1B55 /* ScrollingStateFrameScrollingNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FEA3E79191B2FC5000F1B55 /* ScrollingStateFrameScrollingNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
                0FEA3E7C191B2FC5000F1B55 /* ScrollingStateFrameScrollingNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FEA3E7A191B2FC5000F1B55 /* ScrollingStateFrameScrollingNode.cpp */; };
                0FEA3E7F191B3169000F1B55 /* ScrollingTreeOverflowScrollingNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FEA3E7D191B3169000F1B55 /* ScrollingTreeOverflowScrollingNode.cpp */; };
                0FE71403142170B800DB33BA /* ScrollbarThemeMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollbarThemeMock.cpp; sourceTree = "<group>"; };
                0FE71404142170B800DB33BA /* ScrollbarThemeMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollbarThemeMock.h; sourceTree = "<group>"; };
                0FE71415142189FC00DB33BA /* ScrollbarTheme.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollbarTheme.cpp; sourceTree = "<group>"; };
+               0FE95F1A1CD540D000D2F45A /* LengthBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LengthBox.cpp; sourceTree = "<group>"; };
+               0FE95F1C1CD543DF00D2F45A /* TransformOperation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TransformOperation.cpp; sourceTree = "<group>"; };
                0FEA3E79191B2FC5000F1B55 /* ScrollingStateFrameScrollingNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollingStateFrameScrollingNode.h; sourceTree = "<group>"; };
                0FEA3E7A191B2FC5000F1B55 /* ScrollingStateFrameScrollingNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollingStateFrameScrollingNode.cpp; sourceTree = "<group>"; };
                0FEA3E7D191B3169000F1B55 /* ScrollingTreeOverflowScrollingNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollingTreeOverflowScrollingNode.cpp; sourceTree = "<group>"; };
                                49E911BD0EF86D47009D0CAF /* SkewTransformOperation.h */,
                                49E911B30EF86D47009D0CAF /* TransformationMatrix.cpp */,
                                49E911B40EF86D47009D0CAF /* TransformationMatrix.h */,
+                               0FE95F1C1CD543DF00D2F45A /* TransformOperation.cpp */,
                                49E911BE0EF86D47009D0CAF /* TransformOperation.h */,
                                49E911BF0EF86D47009D0CAF /* TransformOperations.cpp */,
                                49E911C00EF86D47009D0CAF /* TransformOperations.h */,
                                141DC0471648348F00371E5A /* LayoutUnit.h */,
                                BCE65BE80EACDF16007E4533 /* Length.cpp */,
                                BCE65BE90EACDF16007E4533 /* Length.h */,
+                               0FE95F1A1CD540D000D2F45A /* LengthBox.cpp */,
                                BCFF648F0EAD15C200C1D6F7 /* LengthBox.h */,
                                0F87166D1C869D83004FF0DE /* LengthPoint.cpp */,
                                0F87166E1C869D83004FF0DE /* LengthPoint.h */,
                                F5973DE115CFB2030027F804 /* LocaleMac.mm in Sources */,
                                7633A72713D8B33A008501B6 /* LocaleToScriptMappingDefault.cpp in Sources */,
                                A516E8B8136E04DB0076C3C0 /* LocalizedDateCache.mm in Sources */,
+                               0FE95F1B1CD540D000D2F45A /* LengthBox.cpp in Sources */,
                                C046E1AC1208A9FE00BA2CF7 /* LocalizedStrings.cpp in Sources */,
                                1A4832B31A953BA6008B4DFE /* LocalizedStringsCocoa.mm in Sources */,
                                BCE1C41C0D982981003B02F2 /* Location.cpp in Sources */,
                                0F580D000F12DE9B0051D689 /* RenderLayerBacking.cpp in Sources */,
                                0F580CFE0F12DE9B0051D689 /* RenderLayerCompositor.cpp in Sources */,
                                50D10D991545F5760096D288 /* RenderLayerFilterInfo.cpp in Sources */,
+                               0FE95F1D1CD543DF00D2F45A /* TransformOperation.cpp in Sources */,
                                3C244FEBA375AC633F88BE6F /* RenderLayerModelObject.cpp in Sources */,
                                BC33FB1B0F30EE85002CDD7C /* RenderLineBoxList.cpp in Sources */,
                                BCEA4863097D93020094C9E4 /* RenderLineBreak.cpp in Sources */,
index e56011d..9e9b275 100644 (file)
@@ -42,6 +42,7 @@
 #include "ClipPathOperation.h"
 #include "FloatConversion.h"
 #include "IdentityTransformOperation.h"
+#include "Logging.h"
 #include "Matrix3DTransformOperation.h"
 #include "MatrixTransformOperation.h"
 #include "RenderBox.h"
@@ -50,6 +51,7 @@
 #include "StyleGeneratedImage.h"
 #include "StylePropertyShorthand.h"
 #include "StyleResolver.h"
+#include "TextStream.h"
 #include <algorithm>
 #include <memory>
 #include <wtf/MathExtras.h>
@@ -384,6 +386,10 @@ public:
     virtual bool isShorthandWrapper() const { return false; }
     virtual bool equals(const RenderStyle* a, const RenderStyle* b) const = 0;
     virtual void blend(const AnimationBase*, RenderStyle*, const RenderStyle*, const RenderStyle*, double) const = 0;
+    
+#if !LOG_DISABLED
+    virtual void logBlend(const RenderStyle* a, const RenderStyle* b, const RenderStyle* result, double) const = 0;
+#endif
 
     CSSPropertyID property() const { return m_prop; }
 
@@ -412,6 +418,18 @@ public:
         return (a->*m_getter)() == (b->*m_getter)();
     }
 
+    T value(const RenderStyle* a) const
+    {
+        return (a->*m_getter)();
+    }
+
+#if !LOG_DISABLED
+    void logBlend(const RenderStyle* a, const RenderStyle* b, const RenderStyle* result, double progress) const final
+    {
+        LOG_WITH_STREAM(Animations, stream << "  blending " << getPropertyName(property()) << " from " << value(a) << " to " << value(b) << " at " << TextStream::FormatNumberRespectingIntegers(progress) << " -> " << value(result));
+    }
+#endif
+
 protected:
     T (RenderStyle::*m_getter)() const;
 };
@@ -717,6 +735,14 @@ public:
         (dst->*m_setter)(blendMismatchedShadowLists(anim, progress, shadowA, shadowB, fromLength, toLength), false);
     }
 
+#if !LOG_DISABLED
+    void logBlend(const RenderStyle*, const RenderStyle*, const RenderStyle*, double progress) const final
+    {
+        // FIXME: better logging.
+        LOG_WITH_STREAM(Animations, stream << "  blending ShadowData at " << TextStream::FormatNumberRespectingIntegers(progress));
+    }
+#endif
+
 private:
     std::unique_ptr<ShadowData> blendSimpleOrMatchedShadowLists(const AnimationBase* anim, double progress, const ShadowData* shadowA, const ShadowData* shadowB) const
     {
@@ -800,8 +826,8 @@ public:
         if (!a || !b)
             return false;
 
-        Color fromColor = (a->*m_getter)();
-        Color toColor = (b->*m_getter)();
+        Color fromColor = value(a);
+        Color toColor = value(b);
 
         if (!fromColor.isValid() && !toColor.isValid())
             return true;
@@ -816,8 +842,8 @@ public:
 
     void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
     {
-        Color fromColor = (a->*m_getter)();
-        Color toColor = (b->*m_getter)();
+        Color fromColor = value(a);
+        Color toColor = value(b);
 
         if (!fromColor.isValid() && !toColor.isValid())
             return;
@@ -829,6 +855,19 @@ public:
         (dst->*m_setter)(blendFunc(anim, fromColor, toColor, progress));
     }
 
+    Color value(const RenderStyle* a) const
+    {
+        return (a->*m_getter)();
+    }
+
+#if !LOG_DISABLED
+    void logBlend(const RenderStyle* a, const RenderStyle* b, const RenderStyle* result, double progress) const final
+    {
+        // FIXME: better logging.
+        LOG_WITH_STREAM(Animations, stream << "  blending " << getPropertyName(property()) << " from " << value(a) << " to " << value(b) << " at " << TextStream::FormatNumberRespectingIntegers(progress) << " -> " << value(result));
+    }
+#endif
+
 private:
     Color (RenderStyle::*m_getter)() const;
     void (RenderStyle::*m_setter)(const Color&);
@@ -863,6 +902,14 @@ public:
         m_visitedWrapper->blend(anim, dst, a, b, progress);
     }
 
+#if !LOG_DISABLED
+    void logBlend(const RenderStyle* a, const RenderStyle* b, const RenderStyle* result, double progress) const final
+    {
+        m_wrapper->logBlend(a, b, result, progress);
+        m_visitedWrapper->logBlend(a, b, result, progress);
+    }
+#endif
+
 private:
     std::unique_ptr<AnimationPropertyWrapperBase> m_wrapper;
     std::unique_ptr<AnimationPropertyWrapperBase> m_visitedWrapper;
@@ -1032,6 +1079,14 @@ public:
         }
     }
 
+#if !LOG_DISABLED
+    void logBlend(const RenderStyle*, const RenderStyle*, const RenderStyle*, double progress) const final
+    {
+        // FIXME: better logging.
+        LOG_WITH_STREAM(Animations, stream << "  blending FillLayers at " << TextStream::FormatNumberRespectingIntegers(progress));
+    }
+#endif
+
 private:
     std::unique_ptr<FillLayerAnimationPropertyWrapperBase> m_fillLayerPropertyWrapper;
 
@@ -1070,6 +1125,14 @@ public:
             wrapper->blend(anim, dst, a, b, progress);
     }
 
+#if !LOG_DISABLED
+    void logBlend(const RenderStyle*, const RenderStyle*, const RenderStyle*, double progress) const final
+    {
+        // FIXME: better logging.
+        LOG_WITH_STREAM(Animations, stream << "  blending shorthand property " << getPropertyName(property()) << " at " << TextStream::FormatNumberRespectingIntegers(progress));
+    }
+#endif
+
     const Vector<AnimationPropertyWrapperBase*>& propertyWrappers() const { return m_propertyWrappers; }
 
 private:
@@ -1100,6 +1163,14 @@ public:
         dst->setFlexGrow(blendFunc(anim, a->flexGrow(), b->flexGrow(), progress));
         dst->setFlexShrink(blendFunc(anim, a->flexShrink(), b->flexShrink(), progress));
     }
+
+#if !LOG_DISABLED
+    void logBlend(const RenderStyle*, const RenderStyle*, const RenderStyle*, double progress) const final
+    {
+        // FIXME: better logging.
+        LOG_WITH_STREAM(Animations, stream << "  blending flex at " << TextStream::FormatNumberRespectingIntegers(progress));
+    }
+#endif
 };
 
 class PropertyWrapperSVGPaint : public AnimationPropertyWrapperBase {
@@ -1162,6 +1233,14 @@ public:
         (dst->*m_setter)(blendFunc(anim, fromColor, toColor, progress));
     }
 
+#if !LOG_DISABLED
+    void logBlend(const RenderStyle*, const RenderStyle*, const RenderStyle*, double progress) const final
+    {
+        // FIXME: better logging.
+        LOG_WITH_STREAM(Animations, stream << "  blending SVGPaint at " << TextStream::FormatNumberRespectingIntegers(progress));
+    }
+#endif
+
 private:
     const SVGPaint::SVGPaintType& (RenderStyle::*m_paintTypeGetter)() const;
     Color (RenderStyle::*m_getter)() const;
@@ -1181,11 +1260,11 @@ public:
     AnimationPropertyWrapperBase* wrapperForProperty(CSSPropertyID propertyID)
     {
         if (propertyID < firstCSSProperty || propertyID > lastCSSProperty)
-            return 0;
+            return nullptr;
 
         unsigned wrapperIndex = indexFromPropertyID(propertyID);
         if (wrapperIndex == cInvalidPropertyWrapperIndex)
-            return 0;
+            return nullptr;
 
         return m_propertyWrappers[wrapperIndex].get();
     }
@@ -1470,6 +1549,9 @@ bool CSSPropertyAnimation::blendProperties(const AnimationBase* anim, CSSPropert
     AnimationPropertyWrapperBase* wrapper = CSSPropertyAnimationWrapperMap::singleton().wrapperForProperty(prop);
     if (wrapper) {
         wrapper->blend(anim, dst, a, b, progress);
+#if !LOG_DISABLED
+        wrapper->logBlend(a, b, dst, progress);
+#endif
         return !wrapper->animationIsAccelerated() || !anim->isAccelerated();
     }
     return false;
index 6c5e2b5..2e038bd 100644 (file)
@@ -328,8 +328,10 @@ TextStream& operator<<(TextStream& ts, Length length)
     case Undefined:
         ts << length.type();
         break;
-    case Relative:
     case Fixed:
+        ts << TextStream::FormatNumberRespectingIntegers(length.value()) << "px";
+        break;
+    case Relative:
     case Intrinsic:
     case MinIntrinsic:
     case MinContent:
@@ -343,6 +345,7 @@ TextStream& operator<<(TextStream& ts, Length length)
         break;
     case Calculated:
         // FIXME: dump CalculationValue.
+        ts << "calc(...)";
         break;
     }
     
diff --git a/Source/WebCore/platform/LengthBox.cpp b/Source/WebCore/platform/LengthBox.cpp
new file mode 100644 (file)
index 0000000..ca8fc0c
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "LengthBox.h"
+
+#include "TextStream.h"
+
+namespace WebCore {
+
+TextStream& operator<<(TextStream& ts, const LengthBox& box)
+{
+    ts << "top: " << box.top() << " right: " << box.right() << " bottom: " << box.bottom() << " left: " << box.left();
+    return ts;
+}
+
+} // namespace WebCore
index 2436a5c..e7a978a 100644 (file)
@@ -153,6 +153,8 @@ public:
 typedef BoxExtent<LayoutUnit> LayoutBoxExtent;
 typedef BoxExtent<float> FloatBoxExtent;
 
+TextStream& operator<<(TextStream&, const LengthBox&);
+
 } // namespace WebCore
 
 #endif // LengthBox_h
index 017401d..eed4c84 100644 (file)
@@ -62,6 +62,8 @@ private:
         return *this;
     }
 
+    void dump(TextStream&) const final;
+
     IdentityTransformOperation()
     {
     }
index 4e4d3bf..c710f39 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "Matrix3DTransformOperation.h"
 
+#include "TextStream.h"
 #include <algorithm>
 
 namespace WebCore {
@@ -60,4 +61,9 @@ Ref<TransformOperation> Matrix3DTransformOperation::blend(const TransformOperati
     return createOperation(toT, fromT, progress);
 }
 
+void Matrix3DTransformOperation::dump(TextStream& ts) const
+{
+    ts << type() << "(" << m_matrix << ")";
+}
+
 } // namespace WebCore
index 4ee164a..a30b0aa 100644 (file)
@@ -62,6 +62,8 @@ private:
 
     Ref<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false) override;
     
+    void dump(TextStream&) const final;
+
     Matrix3DTransformOperation(const TransformationMatrix& mat)
     {
         m_matrix = mat;
index ad9e43f..17860e4 100644 (file)
@@ -22,6 +22,7 @@
 #include "config.h"
 #include "MatrixTransformOperation.h"
 
+#include "TextStream.h"
 #include <algorithm>
 
 namespace WebCore {
@@ -58,4 +59,15 @@ Ref<TransformOperation> MatrixTransformOperation::blend(const TransformOperation
     return createOperation(toT, fromT, progress);
 }
 
+void MatrixTransformOperation::dump(TextStream& ts) const
+{
+    ts << "("
+        << TextStream::FormatNumberRespectingIntegers(m_a) << ", "
+        << TextStream::FormatNumberRespectingIntegers(m_b) << ", "
+        << TextStream::FormatNumberRespectingIntegers(m_c) << ", "
+        << TextStream::FormatNumberRespectingIntegers(m_d) << ", "
+        << TextStream::FormatNumberRespectingIntegers(m_e) << ", "
+        << TextStream::FormatNumberRespectingIntegers(m_f) << ")";
+}
+
 } // namespace WebCore
index d840b33..3e88a99 100644 (file)
@@ -67,7 +67,9 @@ private:
     }
 
     Ref<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false) override;
-    
+
+    void dump(TextStream&) const final;
+
     MatrixTransformOperation(double a, double b, double c, double d, double e, double f)
         : m_a(a)
         , m_b(b)
index fcff708..a612aed 100644 (file)
@@ -27,6 +27,7 @@
 #include "PerspectiveTransformOperation.h"
 
 #include "AnimationUtilities.h"
+#include "TextStream.h"
 #include <wtf/MathExtras.h>
 
 namespace WebCore {
@@ -68,4 +69,9 @@ Ref<TransformOperation> PerspectiveTransformOperation::blend(const TransformOper
     return PerspectiveTransformOperation::create(Length(0, Fixed));
 }
 
+void PerspectiveTransformOperation::dump(TextStream& ts) const
+{
+    ts << type() << "(" << m_p << ")";
+}
+
 } // namespace WebCore
index 3f3a360..d9b20a5 100644 (file)
@@ -64,6 +64,8 @@ private:
 
     Ref<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false) override;
 
+    void dump(TextStream&) const final;
+
     PerspectiveTransformOperation(const Length& p)
         : m_p(p)
     {
index 9c9ac9f..52c3dbc 100644 (file)
@@ -23,6 +23,7 @@
 #include "RotateTransformOperation.h"
 
 #include "AnimationUtilities.h"
+#include "TextStream.h"
 #include <algorithm>
 #include <wtf/MathExtras.h>
 
@@ -99,4 +100,9 @@ Ref<TransformOperation> RotateTransformOperation::blend(const TransformOperation
     return RotateTransformOperation::create(x, y, z, angle, ROTATE_3D);
 }
 
+void RotateTransformOperation::dump(TextStream& ts) const
+{
+    ts << type() << "(" << TextStream::FormatNumberRespectingIntegers(m_x) << ", " << TextStream::FormatNumberRespectingIntegers(m_y) << ", " << TextStream::FormatNumberRespectingIntegers(m_z) << ", " << TextStream::FormatNumberRespectingIntegers(m_angle) << "deg)";
+}
+
 } // namespace WebCore
index 836058b..be8c6e2 100644 (file)
@@ -69,6 +69,8 @@ private:
 
     Ref<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false) override;
 
+    void dump(TextStream&) const final;
+
     RotateTransformOperation(double x, double y, double z, double angle, OperationType type)
         : m_x(x)
         , m_y(y)
index cb2fa7f..862eafe 100644 (file)
@@ -23,6 +23,7 @@
 #include "ScaleTransformOperation.h"
 
 #include "AnimationUtilities.h"
+#include "TextStream.h"
 
 namespace WebCore {
 
@@ -53,4 +54,9 @@ Ref<TransformOperation> ScaleTransformOperation::blend(const TransformOperation*
                                            WebCore::blend(fromZ, m_z, progress), m_type);
 }
 
+void ScaleTransformOperation::dump(TextStream& ts) const
+{
+    ts << type() << "(" << TextStream::FormatNumberRespectingIntegers(m_x) << ", " << TextStream::FormatNumberRespectingIntegers(m_y) << ", " << TextStream::FormatNumberRespectingIntegers(m_z) << ")";
+}
+
 } // namespace WebCore
index 9f8b286..ae8a555 100644 (file)
@@ -68,6 +68,8 @@ private:
 
     Ref<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false) override;
 
+    void dump(TextStream&) const final;
+
     ScaleTransformOperation(double sx, double sy, double sz, OperationType type)
         : m_x(sx)
         , m_y(sy)
index 0b61f90..ec52112 100644 (file)
@@ -23,6 +23,7 @@
 #include "SkewTransformOperation.h"
 
 #include "AnimationUtilities.h"
+#include "TextStream.h"
 
 namespace WebCore {
 
@@ -48,4 +49,9 @@ Ref<TransformOperation> SkewTransformOperation::blend(const TransformOperation*
     return SkewTransformOperation::create(WebCore::blend(fromAngleX, m_angleX, progress), WebCore::blend(fromAngleY, m_angleY, progress), m_type);
 }
 
+void SkewTransformOperation::dump(TextStream& ts) const
+{
+    ts << type() << "(" << TextStream::FormatNumberRespectingIntegers(m_angleX) << "deg, " << TextStream::FormatNumberRespectingIntegers(m_angleY) << "deg)";
+}
+
 } // namespace WebCore
index bde7d31..422d14b 100644 (file)
@@ -61,6 +61,8 @@ private:
     }
 
     Ref<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false) override;
+
+    void dump(TextStream&) const final;
     
     SkewTransformOperation(double angleX, double angleY, OperationType type)
         : m_angleX(angleX)
diff --git a/Source/WebCore/platform/graphics/transforms/TransformOperation.cpp b/Source/WebCore/platform/graphics/transforms/TransformOperation.cpp
new file mode 100644 (file)
index 0000000..2ec90c1
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2016 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "TransformOperation.h"
+
+#include "IdentityTransformOperation.h"
+#include "TextStream.h"
+
+namespace WebCore {
+
+void IdentityTransformOperation::dump(TextStream& ts) const
+{
+    ts << type();
+}
+
+TextStream& operator<<(TextStream& ts, TransformOperation::OperationType type)
+{
+    switch (type) {
+    case TransformOperation::SCALE_X: ts << "scaleX"; break;
+    case TransformOperation::SCALE_Y: ts << "scaleY"; break;
+    case TransformOperation::SCALE: ts << "scale"; break;
+    case TransformOperation::TRANSLATE_X: ts << "translateX"; break;
+    case TransformOperation::TRANSLATE_Y: ts << "translateY"; break;
+    case TransformOperation::TRANSLATE: ts << "translate"; break;
+    case TransformOperation::ROTATE: ts << "rotate"; break;
+    case TransformOperation::SKEW_X: ts << "skewX"; break;
+    case TransformOperation::SKEW_Y: ts << "skewY"; break;
+    case TransformOperation::SKEW: ts << "skew"; break;
+    case TransformOperation::MATRIX: ts << "matrix"; break;
+    case TransformOperation::SCALE_Z: ts << "scaleX"; break;
+    case TransformOperation::SCALE_3D: ts << "scale3d"; break;
+    case TransformOperation::TRANSLATE_Z: ts << "translateZ"; break;
+    case TransformOperation::TRANSLATE_3D: ts << "translate3d"; break;
+    case TransformOperation::ROTATE_X: ts << "rotateX"; break;
+    case TransformOperation::ROTATE_Y: ts << "rotateY"; break;
+    case TransformOperation::ROTATE_3D: ts << "rotate3d"; break;
+    case TransformOperation::MATRIX_3D: ts << "matrix3d"; break;
+    case TransformOperation::PERSPECTIVE: ts << "perspective"; break;
+    case TransformOperation::IDENTITY: ts << "identity"; break;
+    case TransformOperation::NONE: ts << "none"; break;
+    }
+    
+    return ts;
+}
+
+TextStream& operator<<(TextStream& ts, const TransformOperation& operation)
+{
+    operation.dump(ts);
+    return ts;
+}
+
+} // namespace WebCore
index d3eb035..4f6aa88 100644 (file)
@@ -104,8 +104,13 @@ public:
     {
         return type() == TRANSLATE_X || type() == TRANSLATE_Y || type() == TRANSLATE_Z || type() == TRANSLATE || type() == TRANSLATE_3D;
     }
+    
+    virtual void dump(TextStream&) const = 0;
 };
 
+TextStream& operator<<(TextStream&, TransformOperation::OperationType);
+TextStream& operator<<(TextStream&, const TransformOperation&);
+
 } // namespace WebCore
 
 #define SPECIALIZE_TYPE_TRAITS_TRANSFORMOPERATION(ToValueTypeName, predicate) \
index 1435b27..9b156bd 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "IdentityTransformOperation.h"
 #include "Matrix3DTransformOperation.h"
+#include "TextStream.h"
 #include <algorithm>
 
 namespace WebCore {
@@ -126,4 +127,11 @@ TransformOperations TransformOperations::blend(const TransformOperations& from,
     return blendByUsingMatrixInterpolation(from, progress, size);
 }
 
+TextStream& operator<<(TextStream& ts, const TransformOperations& ops)
+{
+    for (const auto& operation : ops.operations())
+        ts << *operation;
+    return ts;
+}
+
 } // namespace WebCore
index 2abfba3..3e1d08e 100644 (file)
@@ -82,6 +82,8 @@ private:
     Vector<RefPtr<TransformOperation>> m_operations;
 };
 
+TextStream& operator<<(TextStream&, const TransformOperations&);
+
 } // namespace WebCore
 
 #endif // TransformOperations_h
index 101dc4f..bb9fdce 100644 (file)
@@ -21,7 +21,9 @@
 
 #include "config.h"
 #include "TranslateTransformOperation.h"
+
 #include "FloatConversion.h"
+#include "TextStream.h"
 
 namespace WebCore {
 
@@ -49,4 +51,9 @@ Ref<TransformOperation> TranslateTransformOperation::blend(const TransformOperat
     return TranslateTransformOperation::create(m_x.blend(fromX, progress), m_y.blend(fromY, progress), m_z.blend(fromZ, progress), m_type);
 }
 
+void TranslateTransformOperation::dump(TextStream& ts) const
+{
+    ts << type() << "(" << m_x << ", " << m_y << ", " << m_z << ")";
+}
+
 } // namespace WebCore
index 58c0066..e9f6875 100644 (file)
@@ -73,6 +73,8 @@ private:
 
     Ref<TransformOperation> blend(const TransformOperation* from, double progress, bool blendToIdentity = false) override;
 
+    void dump(TextStream&) const final;
+
     TranslateTransformOperation(const Length& tx, const Length& ty, const Length& tz, OperationType type)
         : m_x(tx)
         , m_y(ty)
index b4c33f4..9bba0f5 100644 (file)
@@ -27,6 +27,7 @@
 #include "GraphicsContext.h"
 #include "LengthFunctions.h"
 #include "RenderStyle.h"
+#include "TextStream.h"
 #include <wtf/NeverDestroyed.h>
 #include <wtf/PointerComparison.h>
 
@@ -263,4 +264,10 @@ bool NinePieceImageData::operator==(const NinePieceImageData& other) const
         && verticalRule == other.verticalRule;
 }
 
+TextStream& operator<<(TextStream& ts, const NinePieceImage& image)
+{
+    ts << "style-image " << image.image() << " slices " << image.imageSlices();
+    return ts;
+}
+
 }
index 414af9d..dba479b 100644 (file)
@@ -210,6 +210,8 @@ private:
     DataRef<NinePieceImageData> m_data;
 };
 
+TextStream& operator<<(TextStream&, const NinePieceImage&);
+
 } // namespace WebCore
 
 #endif // NinePieceImage_h
index 50c4304..b99b966 100644 (file)
@@ -29,6 +29,7 @@
 #include "FloatConversion.h"
 #include "SVGNames.h"
 #include "SVGParserUtilities.h"
+#include "TextStream.h"
 #include <wtf/MathExtras.h>
 #include <wtf/NeverDestroyed.h>
 #include <wtf/text/StringView.h>
@@ -409,4 +410,10 @@ SVGLengthMode SVGLength::lengthModeForAnimatedLengthAttribute(const QualifiedNam
     return LengthModeOther;
 }
 
+TextStream& operator<<(TextStream& ts, const SVGLength& length)
+{
+    ts << length.valueAsString();
+    return ts;
+}
+
 }
index bea9649..803259a 100644 (file)
@@ -169,6 +169,7 @@ struct SVGPropertyTraits<SVGLength> {
     static String toString(const SVGLength& type) { return type.valueAsString(); }
 };
 
+TextStream& operator<<(TextStream&, const SVGLength&);
 
 } // namespace WebCore