[WTF] Move ValueToString into WTF
authordon.olmstead@sony.com <don.olmstead@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 12 Aug 2017 01:13:47 +0000 (01:13 +0000)
committerdon.olmstead@sony.com <don.olmstead@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 12 Aug 2017 01:13:47 +0000 (01:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=175469

Reviewed by Sam Weinig.

Source/WebCore:

No new tests. No change in behavior.

* WebCore.xcodeproj/project.pbxproj:
* html/HTMLMediaElement.h:
(WTF::ValueToString<WebCore::TextTrackCue::string):
(WebCore::ValueToString<TextTrackCue::string): Deleted.
(WebCore::ValueToString<MediaTime>::string): Deleted.
* platform/LayoutUnit.h:
(WTF::ValueToString<WebCore::LayoutUnit>::string):
(WebCore::ValueToString<LayoutUnit>::string): Deleted.
* platform/PODInterval.h:
* platform/PODIntervalTree.h:
* platform/PODRedBlackTree.h:
* platform/graphics/FloatPolygon.h:
(WTF::ValueToString<WebCore::FloatPolygonEdge::string):
(WebCore::ValueToString<FloatPolygonEdge::string): Deleted.
* rendering/FloatingObjects.h:
(WTF::ValueToString<WebCore::FloatingObject::string):
(WebCore::ValueToString<FloatingObject::string): Deleted.
* rendering/RenderFlowThread.h:
(WTF::ValueToString<WebCore::RenderRegion::string):
(WebCore::ValueToString<RenderRegion::string): Deleted.

Source/WTF:

* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/text/ValueToString.h: Renamed from Source/WebCore/platform/ValueToString.h.

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

14 files changed:
Source/WTF/ChangeLog
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/CMakeLists.txt
Source/WTF/wtf/text/ValueToString.h [moved from Source/WebCore/platform/ValueToString.h with 95% similarity]
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/platform/LayoutUnit.h
Source/WebCore/platform/PODInterval.h
Source/WebCore/platform/PODIntervalTree.h
Source/WebCore/platform/PODRedBlackTree.h
Source/WebCore/platform/graphics/FloatPolygon.h
Source/WebCore/rendering/FloatingObjects.h
Source/WebCore/rendering/RenderFlowThread.h

index ab94082..34b8502 100644 (file)
@@ -1,3 +1,14 @@
+2017-08-11  Don Olmstead  <don.olmstead@sony.com>
+
+        [WTF] Move ValueToString into WTF
+        https://bugs.webkit.org/show_bug.cgi?id=175469
+
+        Reviewed by Sam Weinig.
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/CMakeLists.txt:
+        * wtf/text/ValueToString.h: Renamed from Source/WebCore/platform/ValueToString.h.
+
 2017-08-11  Tim Horton  <timothy_horton@apple.com>
 
         Fix the build with modern Clang's -Wexpansion-to-defined
index f6eb008..06bb3d1 100644 (file)
                9C67C542589348E285B49699 /* IndexedContainerIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexedContainerIterator.h; sourceTree = "<group>"; };
                A30D412C1F0DE0BA00B71954 /* SoftLinking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SoftLinking.h; sourceTree = "<group>"; };
                A30D412D1F0DE13F00B71954 /* SoftLinking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SoftLinking.h; sourceTree = "<group>"; };
+               A3AB6E6A1F3E1AD6009C14B1 /* ValueToString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValueToString.h; sourceTree = "<group>"; };
                A3E4DD911F3A803400DED0B4 /* TextStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextStream.cpp; sourceTree = "<group>"; };
                A3E4DD921F3A803400DED0B4 /* TextStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextStream.h; sourceTree = "<group>"; };
                A5098AFF1C169E0700087797 /* SandboxSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SandboxSPI.h; sourceTree = "<group>"; };
                                A3E4DD911F3A803400DED0B4 /* TextStream.cpp */,
                                A3E4DD921F3A803400DED0B4 /* TextStream.h */,
                                70ECA60C1B02426800449739 /* UniquedStringImpl.h */,
+                               A3AB6E6A1F3E1AD6009C14B1 /* ValueToString.h */,
                                A8A4732D151A825B004123FF /* WTFString.cpp */,
                                A8A4732E151A825B004123FF /* WTFString.h */,
                        );
