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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGPathByteStream.h

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 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public License 14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to 15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA. 17 * Boston, MA 02110-1301, USA.
18 */ 18 */
19 19
20 #ifndef SVGPathByteStream_h 20 #ifndef SVGPathByteStream_h
21 #define SVGPathByteStream_h 21 #define SVGPathByteStream_h
22 22
23 #include "wtf/Noncopyable.h" 23 #include "wtf/Noncopyable.h"
24 #include "wtf/PassOwnPtr.h" 24 #include "wtf/PassRefPtr.h"
25 #include "wtf/RefCounted.h"
25 #include "wtf/Vector.h" 26 #include "wtf/Vector.h"
26 27
27 namespace blink { 28 namespace blink {
28 29
29 template<typename DataType> 30 template<typename DataType>
30 union ByteType { 31 union ByteType {
31 DataType value; 32 DataType value;
32 unsigned char bytes[sizeof(DataType)]; 33 unsigned char bytes[sizeof(DataType)];
33 }; 34 };
34 35
35 class SVGPathByteStream { 36 class SVGPathByteStream : public RefCounted<SVGPathByteStream> {
36 USING_FAST_MALLOC(SVGPathByteStream); 37 USING_FAST_MALLOC(SVGPathByteStream);
37 public: 38 public:
38 static PassOwnPtr<SVGPathByteStream> create() 39 static PassRefPtr<SVGPathByteStream> create()
39 { 40 {
40 return adoptPtr(new SVGPathByteStream); 41 return adoptRef(new SVGPathByteStream);
41 } 42 }
42 43
43 PassOwnPtr<SVGPathByteStream> copy() const 44 PassRefPtr<SVGPathByteStream> clone() const
44 { 45 {
45 return adoptPtr(new SVGPathByteStream(m_data)); 46 return adoptRef(new SVGPathByteStream(m_data));
46 } 47 }
47 48
48 typedef Vector<unsigned char> Data; 49 typedef Vector<unsigned char> Data;
49 typedef Data::const_iterator DataIterator; 50 typedef Data::const_iterator DataIterator;
50 51
51 DataIterator begin() const { return m_data.begin(); } 52 DataIterator begin() const { return m_data.begin(); }
52 DataIterator end() const { return m_data.end(); } 53 DataIterator end() const { return m_data.end(); }
53 void append(const unsigned char* data, size_t dataSize) { m_data.append(data , dataSize); } 54 void append(const unsigned char* data, size_t dataSize) { m_data.append(data , dataSize); }
54 void clear() { m_data.clear(); } 55 void clear() { m_data.clear(); }
55 void reserveInitialCapacity(size_t size) { m_data.reserveInitialCapacity(siz e); } 56 void reserveInitialCapacity(size_t size) { m_data.reserveInitialCapacity(siz e); }
56 void shrinkToFit() { m_data.shrinkToFit(); } 57 void shrinkToFit() { m_data.shrinkToFit(); }
57 bool isEmpty() const { return m_data.isEmpty(); } 58 bool isEmpty() const { return m_data.isEmpty(); }
58 unsigned size() const { return m_data.size(); } 59 unsigned size() const { return m_data.size(); }
59 60
60 bool operator==(const SVGPathByteStream& other) const { return m_data == oth er.m_data; } 61 bool operator==(const SVGPathByteStream& other) const { return m_data == oth er.m_data; }
61 62
62 private: 63 private:
63 SVGPathByteStream() { } 64 SVGPathByteStream() { }
64 SVGPathByteStream(const Data& data) 65 SVGPathByteStream(const Data& data)
65 : m_data(data) 66 : m_data(data)
66 { 67 {
67 } 68 }
68 69
69 Data m_data; 70 Data m_data;
70 }; 71 };
71 72
72 } // namespace blink 73 } // namespace blink
73 74
74 #endif // SVGPathByteStream_h 75 #endif // SVGPathByteStream_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGPath.cpp ('k') | third_party/WebKit/Source/core/svg/SVGPathElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698