OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org> |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
14 * | 14 * |
15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
19 */ | 19 */ |
20 | 20 |
21 #ifndef SVGSVGElement_h | 21 #ifndef SVGSVGElement_h |
22 #define SVGSVGElement_h | 22 #define SVGSVGElement_h |
23 | 23 |
24 #include "core/svg/SVGAnimatedBoolean.h" | 24 #include "core/svg/SVGAnimatedBoolean.h" |
25 #include "core/svg/SVGAnimatedLength.h" | 25 #include "core/svg/SVGAnimatedLength.h" |
26 #include "core/svg/SVGAnimatedPreserveAspectRatio.h" | 26 #include "core/svg/SVGAnimatedPreserveAspectRatio.h" |
27 #include "core/svg/SVGAnimatedRect.h" | 27 #include "core/svg/SVGAnimatedRect.h" |
28 #include "core/svg/SVGFitToViewBox.h" | 28 #include "core/svg/SVGFitToViewBox.h" |
29 #include "core/svg/SVGGraphicsElement.h" | 29 #include "core/svg/SVGGraphicsElement.h" |
| 30 #include "core/svg/SVGLengthTearOff.h" |
30 #include "core/svg/SVGZoomAndPan.h" | 31 #include "core/svg/SVGZoomAndPan.h" |
31 #include "wtf/WeakPtr.h" | 32 #include "wtf/WeakPtr.h" |
32 | 33 |
33 namespace WebCore { | 34 namespace WebCore { |
34 | 35 |
35 class SVGAngle; | 36 class SVGAngle; |
36 class SVGMatrix; | 37 class SVGMatrix; |
37 class SVGTransform; | 38 class SVGTransform; |
38 class SVGViewSpec; | 39 class SVGViewSpec; |
39 class SVGViewElement; | 40 class SVGViewElement; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 void unsuspendRedrawAll(); | 103 void unsuspendRedrawAll(); |
103 void forceRedraw(); | 104 void forceRedraw(); |
104 | 105 |
105 PassRefPtr<NodeList> getIntersectionList(const SVGRect&, SVGElement* referen
ceElement) const; | 106 PassRefPtr<NodeList> getIntersectionList(const SVGRect&, SVGElement* referen
ceElement) const; |
106 PassRefPtr<NodeList> getEnclosureList(const SVGRect&, SVGElement* referenceE
lement) const; | 107 PassRefPtr<NodeList> getEnclosureList(const SVGRect&, SVGElement* referenceE
lement) const; |
107 bool checkIntersection(SVGElement*, const SVGRect&) const; | 108 bool checkIntersection(SVGElement*, const SVGRect&) const; |
108 bool checkEnclosure(SVGElement*, const SVGRect&) const; | 109 bool checkEnclosure(SVGElement*, const SVGRect&) const; |
109 void deselectAll(); | 110 void deselectAll(); |
110 | 111 |
111 static float createSVGNumber(); | 112 static float createSVGNumber(); |
112 static SVGLength createSVGLength(); | 113 static PassRefPtr<SVGLengthTearOff> createSVGLength(); |
113 static SVGAngle createSVGAngle(); | 114 static SVGAngle createSVGAngle(); |
114 static SVGPoint createSVGPoint(); | 115 static SVGPoint createSVGPoint(); |
115 static SVGMatrix createSVGMatrix(); | 116 static SVGMatrix createSVGMatrix(); |
116 static SVGRect createSVGRect(); | 117 static SVGRect createSVGRect(); |
117 static SVGTransform createSVGTransform(); | 118 static SVGTransform createSVGTransform(); |
118 static SVGTransform createSVGTransformFromMatrix(const SVGMatrix&); | 119 static SVGTransform createSVGTransformFromMatrix(const SVGMatrix&); |
119 | 120 |
120 AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) co
nst; | 121 AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) co
nst; |
121 | 122 |
122 void setupInitialView(const String& fragmentIdentifier, Element* anchorNode)
; | 123 void setupInitialView(const String& fragmentIdentifier, Element* anchorNode)
; |
123 | 124 |
124 Element* getElementById(const AtomicString&) const; | 125 Element* getElementById(const AtomicString&) const; |
125 | 126 |
126 bool widthAttributeEstablishesViewport() const; | 127 bool widthAttributeEstablishesViewport() const; |
127 bool heightAttributeEstablishesViewport() const; | 128 bool heightAttributeEstablishesViewport() const; |
128 | 129 |
129 SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; } | 130 SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; } |
130 void setZoomAndPan(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan
::parseFromNumber(zoomAndPan); } | 131 void setZoomAndPan(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan
::parseFromNumber(zoomAndPan); } |
131 | 132 |
132 bool hasEmptyViewBox() const { return viewBoxCurrentValue().isValid() && vie
wBoxCurrentValue().isEmpty(); } | 133 bool hasEmptyViewBox() const { return viewBoxCurrentValue().isValid() && vie
wBoxCurrentValue().isEmpty(); } |
133 | 134 |
| 135 SVGAnimatedLength* x() const { return m_x.get(); } |
| 136 SVGAnimatedLength* y() const { return m_y.get(); } |
| 137 SVGAnimatedLength* width() const { return m_width.get(); } |
| 138 SVGAnimatedLength* height() const { return m_height.get(); } |
| 139 |
134 private: | 140 private: |
135 explicit SVGSVGElement(Document&); | 141 explicit SVGSVGElement(Document&); |
136 virtual ~SVGSVGElement(); | 142 virtual ~SVGSVGElement(); |
137 | 143 |
138 virtual bool isSVGSVGElement() const OVERRIDE { return true; } | 144 virtual bool isSVGSVGElement() const OVERRIDE { return true; } |
139 | 145 |
140 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR
IDE; | 146 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR
IDE; |
141 | 147 |
142 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE; | 148 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE; |
143 virtual RenderObject* createRenderer(RenderStyle*); | 149 virtual RenderObject* createRenderer(RenderStyle*); |
144 | 150 |
145 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; | 151 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; |
146 virtual void removedFrom(ContainerNode*) OVERRIDE; | 152 virtual void removedFrom(ContainerNode*) OVERRIDE; |
147 | 153 |
148 virtual void svgAttributeChanged(const QualifiedName&); | 154 virtual void svgAttributeChanged(const QualifiedName&); |
149 | 155 |
150 virtual bool selfHasRelativeLengths() const; | 156 virtual bool selfHasRelativeLengths() const; |
151 | 157 |
152 void inheritViewAttributes(SVGViewElement*); | 158 void inheritViewAttributes(SVGViewElement*); |
153 | 159 |
154 enum CollectIntersectionOrEnclosure { | 160 enum CollectIntersectionOrEnclosure { |
155 CollectIntersectionList, | 161 CollectIntersectionList, |
156 CollectEnclosureList | 162 CollectEnclosureList |
157 }; | 163 }; |
158 | 164 |
159 PassRefPtr<NodeList> collectIntersectionOrEnclosureList(const SVGRect&, SVGE
lement*, CollectIntersectionOrEnclosure) const; | 165 PassRefPtr<NodeList> collectIntersectionOrEnclosureList(const SVGRect&, SVGE
lement*, CollectIntersectionOrEnclosure) const; |
160 | 166 |
| 167 RefPtr<SVGAnimatedLength> m_x; |
| 168 RefPtr<SVGAnimatedLength> m_y; |
| 169 RefPtr<SVGAnimatedLength> m_width; |
| 170 RefPtr<SVGAnimatedLength> m_height; |
161 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGSVGElement) | 171 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGSVGElement) |
162 DECLARE_ANIMATED_LENGTH(X, x) | |
163 DECLARE_ANIMATED_LENGTH(Y, y) | |
164 DECLARE_ANIMATED_LENGTH(Width, width) | |
165 DECLARE_ANIMATED_LENGTH(Height, height) | |
166 DECLARE_ANIMATED_RECT(ViewBox, viewBox) | 172 DECLARE_ANIMATED_RECT(ViewBox, viewBox) |
167 DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspect
Ratio) | 173 DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspect
Ratio) |
168 END_DECLARE_ANIMATED_PROPERTIES | 174 END_DECLARE_ANIMATED_PROPERTIES |
169 | 175 |
170 virtual AffineTransform localCoordinateSpaceTransform(SVGElement::CTMScope)
const; | 176 virtual AffineTransform localCoordinateSpaceTransform(SVGElement::CTMScope)
const; |
171 | 177 |
172 bool m_useCurrentView; | 178 bool m_useCurrentView; |
173 SVGZoomAndPanType m_zoomAndPan; | 179 SVGZoomAndPanType m_zoomAndPan; |
174 RefPtr<SMILTimeContainer> m_timeContainer; | 180 RefPtr<SMILTimeContainer> m_timeContainer; |
175 SVGPoint m_translation; | 181 SVGPoint m_translation; |
176 RefPtr<SVGViewSpec> m_viewSpec; | 182 RefPtr<SVGViewSpec> m_viewSpec; |
177 WeakPtrFactory<SVGSVGElement> m_weakFactory; | 183 WeakPtrFactory<SVGSVGElement> m_weakFactory; |
178 }; | 184 }; |
179 | 185 |
180 inline bool isSVGSVGElement(const Node& node) | 186 inline bool isSVGSVGElement(const Node& node) |
181 { | 187 { |
182 return node.isSVGElement() && toSVGElement(node).isSVGSVGElement(); | 188 return node.isSVGElement() && toSVGElement(node).isSVGSVGElement(); |
183 } | 189 } |
184 | 190 |
185 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGSVGElement); | 191 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGSVGElement); |
186 | 192 |
187 } // namespace WebCore | 193 } // namespace WebCore |
188 | 194 |
189 #endif | 195 #endif |
OLD | NEW |