Skip to content

Commit

Permalink
Merge r220621 - [WTF] Move ValueToString into WTF
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
donny-dont authored and carlosgcampos committed Aug 14, 2017
1 parent ec55b9b commit 10f5b22
Show file tree
Hide file tree
Showing 14 changed files with 101 additions and 40 deletions.
11 changes: 11 additions & 0 deletions Source/WTF/ChangeLog
@@ -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-10 Sam Weinig <sam@webkit.org>

WTF::Function does not allow for reference / non-default constructible return types
Expand Down
2 changes: 2 additions & 0 deletions Source/WTF/WTF.xcodeproj/project.pbxproj
Expand Up @@ -353,6 +353,7 @@
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>"; };
Expand Down Expand Up @@ -1092,6 +1093,7 @@
A3E4DD911F3A803400DED0B4 /* TextStream.cpp */,
A3E4DD921F3A803400DED0B4 /* TextStream.h */,
70ECA60C1B02426800449739 /* UniquedStringImpl.h */,
A3AB6E6A1F3E1AD6009C14B1 /* ValueToString.h */,
A8A4732D151A825B004123FF /* WTFString.cpp */,
A8A4732E151A825B004123FF /* WTFString.h */,
);
Expand Down
1 change: 1 addition & 0 deletions Source/WTF/wtf/CMakeLists.txt
Expand Up @@ -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
Expand Down
Expand Up @@ -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
Expand All @@ -27,14 +27,13 @@
* 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;
Expand All @@ -54,9 +53,8 @@ struct ValueToString<double> {
static String string(const double value) { return String::number(value); }
};

};
} // namespace WTF

#endif
using WTF::ValueToString;

#endif

30 changes: 30 additions & 0 deletions Source/WebCore/ChangeLog
@@ -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
Expand Down
4 changes: 0 additions & 4 deletions Source/WebCore/WebCore.xcodeproj/project.pbxproj
Expand Up @@ -4216,7 +4216,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 */; };
Expand Down Expand Up @@ -12497,7 +12496,6 @@
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>"; };
Expand Down Expand Up @@ -24288,7 +24286,6 @@
868160D2187669C40021E79D /* UserActivity.h */,
71C916071D1483A300ACA47D /* UserInterfaceLayoutDirection.h */,
83C45B8D1DC2B67C008871BA /* ValidationBubble.h */,
9A1142031832D134000BB8AD /* ValueToString.h */,
515F79511CFCA3C700CCED93 /* WebCoreCrossThreadCopier.cpp */,
515F79521CFCA3C700CCED93 /* WebCoreCrossThreadCopier.h */,
839A2F2B1E204A6D0039057E /* WebGLStateTracker.cpp */,
Expand Down Expand Up @@ -30150,7 +30147,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 */,
Expand Down
14 changes: 9 additions & 5 deletions Source/WebCore/html/HTMLMediaElement.h
Expand Up @@ -1099,22 +1099,27 @@ class HTMLMediaElement
#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)
Expand All @@ -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)); }
Expand Down
13 changes: 8 additions & 5 deletions Source/WebCore/platform/LayoutUnit.h
Expand Up @@ -30,13 +30,13 @@

#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;
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion Source/WebCore/platform/PODInterval.h
Expand Up @@ -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 {
Expand Down
14 changes: 9 additions & 5 deletions Source/WebCore/platform/PODIntervalTree.h
Expand Up @@ -28,10 +28,10 @@

#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 {

Expand Down Expand Up @@ -234,17 +234,21 @@ class PODIntervalTree : public PODRedBlackTree<PODInterval<T, UserData>> {
}
};

} // 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
2 changes: 1 addition & 1 deletion Source/WebCore/platform/PODRedBlackTree.h
Expand Up @@ -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>
Expand Down
12 changes: 8 additions & 4 deletions Source/WebCore/platform/graphics/FloatPolygon.h
Expand Up @@ -131,13 +131,17 @@ class FloatPolygonEdge : public VertexPair {
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
12 changes: 8 additions & 4 deletions Source/WebCore/rendering/FloatingObjects.h
Expand Up @@ -173,14 +173,18 @@ class FloatingObjects {
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
12 changes: 8 additions & 4 deletions Source/WebCore/rendering/RenderFlowThread.h
Expand Up @@ -369,13 +369,17 @@ class RenderFlowThread: public RenderBlockFlow {
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())

0 comments on commit 10f5b22

Please sign in to comment.