Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2057)

Unified Diff: third_party/WebKit/Source/core/css/CSSPathValue.cpp

Issue 1439793003: SVG: Promote d to a property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: RefPtrWillBePersistent Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..d724629e9c80194f47f9a445d1928f5c3dc35163 100644
--- a/third_party/WebKit/Source/core/css/CSSPathValue.cpp
+++ b/third_party/WebKit/Source/core/css/CSSPathValue.cpp
@@ -5,22 +5,38 @@
#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);
+}
+
+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 +44,9 @@ DEFINE_TRACE_AFTER_DISPATCH(CSSPathValue)
CSSValue::traceAfterDispatch(visitor);
}
+String CSSPathValue::pathString() const
+{
+ return buildStringFromByteStream(*m_pathByteStream);
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698