summaryrefslogtreecommitdiff
path: root/Source/WebCore/dom/NamedFlowCollection.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/dom/NamedFlowCollection.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/dom/NamedFlowCollection.cpp')
-rw-r--r--Source/WebCore/dom/NamedFlowCollection.cpp35
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.