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

Unified Diff: Source/core/svg/SVGUseElement.cpp

Issue 298873003: SVG: SVGAnimateElement should not cache |m_animatedElements| (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/svg/SVGUseElement.cpp
diff --git a/Source/core/svg/SVGUseElement.cpp b/Source/core/svg/SVGUseElement.cpp
index 834dae3f388245f2708a391447448c2590af45e8..98994321bb8f31b22469b2107a18abc5691c5d9c 100644
--- a/Source/core/svg/SVGUseElement.cpp
+++ b/Source/core/svg/SVGUseElement.cpp
@@ -45,6 +45,7 @@
namespace WebCore {
+
inline SVGUseElement::SVGUseElement(Document& document, bool wasInsertedByParser)
: SVGGraphicsElement(SVGNames::useTag, document)
, SVGURIReference(this)
@@ -370,6 +371,18 @@ void SVGUseElement::buildPendingResource()
ASSERT(!m_needsShadowTreeRecreation);
}
+namespace {
+
+void restartSMILAnimationsForShadowTreeElements(SVGElement* shadowTreeTargetElement)
+{
+ shadowTreeTargetElement->document().accessSVGExtensions().rebuildSMILElementReferencesForTarget(shadowTreeTargetElement);
+
+ for (SVGElement* child = Traversal<SVGElement>::firstChild(*shadowTreeTargetElement); child; child = Traversal<SVGElement>::nextSibling(*child))
+ restartSMILAnimationsForShadowTreeElements(child);
+}
+
+} // namespace
+
void SVGUseElement::buildShadowAndInstanceTree(SVGElement* target)
{
ASSERT(!m_targetElementInstance);
@@ -457,6 +470,9 @@ void SVGUseElement::buildShadowAndInstanceTree(SVGElement* target)
// Update relative length information.
updateRelativeLengthsInformation();
+
+ // SMIL animations need to be restarted in order to include elements inside new shadow tree.
+ restartSMILAnimationsForShadowTreeElements(shadowTreeTargetElement);
}
RenderObject* SVGUseElement::createRenderer(RenderStyle*)

Powered by Google App Engine
This is Rietveld 408576698