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

Side by Side Diff: Source/core/svg/SVGElement.cpp

Issue 298873003: SVG: SVGAnimateElement should not cache |m_animatedElements| (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: revert change on SVGElementInstance.cpp 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
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, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
4 * Copyright (C) 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2008 Apple Inc. All rights reserved.
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 } 1041 }
1042 1042
1043 bool SVGElement::hasFocusEventListeners() const 1043 bool SVGElement::hasFocusEventListeners() const
1044 { 1044 {
1045 return hasEventListeners(EventTypeNames::focusin) || hasEventListeners(Event TypeNames::focusout) 1045 return hasEventListeners(EventTypeNames::focusin) || hasEventListeners(Event TypeNames::focusout)
1046 || hasEventListeners(EventTypeNames::focus) || hasEventListeners(EventTy peNames::blur); 1046 || hasEventListeners(EventTypeNames::focus) || hasEventListeners(EventTy peNames::blur);
1047 } 1047 }
1048 1048
1049 void SVGElement::invalidateInstances() 1049 void SVGElement::invalidateInstances()
1050 { 1050 {
1051 if (!inDocument())
1052 return;
1053
1054 if (instanceUpdatesBlocked()) 1051 if (instanceUpdatesBlocked())
1055 return; 1052 return;
1056 1053
1057 const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >& set = instance sForElement(); 1054 const WillBeHeapHashSet<RawPtrWillBeMember<SVGElement> >& set = instancesFor Element();
1058 if (set.isEmpty()) 1055 if (set.isEmpty())
1059 return; 1056 return;
1060 1057
1058 // Take snapshot of the |set|, as it may be be modified from |invalidateShad owTree()|.
1059 WillBeHeapVector<RawPtrWillBeWeakMember<SVGElement> > snapshot;
1060 copyToVector(set, snapshot);
1061
1061 // Mark all use elements referencing 'element' for rebuilding 1062 // Mark all use elements referencing 'element' for rebuilding
1062 const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator end = set.end(); 1063 for (WillBeHeapVector<RawPtrWillBeWeakMember<SVGElement> >::const_iterator i t = snapshot.begin(), end = snapshot.end(); it != end; ++it) {
1063 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator it = set.begin(); it != end; ++it) { 1064 SVGElement* element = *it;
1064 (*it)->setCorrespondingElement(0); 1065 if (!element)
1066 continue;
1065 1067
1066 if (SVGUseElement* element = (*it)->correspondingUseElement()) { 1068 element->setCorrespondingElement(0);
1067 ASSERT(element->inDocument()); 1069
1068 element->invalidateShadowTree(); 1070 if (SVGUseElement* useElement = element->correspondingUseElement()) {
1071 ASSERT(useElement->inDocument());
1072 useElement->invalidateShadowTree();
1069 } 1073 }
1070 } 1074 }
1071 1075
1072 document().updateRenderTreeIfNeeded(); 1076 if (inDocument())
1077 document().updateUseShadowTreesIfNeeded();
1073 } 1078 }
1074 1079
1075 SVGElement::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* targetEleme nt) 1080 SVGElement::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* targetEleme nt)
1076 : m_targetElement(targetElement) 1081 : m_targetElement(targetElement)
1077 { 1082 {
1078 if (m_targetElement) 1083 if (m_targetElement)
1079 m_targetElement->setInstanceUpdatesBlocked(true); 1084 m_targetElement->setInstanceUpdatesBlocked(true);
1080 } 1085 }
1081 1086
1082 SVGElement::InstanceUpdateBlocker::~InstanceUpdateBlocker() 1087 SVGElement::InstanceUpdateBlocker::~InstanceUpdateBlocker()
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 animatableAttributes.add(SVGNames::zAttr); 1190 animatableAttributes.add(SVGNames::zAttr);
1186 } 1191 }
1187 1192
1188 if (name == classAttr) 1193 if (name == classAttr)
1189 return true; 1194 return true;
1190 1195
1191 return animatableAttributes.contains(name); 1196 return animatableAttributes.contains(name);
1192 } 1197 }
1193 #endif 1198 #endif
1194 } 1199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698