OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/style/StylePath.h" | 5 #include "core/style/StylePath.h" |
6 | 6 |
7 #include "core/css/CSSPathValue.h" | 7 #include "core/css/CSSPathValue.h" |
8 #include "core/svg/SVGPathByteStream.h" | 8 #include "core/svg/SVGPathByteStream.h" |
9 #include "core/svg/SVGPathUtilities.h" | 9 #include "core/svg/SVGPathUtilities.h" |
10 #include "platform/graphics/Path.h" | 10 #include "platform/graphics/Path.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 } | 27 } |
28 | 28 |
29 StylePath* StylePath::emptyPath() { | 29 StylePath* StylePath::emptyPath() { |
30 DEFINE_STATIC_REF(StylePath, emptyPath, | 30 DEFINE_STATIC_REF(StylePath, emptyPath, |
31 StylePath::create(SVGPathByteStream::create())); | 31 StylePath::create(SVGPathByteStream::create())); |
32 return emptyPath; | 32 return emptyPath; |
33 } | 33 } |
34 | 34 |
35 const Path& StylePath::path() const { | 35 const Path& StylePath::path() const { |
36 if (!m_path) { | 36 if (!m_path) { |
37 m_path = wrapUnique(new Path); | 37 m_path = WTF::wrapUnique(new Path); |
38 buildPathFromByteStream(*m_byteStream, *m_path); | 38 buildPathFromByteStream(*m_byteStream, *m_path); |
39 } | 39 } |
40 return *m_path; | 40 return *m_path; |
41 } | 41 } |
42 | 42 |
43 float StylePath::length() const { | 43 float StylePath::length() const { |
44 if (std::isnan(m_pathLength)) | 44 if (std::isnan(m_pathLength)) |
45 m_pathLength = path().length(); | 45 m_pathLength = path().length(); |
46 return m_pathLength; | 46 return m_pathLength; |
47 } | 47 } |
48 | 48 |
49 bool StylePath::isClosed() const { | 49 bool StylePath::isClosed() const { |
50 return path().isClosed(); | 50 return path().isClosed(); |
51 } | 51 } |
52 | 52 |
53 CSSValue* StylePath::computedCSSValue() const { | 53 CSSValue* StylePath::computedCSSValue() const { |
54 return CSSPathValue::create(const_cast<StylePath*>(this)); | 54 return CSSPathValue::create(const_cast<StylePath*>(this)); |
55 } | 55 } |
56 | 56 |
57 bool StylePath::operator==(const StylePath& other) const { | 57 bool StylePath::operator==(const StylePath& other) const { |
58 return *m_byteStream == *other.m_byteStream; | 58 return *m_byteStream == *other.m_byteStream; |
59 } | 59 } |
60 | 60 |
61 } // namespace blink | 61 } // namespace blink |
OLD | NEW |