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

Side by Side Diff: third_party/WebKit/Source/core/css/CSSPathValue.cpp

Issue 1545713003: Add StylePath and use it to store 'd' in ComputedStyle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2015->2016; Remove unnecessary explicit. Created 4 years, 11 months 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 "core/css/CSSPathValue.h" 5 #include "core/css/CSSPathValue.h"
6 6
7 #include "core/style/StylePath.h"
7 #include "core/svg/SVGPathUtilities.h" 8 #include "core/svg/SVGPathUtilities.h"
8 9
9 namespace blink { 10 namespace blink {
10 11
12 PassRefPtrWillBeRawPtr<CSSPathValue> CSSPathValue::create(PassRefPtr<SVGPathByte Stream> pathByteStream, StylePath* cachedPath)
13 {
14 return adoptRefWillBeNoop(new CSSPathValue(pathByteStream, cachedPath));
15 }
16
11 PassRefPtrWillBeRawPtr<CSSPathValue> CSSPathValue::create(const String& pathStri ng) 17 PassRefPtrWillBeRawPtr<CSSPathValue> CSSPathValue::create(const String& pathStri ng)
12 { 18 {
13 OwnPtr<SVGPathByteStream> byteStream = SVGPathByteStream::create(); 19 RefPtr<SVGPathByteStream> byteStream = SVGPathByteStream::create();
14 buildByteStreamFromString(pathString, *byteStream); 20 buildByteStreamFromString(pathString, *byteStream);
15 return CSSPathValue::create(byteStream.release()); 21 return CSSPathValue::create(byteStream.release());
16 } 22 }
17 23
18 CSSPathValue::CSSPathValue(PassOwnPtr<SVGPathByteStream> pathByteStream) 24 CSSPathValue::CSSPathValue(PassRefPtr<SVGPathByteStream> pathByteStream, StylePa th* cachedPath)
19 : CSSValue(PathClass) 25 : CSSValue(PathClass)
20 , m_pathByteStream(pathByteStream) 26 , m_pathByteStream(pathByteStream)
27 , m_cachedPath(cachedPath)
21 { 28 {
22 ASSERT(m_pathByteStream); 29 ASSERT(m_pathByteStream);
23 buildPathFromByteStream(*m_pathByteStream, m_path); 30 }
31
32 CSSPathValue::~CSSPathValue()
33 {
24 } 34 }
25 35
26 CSSPathValue* CSSPathValue::emptyPathValue() 36 CSSPathValue* CSSPathValue::emptyPathValue()
27 { 37 {
28 DEFINE_STATIC_LOCAL(RefPtrWillBePersistent<CSSPathValue>, empty, (CSSPathVal ue::create(SVGPathByteStream::create()))); 38 DEFINE_STATIC_LOCAL(RefPtrWillBePersistent<CSSPathValue>, empty, (CSSPathVal ue::create(SVGPathByteStream::create())));
29 return empty.get(); 39 return empty.get();
30 } 40 }
31 41
42 StylePath* CSSPathValue::cachedPath()
43 {
44 if (!m_cachedPath)
45 m_cachedPath = StylePath::create(m_pathByteStream);
46 return m_cachedPath.get();
47 }
48
32 String CSSPathValue::customCSSText() const 49 String CSSPathValue::customCSSText() const
33 { 50 {
34 return "path('" + pathString() + "')"; 51 return "path('" + pathString() + "')";
35 } 52 }
36 53
37 bool CSSPathValue::equals(const CSSPathValue& other) const 54 bool CSSPathValue::equals(const CSSPathValue& other) const
38 { 55 {
39 return *m_pathByteStream == *other.m_pathByteStream; 56 return *m_pathByteStream == *other.m_pathByteStream;
40 } 57 }
41 58
42 DEFINE_TRACE_AFTER_DISPATCH(CSSPathValue) 59 DEFINE_TRACE_AFTER_DISPATCH(CSSPathValue)
43 { 60 {
44 CSSValue::traceAfterDispatch(visitor); 61 CSSValue::traceAfterDispatch(visitor);
45 } 62 }
46 63
47 String CSSPathValue::pathString() const 64 String CSSPathValue::pathString() const
48 { 65 {
49 return buildStringFromByteStream(*m_pathByteStream); 66 return buildStringFromByteStream(*m_pathByteStream);
50 } 67 }
51 68
52 } // namespace blink 69 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSPathValue.h ('k') | third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698