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

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

Issue 2657443005: Migrate WTF::HashSet::add() to ::insert() [part 1 of N] (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann
3 * <zimmermann@kde.org> 3 * <zimmermann@kde.org>
4 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> 4 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
5 * Copyright (C) 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2008 Apple Inc. All rights reserved.
6 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 6 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
7 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 7 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 262
263 void SVGElement::setWebAnimatedAttribute(const QualifiedName& attribute, 263 void SVGElement::setWebAnimatedAttribute(const QualifiedName& attribute,
264 SVGPropertyBase* value) { 264 SVGPropertyBase* value) {
265 forSelfAndInstances(this, [&attribute, &value](SVGElement* element) { 265 forSelfAndInstances(this, [&attribute, &value](SVGElement* element) {
266 if (SVGAnimatedPropertyBase* animatedProperty = 266 if (SVGAnimatedPropertyBase* animatedProperty =
267 element->propertyFromAttribute(attribute)) { 267 element->propertyFromAttribute(attribute)) {
268 animatedProperty->setAnimatedValue(value); 268 animatedProperty->setAnimatedValue(value);
269 notifyAnimValChanged(element, attribute); 269 notifyAnimValChanged(element, attribute);
270 } 270 }
271 }); 271 });
272 ensureSVGRareData()->webAnimatedAttributes().add(&attribute); 272 ensureSVGRareData()->webAnimatedAttributes().insert(&attribute);
273 } 273 }
274 274
275 void SVGElement::clearWebAnimatedAttributes() { 275 void SVGElement::clearWebAnimatedAttributes() {
276 if (!hasSVGRareData()) 276 if (!hasSVGRareData())
277 return; 277 return;
278 for (const QualifiedName* attribute : 278 for (const QualifiedName* attribute :
279 svgRareData()->webAnimatedAttributes()) { 279 svgRareData()->webAnimatedAttributes()) {
280 forSelfAndInstances(this, [&attribute](SVGElement* element) { 280 forSelfAndInstances(this, [&attribute](SVGElement* element) {
281 if (SVGAnimatedPropertyBase* animatedProperty = 281 if (SVGAnimatedPropertyBase* animatedProperty =
282 element->propertyFromAttribute(*attribute)) { 282 element->propertyFromAttribute(*attribute)) {
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 // relative length map. Register the parent in the grandparents map, etc. 521 // relative length map. Register the parent in the grandparents map, etc.
522 // Repeat procedure until the root of the SVG tree. 522 // Repeat procedure until the root of the SVG tree.
523 for (Node& currentNode : NodeTraversal::inclusiveAncestorsOf(*this)) { 523 for (Node& currentNode : NodeTraversal::inclusiveAncestorsOf(*this)) {
524 if (!currentNode.isSVGElement()) 524 if (!currentNode.isSVGElement())
525 break; 525 break;
526 SVGElement& currentElement = toSVGElement(currentNode); 526 SVGElement& currentElement = toSVGElement(currentNode);
527 ASSERT(!currentElement.m_inRelativeLengthClientsInvalidation); 527 ASSERT(!currentElement.m_inRelativeLengthClientsInvalidation);
528 528
529 bool hadRelativeLengths = currentElement.hasRelativeLengths(); 529 bool hadRelativeLengths = currentElement.hasRelativeLengths();
530 if (clientHasRelativeLengths) 530 if (clientHasRelativeLengths)
531 currentElement.m_elementsWithRelativeLengths.add(clientElement); 531 currentElement.m_elementsWithRelativeLengths.insert(clientElement);
532 else 532 else
533 currentElement.m_elementsWithRelativeLengths.remove(clientElement); 533 currentElement.m_elementsWithRelativeLengths.remove(clientElement);
534 534
535 // If the relative length state hasn't changed, we can stop propagating the 535 // If the relative length state hasn't changed, we can stop propagating the
536 // notification. 536 // notification.
537 if (hadRelativeLengths == currentElement.hasRelativeLengths()) 537 if (hadRelativeLengths == currentElement.hasRelativeLengths())
538 return; 538 return;
539 539
540 clientElement = &currentElement; 540 clientElement = &currentElement;
541 clientHasRelativeLengths = clientElement->hasRelativeLengths(); 541 clientHasRelativeLengths = clientElement->hasRelativeLengths();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 } 607 }
608 608
609 void SVGElement::mapInstanceToElement(SVGElement* instance) { 609 void SVGElement::mapInstanceToElement(SVGElement* instance) {
610 ASSERT(instance); 610 ASSERT(instance);
611 ASSERT(instance->inUseShadowTree()); 611 ASSERT(instance->inUseShadowTree());
612 612
613 HeapHashSet<WeakMember<SVGElement>>& instances = 613 HeapHashSet<WeakMember<SVGElement>>& instances =
614 ensureSVGRareData()->elementInstances(); 614 ensureSVGRareData()->elementInstances();
615 ASSERT(!instances.contains(instance)); 615 ASSERT(!instances.contains(instance));
616 616
617 instances.add(instance); 617 instances.insert(instance);
618 } 618 }
619 619
620 void SVGElement::removeInstanceMapping(SVGElement* instance) { 620 void SVGElement::removeInstanceMapping(SVGElement* instance) {
621 ASSERT(instance); 621 ASSERT(instance);
622 ASSERT(instance->inUseShadowTree()); 622 ASSERT(instance->inUseShadowTree());
623 623
624 if (!hasSVGRareData()) 624 if (!hasSVGRareData())
625 return; 625 return;
626 626
627 HeapHashSet<WeakMember<SVGElement>>& instances = 627 HeapHashSet<WeakMember<SVGElement>>& instances =
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 1228
1229 SVGElementSet* SVGElement::setOfIncomingReferences() const { 1229 SVGElementSet* SVGElement::setOfIncomingReferences() const {
1230 if (!hasSVGRareData()) 1230 if (!hasSVGRareData())
1231 return nullptr; 1231 return nullptr;
1232 return &svgRareData()->incomingReferences(); 1232 return &svgRareData()->incomingReferences();
1233 } 1233 }
1234 1234
1235 void SVGElement::addReferenceTo(SVGElement* targetElement) { 1235 void SVGElement::addReferenceTo(SVGElement* targetElement) {
1236 ASSERT(targetElement); 1236 ASSERT(targetElement);
1237 1237
1238 ensureSVGRareData()->outgoingReferences().add(targetElement); 1238 ensureSVGRareData()->outgoingReferences().insert(targetElement);
1239 targetElement->ensureSVGRareData()->incomingReferences().add(this); 1239 targetElement->ensureSVGRareData()->incomingReferences().insert(this);
1240 } 1240 }
1241 1241
1242 void SVGElement::rebuildAllIncomingReferences() { 1242 void SVGElement::rebuildAllIncomingReferences() {
1243 if (!hasSVGRareData()) 1243 if (!hasSVGRareData())
1244 return; 1244 return;
1245 1245
1246 const SVGElementSet& incomingReferences = svgRareData()->incomingReferences(); 1246 const SVGElementSet& incomingReferences = svgRareData()->incomingReferences();
1247 1247
1248 // Iterate on a snapshot as |incomingReferences| may be altered inside loop. 1248 // Iterate on a snapshot as |incomingReferences| may be altered inside loop.
1249 HeapVector<Member<SVGElement>> incomingReferencesSnapshot; 1249 HeapVector<Member<SVGElement>> incomingReferencesSnapshot;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 visitor->trace(m_className); 1289 visitor->trace(m_className);
1290 Element::trace(visitor); 1290 Element::trace(visitor);
1291 } 1291 }
1292 1292
1293 const AtomicString& SVGElement::eventParameterName() { 1293 const AtomicString& SVGElement::eventParameterName() {
1294 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); 1294 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt"));
1295 return evtString; 1295 return evtString;
1296 } 1296 }
1297 1297
1298 } // namespace blink 1298 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp ('k') | third_party/WebKit/Source/core/svg/SVGElementProxy.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698