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

Side by Side Diff: Source/core/svg/SVGAnimateElement.cpp

Issue 266063002: Store SVGElement instead of SVGElementInstance for instancesForElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4 * Copyright (C) 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2008 Apple Inc. All rights reserved.
5 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 141
142 namespace { 142 namespace {
143 143
144 Vector<SVGElement*> findElementInstances(SVGElement* targetElement) 144 Vector<SVGElement*> findElementInstances(SVGElement* targetElement)
145 { 145 {
146 ASSERT(targetElement); 146 ASSERT(targetElement);
147 Vector<SVGElement*> animatedElements; 147 Vector<SVGElement*> animatedElements;
148 148
149 animatedElements.append(targetElement); 149 animatedElements.append(targetElement);
150 150
151 const HashSet<SVGElementInstance*>& instances = targetElement->instancesForE lement(); 151 const HashSet<SVGElement*>& instances = targetElement->instancesForElement() ;
152 const HashSet<SVGElementInstance*>::const_iterator end = instances.end(); 152 const HashSet<SVGElement*>::const_iterator end = instances.end();
153 for (HashSet<SVGElementInstance*>::const_iterator it = instances.begin(); it != end; ++it) { 153 for (HashSet<SVGElement*>::const_iterator it = instances.begin(); it != end; ++it) {
154 if (SVGElement* shadowTreeElement = (*it)->shadowTreeElement()) 154 if (SVGElement* shadowTreeElement = *it)
155 animatedElements.append(shadowTreeElement); 155 animatedElements.append(shadowTreeElement);
156 } 156 }
157 157
158 return animatedElements; 158 return animatedElements;
159 } 159 }
160 160
161 } 161 }
162 162
163 void SVGAnimateElement::resetAnimatedType() 163 void SVGAnimateElement::resetAnimatedType()
164 { 164 {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 ASSERT(targetElement); 224 ASSERT(targetElement);
225 if (attributeName == anyQName() || !targetElement->inDocument() || !targetEl ement->parentNode()) 225 if (attributeName == anyQName() || !targetElement->inDocument() || !targetEl ement->parentNode())
226 return; 226 return;
227 227
228 CSSPropertyID id = cssPropertyID(attributeName.localName()); 228 CSSPropertyID id = cssPropertyID(attributeName.localName());
229 229
230 SVGElementInstance::InstanceUpdateBlocker blocker(targetElement); 230 SVGElementInstance::InstanceUpdateBlocker blocker(targetElement);
231 applyCSSPropertyToTarget(targetElement, id, valueAsString); 231 applyCSSPropertyToTarget(targetElement, id, valueAsString);
232 232
233 // If the target element has instances, update them as well, w/o requiring t he <use> tree to be rebuilt. 233 // If the target element has instances, update them as well, w/o requiring t he <use> tree to be rebuilt.
234 const HashSet<SVGElementInstance*>& instances = targetElement->instancesForE lement(); 234 const HashSet<SVGElement*>& instances = targetElement->instancesForElement() ;
235 const HashSet<SVGElementInstance*>::const_iterator end = instances.end(); 235 const HashSet<SVGElement*>::const_iterator end = instances.end();
236 for (HashSet<SVGElementInstance*>::const_iterator it = instances.begin(); it != end; ++it) { 236 for (HashSet<SVGElement*>::const_iterator it = instances.begin(); it != end; ++it) {
237 if (SVGElement* shadowTreeElement = (*it)->shadowTreeElement()) 237 if (SVGElement* shadowTreeElement = *it)
238 applyCSSPropertyToTarget(shadowTreeElement, id, valueAsString); 238 applyCSSPropertyToTarget(shadowTreeElement, id, valueAsString);
239 } 239 }
240 } 240 }
241 241
242 static inline void removeCSSPropertyFromTargetAndInstances(SVGElement* targetEle ment, const QualifiedName& attributeName) 242 static inline void removeCSSPropertyFromTargetAndInstances(SVGElement* targetEle ment, const QualifiedName& attributeName)
243 { 243 {
244 ASSERT(targetElement); 244 ASSERT(targetElement);
245 if (attributeName == anyQName() || !targetElement->inDocument() || !targetEl ement->parentNode()) 245 if (attributeName == anyQName() || !targetElement->inDocument() || !targetEl ement->parentNode())
246 return; 246 return;
247 247
248 CSSPropertyID id = cssPropertyID(attributeName.localName()); 248 CSSPropertyID id = cssPropertyID(attributeName.localName());
249 249
250 SVGElementInstance::InstanceUpdateBlocker blocker(targetElement); 250 SVGElementInstance::InstanceUpdateBlocker blocker(targetElement);
251 removeCSSPropertyFromTarget(targetElement, id); 251 removeCSSPropertyFromTarget(targetElement, id);
252 252
253 // If the target element has instances, update them as well, w/o requiring t he <use> tree to be rebuilt. 253 // If the target element has instances, update them as well, w/o requiring t he <use> tree to be rebuilt.
254 const HashSet<SVGElementInstance*>& instances = targetElement->instancesForE lement(); 254 const HashSet<SVGElement*>& instances = targetElement->instancesForElement() ;
255 const HashSet<SVGElementInstance*>::const_iterator end = instances.end(); 255 const HashSet<SVGElement*>::const_iterator end = instances.end();
256 for (HashSet<SVGElementInstance*>::const_iterator it = instances.begin(); it != end; ++it) { 256 for (HashSet<SVGElement*>::const_iterator it = instances.begin(); it != end; ++it) {
257 if (SVGElement* shadowTreeElement = (*it)->shadowTreeElement()) 257 if (SVGElement* shadowTreeElement = *it)
258 removeCSSPropertyFromTarget(shadowTreeElement, id); 258 removeCSSPropertyFromTarget(shadowTreeElement, id);
259 } 259 }
260 } 260 }
261 261
262 static inline void notifyTargetAboutAnimValChange(SVGElement* targetElement, con st QualifiedName& attributeName) 262 static inline void notifyTargetAboutAnimValChange(SVGElement* targetElement, con st QualifiedName& attributeName)
263 { 263 {
264 ASSERT_WITH_SECURITY_IMPLICATION(!targetElement->m_deletionHasBegun); 264 ASSERT_WITH_SECURITY_IMPLICATION(!targetElement->m_deletionHasBegun);
265 targetElement->invalidateSVGAttributes(); 265 targetElement->invalidateSVGAttributes();
266 targetElement->svgAttributeChanged(attributeName); 266 targetElement->svgAttributeChanged(attributeName);
267 } 267 }
268 268
269 static inline void notifyTargetAndInstancesAboutAnimValChange(SVGElement* target Element, const QualifiedName& attributeName) 269 static inline void notifyTargetAndInstancesAboutAnimValChange(SVGElement* target Element, const QualifiedName& attributeName)
270 { 270 {
271 ASSERT(targetElement); 271 ASSERT(targetElement);
272 if (attributeName == anyQName() || !targetElement->inDocument() || !targetEl ement->parentNode()) 272 if (attributeName == anyQName() || !targetElement->inDocument() || !targetEl ement->parentNode())
273 return; 273 return;
274 274
275 SVGElementInstance::InstanceUpdateBlocker blocker(targetElement); 275 SVGElementInstance::InstanceUpdateBlocker blocker(targetElement);
276 notifyTargetAboutAnimValChange(targetElement, attributeName); 276 notifyTargetAboutAnimValChange(targetElement, attributeName);
277 277
278 // If the target element has instances, update them as well, w/o requiring t he <use> tree to be rebuilt. 278 // If the target element has instances, update them as well, w/o requiring t he <use> tree to be rebuilt.
279 const HashSet<SVGElementInstance*>& instances = targetElement->instancesForE lement(); 279 const HashSet<SVGElement*>& instances = targetElement->instancesForElement() ;
280 const HashSet<SVGElementInstance*>::const_iterator end = instances.end(); 280 const HashSet<SVGElement*>::const_iterator end = instances.end();
281 for (HashSet<SVGElementInstance*>::const_iterator it = instances.begin(); it != end; ++it) { 281 for (HashSet<SVGElement*>::const_iterator it = instances.begin(); it != end; ++it) {
282 if (SVGElement* shadowTreeElement = (*it)->shadowTreeElement()) 282 if (SVGElement* shadowTreeElement = *it)
283 notifyTargetAboutAnimValChange(shadowTreeElement, attributeName); 283 notifyTargetAboutAnimValChange(shadowTreeElement, attributeName);
284 } 284 }
285 } 285 }
286 286
287 void SVGAnimateElement::clearAnimatedType(SVGElement* targetElement) 287 void SVGAnimateElement::clearAnimatedType(SVGElement* targetElement)
288 { 288 {
289 if (!m_animatedProperty) 289 if (!m_animatedProperty)
290 return; 290 return;
291 291
292 if (!targetElement) { 292 if (!targetElement) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 392
393 SVGAnimatedTypeAnimator* SVGAnimateElement::ensureAnimator() 393 SVGAnimatedTypeAnimator* SVGAnimateElement::ensureAnimator()
394 { 394 {
395 if (!m_animator) 395 if (!m_animator)
396 m_animator = SVGAnimatedTypeAnimator::create(m_animatedPropertyType, thi s, targetElement()); 396 m_animator = SVGAnimatedTypeAnimator::create(m_animatedPropertyType, thi s, targetElement());
397 ASSERT(m_animatedPropertyType == m_animator->type()); 397 ASSERT(m_animatedPropertyType == m_animator->type());
398 return m_animator.get(); 398 return m_animator.get();
399 } 399 }
400 400
401 } 401 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698