index fa2b616..4f92d54 100644 (file)
@@ -188,6 +188,7 @@ set(WTF_HEADERS
     text/TextBreakIteratorInternalICU.h
     text/TextStream.h
     text/UniquedStringImpl.h
+    text/ValueToString.h
     text/WTFString.h
 
     text/icu/UTextProvider.h
similarity index 95%
rename from Source/WebCore/platform/ValueToString.h
rename to Source/WTF/wtf/text/ValueToString.h
index 06643a1..7a396a6 100644 (file)
@@ -12,7 +12,7 @@
  *    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 THE COPYRIGHT HOLDER "AS IS" AND ANY
  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  * SUCH DAMAGE.
  */
 
-#ifndef ValueToString_h
-#define ValueToString_h
+#pragma once
 
 #ifndef NDEBUG
 
 #include <wtf/text/WTFString.h>
 
-namespace WebCore {
+namespace WTF {
 
 template<class T>
 struct ValueToString;
@@ -54,9 +53,8 @@ struct ValueToString<double> {
     static String string(const double value) { return String::number(value); }
 };
 
-};
+} // namespace WTF
 
-#endif
+using WTF::ValueToString;
 
 #endif
-
index dde4363..601953b 100644 (file)
@@ -1,3 +1,33 @@
+2017-08-11  Don Olmstead  <don.olmstead@sony.com>
+
+        [WTF] Move ValueToString into WTF
+        https://bugs.webkit.org/show_bug.cgi?id=175469
+
+        Reviewed by Sam Weinig.
+
+        No new tests. No change in behavior.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * html/HTMLMediaElement.h:
+        (WTF::ValueToString<WebCore::TextTrackCue::string):
+        (WebCore::ValueToString<TextTrackCue::string): Deleted.
+        (WebCore::ValueToString<MediaTime>::string): Deleted.
+        * platform/LayoutUnit.h:
+        (WTF::ValueToString<WebCore::LayoutUnit>::string):
+        (WebCore::ValueToString<LayoutUnit>::string): Deleted.
+        * platform/PODInterval.h:
+        * platform/PODIntervalTree.h:
+        * platform/PODRedBlackTree.h:
+        * platform/graphics/FloatPolygon.h:
+        (WTF::ValueToString<WebCore::FloatPolygonEdge::string):
+        (WebCore::ValueToString<FloatPolygonEdge::string): Deleted.
+        * rendering/FloatingObjects.h:
+        (WTF::ValueToString<WebCore::FloatingObject::string):
+        (WebCore::ValueToString<FloatingObject::string): Deleted.
+        * rendering/RenderFlowThread.h:
+        (WTF::ValueToString<WebCore::RenderRegion::string):
+        (WebCore::ValueToString<RenderRegion::string): Deleted.
+
 2017-08-11  Sam Weinig  <sam@webkit.org>
 
         [Bindings] Simplify DOMPromiseProxy now that WTF::Function can return references
index 14d4e8b..8777e29 100644 (file)
                9920398318B95BC600B39AF9 /* UserInputBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 9920398118B95BC600B39AF9 /* UserInputBridge.h */; settings = {ATTRIBUTES = (Private, ); }; };
                996E59DE1DF01285006612B9 /* NavigatorWebDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 996E59DB1DF00D90006612B9 /* NavigatorWebDriver.cpp */; };
                996E59DF1DF0128D006612B9 /* NavigatorWebDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 996E59DC1DF00D90006612B9 /* NavigatorWebDriver.h */; };
-               9A1142041832D135000BB8AD /* ValueToString.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A1142031832D134000BB8AD /* ValueToString.h */; settings = {ATTRIBUTES = (Private, ); }; };
                9A528E8317D7F52F00AA9518 /* FloatingObjects.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A528E8117D7F52F00AA9518 /* FloatingObjects.cpp */; };
                9A528E8417D7F52F00AA9518 /* FloatingObjects.h in Headers */ = {isa = PBXBuildFile; fileRef = 9A528E8217D7F52F00AA9518 /* FloatingObjects.h */; settings = {ATTRIBUTES = (Private, ); }; };
                9AB1F38018E2489A00534743 /* CSSToLengthConversionData.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AB1F37E18E2489A00534743 /* CSSToLengthConversionData.h */; };
                996E59DB1DF00D90006612B9 /* NavigatorWebDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NavigatorWebDriver.cpp; sourceTree = "<group>"; };
                996E59DC1DF00D90006612B9 /* NavigatorWebDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigatorWebDriver.h; sourceTree = "<group>"; };
                996E59DD1DF00D90006612B9 /* NavigatorWebDriver.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NavigatorWebDriver.idl; sourceTree = "<group>"; };
-               9A1142031832D134000BB8AD /* ValueToString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValueToString.h; sourceTree = "<group>"; };
                9A528E8117D7F52F00AA9518 /* FloatingObjects.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FloatingObjects.cpp; sourceTree = "<group>"; };
                9A528E8217D7F52F00AA9518 /* FloatingObjects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FloatingObjects.h; sourceTree = "<group>"; };
                9AB1F37E18E2489A00534743 /* CSSToLengthConversionData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSToLengthConversionData.h; sourceTree = "<group>"; };
                                868160D2187669C40021E79D /* UserActivity.h */,
                                71C916071D1483A300ACA47D /* UserInterfaceLayoutDirection.h */,
                                83C45B8D1DC2B67C008871BA /* ValidationBubble.h */,
