Remove unused variable movedSectionLogicalTop from table layout code.
[chromium-blink-merge.git] / third_party / WebKit / Source / core / svg / PatternAttributes.h
blob757ce96328be1d9fb8cee6bb069abef07402bdc9
1 /*
2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
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
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #ifndef PatternAttributes_h
21 #define PatternAttributes_h
23 #include "core/svg/SVGLength.h"
24 #include "core/svg/SVGPreserveAspectRatio.h"
25 #include "platform/heap/Handle.h"
26 #include "platform/transforms/AffineTransform.h"
28 namespace blink {
30 class SVGPatternElement;
32 class PatternAttributes final {
33 DISALLOW_ALLOCATION();
34 public:
35 PatternAttributes()
36 : m_x(SVGLength::create(SVGLengthMode::Width))
37 , m_y(SVGLength::create(SVGLengthMode::Height))
38 , m_width(SVGLength::create(SVGLengthMode::Width))
39 , m_height(SVGLength::create(SVGLengthMode::Height))
40 , m_viewBox()
41 , m_preserveAspectRatio(SVGPreserveAspectRatio::create())
42 , m_patternUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
43 , m_patternContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)
44 , m_patternContentElement(nullptr)
45 , m_xSet(false)
46 , m_ySet(false)
47 , m_widthSet(false)
48 , m_heightSet(false)
49 , m_viewBoxSet(false)
50 , m_preserveAspectRatioSet(false)
51 , m_patternUnitsSet(false)
52 , m_patternContentUnitsSet(false)
53 , m_patternTransformSet(false)
54 , m_patternContentElementSet(false)
58 SVGLength* x() const { return m_x.get(); }
59 SVGLength* y() const { return m_y.get(); }
60 SVGLength* width() const { return m_width.get(); }
61 SVGLength* height() const { return m_height.get(); }
62 FloatRect viewBox() const { return m_viewBox; }
63 SVGPreserveAspectRatio* preserveAspectRatio() const { return m_preserveAspectRatio.get(); }
64 SVGUnitTypes::SVGUnitType patternUnits() const { return m_patternUnits; }
65 SVGUnitTypes::SVGUnitType patternContentUnits() const { return m_patternContentUnits; }
66 AffineTransform patternTransform() const { return m_patternTransform; }
67 const SVGPatternElement* patternContentElement() const { return m_patternContentElement; }
69 void setX(PassRefPtrWillBeRawPtr<SVGLength> value)
71 m_x = value;
72 m_xSet = true;
75 void setY(PassRefPtrWillBeRawPtr<SVGLength> value)
77 m_y = value;
78 m_ySet = true;
81 void setWidth(PassRefPtrWillBeRawPtr<SVGLength> value)
83 m_width = value;
84 m_widthSet = true;
87 void setHeight(PassRefPtrWillBeRawPtr<SVGLength> value)
89 m_height = value;
90 m_heightSet = true;
93 void setViewBox(const FloatRect& value)
95 m_viewBox = value;
96 m_viewBoxSet = true;
99 void setPreserveAspectRatio(PassRefPtrWillBeRawPtr<SVGPreserveAspectRatio> value)
101 m_preserveAspectRatio = value;
102 m_preserveAspectRatioSet = true;
105 void setPatternUnits(SVGUnitTypes::SVGUnitType value)
107 m_patternUnits = value;
108 m_patternUnitsSet = true;
111 void setPatternContentUnits(SVGUnitTypes::SVGUnitType value)
113 m_patternContentUnits = value;
114 m_patternContentUnitsSet = true;
117 void setPatternTransform(const AffineTransform& value)
119 m_patternTransform = value;
120 m_patternTransformSet = true;
123 void setPatternContentElement(const SVGPatternElement* value)
125 m_patternContentElement = value;
126 m_patternContentElementSet = true;
129 bool hasX() const { return m_xSet; }
130 bool hasY() const { return m_ySet; }
131 bool hasWidth() const { return m_widthSet; }
132 bool hasHeight() const { return m_heightSet; }
133 bool hasViewBox() const { return m_viewBoxSet; }
134 bool hasPreserveAspectRatio() const { return m_preserveAspectRatioSet; }
135 bool hasPatternUnits() const { return m_patternUnitsSet; }
136 bool hasPatternContentUnits() const { return m_patternContentUnitsSet; }
137 bool hasPatternTransform() const { return m_patternTransformSet; }
138 bool hasPatternContentElement() const { return m_patternContentElementSet; }
140 DEFINE_INLINE_TRACE()
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);
150 private:
151 // Properties
152 RefPtrWillBeMember<SVGLength> m_x;
153 RefPtrWillBeMember<SVGLength> m_y;
154 RefPtrWillBeMember<SVGLength> m_width;
155 RefPtrWillBeMember<SVGLength> m_height;
156 FloatRect m_viewBox;
157 RefPtrWillBeMember<SVGPreserveAspectRatio> m_preserveAspectRatio;
158 SVGUnitTypes::SVGUnitType m_patternUnits;
159 SVGUnitTypes::SVGUnitType m_patternContentUnits;
160 AffineTransform m_patternTransform;
161 RawPtrWillBeMember<const SVGPatternElement> m_patternContentElement;
163 // Property states
164 bool m_xSet : 1;
165 bool m_ySet : 1;
166 bool m_widthSet : 1;
167 bool m_heightSet : 1;
168 bool m_viewBoxSet : 1;
169 bool m_preserveAspectRatioSet : 1;
170 bool m_patternUnitsSet : 1;
171 bool m_patternContentUnitsSet : 1;
172 bool m_patternTransformSet : 1;
173 bool m_patternContentElementSet : 1;
176 #if ENABLE(OILPAN)
177 // Wrapper object for the PatternAttributes part object.
178 class PatternAttributesWrapper : public GarbageCollectedFinalized<PatternAttributesWrapper> {
179 public:
180 static PatternAttributesWrapper* create()
182 return new PatternAttributesWrapper;
185 PatternAttributes& attributes() { return m_attributes; }
186 void set(const PatternAttributes& attributes) { m_attributes = attributes; }
187 DEFINE_INLINE_TRACE() { visitor->trace(m_attributes); }
189 private:
190 PatternAttributesWrapper()
194 PatternAttributes m_attributes;
196 #endif
198 } // namespace blink
200 #endif // PatternAttributes_h