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

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: parser 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..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);
fs 2015/12/14 11:51:40 I think we should strive to make this realization
+}
+
+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

Powered by Google App Engine
This is Rietveld 408576698