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

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: 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 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 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 } 1035 }
1036 1036
1037 bool SVGElement::hasFocusEventListeners() const 1037 bool SVGElement::hasFocusEventListeners() const
1038 { 1038 {
1039 return hasEventListeners(EventTypeNames::focusin) || hasEventListeners(Event TypeNames::focusout) 1039 return hasEventListeners(EventTypeNames::focusin) || hasEventListeners(Event TypeNames::focusout)
1040 || hasEventListeners(EventTypeNames::focus) || hasEventListeners(EventTy peNames::blur); 1040 || hasEventListeners(EventTypeNames::focus) || hasEventListeners(EventTy peNames::blur);
1041 } 1041 }
1042 1042
1043 void SVGElement::invalidateInstances() 1043 void SVGElement::invalidateInstances()
1044 { 1044 {
1045 if (!inDocument())
1046 return;
1047
1048 if (instanceUpdatesBlocked()) 1045 if (instanceUpdatesBlocked())
1049 return; 1046 return;
1050 1047
1051 const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >& set = instance sForElement(); 1048 const WillBeHeapHashSet<RawPtrWillBeMember<SVGElement> >& set = instancesFor Element();
1052 if (set.isEmpty()) 1049 if (set.isEmpty())
1053 return; 1050 return;
1054 1051
1052 // Take snapshot of the |set|, as it may be be modified from |invalidateShad owTree()|.
1053 WillBeHeapVector<RawPtrWillBeWeakMember<SVGElement> > snapshot;
1054 copyToVector(set, snapshot);
1055
1055 // Mark all use elements referencing 'element' for rebuilding 1056 // Mark all use elements referencing 'element' for rebuilding
1056 const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator end = set.end(); 1057 for (WillBeHeapVector<RawPtrWillBeWeakMember<SVGElement> >::const_iterator i t = snapshot.begin(), end = snapshot.end(); it != end; ++it) {
1057 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement> >::const_iterator it = set.begin(); it != end; ++it) { 1058 SVGElement* element = *it;
1058 (*it)->setCorrespondingElement(0); 1059 if (!element)
1060 continue;
1059 1061
1060 if (SVGUseElement* element = (*it)->correspondingUseElement()) { 1062 element->setCorrespondingElement(0);
1061 ASSERT(element->inDocument()); 1063
1062 element->invalidateShadowTree(); 1064 if (SVGUseElement* useElement = element->correspondingUseElement()) {
1065 ASSERT(useElement->inDocument());
1066 useElement->invalidateShadowTree();
1063 } 1067 }
1064 } 1068 }
1065 1069
1066 document().updateRenderTreeIfNeeded(); 1070 if (inDocument())
1071 document().updateUseShadowTreesIfNeeded();
1067 } 1072 }
1068 1073
1069 SVGElement::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* targetEleme nt) 1074 SVGElement::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* targetEleme nt)
1070 : m_targetElement(targetElement) 1075 : m_targetElement(targetElement)
1071 { 1076 {
1072 if (m_targetElement) 1077 if (m_targetElement)
1073 m_targetElement->setInstanceUpdatesBlocked(true); 1078 m_targetElement->setInstanceUpdatesBlocked(true);
1074 } 1079 }
1075 1080
1076 SVGElement::InstanceUpdateBlocker::~InstanceUpdateBlocker() 1081 SVGElement::InstanceUpdateBlocker::~InstanceUpdateBlocker()
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 animatableAttributes.add(SVGNames::zAttr); 1184 animatableAttributes.add(SVGNames::zAttr);
1180 } 1185 }
1181 1186
1182 if (name == classAttr) 1187 if (name == classAttr)
1183 return true; 1188 return true;
1184 1189
1185 return animatableAttributes.contains(name); 1190 return animatableAttributes.contains(name);
1186 } 1191 }
1187 #endif 1192 #endif
1188 } 1193 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698