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 * https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#concept-selection
9 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
10 * liability, trademark and document use rules apply.
14 readonly attribute Node? anchorNode;
15 readonly attribute unsigned long anchorOffset;
16 readonly attribute Node? focusNode;
17 readonly attribute unsigned long focusOffset;
19 readonly attribute boolean isCollapsed;
21 void collapse(Node node, unsigned long offset);
23 void collapseToStart();
28 void extend(Node node, unsigned long offset);
31 void selectAllChildren(Node node);
33 void deleteFromDocument();
35 readonly attribute unsigned long rangeCount;
37 Range getRangeAt(unsigned long index);
39 void addRange(Range range);
41 void removeRange(Range range);
43 void removeAllRanges();
48 // Additional methods not currently in the spec
49 partial interface Selection {
51 boolean containsNode(Node? node, boolean partlyContained);
54 void modify(DOMString alter, DOMString direction,
55 DOMString granularity);
58 // Additional chrome-only methods from nsISelectionPrivate
59 interface nsISelectionListener;
60 partial interface Selection {
62 const short ENDOFPRECEDINGLINE = 0;
64 const short STARTOFNEXTLINE = 1;
67 attribute boolean interlinePosition;
70 DOMString toStringWithFormat(DOMString formatType, unsigned long flags, long wrapColumn);
72 void addSelectionListener(nsISelectionListener newListener);
74 void removeSelectionListener(nsISelectionListener listenerToRemove);
77 readonly attribute short type;
79 [ChromeOnly,Throws,Pref="dom.testing.selection.GetRangesForInterval"]
80 sequence<Range> GetRangesForInterval(Node beginNode, long beginOffset, Node endNode, long endOffset,
81 boolean allowAdjacent);
84 void scrollIntoView(short aRegion, boolean aIsSynchronous, short aVPercent, short aHPercent);