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