OLD | NEW |
(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 |
OLD | NEW |