Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: third_party/WebKit/Source/core/dom/NodeList.cpp

Issue 1367523002: [dom] support iterable<> NodeList (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Actual on the left, expected on the right Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/dom/NodeList.h"
7
8 namespace blink {
9
10 namespace {
11
12 class NodeListIterationSource final : public ValueIterable<Node*>::Iteration Source {
13 public:
14 explicit NodeListIterationSource(NodeList& nodeList)
15 : m_nodeList(nodeList)
16 {
17 }
18
19 bool next(ScriptState* scriptState, Node*& value, ExceptionState& except ionState) override
20 {
21 value = m_nodeList->item(m_index);
22 return !!value;
23 }
24
25 DEFINE_INLINE_VIRTUAL_TRACE()
26 {
27 visitor->trace(m_nodeList);
28 ValueIterable<Node*>::IterationSource::trace(visitor);
29 }
30
31 private:
32 const RefPtrWillBeMember<NodeList> m_nodeList;
33 };
34
35 } // namespace
36
37 ValueIterable<Node*>::IterationSource* NodeList::startIteration(ScriptState*, Ex ceptionState&)
38 {
39 return new NodeListIterationSource(*this);
40 }
41
42 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/NodeList.h ('k') | third_party/WebKit/Source/core/dom/NodeList.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698