1/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2/* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6#include "nsISupports.idl" 7 8webidl Node; 9webidl Range; 10 11/** 12 * nsIScriptableContentIterator is designed to testing concrete classes of 13 * ContentIteratorBase. 14 */ 15[scriptable, builtinclass, uuid(9f25fb2a-265f-44f9-a122-62bbf443239e)] 16interface nsIScriptableContentIterator : nsISupports 17{ 18 cenum IteratorType : 8 { 19 NOT_INITIALIZED, 20 POST_ORDER_ITERATOR, 21 PRE_ORDER_ITERATOR, 22 SUBTREE_ITERATOR 23 }; 24 25 /** 26 * You need to call initWith*() first. Then, the instance of this interface 27 * decides the type of iterator with its aType argument. You can call 28 * initWith*() multiple times, but you need to keep setting same type as 29 * previous call. If you set different type, these method with throw an 30 * exception. 31 */ 32 33 // See ContentIteratorBase::Init(nsINode*) 34 void initWithRootNode(in nsIScriptableContentIterator_IteratorType aType, 35 in Node aRoot); 36 37 // See ContentIteratorBase::Init(nsRange*) 38 void initWithRange(in nsIScriptableContentIterator_IteratorType aType, 39 in Range aRange); 40 41 // See ContentIteratorBase::Init(nsINode*, uint32_t, nsINode*, uint32_t) 42 void initWithPositions(in nsIScriptableContentIterator_IteratorType aType, 43 in Node aStartContainer, in unsigned long aStartOffset, 44 in Node aEndContainer, in unsigned long aEndOffset); 45 46 // See ContentIteratorBase::First() 47 void first(); 48 49 // See ContentIteratorBase::Last() 50 void last(); 51 52 // See ContentIteratorBase::Next() 53 void next(); 54 55 // See ContentIteratorBase::Prev() 56 void prev(); 57 58 // See ContentIteratorBase::GetCurrentNode() 59 readonly attribute Node currentNode; 60 61 // See ContentIteratorBase::IsDone() 62 readonly attribute bool isDone; 63 64 // See ContentIteratorBase::PositionAt(nsINode*) 65 void positionAt(in Node aNode); 66}; 67 68%{C++ 69#define SCRIPTABLE_CONTENT_ITERATOR_CID \ 70 { 0xf68037ec, 0x2790, 0x44c5, \ 71 { 0x8e, 0x5f, 0xdf, 0x5d, 0xa5, 0x8b, 0x93, 0xa7 } } 72#define SCRIPTABLE_CONTENT_ITERATOR_CONTRACTID \ 73 "@mozilla.org/scriptable-content-iterator;1" 74%} 75