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

Side by Side 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: remove notification from detach 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGElementInstance.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
6 * Copyright (C) 2012 University of Szeged 6 * Copyright (C) 2012 University of Szeged
7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> 7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org>
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 } 357 }
358 358
359 if (target->isSVGElement()) { 359 if (target->isSVGElement()) {
360 buildShadowAndInstanceTree(toSVGElement(target)); 360 buildShadowAndInstanceTree(toSVGElement(target));
361 invalidateDependentShadowTrees(); 361 invalidateDependentShadowTrees();
362 } 362 }
363 363
364 ASSERT(!m_needsShadowTreeRecreation); 364 ASSERT(!m_needsShadowTreeRecreation);
365 } 365 }
366 366
367 namespace {
368
369 void rebuildNonUseElementReferencesForTree(SVGElement* shadowTreeTargetElement)
370 {
371 shadowTreeTargetElement->document().accessSVGExtensions().rebuildAllElementR eferencesForTarget(shadowTreeTargetElement, SVGDocumentExtensions::ExcludeUseEle ments);
372
373 for (SVGElement* child = Traversal<SVGElement>::firstChild(*shadowTreeTarget Element); child; child = Traversal<SVGElement>::nextSibling(*child))
374 rebuildNonUseElementReferencesForTree(child);
375 }
376
377 } // namespace
378
367 void SVGUseElement::buildShadowAndInstanceTree(SVGElement* target) 379 void SVGUseElement::buildShadowAndInstanceTree(SVGElement* target)
368 { 380 {
369 ASSERT(!m_targetElementInstance); 381 ASSERT(!m_targetElementInstance);
370 382
371 // <use> creates a "user agent" shadow root. Do not build the shadow/instanc e tree for <use> 383 // <use> creates a "user agent" shadow root. Do not build the shadow/instanc e tree for <use>
372 // elements living in a user agent shadow tree because they will get expande d in a second 384 // elements living in a user agent shadow tree because they will get expande d in a second
373 // pass -- see expandUseElementsInShadowTree(). 385 // pass -- see expandUseElementsInShadowTree().
374 if (inUseShadowTree()) 386 if (inUseShadowTree())
375 return; 387 return;
376 388
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 ASSERT(shadowTreeTargetElement->correspondingElement()); 456 ASSERT(shadowTreeTargetElement->correspondingElement());
445 transferUseWidthAndHeightIfNeeded(*this, shadowTreeTargetElement, *shadowTre eTargetElement->correspondingElement()); 457 transferUseWidthAndHeightIfNeeded(*this, shadowTreeTargetElement, *shadowTre eTargetElement->correspondingElement());
446 458
447 ASSERT(shadowTreeTargetElement->parentNode() == shadowTreeRootElement); 459 ASSERT(shadowTreeTargetElement->parentNode() == shadowTreeRootElement);
448 460
449 // Transfer event listeners assigned to the referenced element to our shadow tree elements. 461 // Transfer event listeners assigned to the referenced element to our shadow tree elements.
450 transferEventListenersToShadowTree(shadowTreeTargetElement); 462 transferEventListenersToShadowTree(shadowTreeTargetElement);
451 463
452 // Update relative length information. 464 // Update relative length information.
453 updateRelativeLengthsInformation(); 465 updateRelativeLengthsInformation();
466
467 // Element references need to be rebuilt to include the new shadow tree.
468 // <use> elements are excluded from notification to avoid infinite loop.
469 rebuildNonUseElementReferencesForTree(target);
kouhei (in TOK) 2014/05/26 04:35:45 here.
454 } 470 }
455 471
456 RenderObject* SVGUseElement::createRenderer(RenderStyle*) 472 RenderObject* SVGUseElement::createRenderer(RenderStyle*)
457 { 473 {
458 return new RenderSVGTransformableContainer(this); 474 return new RenderSVGTransformableContainer(this);
459 } 475 }
460 476
461 static bool isDirectReference(const Node& node) 477 static bool isDirectReference(const Node& node)
462 { 478 {
463 return isSVGPathElement(node) 479 return isSVGPathElement(node)
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 m_resource->addClient(this); 926 m_resource->addClient(this);
911 } 927 }
912 928
913 void SVGUseElement::trace(Visitor* visitor) 929 void SVGUseElement::trace(Visitor* visitor)
914 { 930 {
915 visitor->trace(m_targetElementInstance); 931 visitor->trace(m_targetElementInstance);
916 SVGGraphicsElement::trace(visitor); 932 SVGGraphicsElement::trace(visitor);
917 } 933 }
918 934
919 } 935 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGElementInstance.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698