OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org> | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org> |
3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2008 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) 2008 Alp Toker <alp@atoker.com> | 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 24 matching lines...) Expand all Loading... | |
35 #include "core/css/CSSCursorImageValue.h" | 35 #include "core/css/CSSCursorImageValue.h" |
36 #include "core/css/resolver/StyleResolver.h" | 36 #include "core/css/resolver/StyleResolver.h" |
37 #include "core/dom/Document.h" | 37 #include "core/dom/Document.h" |
38 #include "core/dom/ElementTraversal.h" | 38 #include "core/dom/ElementTraversal.h" |
39 #include "core/dom/shadow/ShadowRoot.h" | 39 #include "core/dom/shadow/ShadowRoot.h" |
40 #include "core/events/Event.h" | 40 #include "core/events/Event.h" |
41 #include "core/frame/Settings.h" | 41 #include "core/frame/Settings.h" |
42 #include "core/html/HTMLElement.h" | 42 #include "core/html/HTMLElement.h" |
43 #include "core/layout/LayoutObject.h" | 43 #include "core/layout/LayoutObject.h" |
44 #include "core/layout/svg/LayoutSVGResourceContainer.h" | 44 #include "core/layout/svg/LayoutSVGResourceContainer.h" |
45 #include "core/svg/SVGAnimateElement.h" | |
46 #include "core/svg/SVGCursorElement.h" | 45 #include "core/svg/SVGCursorElement.h" |
47 #include "core/svg/SVGDocumentExtensions.h" | 46 #include "core/svg/SVGDocumentExtensions.h" |
48 #include "core/svg/SVGElementRareData.h" | 47 #include "core/svg/SVGElementRareData.h" |
49 #include "core/svg/SVGGraphicsElement.h" | 48 #include "core/svg/SVGGraphicsElement.h" |
50 #include "core/svg/SVGSVGElement.h" | 49 #include "core/svg/SVGSVGElement.h" |
51 #include "core/svg/SVGTitleElement.h" | 50 #include "core/svg/SVGTitleElement.h" |
52 #include "core/svg/SVGUseElement.h" | 51 #include "core/svg/SVGUseElement.h" |
53 #include "core/svg/properties/SVGProperty.h" | 52 #include "core/svg/properties/SVGProperty.h" |
54 #include "wtf/AutoReset.h" | 53 #include "wtf/AutoReset.h" |
55 #include "wtf/Threading.h" | 54 #include "wtf/Threading.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
236 } | 235 } |
237 svgRareData()->setWebAnimatedAttributesDirty(false); | 236 svgRareData()->setWebAnimatedAttributesDirty(false); |
238 } | 237 } |
239 | 238 |
240 static inline void notifyAnimValChanged(SVGElement* targetElement, const Qualifi edName& attributeName) | 239 static inline void notifyAnimValChanged(SVGElement* targetElement, const Qualifi edName& attributeName) |
241 { | 240 { |
242 targetElement->invalidateSVGAttributes(); | 241 targetElement->invalidateSVGAttributes(); |
243 targetElement->svgAttributeChanged(attributeName); | 242 targetElement->svgAttributeChanged(attributeName); |
244 } | 243 } |
245 | 244 |
245 // The size of SVGElementInstances is 1 unless there is a <use> instance of the element. | |
246 using SVGElementInstances = HeapVector<Member<SVGElement>, 1u>; | |
247 | |
248 static SVGElementInstances findElementInstances(SVGElement* element) | |
pdr.
2016/08/30 23:06:51
This looks great. WDYT about taking it one step fu
fs
2016/08/31 09:00:35
I was considering doing that separately (in case t
| |
249 { | |
250 SVGElementInstances animatedElements; | |
251 animatedElements.append(element); | |
252 | |
253 const auto& instances = element->instancesForElement(); | |
254 animatedElements.appendRange(instances.begin(), instances.end()); | |
255 | |
256 return animatedElements; | |
257 } | |
258 | |
246 template<typename T> | 259 template<typename T> |
247 static void forSelfAndInstances(SVGElement* element, T callback) | 260 static void forSelfAndInstances(SVGElement* element, T callback) |
248 { | 261 { |
249 SVGElement::InstanceUpdateBlocker blocker(element); | 262 SVGElement::InstanceUpdateBlocker blocker(element); |
250 for (SVGElement* instance : SVGAnimateElement::findElementInstances(element) ) | 263 for (SVGElement* instance : findElementInstances(element)) |
251 callback(instance); | 264 callback(instance); |
252 } | 265 } |
253 | 266 |
254 void SVGElement::setWebAnimatedAttribute(const QualifiedName& attribute, SVGProp ertyBase* value) | 267 void SVGElement::setWebAnimatedAttribute(const QualifiedName& attribute, SVGProp ertyBase* value) |
255 { | 268 { |
256 forSelfAndInstances(this, [&attribute, &value](SVGElement* element) { | 269 forSelfAndInstances(this, [&attribute, &value](SVGElement* element) { |
257 if (SVGAnimatedPropertyBase* animatedProperty = element->propertyFromAtt ribute(attribute)) { | 270 if (SVGAnimatedPropertyBase* animatedProperty = element->propertyFromAtt ribute(attribute)) { |
258 animatedProperty->setAnimatedValue(value); | 271 animatedProperty->setAnimatedValue(value); |
259 notifyAnimValChanged(element, attribute); | 272 notifyAnimValChanged(element, attribute); |
260 } | 273 } |
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1208 Element::trace(visitor); | 1221 Element::trace(visitor); |
1209 } | 1222 } |
1210 | 1223 |
1211 const AtomicString& SVGElement::eventParameterName() | 1224 const AtomicString& SVGElement::eventParameterName() |
1212 { | 1225 { |
1213 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); | 1226 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); |
1214 return evtString; | 1227 return evtString; |
1215 } | 1228 } |
1216 | 1229 |
1217 } // namespace blink | 1230 } // namespace blink |
OLD | NEW |