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 file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
5 *
6 * The origin of this IDL file is
7 * http://dom.spec.whatwg.org/#range
8 * http://domparsing.spec.whatwg.org/#dom-range-createcontextualfragment
9 * http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-view/Overview.html#extensions-to-the-range-interface
10 *
11 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
12 * liability, trademark and document use rules apply.
13 */
14
15[Constructor]
16interface Range {
17  [Throws]
18  readonly attribute Node startContainer;
19  [Throws]
20  readonly attribute unsigned long startOffset;
21  [Throws]
22  readonly attribute Node endContainer;
23  [Throws]
24  readonly attribute unsigned long endOffset;
25  readonly attribute boolean collapsed;
26  [Throws]
27  readonly attribute Node commonAncestorContainer;
28
29  [Throws, BinaryName="setStartJS"]
30  void setStart(Node refNode, unsigned long offset);
31  [Throws, BinaryName="setEndJS"]
32  void setEnd(Node refNode, unsigned long offset);
33  [Throws, BinaryName="setStartBeforeJS"]
34  void setStartBefore(Node refNode);
35  [Throws, BinaryName="setStartAfterJS"]
36  void setStartAfter(Node refNode);
37  [Throws, BinaryName="setEndBeforeJS"]
38  void setEndBefore(Node refNode);
39  [Throws, BinaryName="setEndAfterJS"]
40  void setEndAfter(Node refNode);
41  [BinaryName="collapseJS"]
42  void collapse(optional boolean toStart = false);
43  [Throws, BinaryName="selectNodeJS"]
44  void selectNode(Node refNode);
45  [Throws, BinaryName="selectNodeContentsJS"]
46  void selectNodeContents(Node refNode);
47
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  [Throws]
53  short compareBoundaryPoints(unsigned short how, Range sourceRange);
54  [CEReactions, Throws]
55  void deleteContents();
56  [CEReactions, Throws]
57  DocumentFragment extractContents();
58  [CEReactions, Throws]
59  DocumentFragment cloneContents();
60  [CEReactions, Throws]
61  void insertNode(Node node);
62  [CEReactions, Throws]
63  void surroundContents(Node newParent);
64
65  Range cloneRange();
66  void detach();
67
68  [Throws]
69  boolean isPointInRange(Node node, unsigned long offset);
70  [Throws]
71  short comparePoint(Node node, unsigned long offset);
72
73  [Throws]
74  boolean intersectsNode(Node node);
75
76  [Throws]
77  stringifier;
78};
79
80// http://domparsing.spec.whatwg.org/#dom-range-createcontextualfragment
81partial interface Range {
82  [CEReactions, Throws]
83  DocumentFragment createContextualFragment(DOMString fragment);
84};
85
86// http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-view/Overview.html#extensions-to-the-range-interface
87partial interface Range {
88  DOMRectList? getClientRects();
89  DOMRect getBoundingClientRect();
90};
91
92dictionary ClientRectsAndTexts {
93  required DOMRectList rectList;
94  required sequence<DOMString> textList;
95};
96
97partial interface Range {
98  [ChromeOnly, Throws]
99  ClientRectsAndTexts getClientRectsAndTexts();
100};
101