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

Side by Side Diff: Source/core/svg/SVGSVGElement.h

Issue 132233010: [SVG] SVGAnimatedRect migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 virtual bool isValid() const OVERRIDE { return SVGTests::isValid(); } 52 virtual bool isValid() const OVERRIDE { return SVGTests::isValid(); }
53 virtual bool supportsFocus() const OVERRIDE { return hasFocusEventListeners( ); } 53 virtual bool supportsFocus() const OVERRIDE { return hasFocusEventListeners( ); }
54 54
55 // 'SVGSVGElement' functions 55 // 'SVGSVGElement' functions
56 const AtomicString& contentScriptType() const; 56 const AtomicString& contentScriptType() const;
57 void setContentScriptType(const AtomicString& type); 57 void setContentScriptType(const AtomicString& type);
58 58
59 const AtomicString& contentStyleType() const; 59 const AtomicString& contentStyleType() const;
60 void setContentStyleType(const AtomicString& type); 60 void setContentStyleType(const AtomicString& type);
61 61
62 SVGRect viewport() const; 62 PassRefPtr<SVGRectTearOff> viewport() const;
63 63
64 float pixelUnitToMillimeterX() const; 64 float pixelUnitToMillimeterX() const;
65 float pixelUnitToMillimeterY() const; 65 float pixelUnitToMillimeterY() const;
66 float screenPixelToMillimeterX() const; 66 float screenPixelToMillimeterX() const;
67 float screenPixelToMillimeterY() const; 67 float screenPixelToMillimeterY() const;
68 68
69 bool useCurrentView() const { return m_useCurrentView; } 69 bool useCurrentView() const { return m_useCurrentView; }
70 SVGViewSpec* currentView(); 70 SVGViewSpec* currentView();
71 71
72 enum ConsiderCSSMode { 72 enum ConsiderCSSMode {
73 RespectCSSProperties, 73 RespectCSSProperties,
74 IgnoreCSSProperties 74 IgnoreCSSProperties
75 }; 75 };
76 76
77 // RenderSVGRoot wants to query the intrinsic size, by only examining the wi dth/height attributes. 77 // RenderSVGRoot wants to query the intrinsic size, by only examining the wi dth/height attributes.
78 Length intrinsicWidth(ConsiderCSSMode = RespectCSSProperties) const; 78 Length intrinsicWidth(ConsiderCSSMode = RespectCSSProperties) const;
79 Length intrinsicHeight(ConsiderCSSMode = RespectCSSProperties) const; 79 Length intrinsicHeight(ConsiderCSSMode = RespectCSSProperties) const;
80 FloatSize currentViewportSize() const; 80 FloatSize currentViewportSize() const;
81 SVGRect currentViewBoxRect() const; 81 FloatRect currentViewBoxRect() const;
82 82
83 float currentScale() const; 83 float currentScale() const;
84 void setCurrentScale(float scale); 84 void setCurrentScale(float scale);
85 85
86 SVGPoint& currentTranslate() { return m_translation; } 86 SVGPoint& currentTranslate() { return m_translation; }
87 void setCurrentTranslate(const FloatPoint&); 87 void setCurrentTranslate(const FloatPoint&);
88 88
89 // Only used from the bindings. 89 // Only used from the bindings.
90 void updateCurrentTranslate(); 90 void updateCurrentTranslate();
91 91
92 SMILTimeContainer* timeContainer() const { return m_timeContainer.get(); } 92 SMILTimeContainer* timeContainer() const { return m_timeContainer.get(); }
93 93
94 void pauseAnimations(); 94 void pauseAnimations();
95 void unpauseAnimations(); 95 void unpauseAnimations();
96 bool animationsPaused() const; 96 bool animationsPaused() const;
97 97
98 float getCurrentTime() const; 98 float getCurrentTime() const;
99 void setCurrentTime(float seconds); 99 void setCurrentTime(float seconds);
100 100
101 unsigned suspendRedraw(unsigned maxWaitMilliseconds); 101 unsigned suspendRedraw(unsigned maxWaitMilliseconds);
102 void unsuspendRedraw(unsigned suspendHandleId); 102 void unsuspendRedraw(unsigned suspendHandleId);
103 void unsuspendRedrawAll(); 103 void unsuspendRedrawAll();
104 void forceRedraw(); 104 void forceRedraw();
105 105
106 PassRefPtr<NodeList> getIntersectionList(const SVGRect&, SVGElement* referen ceElement) const; 106 PassRefPtr<NodeList> getIntersectionList(PassRefPtr<SVGRectTearOff>, SVGElem ent* referenceElement) const;
107 PassRefPtr<NodeList> getEnclosureList(const SVGRect&, SVGElement* referenceE lement) const; 107 PassRefPtr<NodeList> getEnclosureList(PassRefPtr<SVGRectTearOff>, SVGElement * referenceElement) const;
108 bool checkIntersection(SVGElement*, const SVGRect&) const; 108 bool checkIntersection(SVGElement*, PassRefPtr<SVGRectTearOff>) const;
109 bool checkEnclosure(SVGElement*, const SVGRect&) const; 109 bool checkEnclosure(SVGElement*, PassRefPtr<SVGRectTearOff>) const;
110 void deselectAll(); 110 void deselectAll();
111 111
112 static float createSVGNumber(); 112 static float createSVGNumber();
113 static PassRefPtr<SVGLengthTearOff> createSVGLength(); 113 static PassRefPtr<SVGLengthTearOff> createSVGLength();
114 static SVGAngle createSVGAngle(); 114 static SVGAngle createSVGAngle();
115 static SVGPoint createSVGPoint(); 115 static SVGPoint createSVGPoint();
116 static SVGMatrix createSVGMatrix(); 116 static SVGMatrix createSVGMatrix();
117 static SVGRect createSVGRect(); 117 static PassRefPtr<SVGRectTearOff> createSVGRect();
118 static SVGTransform createSVGTransform(); 118 static SVGTransform createSVGTransform();
119 static SVGTransform createSVGTransformFromMatrix(const SVGMatrix&); 119 static SVGTransform createSVGTransformFromMatrix(const SVGMatrix&);
120 120
121 AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) co nst; 121 AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) co nst;
122 122
123 void setupInitialView(const String& fragmentIdentifier, Element* anchorNode) ; 123 void setupInitialView(const String& fragmentIdentifier, Element* anchorNode) ;
124 124
125 Element* getElementById(const AtomicString&) const; 125 Element* getElementById(const AtomicString&) const;
126 126
127 bool widthAttributeEstablishesViewport() const; 127 bool widthAttributeEstablishesViewport() const;
128 bool heightAttributeEstablishesViewport() const; 128 bool heightAttributeEstablishesViewport() const;
129 129
130 SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; } 130 SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; }
131 void setZoomAndPan(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan ::parseFromNumber(zoomAndPan); } 131 void setZoomAndPan(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan ::parseFromNumber(zoomAndPan); }
132 132
133 bool hasEmptyViewBox() const { return viewBoxCurrentValue().isValid() && vie wBoxCurrentValue().isEmpty(); } 133 bool hasEmptyViewBox() const { return m_viewBox->currentValue()->isValid() & & m_viewBox->currentValue()->value().isEmpty(); }
134 134
135 SVGAnimatedLength* x() const { return m_x.get(); } 135 SVGAnimatedLength* x() const { return m_x.get(); }
136 SVGAnimatedLength* y() const { return m_y.get(); } 136 SVGAnimatedLength* y() const { return m_y.get(); }
137 SVGAnimatedLength* width() const { return m_width.get(); } 137 SVGAnimatedLength* width() const { return m_width.get(); }
138 SVGAnimatedLength* height() const { return m_height.get(); } 138 SVGAnimatedLength* height() const { return m_height.get(); }
139 SVGAnimatedRect* viewBox() const { return m_viewBox.get(); }
139 140
140 private: 141 private:
141 explicit SVGSVGElement(Document&); 142 explicit SVGSVGElement(Document&);
142 virtual ~SVGSVGElement(); 143 virtual ~SVGSVGElement();
143 144
144 virtual bool isSVGSVGElement() const OVERRIDE { return true; } 145 virtual bool isSVGSVGElement() const OVERRIDE { return true; }
145 146
146 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE; 147 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE;
147 148
148 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE; 149 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE;
149 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE; 150 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE;
150 151
151 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; 152 virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
152 virtual void removedFrom(ContainerNode*) OVERRIDE; 153 virtual void removedFrom(ContainerNode*) OVERRIDE;
153 154
154 virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE; 155 virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE;
155 156
156 virtual bool selfHasRelativeLengths() const OVERRIDE; 157 virtual bool selfHasRelativeLengths() const OVERRIDE;
157 158
158 void inheritViewAttributes(SVGViewElement*); 159 void inheritViewAttributes(SVGViewElement*);
159 160
160 enum CollectIntersectionOrEnclosure { 161 enum CollectIntersectionOrEnclosure {
161 CollectIntersectionList, 162 CollectIntersectionList,
162 CollectEnclosureList 163 CollectEnclosureList
163 }; 164 };
164 165
165 PassRefPtr<NodeList> collectIntersectionOrEnclosureList(const SVGRect&, SVGE lement*, CollectIntersectionOrEnclosure) const; 166 PassRefPtr<NodeList> collectIntersectionOrEnclosureList(const FloatRect&, SV GElement*, CollectIntersectionOrEnclosure) const;
166 167
167 RefPtr<SVGAnimatedLength> m_x; 168 RefPtr<SVGAnimatedLength> m_x;
168 RefPtr<SVGAnimatedLength> m_y; 169 RefPtr<SVGAnimatedLength> m_y;
169 RefPtr<SVGAnimatedLength> m_width; 170 RefPtr<SVGAnimatedLength> m_width;
170 RefPtr<SVGAnimatedLength> m_height; 171 RefPtr<SVGAnimatedLength> m_height;
172 RefPtr<SVGAnimatedRect> m_viewBox;
171 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGSVGElement) 173 BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGSVGElement)
172 DECLARE_ANIMATED_RECT(ViewBox, viewBox)
173 DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspect Ratio) 174 DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspect Ratio)
174 END_DECLARE_ANIMATED_PROPERTIES 175 END_DECLARE_ANIMATED_PROPERTIES
175 176
176 virtual AffineTransform localCoordinateSpaceTransform(SVGElement::CTMScope) const OVERRIDE; 177 virtual AffineTransform localCoordinateSpaceTransform(SVGElement::CTMScope) const OVERRIDE;
177 178
178 bool m_useCurrentView; 179 bool m_useCurrentView;
179 SVGZoomAndPanType m_zoomAndPan; 180 SVGZoomAndPanType m_zoomAndPan;
180 RefPtr<SMILTimeContainer> m_timeContainer; 181 RefPtr<SMILTimeContainer> m_timeContainer;
181 SVGPoint m_translation; 182 SVGPoint m_translation;
182 RefPtr<SVGViewSpec> m_viewSpec; 183 RefPtr<SVGViewSpec> m_viewSpec;
183 WeakPtrFactory<SVGSVGElement> m_weakFactory; 184 WeakPtrFactory<SVGSVGElement> m_weakFactory;
184 }; 185 };
185 186
186 inline bool isSVGSVGElement(const Node& node) 187 inline bool isSVGSVGElement(const Node& node)
187 { 188 {
188 return node.isSVGElement() && toSVGElement(node).isSVGSVGElement(); 189 return node.isSVGElement() && toSVGElement(node).isSVGSVGElement();
189 } 190 }
190 191
191 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGSVGElement); 192 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGSVGElement);
192 193
193 } // namespace WebCore 194 } // namespace WebCore
194 195
195 #endif 196 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698