• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 The PDFium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #include "xfa/fxfa/cxfa_readynodeiterator.h"
8 
9 #include "xfa/fxfa/parser/cxfa_node.h"
10 
CXFA_ReadyNodeIterator(CXFA_Node * pTravelRoot)11 CXFA_ReadyNodeIterator::CXFA_ReadyNodeIterator(CXFA_Node* pTravelRoot)
12     : m_ContentIterator(pTravelRoot) {}
13 
14 CXFA_ReadyNodeIterator::~CXFA_ReadyNodeIterator() = default;
15 
MoveToNext()16 CXFA_Node* CXFA_ReadyNodeIterator::MoveToNext() {
17   CXFA_Node* pItem = m_pCurNode ? m_ContentIterator.MoveToNext()
18                                 : m_ContentIterator.GetCurrent();
19   while (pItem) {
20     m_pCurNode = pItem->IsWidgetReady() ? pItem : nullptr;
21     if (m_pCurNode)
22       return m_pCurNode;
23     pItem = m_ContentIterator.MoveToNext();
24   }
25   return nullptr;
26 }
27 
SkipTree()28 void CXFA_ReadyNodeIterator::SkipTree() {
29   m_ContentIterator.SkipChildrenAndMoveToNext();
30   m_pCurNode = nullptr;
31 }
32