|
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 * https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#concept-selection |
|
8 * |
|
9 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C |
|
10 * liability, trademark and document use rules apply. |
|
11 */ |
|
12 |
|
13 interface Selection { |
|
14 readonly attribute Node? anchorNode; |
|
15 readonly attribute unsigned long anchorOffset; |
|
16 readonly attribute Node? focusNode; |
|
17 readonly attribute unsigned long focusOffset; |
|
18 |
|
19 readonly attribute boolean isCollapsed; |
|
20 [Throws] |
|
21 void collapse(Node node, unsigned long offset); |
|
22 [Throws] |
|
23 void collapseToStart(); |
|
24 [Throws] |
|
25 void collapseToEnd(); |
|
26 |
|
27 [Throws] |
|
28 void extend(Node node, unsigned long offset); |
|
29 |
|
30 [Throws] |
|
31 void selectAllChildren(Node node); |
|
32 [Throws] |
|
33 void deleteFromDocument(); |
|
34 |
|
35 readonly attribute unsigned long rangeCount; |
|
36 [Throws] |
|
37 Range getRangeAt(unsigned long index); |
|
38 [Throws] |
|
39 void addRange(Range range); |
|
40 [Throws] |
|
41 void removeRange(Range range); |
|
42 [Throws] |
|
43 void removeAllRanges(); |
|
44 |
|
45 stringifier; |
|
46 }; |
|
47 |
|
48 // Additional methods not currently in the spec |
|
49 partial interface Selection { |
|
50 [Throws] |
|
51 boolean containsNode(Node? node, boolean partlyContained); |
|
52 |
|
53 [Throws] |
|
54 void modify(DOMString alter, DOMString direction, |
|
55 DOMString granularity); |
|
56 }; |
|
57 |
|
58 // Additional chrome-only methods from nsISelectionPrivate |
|
59 interface nsISelectionListener; |
|
60 partial interface Selection { |
|
61 [ChromeOnly] |
|
62 const short ENDOFPRECEDINGLINE = 0; |
|
63 [ChromeOnly] |
|
64 const short STARTOFNEXTLINE = 1; |
|
65 |
|
66 [ChromeOnly,Throws] |
|
67 attribute boolean interlinePosition; |
|
68 |
|
69 [ChromeOnly,Throws] |
|
70 DOMString toStringWithFormat(DOMString formatType, unsigned long flags, long wrapColumn); |
|
71 [ChromeOnly,Throws] |
|
72 void addSelectionListener(nsISelectionListener newListener); |
|
73 [ChromeOnly,Throws] |
|
74 void removeSelectionListener(nsISelectionListener listenerToRemove); |
|
75 |
|
76 [ChromeOnly] |
|
77 readonly attribute short type; |
|
78 |
|
79 [ChromeOnly,Throws,Pref="dom.testing.selection.GetRangesForInterval"] |
|
80 sequence<Range> GetRangesForInterval(Node beginNode, long beginOffset, Node endNode, long endOffset, |
|
81 boolean allowAdjacent); |
|
82 |
|
83 [ChromeOnly,Throws] |
|
84 void scrollIntoView(short aRegion, boolean aIsSynchronous, short aVPercent, short aHPercent); |
|
85 }; |