Chromium Code Reviews| Index: third_party/WebKit/Source/core/svg/SVGElement.cpp |
| diff --git a/third_party/WebKit/Source/core/svg/SVGElement.cpp b/third_party/WebKit/Source/core/svg/SVGElement.cpp |
| index 00919b333634309bef89b043b880234a655f4ede..09b67c0bebf15e21e19ae71dba2758fdeae4545e 100644 |
| --- a/third_party/WebKit/Source/core/svg/SVGElement.cpp |
| +++ b/third_party/WebKit/Source/core/svg/SVGElement.cpp |
| @@ -42,7 +42,6 @@ |
| #include "core/html/HTMLElement.h" |
| #include "core/layout/LayoutObject.h" |
| #include "core/layout/svg/LayoutSVGResourceContainer.h" |
| -#include "core/svg/SVGAnimateElement.h" |
| #include "core/svg/SVGCursorElement.h" |
| #include "core/svg/SVGDocumentExtensions.h" |
| #include "core/svg/SVGElementRareData.h" |
| @@ -243,11 +242,25 @@ static inline void notifyAnimValChanged(SVGElement* targetElement, const Qualifi |
| targetElement->svgAttributeChanged(attributeName); |
| } |
| +// The size of SVGElementInstances is 1 unless there is a <use> instance of the element. |
| +using SVGElementInstances = HeapVector<Member<SVGElement>, 1u>; |
| + |
| +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
|
| +{ |
| + SVGElementInstances animatedElements; |
| + animatedElements.append(element); |
| + |
| + const auto& instances = element->instancesForElement(); |
| + animatedElements.appendRange(instances.begin(), instances.end()); |
| + |
| + return animatedElements; |
| +} |
| + |
| template<typename T> |
| static void forSelfAndInstances(SVGElement* element, T callback) |
| { |
| SVGElement::InstanceUpdateBlocker blocker(element); |
| - for (SVGElement* instance : SVGAnimateElement::findElementInstances(element)) |
| + for (SVGElement* instance : findElementInstances(element)) |
| callback(instance); |
| } |