diff options
Diffstat (limited to 'Source/WebCore/dom/NamedFlowCollection.cpp')
-rw-r--r-- | Source/WebCore/dom/NamedFlowCollection.cpp | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/Source/WebCore/dom/NamedFlowCollection.cpp b/Source/WebCore/dom/NamedFlowCollection.cpp index c87981671..272954811 100644 --- a/Source/WebCore/dom/NamedFlowCollection.cpp +++ b/Source/WebCore/dom/NamedFlowCollection.cpp @@ -47,11 +47,11 @@ Vector<RefPtr<WebKitNamedFlow>> NamedFlowCollection::namedFlows() { Vector<RefPtr<WebKitNamedFlow>> namedFlows; - for (NamedFlowSet::iterator it = m_namedFlows.begin(); it != m_namedFlows.end(); ++it) { - if ((*it)->flowState() == WebKitNamedFlow::FlowStateNull) + for (auto& namedFlow : m_namedFlows) { + if (namedFlow->flowState() == WebKitNamedFlow::FlowStateNull) continue; - namedFlows.append(RefPtr<WebKitNamedFlow>(*it)); + namedFlows.append(RefPtr<WebKitNamedFlow>(namedFlow)); } return namedFlows; @@ -61,27 +61,27 @@ WebKitNamedFlow* NamedFlowCollection::flowByName(const String& flowName) { NamedFlowSet::iterator it = m_namedFlows.find<String, NamedFlowHashTranslator>(flowName); if (it == m_namedFlows.end() || (*it)->flowState() == WebKitNamedFlow::FlowStateNull) - return 0; + return nullptr; return *it; } -PassRefPtr<WebKitNamedFlow> NamedFlowCollection::ensureFlowWithName(const String& flowName) +Ref<WebKitNamedFlow> NamedFlowCollection::ensureFlowWithName(const String& flowName) { NamedFlowSet::iterator it = m_namedFlows.find<String, NamedFlowHashTranslator>(flowName); if (it != m_namedFlows.end()) { WebKitNamedFlow* namedFlow = *it; ASSERT(namedFlow->flowState() == WebKitNamedFlow::FlowStateNull); - return namedFlow; + return *namedFlow; } - RefPtr<WebKitNamedFlow> newFlow = WebKitNamedFlow::create(this, flowName); + RefPtr<WebKitNamedFlow> newFlow = WebKitNamedFlow::create(*this, flowName); m_namedFlows.add(newFlow.get()); - InspectorInstrumentation::didCreateNamedFlow(document(), newFlow.get()); + InspectorInstrumentation::didCreateNamedFlow(document(), *newFlow); - return newFlow.release(); + return newFlow.releaseNonNull(); } void NamedFlowCollection::discardNamedFlow(WebKitNamedFlow* namedFlow) @@ -93,7 +93,7 @@ void NamedFlowCollection::discardNamedFlow(WebKitNamedFlow* namedFlow) ASSERT(namedFlow->flowState() == WebKitNamedFlow::FlowStateNull); ASSERT(m_namedFlows.contains(namedFlow)); - InspectorInstrumentation::willRemoveNamedFlow(document(), namedFlow); + InspectorInstrumentation::willRemoveNamedFlow(document(), *namedFlow); m_namedFlows.remove(namedFlow); } @@ -101,16 +101,17 @@ void NamedFlowCollection::discardNamedFlow(WebKitNamedFlow* namedFlow) Document* NamedFlowCollection::document() const { ScriptExecutionContext* context = ContextDestructionObserver::scriptExecutionContext(); - return toDocument(context); + return downcast<Document>(context); } -PassRefPtr<DOMNamedFlowCollection> NamedFlowCollection::createCSSOMSnapshot() +Ref<DOMNamedFlowCollection> NamedFlowCollection::createCSSOMSnapshot() { - Vector<WebKitNamedFlow*> createdFlows; - for (NamedFlowSet::iterator it = m_namedFlows.begin(); it != m_namedFlows.end(); ++it) - if ((*it)->flowState() == WebKitNamedFlow::FlowStateCreated) - createdFlows.append(*it); - return DOMNamedFlowCollection::create(createdFlows); + Vector<Ref<WebKitNamedFlow>> createdFlows; + for (auto& namedFlow : m_namedFlows) { + if (namedFlow->flowState() == WebKitNamedFlow::FlowStateCreated) + createdFlows.append(*namedFlow); + } + return DOMNamedFlowCollection::create(WTFMove(createdFlows)); } // The HashFunctions object used by the HashSet to compare between NamedFlows. |