-                               9A1142031832D134000BB8AD /* ValueToString.h */,
                                515F79511CFCA3C700CCED93 /* WebCoreCrossThreadCopier.cpp */,
                                515F79521CFCA3C700CCED93 /* WebCoreCrossThreadCopier.h */,
                                839A2F2B1E204A6D0039057E /* WebGLStateTracker.cpp */,
                                F5A154281279534D00D0B0C0 /* ValidationMessage.h in Headers */,
                                F513A3EA15FF4841001526DB /* ValidationMessageClient.h in Headers */,
                                15C7708D100D3C6B005BA267 /* ValidityState.h in Headers */,
-                               9A1142041832D135000BB8AD /* ValueToString.h in Headers */,
                                FD3160AF12B026F700C1A359 /* VectorMath.h in Headers */,
                                BCA257151293C010007A263D /* VerticalPositionCache.h in Headers */,
                                52B0D4C01C57FD660077CE53 /* VideoFullscreenChangeObserver.h in Headers */,
index af0206e..bf49d63 100644 (file)
@@ -1099,22 +1099,27 @@ private:
 #endif
 };
 
+} // namespace WebCore
+
 #if ENABLE(VIDEO_TRACK) && !defined(NDEBUG)
+namespace WTF {
 
 // Template specialization required by PodIntervalTree in debug mode.
-template <> struct ValueToString<TextTrackCue*> {
-    static String string(TextTrackCue* const& cue)
+template <> struct ValueToString<WebCore::TextTrackCue*> {
+    static String string(WebCore::TextTrackCue* const& cue)
     {
         String text;
         if (cue->isRenderable())
-            text = toVTTCue(cue)->text();
+            text = WebCore::toVTTCue(cue)->text();
         return String::format("%p id=%s interval=%s-->%s cue=%s)", cue, cue->id().utf8().data(), toString(cue->startTime()).utf8().data(), toString(cue->endTime()).utf8().data(), text.utf8().data());
     }
 };
 
+} // namespace WTF
 #endif
 
 #ifndef NDEBUG
+namespace WTF {
 
 template<> struct ValueToString<MediaTime> {
     static String string(const MediaTime& time)
@@ -1123,10 +1128,9 @@ template<> struct ValueToString<MediaTime> {
     }
 };
 
+} // namespace WTF
 #endif
 
-} // namespace WebCore
-
 SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::HTMLMediaElement)
     static bool isType(const WebCore::Element& element) { return element.isMediaElement(); }
     static bool isType(const WebCore::Node& node) { return is<WebCore::Element>(node) && isType(downcast<WebCore::Element>(node)); }
index 095aaa0..a89a98a 100644 (file)
 
 #pragma once
 
-#include "ValueToString.h"
 #include <limits.h>
 #include <limits>
 #include <math.h>
 #include <stdlib.h>
 #include <wtf/MathExtras.h>
 #include <wtf/SaturatedArithmetic.h>
+#include <wtf/text/ValueToString.h>
 
 namespace WTF {
 class TextStream;
@@ -826,12 +826,15 @@ inline bool isIntegerValue(const LayoutUnit value)
     return value.toInt() == value;
 }
 
+} // namespace WebCore
+
 #ifndef NDEBUG
+namespace WTF {
 // This structure is used by PODIntervalTree for debugging.
 template <>
-struct ValueToString<LayoutUnit> {
-    static String string(const LayoutUnit value) { return String::number(value.toFloat()); }
+struct ValueToString<WebCore::LayoutUnit> {
+    static String string(const WebCore::LayoutUnit value) { return String::number(value.toFloat()); }
 };
-#endif
 
-} // namespace WebCore
+} // namespace WTF
+#endif
index f95a338..048da98 100644 (file)
@@ -27,8 +27,8 @@
 #define PODInterval_h
 
 #ifndef NDEBUG
