Bug 1634779 - pt 2. Partially revert Bug 1603006 r=kmag
[gecko.git] / dom / webidl / Range.webidl
blob281cd72350233ccbbf4b870ba970c96905333d6d
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  */
15 [Exposed=Window]
16 interface Range : AbstractRange {
17   [Throws]
18   constructor();
20   [Throws]
21   readonly attribute Node commonAncestorContainer;
23   [Throws, BinaryName="setStartJS"]
24   void setStart(Node refNode, unsigned long offset);
25   [Throws, BinaryName="setEndJS"]
26   void setEnd(Node refNode, unsigned long offset);
27   [Throws, BinaryName="setStartBeforeJS"]
28   void setStartBefore(Node refNode);
29   [Throws, BinaryName="setStartAfterJS"]
30   void setStartAfter(Node refNode);
31   [Throws, BinaryName="setEndBeforeJS"]
32   void setEndBefore(Node refNode);
33   [Throws, BinaryName="setEndAfterJS"]
34   void setEndAfter(Node refNode);
35   [BinaryName="collapseJS"]
36   void collapse(optional boolean toStart = false);
37   [Throws, BinaryName="selectNodeJS"]
38   void selectNode(Node refNode);
39   [Throws, BinaryName="selectNodeContentsJS"]
40   void selectNodeContents(Node refNode);
42   const unsigned short START_TO_START = 0;
43   const unsigned short START_TO_END = 1;
44   const unsigned short END_TO_END = 2;
45   const unsigned short END_TO_START = 3;
46   [Throws]
47   short compareBoundaryPoints(unsigned short how, Range sourceRange);
48   [CEReactions, Throws]
49   void deleteContents();
50   [CEReactions, Throws]
51   DocumentFragment extractContents();
52   [CEReactions, Throws]
53   DocumentFragment cloneContents();
54   [CEReactions, Throws]
55   void insertNode(Node node);
56   [CEReactions, Throws]
57   void surroundContents(Node newParent);
59   Range cloneRange();
60   void detach();
62   [Throws]
63   boolean isPointInRange(Node node, unsigned long offset);
64   [Throws]
65   short comparePoint(Node node, unsigned long offset);
67   [Throws]
68   boolean intersectsNode(Node node);
70   [Throws, BinaryName="ToString"]
71   stringifier;
74 // http://domparsing.spec.whatwg.org/#dom-range-createcontextualfragment
75 partial interface Range {
76   [CEReactions, Throws]
77   DocumentFragment createContextualFragment(DOMString fragment);
80 // http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-view/Overview.html#extensions-to-the-range-interface
81 partial interface Range {
82   DOMRectList? getClientRects();
83   DOMRect getBoundingClientRect();
86 dictionary ClientRectsAndTexts {
87   required DOMRectList rectList;
88   required sequence<DOMString> textList;
91 partial interface Range {
92   [ChromeOnly, Throws]
93   ClientRectsAndTexts getClientRectsAndTexts();