Changeset 161096 in webkit
- Timestamp:
- Dec 26, 2013 6:55:57 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r161094 r161096 1 2013-12-26 Sam Weinig <sam@webkit.org> 2 3 Convert some of WebCore/dom over to range-for loops 4 https://bugs.webkit.org/show_bug.cgi?id=126250 5 6 Reviewed by Andreas Kling. 7 8 * dom/ContainerNode.cpp: 9 * dom/Document.cpp: 10 * dom/MutationObserver.cpp: 11 * dom/MutationObserverInterestGroup.cpp: 12 * dom/MutationObserverRegistration.cpp: 13 * dom/Node.cpp: 14 * dom/NodeRareData.h: 15 * dom/ScriptExecutionContext.cpp: 16 * dom/WebKitNamedFlow.cpp: 17 1 18 2013-12-26 Thiago de Barros Lacerda <thiago.lacerda@openbossa.org> 2 19 -
trunk/Source/WebCore/dom/ContainerNode.cpp
r161024 r161096 302 302 303 303 ChildListMutationScope mutation(*this); 304 for (auto it = targets.begin(), end = targets.end(); it != end; ++it) { 305 Node& child = it->get(); 306 304 for (auto& child : targets) { 307 305 // Due to arbitrary code running in response to a DOM mutation event it's 308 306 // possible that "next" is no longer a child of "this". … … 311 309 if (next->parentNode() != this) 312 310 break; 313 if (child .parentNode())311 if (child->parentNode()) 314 312 break; 315 313 316 treeScope().adoptIfNeeded(&child );317 318 insertBeforeCommon(next.get(), child );319 320 updateTreeAfterInsertion(child );314 treeScope().adoptIfNeeded(&child.get()); 315 316 insertBeforeCommon(next.get(), child.get()); 317 318 updateTreeAfterInsertion(child.get()); 321 319 } 322 320 … … 458 456 459 457 // Add the new child(ren) 460 for (auto it = targets.begin(), end = targets.end(); it != end; ++it) { 461 Node& child = it->get(); 462 458 for (auto& child : targets) { 463 459 // Due to arbitrary code running in response to a DOM mutation event it's 464 460 // possible that "next" is no longer a child of "this". … … 467 463 if (next && next->parentNode() != this) 468 464 break; 469 if (child .parentNode())465 if (child->parentNode()) 470 466 break; 471 467 472 treeScope().adoptIfNeeded(&child );468 treeScope().adoptIfNeeded(&child.get()); 473 469 474 470 // Add child before "next". … … 476 472 NoEventDispatchAssertion assertNoEventDispatch; 477 473 if (next) 478 insertBeforeCommon(*next, child );474 insertBeforeCommon(*next, child.get()); 479 475 else 480 appendChildToContainer(&child , *this);476 appendChildToContainer(&child.get(), *this); 481 477 } 482 478 483 updateTreeAfterInsertion(child );479 updateTreeAfterInsertion(child.get()); 484 480 } 485 481 … … 506 502 507 503 ChildListMutationScope mutation(container); 508 for (auto it = children.begin(); it != children.end(); ++it) { 509 Node& child = it->get(); 510 mutation.willRemoveChild(child); 511 child.notifyMutationObserversNodeWillDetach(); 504 for (auto& child : children) { 505 mutation.willRemoveChild(child.get()); 506 child->notifyMutationObserversNodeWillDetach(); 512 507 513 508 // fire removed from document mutation events. 514 dispatchChildRemovalEvents(child );509 dispatchChildRemovalEvents(child.get()); 515 510 } 516 511 … … 710 705 // Now actually add the child(ren) 711 706 ChildListMutationScope mutation(*this); 712 for (auto it = targets.begin(), end = targets.end(); it != end; ++it) { 713 Node& child = it->get(); 714 707 for (auto& child : targets) { 715 708 // If the child has a parent again, just stop what we're doing, because 716 709 // that means someone is doing something with DOM mutation -- can't re-parent 717 710 // a child that already has a parent. 718 if (child .parentNode())711 if (child->parentNode()) 719 712 break; 720 713 721 treeScope().adoptIfNeeded(&child );714 treeScope().adoptIfNeeded(&child.get()); 722 715 723 716 // Append child to the end of the list 724 717 { 725 718 NoEventDispatchAssertion assertNoEventDispatch; 726 appendChildToContainer(&child , *this);719 appendChildToContainer(&child.get(), *this); 727 720 } 728 721 729 updateTreeAfterInsertion(child );722 updateTreeAfterInsertion(child.get()); 730 723 } 731 724 -
trunk/Source/WebCore/dom/Document.cpp
r161024 r161096 1554 1554 { 1555 1555 dispatchEvent(Event::create(eventNames().visibilitychangeEvent, false, false)); 1556 for (auto it = m_visibilityStateCallbackElements.begin(); it != m_visibilityStateCallbackElements.end(); ++it)1557 (*it)->visibilityStateChanged();1556 for (auto* element : m_visibilityStateCallbackElements) 1557 element->visibilityStateChanged(); 1558 1558 } 1559 1559 … … 3531 3531 void Document::moveNodeIteratorsToNewDocument(Node* node, Document* newDocument) 3532 3532 { 3533 HashSet<NodeIterator*> nodeIteratorsList = m_nodeIterators; 3534 HashSet<NodeIterator*>::const_iterator nodeIteratorsEnd = nodeIteratorsList.end(); 3535 for (HashSet<NodeIterator*>::const_iterator it = nodeIteratorsList.begin(); it != nodeIteratorsEnd; ++it) { 3536 if ((*it)->root() == node) { 3537 detachNodeIterator(*it); 3538 newDocument->attachNodeIterator(*it); 3533 HashSet<NodeIterator*> nodeIteratorsCopy = m_nodeIterators; 3534 for (auto* nodeIterator : nodeIteratorsCopy) { 3535 if (nodeIterator->root() == node) { 3536 detachNodeIterator(nodeIterator); 3537 newDocument->attachNodeIterator(nodeIterator); 3539 3538 } 3540 3539 } … … 3544 3543 { 3545 3544 if (!m_ranges.isEmpty()) { 3546 for (auto it = m_ranges.begin(), end = m_ranges.end(); it != end; ++it)3547 (*it)->nodeChildrenChanged(container);3545 for (auto* range : m_ranges) 3546 range->nodeChildrenChanged(container); 3548 3547 } 3549 3548 } … … 3552 3551 { 3553 3552 if (!m_ranges.isEmpty()) { 3554 for (auto it = m_ranges.begin(), end = m_ranges.end(); it != end; ++it)3555 (*it)->nodeChildrenWillBeRemoved(container);3556 } 3557 3558 for (auto it = m_nodeIterators.begin(), end = m_nodeIterators.end(); it != end; ++it) {3553 for (auto* range : m_ranges) 3554 range->nodeChildrenWillBeRemoved(container); 3555 } 3556 3557 for (auto* nodeIterator : m_nodeIterators) { 3559 3558 for (Node* n = container.firstChild(); n; n = n->nextSibling()) 3560 (*it)->nodeWillBeRemoved(n);3559 nodeIterator->nodeWillBeRemoved(n); 3561 3560 } 3562 3561 … … 3572 3571 void Document::nodeWillBeRemoved(Node* n) 3573 3572 { 3574 HashSet<NodeIterator*>::const_iterator nodeIteratorsEnd = m_nodeIterators.end(); 3575 for (HashSet<NodeIterator*>::const_iterator it = m_nodeIterators.begin(); it != nodeIteratorsEnd; ++it) 3576 (*it)->nodeWillBeRemoved(n); 3573 for (auto* nodeIterator : m_nodeIterators) 3574 nodeIterator->nodeWillBeRemoved(n); 3577 3575 3578 3576 if (!m_ranges.isEmpty()) { 3579 HashSet<Range*>::const_iterator rangesEnd = m_ranges.end(); 3580 for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != rangesEnd; ++it) 3581 (*it)->nodeWillBeRemoved(n); 3577 for (auto* range : m_ranges) 3578 range->nodeWillBeRemoved(n); 3582 3579 } 3583 3580 … … 3592 3589 { 3593 3590 if (!m_ranges.isEmpty()) { 3594 HashSet<Range*>::const_iterator end = m_ranges.end(); 3595 for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it) 3596 (*it)->textInserted(text, offset, length); 3591 for (auto* range : m_ranges) 3592 range->textInserted(text, offset, length); 3597 3593 } 3598 3594 … … 3604 3600 { 3605 3601 if (!m_ranges.isEmpty()) { 3606 HashSet<Range*>::const_iterator end = m_ranges.end(); 3607 for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it) 3608 (*it)->textRemoved(text, offset, length); 3602 for (auto* range : m_ranges) 3603 range->textRemoved(text, offset, length); 3609 3604 } 3610 3605 … … 3618 3613 if (!m_ranges.isEmpty()) { 3619 3614 NodeWithIndex oldNodeWithIndex(oldNode); 3620 HashSet<Range*>::const_iterator end = m_ranges.end(); 3621 for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it) 3622 (*it)->textNodesMerged(oldNodeWithIndex, offset); 3615 for (auto* range : m_ranges) 3616 range->textNodesMerged(oldNodeWithIndex, offset); 3623 3617 } 3624 3618 … … 3629 3623 { 3630 3624 if (!m_ranges.isEmpty()) { 3631 HashSet<Range*>::const_iterator end = m_ranges.end(); 3632 for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it) 3633 (*it)->textNodeSplit(oldNode); 3625 for (auto* range : m_ranges) 3626 range->textNodeSplit(oldNode); 3634 3627 } 3635 3628 … … 4096 4089 documentWillBecomeInactive(); 4097 4090 4098 HashSet<Element*>::iterator end = m_documentSuspensionCallbackElements.end(); 4099 for (HashSet<Element*>::iterator i = m_documentSuspensionCallbackElements.begin(); i != end; ++i) 4100 (*i)->documentWillSuspendForPageCache(); 4091 for (auto* element : m_documentSuspensionCallbackElements) 4092 element->documentWillSuspendForPageCache(); 4101 4093 4102 4094 #ifndef NDEBUG … … 4111 4103 Vector<Element*> elements; 4112 4104 copyToVector(m_documentSuspensionCallbackElements, elements); 4113 Vector<Element*>::iterator end = elements.end(); 4114 for (Vector<Element*>::iterator i = elements.begin(); i != end; ++i) 4115 (*i)->documentDidResumeFromPageCache(); 4105 for (auto* element : elements) 4106 element->documentDidResumeFromPageCache(); 4116 4107 4117 4108 #if USE(ACCELERATED_COMPOSITING) … … 4139 4130 void Document::mediaVolumeDidChange() 4140 4131 { 4141 HashSet<Element*>::iterator end = m_mediaVolumeCallbackElements.end(); 4142 for (HashSet<Element*>::iterator i = m_mediaVolumeCallbackElements.begin(); i != end; ++i) 4143 (*i)->mediaVolumeDidChange(); 4132 for (auto* element : m_mediaVolumeCallbackElements) 4133 element->mediaVolumeDidChange(); 4144 4134 } 4145 4135 … … 4162 4152 void Document::privateBrowsingStateDidChange() 4163 4153 { 4164 HashSet<Element*>::iterator end = m_privateBrowsingStateChangedElements.end(); 4165 for (HashSet<Element*>::iterator it = m_privateBrowsingStateChangedElements.begin(); it != end; ++it) 4166 (*it)->privateBrowsingStateDidChange(); 4154 for (auto* element : m_privateBrowsingStateChangedElements) 4155 element->privateBrowsingStateDidChange(); 4167 4156 } 4168 4157 … … 4193 4182 void Document::captionPreferencesChanged() 4194 4183 { 4195 HashSet<Element*>::iterator end = m_captionPreferencesChangedElements.end(); 4196 for (HashSet<Element*>::iterator it = m_captionPreferencesChangedElements.begin(); it != end; ++it) 4197 (*it)->captionPreferencesChanged(); 4184 for (auto* element : m_captionPreferencesChangedElements) 4185 element->captionPreferencesChanged(); 4198 4186 } 4199 4187 #endif … … 4843 4831 { 4844 4832 Vector<TextAutoSizingKey> nodesForRemoval; 4845 for (auto it = m_textAutoSizedNodes.begin(), end = m_textAutoSizedNodes.end(); it != end; ++it) {4846 RefPtr<TextAutoSizingValue> value = it->value;4833 for (auto& autoSizingKeyValuePair : m_textAutoSizedNodes) { 4834 RefPtr<TextAutoSizingValue> value = autoSizingKeyValuePair.value; 4847 4835 // Update all the nodes in the collection to reflect the new 4848 4836 // candidate size. … … 4852 4840 value->adjustNodeSizes(); 4853 4841 if (!value->numNodes()) 4854 nodesForRemoval.append( it->key);4842 nodesForRemoval.append(autoSizingKeyValuePair.key); 4855 4843 } 4856 4844 unsigned count = nodesForRemoval.size(); … … 4861 4849 void Document::resetAutoSizingNodes() 4862 4850 { 4863 for (auto it = m_textAutoSizedNodes.begin(), end = m_textAutoSizedNodes.end(); it != end; ++it) { 4864 RefPtr<TextAutoSizingValue> value = it->value; 4865 if (value) 4866 value->reset(); 4851 for (auto& autoSizingValue : m_textAutoSizedNodes.values()) { 4852 if (autoSizingValue) 4853 autoSizingValue->reset(); 4867 4854 } 4868 4855 m_textAutoSizedNodes.clear(); … … 5301 5288 // 4. For each descendant in descendants, empty descendant's fullscreen element stack, and queue a 5302 5289 // task to fire an event named fullscreenchange with its bubbles attribute set to true on descendant. 5303 for ( Deque<RefPtr<Document>>::iterator i = descendants.begin(); i != descendants.end(); ++i) {5304 (*i)->clearFullscreenElementStack();5305 addDocumentToFullScreenChangeEventQueue( i->get());5290 for (auto& descendant : descendants) { 5291 descendant->clearFullscreenElementStack(); 5292 addDocumentToFullScreenChangeEventQueue(descendant.get()); 5306 5293 } 5307 5294 -
trunk/Source/WebCore/dom/MutationObserver.cpp
r158569 r161096 119 119 m_records.clear(); 120 120 HashSet<MutationObserverRegistration*> registrations(m_registrations); 121 for ( HashSet<MutationObserverRegistration*>::iterator iter = registrations.begin(); iter != registrations.end(); ++iter)122 MutationObserverRegistration::unregisterAndDelete( *iter);121 for (auto* registration : registrations) 122 MutationObserverRegistration::unregisterAndDelete(registration); 123 123 } 124 124 … … 165 165 { 166 166 HashSet<Node*> observedNodes; 167 for ( HashSet<MutationObserverRegistration*>::const_iterator iter = m_registrations.begin(); iter != m_registrations.end(); ++iter)168 (*iter)->addRegistrationNodesToSet(observedNodes);167 for (auto* registration : m_registrations) 168 registration->addRegistrationNodesToSet(observedNodes); 169 169 return observedNodes; 170 170 } … … 182 182 // to make a copy of the transient registrations before operating on them. 183 183 Vector<MutationObserverRegistration*, 1> transientRegistrations; 184 for ( HashSet<MutationObserverRegistration*>::iterator iter = m_registrations.begin(); iter != m_registrations.end(); ++iter) {185 if ( (*iter)->hasTransientRegistrations())186 transientRegistrations.append( *iter);184 for (auto* registration : m_registrations) { 185 if (registration->hasTransientRegistrations()) 186 transientRegistrations.append(registration); 187 187 } 188 188 for (size_t i = 0; i < transientRegistrations.size(); ++i) -
trunk/Source/WebCore/dom/MutationObserverInterestGroup.cpp
r158569 r161096 58 58 bool MutationObserverInterestGroup::isOldValueRequested() 59 59 { 60 for ( HashMap<MutationObserver*, MutationRecordDeliveryOptions>::iterator iter = m_observers.begin(); iter != m_observers.end(); ++iter) {61 if (hasOldValue( iter->value))60 for (auto options : m_observers.values()) { 61 if (hasOldValue(options)) 62 62 return true; 63 63 } … … 69 69 RefPtr<MutationRecord> mutation = prpMutation; 70 70 RefPtr<MutationRecord> mutationWithNullOldValue; 71 for ( HashMap<MutationObserver*, MutationRecordDeliveryOptions>::iterator iter = m_observers.begin(); iter != m_observers.end(); ++iter) {72 MutationObserver* observer = iter->key;73 if (hasOldValue( iter->value)) {71 for (auto& observerOptionsPair : m_observers) { 72 MutationObserver* observer = observerOptionsPair.key; 73 if (hasOldValue(observerOptionsPair.value)) { 74 74 observer->enqueueMutationRecord(mutation); 75 75 continue; -
trunk/Source/WebCore/dom/MutationObserverRegistration.cpp
r158569 r161096 88 88 } 89 89 90 for ( NodeHashSet::iterator iter = m_transientRegistrationNodes->begin(); iter != m_transientRegistrationNodes->end(); ++iter)91 (*iter)->unregisterTransientMutationObserver(this);90 for (auto& node : *m_transientRegistrationNodes) 91 node->unregisterTransientMutationObserver(this); 92 92 93 93 m_transientRegistrationNodes.clear(); … … 127 127 if (!m_transientRegistrationNodes) 128 128 return; 129 for ( NodeHashSet::const_iterator iter = m_transientRegistrationNodes->begin(); iter != m_transientRegistrationNodes->end(); ++iter)130 nodes.add( iter->get());129 for (auto& node : *m_transientRegistrationNodes) 130 nodes.add(node.get()); 131 131 } 132 132 -
trunk/Source/WebCore/dom/Node.cpp
r160966 r161096 132 132 size_t elementsWithNamedNodeMap = 0; 133 133 134 for (HashSet<Node*>::iterator it = liveNodeSet.begin(); it != liveNodeSet.end(); ++it) { 135 Node* node = *it; 136 134 for (auto* node : liveNodeSet) { 137 135 if (node->hasRareData()) { 138 136 ++nodesWithRareData; … … 240 238 241 239 printf("Element tag name distibution:\n"); 242 for ( HashMap<String, size_t>::iterator it = perTagCount.begin(); it != perTagCount.end(); ++it)243 printf(" Number of <%s> tags: %zu\n", it->key.utf8().data(), it->value);240 for (auto stringSizePair : perTagCount) 241 printf(" Number of <%s> tags: %zu\n", stringSizePair.key.utf8().data(), stringSizePair.value); 244 242 245 243 printf("Attributes:\n"); … … 728 726 void Document::invalidateNodeListAndCollectionCaches(const QualifiedName* attrName) 729 727 { 730 for ( HashSet<LiveNodeList*>::iterator it = m_listsInvalidatedAtDocument.begin(), end = m_listsInvalidatedAtDocument.end(); it != end; ++it)731 (*it)->invalidateCache(attrName);732 for ( HashSet<HTMLCollection*>::iterator it = m_collectionsInvalidatedAtDocument.begin(), end = m_collectionsInvalidatedAtDocument.end(); it != end; ++it)733 (*it)->invalidateCache(attrName);728 for (auto* nodeList : m_listsInvalidatedAtDocument) 729 nodeList->invalidateCache(attrName); 730 for (auto* collection : m_collectionsInvalidatedAtDocument) 731 collection->invalidateCache(attrName); 734 732 } 735 733 … … 1702 1700 void NodeListsNodeData::invalidateCaches(const QualifiedName* attrName) 1703 1701 { 1704 for (auto it = m_atomicNameCaches.begin(), end = m_atomicNameCaches.end(); it != end; ++it)1705 it->value->invalidateCache(attrName);1706 1707 for (auto it = m_nameCaches.begin(), end = m_nameCaches.end(); it != end; ++it)1708 it->value->invalidateCache(attrName);1709 1710 for (auto it = m_cachedCollections.begin(), end = m_cachedCollections.end(); it != end; ++it)1711 it->value->invalidateCache(attrName);1702 for (auto* nodeList : m_atomicNameCaches.values()) 1703 nodeList->invalidateCache(attrName); 1704 1705 for (auto* nodeList : m_nameCaches.values()) 1706 nodeList->invalidateCache(attrName); 1707 1708 for (auto* collection : m_cachedCollections.values()) 1709 collection->invalidateCache(attrName); 1712 1710 1713 1711 if (attrName) 1714 1712 return; 1715 1713 1716 for (auto it = m_tagNodeListCacheNS.begin(), end = m_tagNodeListCacheNS.end(); it != end; ++it)1717 it->value->invalidateCache();1714 for (auto* nodeList : m_tagNodeListCacheNS.values()) 1715 nodeList->invalidateCache(); 1718 1716 } 1719 1717 … … 1779 1777 } 1780 1778 1781 if ( Vector<OwnPtr<MutationObserverRegistration>>* registry = mutationObserverRegistry()) {1779 if (auto* registry = mutationObserverRegistry()) { 1782 1780 for (size_t i = 0; i < registry->size(); ++i) { 1783 1781 document().addMutationObserverTypes(registry->at(i)->mutationTypes()); … … 1785 1783 } 1786 1784 1787 if (HashSet<MutationObserverRegistration*>* transientRegistry = transientMutationObserverRegistry()) { 1788 for (HashSet<MutationObserverRegistration*>::iterator iter = transientRegistry->begin(); iter != transientRegistry->end(); ++iter) { 1789 document().addMutationObserverTypes((*iter)->mutationTypes()); 1790 } 1785 if (auto* transientRegistry = transientMutationObserverRegistry()) { 1786 for (auto* registration : *transientRegistry) 1787 document().addMutationObserverTypes(registration->mutationTypes()); 1791 1788 } 1792 1789 } … … 1929 1926 if (!registry) 1930 1927 return; 1931 for (typename Registry::iterator iter = registry->begin(); iter != registry->end(); ++iter) { 1932 const MutationObserverRegistration& registration = **iter;1933 if (registration .shouldReceiveMutationFrom(target, type, attributeName)) {1934 MutationRecordDeliveryOptions deliveryOptions = registration .deliveryOptions();1935 HashMap<MutationObserver*, MutationRecordDeliveryOptions>::AddResult result = observers.add(registration.observer(), deliveryOptions);1928 1929 for (auto& registration : *registry) { 1930 if (registration->shouldReceiveMutationFrom(target, type, attributeName)) { 1931 MutationRecordDeliveryOptions deliveryOptions = registration->deliveryOptions(); 1932 auto result = observers.add(registration->observer(), deliveryOptions); 1936 1933 if (!result.isNewEntry) 1937 1934 result.iterator->value |= deliveryOptions; … … 2007 2004 2008 2005 for (Node* node = parentNode(); node; node = node->parentNode()) { 2009 if ( Vector<OwnPtr<MutationObserverRegistration>>* registry = node->mutationObserverRegistry()) {2006 if (auto* registry = node->mutationObserverRegistry()) { 2010 2007 const size_t size = registry->size(); 2011 2008 for (size_t i = 0; i < size; ++i) … … 2013 2010 } 2014 2011 2015 if ( HashSet<MutationObserverRegistration*>* transientRegistry = node->transientMutationObserverRegistry()) {2016 for ( HashSet<MutationObserverRegistration*>::iterator iter = transientRegistry->begin(); iter != transientRegistry->end(); ++iter)2017 (*iter)->observedSubtreeNodeWillDetach(this);2012 if (auto* transientRegistry = node->transientMutationObserverRegistry()) { 2013 for (auto* registration : *transientRegistry) 2014 registration->observedSubtreeNodeWillDetach(this); 2018 2015 } 2019 2016 } -
trunk/Source/WebCore/dom/NodeRareData.h
r158665 r161096 229 229 230 230 if (oldDocument != newDocument) { 231 for (auto it = m_atomicNameCaches.begin(), end = m_atomicNameCaches.end(); it != end; ++it) { 232 LiveNodeList& list = *it->value; 233 oldDocument->unregisterNodeList(list); 234 newDocument->registerNodeList(list); 231 for (auto* list : m_atomicNameCaches.values()) { 232 oldDocument->unregisterNodeList(*list); 233 newDocument->registerNodeList(*list); 235 234 } 236 235 237 for (auto it = m_nameCaches.begin(), end = m_nameCaches.end(); it != end; ++it) { 238 LiveNodeList& list = *it->value; 239 oldDocument->unregisterNodeList(list); 240 newDocument->registerNodeList(list); 236 for (auto* list : m_nameCaches.values()) { 237 oldDocument->unregisterNodeList(*list); 238 newDocument->registerNodeList(*list); 241 239 } 242 240 243 for (auto it = m_tagNodeListCacheNS.begin(), end = m_tagNodeListCacheNS.end(); it != end; ++it) { 244 LiveNodeList& list = *it->value; 245 ASSERT(!list.isRootedAtDocument()); 246 oldDocument->unregisterNodeList(list); 247 newDocument->registerNodeList(list); 241 for (auto* list : m_tagNodeListCacheNS.values()) { 242 ASSERT(!list->isRootedAtDocument()); 243 oldDocument->unregisterNodeList(*list); 244 newDocument->registerNodeList(*list); 248 245 } 249 246 250 for (auto it = m_cachedCollections.begin(), end = m_cachedCollections.end(); it != end; ++it) { 251 HTMLCollection& collection = *it->value; 252 oldDocument->unregisterCollection(collection); 253 newDocument->registerCollection(collection); 247 for (auto collection : m_cachedCollections.values()) { 248 oldDocument->unregisterCollection(*collection); 249 newDocument->registerCollection(*collection); 254 250 } 255 251 } -
trunk/Source/WebCore/dom/ScriptExecutionContext.cpp
r160679 r161096 104 104 { 105 105 m_inDestructor = true; 106 for (HashSet<ContextDestructionObserver*>::iterator iter = m_destructionObservers.begin(); iter != m_destructionObservers.end(); iter = m_destructionObservers.begin()) { 107 ContextDestructionObserver* observer = *iter; 106 for (auto* observer : m_destructionObservers) { 108 107 m_destructionObservers.remove(observer); 109 108 ASSERT(observer->scriptExecutionContext() == this); … … 111 110 } 112 111 113 HashSet<MessagePort*>::iterator messagePortsEnd = m_messagePorts.end(); 114 for (HashSet<MessagePort*>::iterator iter = m_messagePorts.begin(); iter != messagePortsEnd; ++iter) { 115 ASSERT((*iter)->scriptExecutionContext() == this); 116 (*iter)->contextDestroyed(); 112 for (auto* port : m_messagePorts) { 113 ASSERT(port->scriptExecutionContext() == this); 114 port->contextDestroyed(); 117 115 } 118 116 #if ENABLE(BLOB) … … 167 165 // No protection against m_activeDOMObjects changing during iteration: canSuspend() shouldn't execute arbitrary JS. 168 166 m_iteratingActiveDOMObjects = true; 169 ActiveDOMObjectsSet::iterator activeObjectsEnd = m_activeDOMObjects.end(); 170 for (ActiveDOMObjectsSet::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) { 171 ASSERT((*iter)->scriptExecutionContext() == this); 172 ASSERT((*iter)->suspendIfNeededCalled()); 173 if (!(*iter)->canSuspend()) { 167 for (auto* activeDOMObject : m_activeDOMObjects) { 168 ASSERT(activeDOMObject->scriptExecutionContext() == this); 169 ASSERT(activeDOMObject->suspendIfNeededCalled()); 170 if (!activeDOMObject->canSuspend()) { 174 171 m_iteratingActiveDOMObjects = false; 175 172 return false; … … 191 188 // No protection against m_activeDOMObjects changing during iteration: suspend() shouldn't execute arbitrary JS. 192 189 m_iteratingActiveDOMObjects = true; 193 ActiveDOMObjectsSet::iterator activeObjectsEnd = m_activeDOMObjects.end(); 194 for (ActiveDOMObjectsSet::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) { 195 ASSERT((*iter)->scriptExecutionContext() == this); 196 ASSERT((*iter)->suspendIfNeededCalled()); 197 (*iter)->suspend(why); 190 for (auto* activeDOMObject : m_activeDOMObjects) { 191 ASSERT(activeDOMObject->scriptExecutionContext() == this); 192 ASSERT(activeDOMObject->suspendIfNeededCalled()); 193 activeDOMObject->suspend(why); 198 194 } 199 195 m_iteratingActiveDOMObjects = false; … … 210 206 // No protection against m_activeDOMObjects changing during iteration: resume() shouldn't execute arbitrary JS. 211 207 m_iteratingActiveDOMObjects = true; 212 ActiveDOMObjectsSet::iterator activeObjectsEnd = m_activeDOMObjects.end(); 213 for (ActiveDOMObjectsSet::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) { 214 ASSERT((*iter)->scriptExecutionContext() == this); 215 ASSERT((*iter)->suspendIfNeededCalled()); 216 (*iter)->resume(); 208 for (auto* activeDOMObject : m_activeDOMObjects) { 209 ASSERT(activeDOMObject->scriptExecutionContext() == this); 210 ASSERT(activeDOMObject->suspendIfNeededCalled()); 211 activeDOMObject->resume(); 217 212 } 218 213 m_iteratingActiveDOMObjects = false; … … 226 221 // No protection against m_activeDOMObjects changing during iteration: stop() shouldn't execute arbitrary JS. 227 222 m_iteratingActiveDOMObjects = true; 228 ActiveDOMObjectsSet::iterator activeObjectsEnd = m_activeDOMObjects.end(); 229 for (ActiveDOMObjectsSet::iterator iter = m_activeDOMObjects.begin(); iter != activeObjectsEnd; ++iter) { 230 ASSERT((*iter)->scriptExecutionContext() == this); 231 ASSERT((*iter)->suspendIfNeededCalled()); 232 (*iter)->stop(); 223 for (auto* activeDOMObject : m_activeDOMObjects) { 224 ASSERT(activeDOMObject->scriptExecutionContext() == this); 225 ASSERT(activeDOMObject->suspendIfNeededCalled()); 226 activeDOMObject->stop(); 233 227 } 234 228 m_iteratingActiveDOMObjects = false; … … 278 272 } 279 273 280 void ScriptExecutionContext::closeMessagePorts() {281 HashSet<MessagePort*>::iterator messagePortsEnd = m_messagePorts.end(); 282 for ( HashSet<MessagePort*>::iterator iter = m_messagePorts.begin(); iter != messagePortsEnd; ++iter) {283 ASSERT( (*iter)->scriptExecutionContext() == this);284 (*iter)->close();274 void ScriptExecutionContext::closeMessagePorts() 275 { 276 for (auto* port : m_messagePorts) { 277 ASSERT(port->scriptExecutionContext() == this); 278 port->close(); 285 279 } 286 280 } … … 374 368 { 375 369 if (minimumTimerInterval() != oldMinimumTimerInterval) { 376 for (TimeoutMap::iterator iter = m_timeouts.begin(); iter != m_timeouts.end(); ++iter) { 377 DOMTimer* timer = iter->value; 370 for (auto* timer : m_timeouts.values()) 378 371 timer->adjustMinimumTimerInterval(oldMinimumTimerInterval); 379 }380 372 } 381 373 } … … 393 385 void ScriptExecutionContext::didChangeTimerAlignmentInterval() 394 386 { 395 for (TimeoutMap::iterator iter = m_timeouts.begin(); iter != m_timeouts.end(); ++iter) { 396 DOMTimer* timer = iter->value; 387 for (auto* timer : m_timeouts.values()) 397 388 timer->didChangeAlignmentInterval(); 398 }399 389 } 400 390 -
trunk/Source/WebCore/dom/WebKitNamedFlow.cpp
r158569 r161096 131 131 132 132 if (inFlowThread(contentNode->renderer(), m_parentFlowThread)) { 133 const RenderRegionList& regionList = m_parentFlowThread->renderRegionList(); 134 for (auto iter = regionList.begin(), end = regionList.end(); iter != end; ++iter) { 133 for (auto* region : m_parentFlowThread->renderRegionList()) { 135 134 // FIXME: Pseudo-elements are not included in the list. 136 135 // They will be included when we will properly support the Region interface 137 136 // http://dev.w3.org/csswg/css-regions/#the-region-interface 138 const RenderNamedFlowFragment* renderRegion = toRenderNamedFlowFragment( *iter);137 const RenderNamedFlowFragment* renderRegion = toRenderNamedFlowFragment(region); 139 138 if (renderRegion->isPseudoElementRegion()) 140 139 continue; … … 160 159 161 160 Vector<Ref<Element>> regionElements; 162 163 const RenderRegionList& regionList = m_parentFlowThread->renderRegionList(); 164 for (auto iter = regionList.begin(), end = regionList.end(); iter != end; ++iter) { 161 for (auto region : m_parentFlowThread->renderRegionList()) { 165 162 // FIXME: Pseudo-elements are not included in the list. 166 163 // They will be included when we will properly support the Region interface 167 164 // http://dev.w3.org/csswg/css-regions/#the-region-interface 168 const RenderNamedFlowFragment* renderRegion = toRenderNamedFlowFragment( *iter);165 const RenderNamedFlowFragment* renderRegion = toRenderNamedFlowFragment(region); 169 166 if (renderRegion->isPseudoElementRegion()) 170 167 continue; … … 187 184 188 185 Vector<Ref<Element>> contentElements; 189 190 const NamedFlowContentElements& contentElementsList = m_parentFlowThread->contentElements(); 191 for (auto it = contentElementsList.begin(), end = contentElementsList.end(); it != end; ++it) { 192 Element* element = *it; 186 for (auto* element : m_parentFlowThread->contentElements()) { 193 187 ASSERT(element->computedStyle()->flowThread() == m_parentFlowThread->flowThreadName()); 194 188 contentElements.append(*element);
Note: See TracChangeset
for help on using the changeset viewer.