Chromium Code Reviews| Index: Source/core/svg/SVGElement.cpp |
| diff --git a/Source/core/svg/SVGElement.cpp b/Source/core/svg/SVGElement.cpp |
| index 6e840b75e4a5f90e0f44eee00700bcb6d222bf13..59b75b66dd61ce8483d1ff83e0831e665e1a84b7 100644 |
| --- a/Source/core/svg/SVGElement.cpp |
| +++ b/Source/core/svg/SVGElement.cpp |
| @@ -1042,9 +1042,6 @@ bool SVGElement::hasFocusEventListeners() const |
| void SVGElement::invalidateInstances() |
| { |
| - if (!inDocument()) |
| - return; |
| - |
| if (instanceUpdatesBlocked()) |
| return; |
| @@ -1052,9 +1049,14 @@ void SVGElement::invalidateInstances() |
| if (set.isEmpty()) |
| return; |
| + // Take snapshot of the |set|, as it may be be modified from |invalidateShadowTree()|. |
| + WillBeHeapVector<RawPtrWillBeWeakMember<SVGElement> > snapshot; |
| + for (WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator it = set.begin(), end = set.end(); it != end; ++it) { |
| + snapshot.append(*it); |
|
esprehn
2014/05/23 04:38:17
I think you want copyToVector? Also these braces a
kouhei (in TOK)
2014/05/23 07:17:15
Done.
|
| + } |
| + |
| // Mark all use elements referencing 'element' for rebuilding |
| - const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator end = set.end(); |
| - for (WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator it = set.begin(); it != end; ++it) { |
| + for (WillBeHeapVector<RawPtrWillBeWeakMember<SVGElement> >::const_iterator it = snapshot.begin(), end = snapshot.end(); it != end; ++it) { |
| (*it)->setCorrespondingElement(0); |
| if (SVGUseElement* element = (*it)->correspondingUseElement()) { |
| @@ -1063,7 +1065,8 @@ void SVGElement::invalidateInstances() |
| } |
| } |
| - document().updateRenderTreeIfNeeded(); |
| + if (inDocument()) |
| + document().updateUseShadowTreesIfNeeded(); |
| } |
| SVGElement::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* targetElement) |