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

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: 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 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 }
25
26 CSSPathValue* CSSPathValue::emptyPathValue()
27 {
28 DEFINE_STATIC_LOCAL(RefPtrWillBePersistent<CSSPathValue>, empty, (CSSPathVal ue::create(SVGPathByteStream::create())));
29 return empty.get();
14 } 30 }
15 31
16 String CSSPathValue::customCSSText() const 32 String CSSPathValue::customCSSText() const
17 { 33 {
18 return "path('" + m_pathString + "')"; 34 return "path('" + pathString() + "')";
19 } 35 }
20 36
21 bool CSSPathValue::equals(const CSSPathValue& other) const 37 bool CSSPathValue::equals(const CSSPathValue& other) const
22 { 38 {
23 return m_pathString == other.m_pathString; 39 return *m_pathByteStream == *other.m_pathByteStream;
24 } 40 }
25 41
26 DEFINE_TRACE_AFTER_DISPATCH(CSSPathValue) 42 DEFINE_TRACE_AFTER_DISPATCH(CSSPathValue)
27 { 43 {
28 CSSValue::traceAfterDispatch(visitor); 44 CSSValue::traceAfterDispatch(visitor);
29 } 45 }
30 46
47 String CSSPathValue::pathString() const
48 {
49 return buildStringFromByteStream(*m_pathByteStream);
50 }
51
31 } // namespace blink 52 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698