Index: Source/core/inspector/InspectorDOMAgent.cpp |
diff --git a/Source/core/inspector/InspectorDOMAgent.cpp b/Source/core/inspector/InspectorDOMAgent.cpp |
index b2bda8f5500f01f75718b7a4de32328a063098b4..1ca43cb88cc6e499a399fabe3f9c013d21527272 100644 |
--- a/Source/core/inspector/InspectorDOMAgent.cpp |
+++ b/Source/core/inspector/InspectorDOMAgent.cpp |
@@ -222,9 +222,8 @@ void InspectorRevalidateDOMTask::onTimer(Timer<InspectorRevalidateDOMTask>*) |
{ |
// The timer is stopped on m_domAgent destruction, so this method will never be called after m_domAgent has been destroyed. |
WillBeHeapVector<RawPtrWillBeMember<Element> > elements; |
- WillBePersistentHeapHashSet<RefPtrWillBeMember<Element> >::iterator it; |
- for (it = m_styleAttrInvalidatedElements.begin(); it != m_styleAttrInvalidatedElements.end(); ++it) |
- elements.append(it->get()); |
+ for (auto it : m_styleAttrInvalidatedElements) |
+ elements.append(it.get()); |
m_domAgent->styleAttributeInvalidated(elements); |
m_styleAttrInvalidatedElements.clear(); |
@@ -843,14 +842,13 @@ void InspectorDOMAgent::setAttributesAsText(ErrorString* errorString, int elemen |
} |
bool foundOriginalAttribute = false; |
- AttributeCollection::iterator end = attributes.end(); |
- for (AttributeCollection::iterator it = attributes.begin(); it != end; ++it) { |
+ for (auto it : attributes) { |
// Add attribute pair |
- String attributeName = it->name().toString(); |
+ String attributeName = it.name().toString(); |
if (shouldIgnoreCase) |
attributeName = attributeName.lower(); |
foundOriginalAttribute |= name && attributeName == caseAdjustedName; |
- if (!m_domEditor->setAttribute(element, attributeName, it->value(), errorString)) |
+ if (!m_domEditor->setAttribute(element, attributeName, it.value(), errorString)) |
return; |
} |
@@ -1111,8 +1109,8 @@ void InspectorDOMAgent::performSearch(ErrorString*, const String& whitespaceTrim |
WillBeHeapVector<RawPtrWillBeMember<Document> > docs = documents(); |
WillBeHeapListHashSet<RawPtrWillBeMember<Node> > resultCollector; |
- for (WillBeHeapVector<RawPtrWillBeMember<Document> >::iterator it = docs.begin(); it != docs.end(); ++it) { |
- Document* document = *it; |
+ for (auto it : docs) { |
+ Document* document = it; |
Node* documentElement = document->documentElement(); |
Node* node = documentElement; |
if (!node) |
@@ -1140,16 +1138,15 @@ void InspectorDOMAgent::performSearch(ErrorString*, const String& whitespaceTrim |
// Go through all attributes and serialize them. |
const Element* element = toElement(node); |
AttributeCollection attributes = element->attributes(); |
- AttributeCollection::iterator end = attributes.end(); |
- for (AttributeCollection::iterator it = attributes.begin(); it != end; ++it) { |
+ for (auto it : attributes) { |
// Add attribute pair |
- if (it->localName().find(whitespaceTrimmedQuery, 0, false) != kNotFound) { |
+ if (it.localName().find(whitespaceTrimmedQuery, 0, false) != kNotFound) { |
resultCollector.add(node); |
break; |
} |
- size_t foundPosition = it->value().find(attributeQuery, 0, false); |
+ size_t foundPosition = it.value().find(attributeQuery, 0, false); |
if (foundPosition != kNotFound) { |
- if (!exactAttributeMatch || (!foundPosition && it->value().length() == attributeQuery.length())) { |
+ if (!exactAttributeMatch || (!foundPosition && it.value().length() == attributeQuery.length())) { |
resultCollector.add(node); |
break; |
} |
@@ -1163,8 +1160,8 @@ void InspectorDOMAgent::performSearch(ErrorString*, const String& whitespaceTrim |
} |
// XPath evaluation |
- for (WillBeHeapVector<RawPtrWillBeMember<Document> >::iterator it = docs.begin(); it != docs.end(); ++it) { |
- Document* document = *it; |
+ for (auto it : docs) { |
+ Document* document = it; |
ASSERT(document); |
TrackExceptionState exceptionState; |
RefPtrWillBeRawPtr<XPathResult> result = DocumentXPathEvaluator::evaluate(*document, whitespaceTrimmedQuery, document, nullptr, XPathResult::ORDERED_NODE_SNAPSHOT_TYPE, 0, exceptionState); |
@@ -1184,8 +1181,8 @@ void InspectorDOMAgent::performSearch(ErrorString*, const String& whitespaceTrim |
} |
// Selector evaluation |
- for (WillBeHeapVector<RawPtrWillBeMember<Document> >::iterator it = docs.begin(); it != docs.end(); ++it) { |
- Document* document = *it; |
+ for (auto it : docs) { |
+ Document* document = it; |
TrackExceptionState exceptionState; |
RefPtrWillBeRawPtr<StaticElementList> elementList = document->querySelectorAll(AtomicString(whitespaceTrimmedQuery), exceptionState); |
if (exceptionState.hadException() || !elementList) |
@@ -1200,8 +1197,8 @@ void InspectorDOMAgent::performSearch(ErrorString*, const String& whitespaceTrim |
*searchId = IdentifiersFactory::createIdentifier(); |
WillBeHeapVector<RefPtrWillBeMember<Node> >* resultsIt = &m_searchResults.add(*searchId, WillBeHeapVector<RefPtrWillBeMember<Node> >()).storedValue->value; |
- for (WillBeHeapListHashSet<RawPtrWillBeMember<Node> >::iterator it = resultCollector.begin(); it != resultCollector.end(); ++it) |
- resultsIt->append(*it); |
+ for (auto it : resultCollector) |
+ resultsIt->append(it); |
*resultCount = resultsIt->size(); |
} |
@@ -1543,9 +1540,9 @@ void InspectorDOMAgent::setFileInputFiles(ErrorString* errorString, int nodeId, |
} |
FileList* fileList = FileList::create(); |
- for (JSONArray::const_iterator iter = files->begin(); iter != files->end(); ++iter) { |
+ for (const auto& iter : *files) { |
String path; |
- if (!(*iter)->asString(&path)) { |
+ if (!(iter)->asString(&path)) { |
*errorString = "Files must be strings"; |
return; |
} |
@@ -1761,11 +1758,10 @@ PassRefPtr<TypeBuilder::Array<String> > InspectorDOMAgent::buildArrayForElementA |
RefPtr<TypeBuilder::Array<String> > attributesValue = TypeBuilder::Array<String>::create(); |
// Go through all attributes and serialize them. |
AttributeCollection attributes = element->attributes(); |
- AttributeCollection::iterator end = attributes.end(); |
- for (AttributeCollection::iterator it = attributes.begin(); it != end; ++it) { |
+ for (auto it : attributes) { |
// Add attribute pair |
- attributesValue->addItem(it->name().toString()); |
- attributesValue->addItem(it->value()); |
+ attributesValue->addItem(it.name().toString()); |
+ attributesValue->addItem(it.value()); |
} |
return attributesValue.release(); |
} |
@@ -2234,10 +2230,10 @@ void InspectorDOMAgent::pushNodeByPathToFrontend(ErrorString* errorString, const |
void InspectorDOMAgent::pushNodesByBackendIdsToFrontend(ErrorString* errorString, const RefPtr<JSONArray>& backendNodeIds, RefPtr<TypeBuilder::Array<int> >& result) |
{ |
result = TypeBuilder::Array<int>::create(); |
- for (JSONArray::const_iterator it = backendNodeIds->begin(); it != backendNodeIds->end(); ++it) { |
+ for (const auto& it : *backendNodeIds) { |
int backendNodeId; |
- if (!(*it)->asNumber(&backendNodeId)) { |
+ if (!(it)->asNumber(&backendNodeId)) { |
*errorString = "Invalid argument type"; |
return; |
} |