-#include "ValueToString.h"
 #include <wtf/text/StringBuilder.h>
+#include <wtf/text/ValueToString.h>
 #endif
 
 namespace WebCore {
index f8a4085..04e2669 100644 (file)
 
 #include "PODInterval.h"
 #include "PODRedBlackTree.h"
-#include "ValueToString.h"
 #include <wtf/Assertions.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/Vector.h>
+#include <wtf/text/ValueToString.h>
 
 namespace WebCore {
 
@@ -234,17 +234,21 @@ private:
     }
 };
 
+} // namespace WebCore
+
 #ifndef NDEBUG
+namespace WTF {
+
 // Support for printing PODIntervals at the PODRedBlackTree level.
 template<class T, class UserData>
-struct ValueToString<PODInterval<T, UserData>> {
-    static String string(const PODInterval<T, UserData>& interval)
+struct ValueToString<WebCore::PODInterval<T, UserData>> {
+    static String string(const WebCore::PODInterval<T, UserData>& interval)
     {
         return interval.toString();
     }
 };
-#endif
 
-} // namespace WebCore
+} // namespace WTF
+#endif
 
 #endif // PODIntervalTree_h
index 4b6efe3..d2b80da 100644 (file)
@@ -72,9 +72,9 @@
 #ifndef PODRedBlackTree_h
 #define PODRedBlackTree_h
 
-#include "ValueToString.h"
 #include <wtf/Assertions.h>
 #include <wtf/Noncopyable.h>
+#include <wtf/text/ValueToString.h>
 #ifndef NDEBUG
 #include <wtf/text/StringBuilder.h>
 #include <wtf/text/WTFString.h>
index 4b84e65..f47c9ae 100644 (file)
@@ -131,13 +131,17 @@ private:
     const FloatPolygon* m_polygon;
 };
 
+} // namespace WebCore
+
 // This structure is used by PODIntervalTree for debugging.
 #ifndef NDEBUG
-template<> struct ValueToString<FloatPolygonEdge*> {
-    static String string(const FloatPolygonEdge* edge) { return String::format("%p (%f,%f %f,%f)", edge, edge->vertex1().x(), edge->vertex1().y(), edge->vertex2().x(), edge->vertex2().y()); }
+namespace WTF {
+
+template<> struct ValueToString<WebCore::FloatPolygonEdge*> {
+    static String string(const WebCore::FloatPolygonEdge* edge) { return String::format("%p (%f,%f %f,%f)", edge, edge->vertex1().x(), edge->vertex1().y(), edge->vertex2().x(), edge->vertex2().y()); }
 };
-#endif
 
-} // namespace WebCore
+}
+#endif
 
 #endif // FloatPolygon_h
index 5c3e83a..62fc873 100644 (file)
@@ -173,14 +173,18 @@ private:
     const RenderBlockFlow& m_renderer;
 };
 
+} // namespace WebCore
+
 #ifndef NDEBUG
+namespace WTF {
+
 // This helper is used by PODIntervalTree for debugging purposes.
-template<> struct ValueToString<FloatingObject*> {
-    static String string(const FloatingObject* floatingObject)
+template<> struct ValueToString<WebCore::FloatingObject*> {
+    static String string(const WebCore::FloatingObject* floatingObject)
     {
         return String::format("%p (%ix%i %ix%i)", floatingObject, floatingObject->frameRect().x().toInt(), floatingObject->frameRect().y().toInt(), floatingObject->frameRect().maxX().toInt(), floatingObject->frameRect().maxY().toInt());
     }
 };
-#endif
 
-} // namespace WebCore
+} // namespace WTF
+#endif
index 174e210..f940b39 100644 (file)
@@ -369,13 +369,17 @@ protected:
     bool m_layersToRegionMappingsDirty : 1;
 };
 
+} // namespace WebCore
+
 // This structure is used by PODIntervalTree for debugging.
 #ifndef NDEBUG
-template <> struct ValueToString<RenderRegion*> {
-    static String string(const RenderRegion* value) { return String::format("%p", value); }
+namespace WTF {
+
+template <> struct ValueToString<WebCore::RenderRegion*> {
+    static String string(const WebCore::RenderRegion* value) { return String::format("%p", value); }
 };
-#endif
 
-} // namespace WebCore
+} // namespace WTF
+#endif
 
 SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderFlowThread, isRenderFlowThread())