Changeset 143498 in webkit
- Timestamp:
- Feb 20, 2013 1:43:29 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r143490 r143498 1 2013-02-20 Florin Malita <fmalita@chromium.org> 2 3 [SVG] Update of element referenced by multiple 'use' nodes is absurdly slow 4 https://bugs.webkit.org/show_bug.cgi?id=97905 5 6 Reviewed by Dirk Schulze. 7 8 Rebuilding the shadow and instance trees of dependent use nodes recursively can be 9 extremely inefficient with non-trivial dependency graphs (the trees are not constructed 10 in topological order). 11 12 To avoid redundant buildShadowAndInstanceTree() invokations, separate the invalidation 13 phase from the actual tree (re)building phase, and only descend into the dependency DAG 14 during the invalidation phase (recursion also stops at nodes that have been previously 15 invalidated). 16 17 No new tests: functional coverage provided by existing tests, perfomance tracked by 18 PerformanceTests/SVG/SvgNestedUse.html. 19 20 * svg/SVGUseElement.cpp: 21 (WebCore::SVGUseElement::buildPendingResource): 22 (WebCore::SVGUseElement::buildShadowAndInstanceTree): 23 (WebCore::SVGUseElement::invalidateShadowTree): 24 (WebCore): 25 (WebCore::SVGUseElement::invalidateDependentShadowTrees): 26 * svg/SVGUseElement.h: 27 (SVGUseElement): 28 1 29 2013-02-20 Tim Horton <timothy_horton@apple.com> 2 30 -
trunk/Source/WebCore/svg/SVGUseElement.cpp
r143089 r143498 410 410 void SVGUseElement::buildPendingResource() 411 411 { 412 if (!referencedDocument() )412 if (!referencedDocument() || isInShadowTree()) 413 413 return; 414 414 clearResourceReferences(); 415 if (!inDocument() || isInShadowTree())415 if (!inDocument()) 416 416 return; 417 417 … … 431 431 } 432 432 433 if (target->isSVGElement()) 433 if (target->isSVGElement()) { 434 434 buildShadowAndInstanceTree(static_cast<SVGElement*>(target)); 435 invalidateDependentShadowTrees(); 436 } 437 435 438 ASSERT(!m_needsShadowTreeRecreation); 436 439 } … … 517 520 // Update relative length information. 518 521 updateRelativeLengthsInformation(); 519 520 // Rebuild all dependent use elements.521 ASSERT(document());522 document()->accessSVGExtensions()->rebuildAllElementReferencesForTarget(this);523 522 524 523 // Eventually dump instance tree … … 907 906 m_needsShadowTreeRecreation = true; 908 907 setNeedsStyleRecalc(); 908 invalidateDependentShadowTrees(); 909 } 910 911 void SVGUseElement::invalidateDependentShadowTrees() 912 { 913 // Recursively invalidate dependent <use> shadow trees 914 const HashSet<SVGElementInstance*>& instances = instancesForElement(); 915 const HashSet<SVGElementInstance*>::const_iterator end = instances.end(); 916 for (HashSet<SVGElementInstance*>::const_iterator it = instances.begin(); it != end; ++it) { 917 if (SVGUseElement* element = (*it)->correspondingUseElement()) { 918 ASSERT(element->inDocument()); 919 element->invalidateShadowTree(); 920 } 921 } 909 922 } 910 923 -
trunk/Source/WebCore/svg/SVGUseElement.h
r141066 r143498 51 51 SVGElementInstance* instanceForShadowTreeElement(Node*) const; 52 52 void invalidateShadowTree(); 53 void invalidateDependentShadowTrees(); 53 54 54 55 RenderObject* rendererClipChild() const;
Note: See TracChangeset
for help on using the changeset viewer.