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

Unified Diff: third_party/WebKit/Source/core/svg/SVGElement.cpp

Issue 2293173003: Move SVGAnimateElement::findElementInstances to SVGElement.cpp (Closed)
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698