Index: third_party/WebKit/Source/core/css/CSSPathValue.cpp |
diff --git a/third_party/WebKit/Source/core/css/CSSPathValue.cpp b/third_party/WebKit/Source/core/css/CSSPathValue.cpp |
index 22b868974d1636ef56cc8fbe8fe8c39a1f3f8ab0..c99567122f78ee4c10624e51009af3153f77af29 100644 |
--- a/third_party/WebKit/Source/core/css/CSSPathValue.cpp |
+++ b/third_party/WebKit/Source/core/css/CSSPathValue.cpp |
@@ -5,22 +5,39 @@ |
#include "config.h" |
#include "core/css/CSSPathValue.h" |
+#include "core/svg/SVGPathUtilities.h" |
+ |
namespace blink { |
-CSSPathValue::CSSPathValue(const String& pathString) |
+PassRefPtrWillBeRawPtr<CSSPathValue> CSSPathValue::create(const String& pathString) |
+{ |
+ OwnPtr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); |
+ buildByteStreamFromString(pathString, *byteStream); |
+ return CSSPathValue::create(byteStream.release()); |
+} |
+ |
+CSSPathValue::CSSPathValue(PassOwnPtr<SVGPathByteStream> pathByteStream) |
: CSSValue(PathClass) |
- , m_pathString(pathString) |
+ , m_pathByteStream(pathByteStream) |
+{ |
+ ASSERT(m_pathByteStream); |
+ buildPathFromByteStream(*m_pathByteStream, m_path); |
+} |
+ |
+CSSPathValue* CSSPathValue::emptyPathValue() |
{ |
+ DEFINE_STATIC_LOCAL(RefPtrWillBePersistent<CSSPathValue>, empty, (CSSPathValue::create(SVGPathByteStream::create()))); |
+ return empty.get(); |
} |
String CSSPathValue::customCSSText() const |
{ |
- return "path('" + m_pathString + "')"; |
+ return "path('" + pathString() + "')"; |
} |
bool CSSPathValue::equals(const CSSPathValue& other) const |
{ |
- return m_pathString == other.m_pathString; |
+ return *m_pathByteStream == *other.m_pathByteStream; |
} |
DEFINE_TRACE_AFTER_DISPATCH(CSSPathValue) |
@@ -28,4 +45,9 @@ DEFINE_TRACE_AFTER_DISPATCH(CSSPathValue) |
CSSValue::traceAfterDispatch(visitor); |
} |
+String CSSPathValue::pathString() const |
+{ |
+ return buildStringFromByteStream(*m_pathByteStream); |
+} |
+ |
} // namespace blink |