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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/css/CSSPathValue.h" 6 #include "core/css/CSSPathValue.h"
7 7
8 #include "core/svg/SVGPathUtilities.h"
9
8 namespace blink { 10 namespace blink {
9 11
10 CSSPathValue::CSSPathValue(const String& pathString) 12 PassRefPtrWillBeRawPtr<CSSPathValue> CSSPathValue::create(const String& pathStri ng)
13 {
14 OwnPtr<SVGPathByteStream> byteStream = SVGPathByteStream::create();
15 buildByteStreamFromString(pathString, *byteStream);
16 return CSSPathValue::create(byteStream.release());
17 }
18
19 CSSPathValue::CSSPathValue(PassOwnPtr<SVGPathByteStream> pathByteStream)
11 : CSSValue(PathClass) 20 : CSSValue(PathClass)
12 , m_pathString(pathString) 21 , m_pathByteStream(pathByteStream)
13 { 22 {
23 ASSERT(m_pathByteStream);
24 buildPathFromByteStream(*m_pathByteStream, m_path);
fs 2015/12/14 11:51:40 I think we should strive to make this realization
25 }
26
27 CSSPathValue* CSSPathValue::emptyPathValue()
28 {
29 DEFINE_STATIC_LOCAL(RefPtrWillBePersistent<CSSPathValue>, empty, (CSSPathVal ue::create(SVGPathByteStream::create())));
30 return empty.get();
14 } 31 }
15 32
16 String CSSPathValue::customCSSText() const 33 String CSSPathValue::customCSSText() const
17 { 34 {
18 return "path('" + m_pathString + "')"; 35 return "path('" + pathString() + "')";
19 } 36 }
20 37
21 bool CSSPathValue::equals(const CSSPathValue& other) const 38 bool CSSPathValue::equals(const CSSPathValue& other) const
22 { 39 {
23 return m_pathString == other.m_pathString; 40 return *m_pathByteStream == *other.m_pathByteStream;
24 } 41 }
25 42
26 DEFINE_TRACE_AFTER_DISPATCH(CSSPathValue) 43 DEFINE_TRACE_AFTER_DISPATCH(CSSPathValue)
27 { 44 {
28 CSSValue::traceAfterDispatch(visitor); 45 CSSValue::traceAfterDispatch(visitor);
29 } 46 }
30 47
48 String CSSPathValue::pathString() const
49 {
50 return buildStringFromByteStream(*m_pathByteStream);
51 }
52
31 } // namespace blink 53 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698