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/.
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
11 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
12 * liability, trademark and document use rules apply.
15 // Use ProbablyShortLivingWrapper so that the Range object could be deleted
16 // as soon as possible, and thus slow down DOM operations less.
17 [Exposed=Window, ProbablyShortLivingWrapper]
18 interface Range : AbstractRange {
23 readonly attribute Node commonAncestorContainer;
25 [Throws, BinaryName="setStartJS"]
26 undefined setStart(Node refNode, unsigned long offset);
27 [Throws, BinaryName="setEndJS"]
28 undefined setEnd(Node refNode, unsigned long offset);
29 [Throws, BinaryName="setStartBeforeJS"]
30 undefined setStartBefore(Node refNode);
31 [Throws, BinaryName="setStartAfterJS"]
32 undefined setStartAfter(Node refNode);
33 [Throws, BinaryName="setEndBeforeJS"]
34 undefined setEndBefore(Node refNode);
35 [Throws, BinaryName="setEndAfterJS"]
36 undefined setEndAfter(Node refNode);
37 [BinaryName="collapseJS"]
38 undefined collapse(optional boolean toStart = false);
39 [Throws, BinaryName="selectNodeJS"]
40 undefined selectNode(Node refNode);
41 [Throws, BinaryName="selectNodeContentsJS"]
42 undefined selectNodeContents(Node refNode);
44 const unsigned short START_TO_START = 0;
45 const unsigned short START_TO_END = 1;
46 const unsigned short END_TO_END = 2;
47 const unsigned short END_TO_START = 3;
49 short compareBoundaryPoints(unsigned short how, Range sourceRange);
51 undefined deleteContents();
53 DocumentFragment extractContents();
55 DocumentFragment cloneContents();
57 undefined insertNode(Node node);
59 undefined surroundContents(Node newParent);
65 boolean isPointInRange(Node node, unsigned long offset);
67 short comparePoint(Node node, unsigned long offset);
70 boolean intersectsNode(Node node);
72 [Throws, BinaryName="ToString"]
76 // http://domparsing.spec.whatwg.org/#dom-range-createcontextualfragment
77 partial interface Range {
78 [CEReactions, Throws, UseCounter]
79 DocumentFragment createContextualFragment(DOMString fragment);
82 // http://dvcs.w3.org/hg/csswg/raw-file/tip/cssom-view/Overview.html#extensions-to-the-range-interface
83 partial interface Range {
84 DOMRectList? getClientRects();
85 DOMRect getBoundingClientRect();
88 dictionary ClientRectsAndTexts {
89 required DOMRectList rectList;
90 required sequence<DOMString> textList;
93 partial interface Range {
95 ClientRectsAndTexts getClientRectsAndTexts();
98 // ChromeOnly methods that allow setting Range boundaries to cross
100 partial interface Range {
102 undefined setStartAllowCrossShadowBoundary(Node refNode, unsigned long offset);
104 undefined setEndAllowCrossShadowBoundary(Node refNode, unsigned long offset);