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, |
(...skipping 10 matching lines...) Expand all Loading... |
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/SVGExternalResourcesRequired.h" | 28 #include "core/svg/SVGExternalResourcesRequired.h" |
29 #include "core/svg/SVGFitToViewBox.h" | 29 #include "core/svg/SVGFitToViewBox.h" |
30 #include "core/svg/SVGGraphicsElement.h" | 30 #include "core/svg/SVGGraphicsElement.h" |
| 31 #include "core/svg/SVGLengthTearOff.h" |
31 #include "core/svg/SVGZoomAndPan.h" | 32 #include "core/svg/SVGZoomAndPan.h" |
32 #include "wtf/WeakPtr.h" | 33 #include "wtf/WeakPtr.h" |
33 | 34 |
34 namespace WebCore { | 35 namespace WebCore { |
35 | 36 |
36 class SVGAngle; | 37 class SVGAngle; |
37 class SVGMatrix; | 38 class SVGMatrix; |
38 class SVGTransform; | 39 class SVGTransform; |
39 class SVGViewSpec; | 40 class SVGViewSpec; |
40 class SVGViewElement; | 41 class SVGViewElement; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 void unsuspendRedrawAll(); | 105 void unsuspendRedrawAll(); |
105 void forceRedraw(); | 106 void forceRedraw(); |
106 | 107 |
107 PassRefPtr<NodeList> getIntersectionList(const SVGRect&, SVGElement* referen
ceElement) const; | 108 PassRefPtr<NodeList> getIntersectionList(const SVGRect&, SVGElement* referen
ceElement) const; |
108 PassRefPtr<NodeList> getEnclosureList(const SVGRect&, SVGElement* referenceE
lement) const; | 109 PassRefPtr<NodeList> getEnclosureList(const SVGRect&, SVGElement* referenceE
lement) const; |
109 bool checkIntersection(SVGElement*, const SVGRect&) const; | 110 bool checkIntersection(SVGElement*, const SVGRect&) const; |
110 bool checkEnclosure(SVGElement*, const SVGRect&) const; | 111 bool checkEnclosure(SVGElement*, const SVGRect&) const; |
111 void deselectAll(); | 112 void deselectAll(); |
112 | 113 |
113 static float createSVGNumber(); | 114 static float createSVGNumber(); |
114 static SVGLength createSVGLength(); | 115 static PassRefPtr<SVGLengthTearOff> createSVGLength(); |
115 static SVGAngle createSVGAngle(); | 116 static SVGAngle createSVGAngle(); |
116 static SVGPoint createSVGPoint(); | 117 static SVGPoint createSVGPoint(); |
117 static SVGMatrix createSVGMatrix(); | 118 static SVGMatrix createSVGMatrix(); |
118 static SVGRect createSVGRect(); | 119 static SVGRect createSVGRect(); |
119 static SVGTransform createSVGTransform(); | 120 static SVGTransform createSVGTransform(); |
120 static SVGTransform createSVGTransformFromMatrix(const SVGMatrix&); | 121 static SVGTransform createSVGTransformFromMatrix(const SVGMatrix&); |
121 | 122 |
122 AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) co
nst; | 123 AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) co
nst; |
123 | 124 |
124 void setupInitialView(const String& fragmentIdentifier, Element* anchorNode)
; | 125 void setupInitialView(const String& fragmentIdentifier, Element* anchorNode)
; |
125 | 126 |
126 Element* getElementById(const AtomicString&) const; | 127 Element* getElementById(const AtomicString&) const; |
127 | 128 |
128 bool widthAttributeEstablishesViewport() const; | 129 bool widthAttributeEstablishesViewport() const; |
129 bool heightAttributeEstablishesViewport() const; | 130 bool heightAttributeEstablishesViewport() const; |
130 | 131 |
131 SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; } | 132 SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; } |
132 void setZoomAndPan(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan
::parseFromNumber(zoomAndPan); } | 133 void setZoomAndPan(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan
::parseFromNumber(zoomAndPan); } |
133 | 134 |
134 bool hasEmptyViewBox() const { return viewBoxCurrentValue().isValid() && vie
wBoxCurrentValue().isEmpty(); } | 135 bool hasEmptyViewBox() const { return viewBoxCurrentValue().isValid() && vie
wBoxCurrentValue().isEmpty(); } |
135 | 136 |
| 137 SVGAnimatedLength* x() const { return m_x.get(); } |
| 138 SVGAnimatedLength* y() const { return m_y.get(); } |
| 139 SVGAnimatedLength* width() const { return m_width.get(); } |
| 140 SVGAnimatedLength* height() const { return m_height.get(); } |
| 141 |
136 private: | 142 private: |
137 explicit SVGSVGElement(Document&); | 143 explicit SVGSVGElement(Document&); |
138 virtual ~SVGSVGElement(); | 144 virtual ~SVGSVGElement(); |
139 | 145 |
140 virtual bool isSVGSVGElement() const OVERRIDE { return true; } | 146 virtual bool isSVGSVGElement() const OVERRIDE { return true; } |
141 | 147 |
142 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR
IDE; | 148 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR
IDE; |
143 | 149 |
144 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE; | 150 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE; |
145 virtual RenderObject* createRenderer(RenderStyle*); | 151 virtual RenderObject* createRenderer(RenderStyle*); |
146 | 152 |
147 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; | 153 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; |
148 virtual void removedFrom(ContainerNode*) OVERRIDE; | 154 virtual void removedFrom(ContainerNode*) OVERRIDE; |
149 | 155 |
150 virtual void svgAttributeChanged(const QualifiedName&); | 156 virtual void svgAttributeChanged(const QualifiedName&); |
151 | 157 |
152 virtual bool selfHasRelativeLengths() const; | 158 virtual bool selfHasRelativeLengths() const; |
153 | 159 |
154 void inheritViewAttributes(SVGViewElement*); | 160 void inheritViewAttributes(SVGViewElement*); |
155 | 161 |
156 enum CollectIntersectionOrEnclosure { | 162 enum CollectIntersectionOrEnclosure { |
157 CollectIntersectionList, | 163 CollectIntersectionList, |
158 CollectEnclosureList | 164 CollectEnclosureList |
159 }; | 165 }; |
160 | 166 |
161 PassRefPtr<NodeList> collectIntersectionOrEnclosureList(const SVGRect&, SVGE
lement*, CollectIntersectionOrEnclosure) const; | 167 PassRefPtr<NodeList> collectIntersectionOrEnclosureList(const SVGRect&, SVGE
lement*, CollectIntersectionOrEnclosure) const; |
162 | 168 |
| 169 RefPtr<SVGAnimatedLength> m_x; |
| 170 RefPtr<SVGAnimatedLength> m_y; |
| 171 RefPtr<SVGAnimatedLength> m_width; |
| 172 RefPtr<SVGAnimatedLength> m_height; |
163 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGSVGElement) | 173 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGSVGElement) |
164 DECLARE_ANIMATED_LENGTH(X, x) | |
165 DECLARE_ANIMATED_LENGTH(Y, y) | |
166 DECLARE_ANIMATED_LENGTH(Width, width) | |
167 DECLARE_ANIMATED_LENGTH(Height, height) | |
168 DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesReq
uired) | 174 DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesReq
uired) |
169 DECLARE_ANIMATED_RECT(ViewBox, viewBox) | 175 DECLARE_ANIMATED_RECT(ViewBox, viewBox) |
170 DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspect
Ratio) | 176 DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspect
Ratio) |
171 END_DECLARE_ANIMATED_PROPERTIES | 177 END_DECLARE_ANIMATED_PROPERTIES |
172 | 178 |
173 virtual AffineTransform localCoordinateSpaceTransform(SVGElement::CTMScope)
const; | 179 virtual AffineTransform localCoordinateSpaceTransform(SVGElement::CTMScope)
const; |
174 | 180 |
175 bool m_useCurrentView; | 181 bool m_useCurrentView; |
176 SVGZoomAndPanType m_zoomAndPan; | 182 SVGZoomAndPanType m_zoomAndPan; |
177 RefPtr<SMILTimeContainer> m_timeContainer; | 183 RefPtr<SMILTimeContainer> m_timeContainer; |
178 SVGPoint m_translation; | 184 SVGPoint m_translation; |
179 RefPtr<SVGViewSpec> m_viewSpec; | 185 RefPtr<SVGViewSpec> m_viewSpec; |
180 WeakPtrFactory<SVGSVGElement> m_weakFactory; | 186 WeakPtrFactory<SVGSVGElement> m_weakFactory; |
181 }; | 187 }; |
182 | 188 |
183 inline bool isSVGSVGElement(const Node& node) | 189 inline bool isSVGSVGElement(const Node& node) |
184 { | 190 { |
185 return node.isSVGElement() && toSVGElement(node).isSVGSVGElement(); | 191 return node.isSVGElement() && toSVGElement(node).isSVGSVGElement(); |
186 } | 192 } |
187 | 193 |
188 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGSVGElement); | 194 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGSVGElement); |
189 | 195 |
190 } // namespace WebCore | 196 } // namespace WebCore |
191 | 197 |
192 #endif | 198 #endif |
OLD | NEW |