From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/dom/NamedFlowCollection.cpp | 35 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'Source/WebCore/dom/NamedFlowCollection.cpp') 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> NamedFlowCollection::namedFlows() { Vector> 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(*it)); + namedFlows.append(RefPtr(namedFlow)); } return namedFlows; @@ -61,27 +61,27 @@ WebKitNamedFlow* NamedFlowCollection::flowByName(const String& flowName) { NamedFlowSet::iterator it = m_namedFlows.find(flowName); if (it == m_namedFlows.end() || (*it)->flowState() == WebKitNamedFlow::FlowStateNull) - return 0; + return nullptr; return *it; } -PassRefPtr NamedFlowCollection::ensureFlowWithName(const String& flowName) +Ref NamedFlowCollection::ensureFlowWithName(const String& flowName) { NamedFlowSet::iterator it = m_namedFlows.find(flowName); if (it != m_namedFlows.end()) { WebKitNamedFlow* namedFlow = *it; ASSERT(namedFlow->flowState() == WebKitNamedFlow::FlowStateNull); - return namedFlow; + return *namedFlow; } - RefPtr newFlow = WebKitNamedFlow::create(this, flowName); + RefPtr 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(context); } -PassRefPtr NamedFlowCollection::createCSSOMSnapshot() +Ref NamedFlowCollection::createCSSOMSnapshot() { - Vector 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> 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. -- cgit v1.2.1