1/*
2 * Copyright (C) 2006 Apple Inc.
3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
4 *
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.
9 *
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.
14 *
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.
19 */
20
21// Introduced in DOM Level 2:
22[
23    Constructor,
24    ConstructorCallWith=ScriptExecutionContext,
25    ImplementationLacksVTable
26] interface Range {
27
28    [GetterRaisesException] readonly attribute Node startContainer;
29    [GetterRaisesException] readonly attribute long startOffset;
30    [GetterRaisesException] readonly attribute Node endContainer;
31    [GetterRaisesException] readonly attribute long endOffset;
32    [GetterRaisesException] readonly attribute boolean collapsed;
33    [GetterRaisesException] readonly attribute Node commonAncestorContainer;
34
35    [ObjCLegacyUnnamedParameters, RaisesException] void setStart([Default=Undefined] optional Node refNode,
36                                 [Default=Undefined] optional long offset);
37    [ObjCLegacyUnnamedParameters, RaisesException] void setEnd([Default=Undefined] optional Node refNode,
38                               [Default=Undefined] optional long offset);
39    [RaisesException] void setStartBefore([Default=Undefined] optional Node refNode);
40    [RaisesException] void setStartAfter([Default=Undefined] optional Node refNode);
41    [RaisesException] void setEndBefore([Default=Undefined] optional Node refNode);
42    [RaisesException] void setEndAfter([Default=Undefined] optional Node refNode);
43    [RaisesException] void collapse([Default=Undefined] optional boolean toStart);
44    [RaisesException] void selectNode([Default=Undefined] optional Node refNode);
45    [RaisesException] void selectNodeContents([Default=Undefined] optional Node refNode);
46
47    // CompareHow
48    const unsigned short START_TO_START = 0;
49    const unsigned short START_TO_END   = 1;
50    const unsigned short END_TO_END     = 2;
51    const unsigned short END_TO_START   = 3;
52
53    [ObjCLegacyUnnamedParameters, RaisesException] short compareBoundaryPoints([Default=Undefined] optional CompareHow how,
54                                               [Default=Undefined] optional Range sourceRange);
55
56    [RaisesException] void deleteContents();
57    [RaisesException] DocumentFragment extractContents();
58    [RaisesException] DocumentFragment cloneContents();
59    [RaisesException] void insertNode([Default=Undefined] optional Node newNode);
60    [RaisesException] void surroundContents([Default=Undefined] optional Node newParent);
61    [RaisesException] Range cloneRange();
62    [RaisesException] DOMString toString();
63
64    [RaisesException] void detach();
65
66#if defined(LANGUAGE_JAVASCRIPT) || LANGUAGE_JAVASCRIPT
67    // CSSOM View Module API extensions
68
69    ClientRectList getClientRects();
70    ClientRect getBoundingClientRect();
71#endif
72
73    // extensions
74
75    [RaisesException] DocumentFragment createContextualFragment([Default=Undefined] optional DOMString html);
76
77    // WebKit extensions
78
79    [RaisesException] boolean intersectsNode([Default=Undefined] optional Node refNode);
80
81    [RaisesException] short compareNode([Default=Undefined] optional Node refNode);
82
83    // CompareResults
84    const unsigned short NODE_BEFORE           = 0;
85    const unsigned short NODE_AFTER            = 1;
86    const unsigned short NODE_BEFORE_AND_AFTER = 2;
87    const unsigned short NODE_INSIDE           = 3;
88
89    [RaisesException] short comparePoint([Default=Undefined] optional Node refNode,
90                       [Default=Undefined] optional long offset);
91
92    [RaisesException] boolean isPointInRange([Default=Undefined] optional Node refNode,
93                           [Default=Undefined] optional long offset);
94
95    [RaisesException] void expand([Default=Undefined] optional DOMString unit);
96
97#if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT
98    readonly attribute DOMString text;
99#endif
100};
101
102