OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> |
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 PatternAttributes_h | 20 #ifndef PatternAttributes_h |
21 #define PatternAttributes_h | 21 #define PatternAttributes_h |
22 | 22 |
23 #include "core/svg/SVGLength.h" | 23 #include "core/svg/SVGLength.h" |
24 #include "core/svg/SVGPreserveAspectRatio.h" | 24 #include "core/svg/SVGPreserveAspectRatio.h" |
| 25 #include "platform/heap/Handle.h" |
25 #include "platform/transforms/AffineTransform.h" | 26 #include "platform/transforms/AffineTransform.h" |
26 | 27 |
27 namespace blink { | 28 namespace blink { |
28 | 29 |
29 class SVGPatternElement; | 30 class SVGPatternElement; |
30 | 31 |
31 struct PatternAttributes { | 32 class PatternAttributes final { |
| 33 DISALLOW_ALLOCATION(); |
| 34 public: |
32 PatternAttributes() | 35 PatternAttributes() |
33 : m_x(SVGLength::create(LengthModeWidth)) | 36 : m_x(SVGLength::create(LengthModeWidth)) |
34 , m_y(SVGLength::create(LengthModeHeight)) | 37 , m_y(SVGLength::create(LengthModeHeight)) |
35 , m_width(SVGLength::create(LengthModeWidth)) | 38 , m_width(SVGLength::create(LengthModeWidth)) |
36 , m_height(SVGLength::create(LengthModeHeight)) | 39 , m_height(SVGLength::create(LengthModeHeight)) |
37 , m_viewBox() | 40 , m_viewBox() |
38 , m_preserveAspectRatio(SVGPreserveAspectRatio::create()) | 41 , m_preserveAspectRatio(SVGPreserveAspectRatio::create()) |
39 , m_patternUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) | 42 , m_patternUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) |
40 , m_patternContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) | 43 , m_patternContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) |
41 , m_patternContentElement(0) | 44 , m_patternContentElement(nullptr) |
42 , m_xSet(false) | 45 , m_xSet(false) |
43 , m_ySet(false) | 46 , m_ySet(false) |
44 , m_widthSet(false) | 47 , m_widthSet(false) |
45 , m_heightSet(false) | 48 , m_heightSet(false) |
46 , m_viewBoxSet(false) | 49 , m_viewBoxSet(false) |
47 , m_preserveAspectRatioSet(false) | 50 , m_preserveAspectRatioSet(false) |
48 , m_patternUnitsSet(false) | 51 , m_patternUnitsSet(false) |
49 , m_patternContentUnitsSet(false) | 52 , m_patternContentUnitsSet(false) |
50 , m_patternTransformSet(false) | 53 , m_patternTransformSet(false) |
51 , m_patternContentElementSet(false) | 54 , m_patternContentElementSet(false) |
52 { | 55 { |
53 } | 56 } |
54 | 57 |
55 SVGLength* x() const { return m_x.get(); } | 58 SVGLength* x() const { return m_x.get(); } |
56 SVGLength* y() const { return m_y.get(); } | 59 SVGLength* y() const { return m_y.get(); } |
57 SVGLength* width() const { return m_width.get(); } | 60 SVGLength* width() const { return m_width.get(); } |
58 SVGLength* height() const { return m_height.get(); } | 61 SVGLength* height() const { return m_height.get(); } |
59 FloatRect viewBox() const { return m_viewBox; } | 62 FloatRect viewBox() const { return m_viewBox; } |
60 SVGPreserveAspectRatio* preserveAspectRatio() const { return m_preserveAspec
tRatio.get(); } | 63 SVGPreserveAspectRatio* preserveAspectRatio() const { return m_preserveAspec
tRatio.get(); } |
61 SVGUnitTypes::SVGUnitType patternUnits() const { return m_patternUnits; } | 64 SVGUnitTypes::SVGUnitType patternUnits() const { return m_patternUnits; } |
62 SVGUnitTypes::SVGUnitType patternContentUnits() const { return m_patternCont
entUnits; } | 65 SVGUnitTypes::SVGUnitType patternContentUnits() const { return m_patternCont
entUnits; } |
63 AffineTransform patternTransform() const { return m_patternTransform; } | 66 AffineTransform patternTransform() const { return m_patternTransform; } |
64 const SVGPatternElement* patternContentElement() const { return m_patternCon
tentElement; } | 67 const SVGPatternElement* patternContentElement() const { return m_patternCon
tentElement; } |
65 | 68 |
66 void setX(PassRefPtr<SVGLength> value) | 69 void setX(PassRefPtrWillBeRawPtr<SVGLength> value) |
67 { | 70 { |
68 m_x = value; | 71 m_x = value; |
69 m_xSet = true; | 72 m_xSet = true; |
70 } | 73 } |
71 | 74 |
72 void setY(PassRefPtr<SVGLength> value) | 75 void setY(PassRefPtrWillBeRawPtr<SVGLength> value) |
73 { | 76 { |
74 m_y = value; | 77 m_y = value; |
75 m_ySet = true; | 78 m_ySet = true; |
76 } | 79 } |
77 | 80 |
78 void setWidth(PassRefPtr<SVGLength> value) | 81 void setWidth(PassRefPtrWillBeRawPtr<SVGLength> value) |
79 { | 82 { |
80 m_width = value; | 83 m_width = value; |
81 m_widthSet = true; | 84 m_widthSet = true; |
82 } | 85 } |
83 | 86 |
84 void setHeight(PassRefPtr<SVGLength> value) | 87 void setHeight(PassRefPtrWillBeRawPtr<SVGLength> value) |
85 { | 88 { |
86 m_height = value; | 89 m_height = value; |
87 m_heightSet = true; | 90 m_heightSet = true; |
88 } | 91 } |
89 | 92 |
90 void setViewBox(const FloatRect& value) | 93 void setViewBox(const FloatRect& value) |
91 { | 94 { |
92 m_viewBox = value; | 95 m_viewBox = value; |
93 m_viewBoxSet = true; | 96 m_viewBoxSet = true; |
94 } | 97 } |
95 | 98 |
96 void setPreserveAspectRatio(PassRefPtr<SVGPreserveAspectRatio> value) | 99 void setPreserveAspectRatio(PassRefPtrWillBeRawPtr<SVGPreserveAspectRatio> v
alue) |
97 { | 100 { |
98 m_preserveAspectRatio = value; | 101 m_preserveAspectRatio = value; |
99 m_preserveAspectRatioSet = true; | 102 m_preserveAspectRatioSet = true; |
100 } | 103 } |
101 | 104 |
102 void setPatternUnits(SVGUnitTypes::SVGUnitType value) | 105 void setPatternUnits(SVGUnitTypes::SVGUnitType value) |
103 { | 106 { |
104 m_patternUnits = value; | 107 m_patternUnits = value; |
105 m_patternUnitsSet = true; | 108 m_patternUnitsSet = true; |
106 } | 109 } |
(...skipping 20 matching lines...) Expand all Loading... |
127 bool hasY() const { return m_ySet; } | 130 bool hasY() const { return m_ySet; } |
128 bool hasWidth() const { return m_widthSet; } | 131 bool hasWidth() const { return m_widthSet; } |
129 bool hasHeight() const { return m_heightSet; } | 132 bool hasHeight() const { return m_heightSet; } |
130 bool hasViewBox() const { return m_viewBoxSet; } | 133 bool hasViewBox() const { return m_viewBoxSet; } |
131 bool hasPreserveAspectRatio() const { return m_preserveAspectRatioSet; } | 134 bool hasPreserveAspectRatio() const { return m_preserveAspectRatioSet; } |
132 bool hasPatternUnits() const { return m_patternUnitsSet; } | 135 bool hasPatternUnits() const { return m_patternUnitsSet; } |
133 bool hasPatternContentUnits() const { return m_patternContentUnitsSet; } | 136 bool hasPatternContentUnits() const { return m_patternContentUnitsSet; } |
134 bool hasPatternTransform() const { return m_patternTransformSet; } | 137 bool hasPatternTransform() const { return m_patternTransformSet; } |
135 bool hasPatternContentElement() const { return m_patternContentElementSet; } | 138 bool hasPatternContentElement() const { return m_patternContentElementSet; } |
136 | 139 |
| 140 void trace(Visitor* visitor) |
| 141 { |
| 142 visitor->trace(m_x); |
| 143 visitor->trace(m_y); |
| 144 visitor->trace(m_width); |
| 145 visitor->trace(m_height); |
| 146 visitor->trace(m_preserveAspectRatio); |
| 147 visitor->trace(m_patternContentElement); |
| 148 } |
| 149 |
137 private: | 150 private: |
138 // Properties | 151 // Properties |
139 RefPtr<SVGLength> m_x; | 152 RefPtrWillBeMember<SVGLength> m_x; |
140 RefPtr<SVGLength> m_y; | 153 RefPtrWillBeMember<SVGLength> m_y; |
141 RefPtr<SVGLength> m_width; | 154 RefPtrWillBeMember<SVGLength> m_width; |
142 RefPtr<SVGLength> m_height; | 155 RefPtrWillBeMember<SVGLength> m_height; |
143 FloatRect m_viewBox; | 156 FloatRect m_viewBox; |
144 RefPtr<SVGPreserveAspectRatio> m_preserveAspectRatio; | 157 RefPtrWillBeMember<SVGPreserveAspectRatio> m_preserveAspectRatio; |
145 SVGUnitTypes::SVGUnitType m_patternUnits; | 158 SVGUnitTypes::SVGUnitType m_patternUnits; |
146 SVGUnitTypes::SVGUnitType m_patternContentUnits; | 159 SVGUnitTypes::SVGUnitType m_patternContentUnits; |
147 AffineTransform m_patternTransform; | 160 AffineTransform m_patternTransform; |
148 const SVGPatternElement* m_patternContentElement; | 161 RawPtrWillBeMember<const SVGPatternElement> m_patternContentElement; |
149 | 162 |
150 // Property states | 163 // Property states |
151 bool m_xSet : 1; | 164 bool m_xSet : 1; |
152 bool m_ySet : 1; | 165 bool m_ySet : 1; |
153 bool m_widthSet : 1; | 166 bool m_widthSet : 1; |
154 bool m_heightSet : 1; | 167 bool m_heightSet : 1; |
155 bool m_viewBoxSet : 1; | 168 bool m_viewBoxSet : 1; |
156 bool m_preserveAspectRatioSet : 1; | 169 bool m_preserveAspectRatioSet : 1; |
157 bool m_patternUnitsSet : 1; | 170 bool m_patternUnitsSet : 1; |
158 bool m_patternContentUnitsSet : 1; | 171 bool m_patternContentUnitsSet : 1; |
159 bool m_patternTransformSet : 1; | 172 bool m_patternTransformSet : 1; |
160 bool m_patternContentElementSet : 1; | 173 bool m_patternContentElementSet : 1; |
161 }; | 174 }; |
162 | 175 |
163 } // namespace blink | 176 } // namespace blink |
164 | 177 |
165 #endif | 178 #endif // PatternAttributes_h |
OLD | NEW |