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

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

Powered by Google App Engine
This is Rietveld 408576698