1 // Copyright 2017 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #include "xfa/fxfa/cxfa_widgetacciterator.h" 8 9 #include "xfa/fxfa/cxfa_widgetacc.h" 10 CXFA_WidgetAccIterator(CXFA_Node * pTravelRoot)11CXFA_WidgetAccIterator::CXFA_WidgetAccIterator(CXFA_Node* pTravelRoot) 12 : m_ContentIterator(pTravelRoot), m_pCurWidgetAcc(nullptr) {} 13 ~CXFA_WidgetAccIterator()14CXFA_WidgetAccIterator::~CXFA_WidgetAccIterator() {} 15 MoveToNext()16CXFA_WidgetAcc* CXFA_WidgetAccIterator::MoveToNext() { 17 CXFA_Node* pItem = m_pCurWidgetAcc ? m_ContentIterator.MoveToNext() 18 : m_ContentIterator.GetCurrent(); 19 while (pItem) { 20 m_pCurWidgetAcc = pItem->GetWidgetAcc(); 21 if (m_pCurWidgetAcc) 22 return m_pCurWidgetAcc.Get(); 23 pItem = m_ContentIterator.MoveToNext(); 24 } 25 return nullptr; 26 } 27 SkipTree()28void CXFA_WidgetAccIterator::SkipTree() { 29 m_ContentIterator.SkipChildrenAndMoveToNext(); 30 m_pCurWidgetAcc = nullptr; 31 } 32