From e5f3757bbfb8f25c54954d4fef93eaf9f4a8f38b Mon Sep 17 00:00:00 2001 From: "don.olmstead@sony.com" Date: Sat, 12 Aug 2017 01:13:47 +0000 Subject: [PATCH] [WTF] Move ValueToString into WTF 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::string): Deleted. * platform/LayoutUnit.h: (WTF::ValueToString::string): (WebCore::ValueToString::string): Deleted. * platform/PODInterval.h: * platform/PODIntervalTree.h: * platform/PODRedBlackTree.h: * platform/graphics/FloatPolygon.h: (WTF::ValueToString WTF/wtf/text}/ValueToString.h | 12 ++++----- Source/WebCore/ChangeLog | 30 ++++++++++++++++++++++ Source/WebCore/WebCore.xcodeproj/project.pbxproj | 4 --- Source/WebCore/html/HTMLMediaElement.h | 14 ++++++---- Source/WebCore/platform/LayoutUnit.h | 13 ++++++---- Source/WebCore/platform/PODInterval.h | 2 +- Source/WebCore/platform/PODIntervalTree.h | 14 ++++++---- Source/WebCore/platform/PODRedBlackTree.h | 2 +- Source/WebCore/platform/graphics/FloatPolygon.h | 12 ++++++--- Source/WebCore/rendering/FloatingObjects.h | 12 ++++++--- Source/WebCore/rendering/RenderFlowThread.h | 12 ++++++--- 14 files changed, 101 insertions(+), 40 deletions(-) rename Source/{WebCore/platform => WTF/wtf/text}/ValueToString.h (95%) diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog index ab94082..34b8502 100644 --- a/Source/WTF/ChangeLog +++ b/Source/WTF/ChangeLog @@ -1,3 +1,14 @@ +2017-08-11 Don Olmstead + + [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 Fix the build with modern Clang's -Wexpansion-to-defined diff --git a/Source/WTF/WTF.xcodeproj/project.pbxproj b/Source/WTF/WTF.xcodeproj/project.pbxproj index f6eb008..06bb3d1 100644 --- a/Source/WTF/WTF.xcodeproj/project.pbxproj +++ b/Source/WTF/WTF.xcodeproj/project.pbxproj @@ -360,6 +360,7 @@ 9C67C542589348E285B49699 /* IndexedContainerIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexedContainerIterator.h; sourceTree = ""; }; A30D412C1F0DE0BA00B71954 /* SoftLinking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SoftLinking.h; sourceTree = ""; }; A30D412D1F0DE13F00B71954 /* SoftLinking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SoftLinking.h; sourceTree = ""; }; + A3AB6E6A1F3E1AD6009C14B1 /* ValueToString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValueToString.h; sourceTree = ""; }; A3E4DD911F3A803400DED0B4 /* TextStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextStream.cpp; sourceTree = ""; }; A3E4DD921F3A803400DED0B4 /* TextStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextStream.h; sourceTree = ""; }; A5098AFF1C169E0700087797 /* SandboxSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SandboxSPI.h; sourceTree = ""; }; @@ -1092,6 +1093,7 @@ A3E4DD911F3A803400DED0B4 /* TextStream.cpp */, A3E4DD921F3A803400DED0B4 /* TextStream.h */, 70ECA60C1B02426800449739 /* UniquedStringImpl.h */, + A3AB6E6A1F3E1AD6009C14B1 /* ValueToString.h */, A8A4732D151A825B004123FF /* WTFString.cpp */, A8A4732E151A825B004123FF /* WTFString.h */, ); diff --git a/Source/WTF/wtf/CMakeLists.txt b/Source/WTF/wtf/CMakeLists.txt index fa2b616..4f92d54 100644 --- a/Source/WTF/wtf/CMakeLists.txt +++ b/Source/WTF/wtf/CMakeLists.txt @@ -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 diff --git a/Source/WebCore/platform/ValueToString.h b/Source/WTF/wtf/text/ValueToString.h similarity index 95% rename from Source/WebCore/platform/ValueToString.h rename to Source/WTF/wtf/text/ValueToString.h index 06643a1..7a396a6 100644 --- a/Source/WebCore/platform/ValueToString.h +++ b/Source/WTF/wtf/text/ValueToString.h @@ -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 @@ -27,14 +27,13 @@ * SUCH DAMAGE. */ -#ifndef ValueToString_h -#define ValueToString_h +#pragma once #ifndef NDEBUG #include -namespace WebCore { +namespace WTF { template struct ValueToString; @@ -54,9 +53,8 @@ struct ValueToString { static String string(const double value) { return String::number(value); } }; -}; +} // namespace WTF -#endif +using WTF::ValueToString; #endif - diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index dde4363..601953b 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,33 @@ +2017-08-11 Don Olmstead + + [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::string): Deleted. + * platform/LayoutUnit.h: + (WTF::ValueToString::string): + (WebCore::ValueToString::string): Deleted. + * platform/PODInterval.h: + * platform/PODIntervalTree.h: + * platform/PODRedBlackTree.h: + * platform/graphics/FloatPolygon.h: + (WTF::ValueToString [Bindings] Simplify DOMPromiseProxy now that WTF::Function can return references diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj index 14d4e8b..8777e29 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj @@ -4209,7 +4209,6 @@ 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 */; }; @@ -12470,7 +12469,6 @@ 996E59DB1DF00D90006612B9 /* NavigatorWebDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NavigatorWebDriver.cpp; sourceTree = ""; }; 996E59DC1DF00D90006612B9 /* NavigatorWebDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigatorWebDriver.h; sourceTree = ""; }; 996E59DD1DF00D90006612B9 /* NavigatorWebDriver.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NavigatorWebDriver.idl; sourceTree = ""; }; - 9A1142031832D134000BB8AD /* ValueToString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ValueToString.h; sourceTree = ""; }; 9A528E8117D7F52F00AA9518 /* FloatingObjects.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FloatingObjects.cpp; sourceTree = ""; }; 9A528E8217D7F52F00AA9518 /* FloatingObjects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FloatingObjects.h; sourceTree = ""; }; 9AB1F37E18E2489A00534743 /* CSSToLengthConversionData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSToLengthConversionData.h; sourceTree = ""; }; @@ -24208,7 +24206,6 @@ 868160D2187669C40021E79D /* UserActivity.h */, 71C916071D1483A300ACA47D /* UserInterfaceLayoutDirection.h */, 83C45B8D1DC2B67C008871BA /* ValidationBubble.h */, - 9A1142031832D134000BB8AD /* ValueToString.h */, 515F79511CFCA3C700CCED93 /* WebCoreCrossThreadCopier.cpp */, 515F79521CFCA3C700CCED93 /* WebCoreCrossThreadCopier.h */, 839A2F2B1E204A6D0039057E /* WebGLStateTracker.cpp */, @@ -30048,7 +30045,6 @@ 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 */, diff --git a/Source/WebCore/html/HTMLMediaElement.h b/Source/WebCore/html/HTMLMediaElement.h index af0206e..bf49d63 100644 --- a/Source/WebCore/html/HTMLMediaElement.h +++ b/Source/WebCore/html/HTMLMediaElement.h @@ -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 { - static String string(TextTrackCue* const& cue) +template <> struct ValueToString { + 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 { static String string(const MediaTime& time) @@ -1123,10 +1128,9 @@ template<> struct ValueToString { } }; +} // 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(node) && isType(downcast(node)); } diff --git a/Source/WebCore/platform/LayoutUnit.h b/Source/WebCore/platform/LayoutUnit.h index 095aaa0..a89a98a 100644 --- a/Source/WebCore/platform/LayoutUnit.h +++ b/Source/WebCore/platform/LayoutUnit.h @@ -30,13 +30,13 @@ #pragma once -#include "ValueToString.h" #include #include #include #include #include #include +#include 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 { - static String string(const LayoutUnit value) { return String::number(value.toFloat()); } +struct ValueToString { + static String string(const WebCore::LayoutUnit value) { return String::number(value.toFloat()); } }; -#endif -} // namespace WebCore +} // namespace WTF +#endif diff --git a/Source/WebCore/platform/PODInterval.h b/Source/WebCore/platform/PODInterval.h index f95a338..048da98 100644 --- a/Source/WebCore/platform/PODInterval.h +++ b/Source/WebCore/platform/PODInterval.h @@ -27,8 +27,8 @@ #define PODInterval_h #ifndef NDEBUG -#include "ValueToString.h" #include +#include #endif namespace WebCore { diff --git a/Source/WebCore/platform/PODIntervalTree.h b/Source/WebCore/platform/PODIntervalTree.h index f8a4085..04e2669 100644 --- a/Source/WebCore/platform/PODIntervalTree.h +++ b/Source/WebCore/platform/PODIntervalTree.h @@ -28,10 +28,10 @@ #include "PODInterval.h" #include "PODRedBlackTree.h" -#include "ValueToString.h" #include #include #include +#include namespace WebCore { @@ -234,17 +234,21 @@ private: } }; +} // namespace WebCore + #ifndef NDEBUG +namespace WTF { + // Support for printing PODIntervals at the PODRedBlackTree level. template -struct ValueToString> { - static String string(const PODInterval& interval) +struct ValueToString> { + static String string(const WebCore::PODInterval& interval) { return interval.toString(); } }; -#endif -} // namespace WebCore +} // namespace WTF +#endif #endif // PODIntervalTree_h diff --git a/Source/WebCore/platform/PODRedBlackTree.h b/Source/WebCore/platform/PODRedBlackTree.h index 4b6efe3..d2b80da 100644 --- a/Source/WebCore/platform/PODRedBlackTree.h +++ b/Source/WebCore/platform/PODRedBlackTree.h @@ -72,9 +72,9 @@ #ifndef PODRedBlackTree_h #define PODRedBlackTree_h -#include "ValueToString.h" #include #include +#include #ifndef NDEBUG #include #include diff --git a/Source/WebCore/platform/graphics/FloatPolygon.h b/Source/WebCore/platform/graphics/FloatPolygon.h index 4b84e65..f47c9ae 100644 --- a/Source/WebCore/platform/graphics/FloatPolygon.h +++ b/Source/WebCore/platform/graphics/FloatPolygon.h @@ -131,13 +131,17 @@ private: const FloatPolygon* m_polygon; }; +} // namespace WebCore + // This structure is used by PODIntervalTree for debugging. #ifndef NDEBUG -template<> struct ValueToString { - 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 { + 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 diff --git a/Source/WebCore/rendering/FloatingObjects.h b/Source/WebCore/rendering/FloatingObjects.h index 5c3e83a..62fc873 100644 --- a/Source/WebCore/rendering/FloatingObjects.h +++ b/Source/WebCore/rendering/FloatingObjects.h @@ -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 { - static String string(const FloatingObject* floatingObject) +template<> struct ValueToString { + 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 diff --git a/Source/WebCore/rendering/RenderFlowThread.h b/Source/WebCore/rendering/RenderFlowThread.h index 174e210..f940b39 100644 --- a/Source/WebCore/rendering/RenderFlowThread.h +++ b/Source/WebCore/rendering/RenderFlowThread.h @@ -369,13 +369,17 @@ protected: bool m_layersToRegionMappingsDirty : 1; }; +} // namespace WebCore + // This structure is used by PODIntervalTree for debugging. #ifndef NDEBUG -template <> struct ValueToString { - static String string(const RenderRegion* value) { return String::format("%p", value); } +namespace WTF { + +template <> struct ValueToString { + 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()) -- 1.8.3.1