2008-11-04 Anders Carlsson <andersca@apple.com>
[webkit/qt.git] / WebCore / dom / Range.idl
blob4344474b1a29d2b7a5b19b2dfbc19142b7c58996
1 /*
2 * Copyright (C) 2006 Apple Computer, Inc.
3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 module ranges {
23 // Introduced in DOM Level 2:
24 interface [GenerateConstructor] Range {
26 readonly attribute Node startContainer
27 getter raises(DOMException);
28 readonly attribute long startOffset
29 getter raises(DOMException);
30 readonly attribute Node endContainer
31 getter raises(DOMException);
32 readonly attribute long endOffset
33 getter raises(DOMException);
34 readonly attribute boolean collapsed
35 getter raises(DOMException);
36 readonly attribute Node commonAncestorContainer
37 getter raises(DOMException);
39 [OldStyleObjC] void setStart(in Node refNode,
40 in long offset)
41 raises(RangeException, DOMException);
42 [OldStyleObjC] void setEnd(in Node refNode,
43 in long offset)
44 raises(RangeException, DOMException);
45 void setStartBefore(in Node refNode)
46 raises(RangeException, DOMException);
47 void setStartAfter(in Node refNode)
48 raises(RangeException, DOMException);
49 void setEndBefore(in Node refNode)
50 raises(RangeException, DOMException);
51 void setEndAfter(in Node refNode)
52 raises(RangeException, DOMException);
53 void collapse(in boolean toStart)
54 raises(DOMException);
55 void selectNode(in Node refNode)
56 raises(RangeException, DOMException);
57 void selectNodeContents(in Node refNode)
58 raises(RangeException, DOMException);
60 // CompareHow
61 const unsigned short START_TO_START = 0;
62 const unsigned short START_TO_END = 1;
63 const unsigned short END_TO_END = 2;
64 const unsigned short END_TO_START = 3;
66 [OldStyleObjC] short compareBoundaryPoints(in CompareHow how,
67 in Range sourceRange)
68 raises(DOMException);
70 void deleteContents()
71 raises(DOMException);
72 DocumentFragment extractContents()
73 raises(DOMException);
74 DocumentFragment cloneContents()
75 raises(DOMException);
76 void insertNode(in Node newNode)
77 raises(DOMException, RangeException);
78 void surroundContents(in Node newParent)
79 raises(DOMException, RangeException);
80 Range cloneRange()
81 raises(DOMException);
82 DOMString toString()
83 raises(DOMException);
85 void detach()
86 raises(DOMException);
88 // extensions
90 DocumentFragment createContextualFragment(in DOMString html)
91 raises(DOMException);
93 // WebKit extensions
95 boolean intersectsNode(in Node refNode)
96 raises(RangeException, DOMException);
98 short compareNode(in Node refNode)
99 raises(RangeException, DOMException);
101 // CompareResults
102 const unsigned short NODE_BEFORE = 0;
103 const unsigned short NODE_AFTER = 1;
104 const unsigned short NODE_BEFORE_AND_AFTER = 2;
105 const unsigned short NODE_INSIDE = 3;
107 short comparePoint(in Node refNode,
108 in long offset)
109 raises(RangeException, DOMException);
111 boolean isPointInRange(in Node refNode,
112 in long offset)
113 raises(RangeException, DOMException);
115 #if !defined(LANGUAGE_JAVASCRIPT)
116 readonly attribute DOMString text;
117 #endif