Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 4 | * You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 5 | * |
michael@0 | 6 | * The origin of this IDL file is |
michael@0 | 7 | * https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#concept-selection |
michael@0 | 8 | * |
michael@0 | 9 | * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C |
michael@0 | 10 | * liability, trademark and document use rules apply. |
michael@0 | 11 | */ |
michael@0 | 12 | |
michael@0 | 13 | interface Selection { |
michael@0 | 14 | readonly attribute Node? anchorNode; |
michael@0 | 15 | readonly attribute unsigned long anchorOffset; |
michael@0 | 16 | readonly attribute Node? focusNode; |
michael@0 | 17 | readonly attribute unsigned long focusOffset; |
michael@0 | 18 | |
michael@0 | 19 | readonly attribute boolean isCollapsed; |
michael@0 | 20 | [Throws] |
michael@0 | 21 | void collapse(Node node, unsigned long offset); |
michael@0 | 22 | [Throws] |
michael@0 | 23 | void collapseToStart(); |
michael@0 | 24 | [Throws] |
michael@0 | 25 | void collapseToEnd(); |
michael@0 | 26 | |
michael@0 | 27 | [Throws] |
michael@0 | 28 | void extend(Node node, unsigned long offset); |
michael@0 | 29 | |
michael@0 | 30 | [Throws] |
michael@0 | 31 | void selectAllChildren(Node node); |
michael@0 | 32 | [Throws] |
michael@0 | 33 | void deleteFromDocument(); |
michael@0 | 34 | |
michael@0 | 35 | readonly attribute unsigned long rangeCount; |
michael@0 | 36 | [Throws] |
michael@0 | 37 | Range getRangeAt(unsigned long index); |
michael@0 | 38 | [Throws] |
michael@0 | 39 | void addRange(Range range); |
michael@0 | 40 | [Throws] |
michael@0 | 41 | void removeRange(Range range); |
michael@0 | 42 | [Throws] |
michael@0 | 43 | void removeAllRanges(); |
michael@0 | 44 | |
michael@0 | 45 | stringifier; |
michael@0 | 46 | }; |
michael@0 | 47 | |
michael@0 | 48 | // Additional methods not currently in the spec |
michael@0 | 49 | partial interface Selection { |
michael@0 | 50 | [Throws] |
michael@0 | 51 | boolean containsNode(Node? node, boolean partlyContained); |
michael@0 | 52 | |
michael@0 | 53 | [Throws] |
michael@0 | 54 | void modify(DOMString alter, DOMString direction, |
michael@0 | 55 | DOMString granularity); |
michael@0 | 56 | }; |
michael@0 | 57 | |
michael@0 | 58 | // Additional chrome-only methods from nsISelectionPrivate |
michael@0 | 59 | interface nsISelectionListener; |
michael@0 | 60 | partial interface Selection { |
michael@0 | 61 | [ChromeOnly] |
michael@0 | 62 | const short ENDOFPRECEDINGLINE = 0; |
michael@0 | 63 | [ChromeOnly] |
michael@0 | 64 | const short STARTOFNEXTLINE = 1; |
michael@0 | 65 | |
michael@0 | 66 | [ChromeOnly,Throws] |
michael@0 | 67 | attribute boolean interlinePosition; |
michael@0 | 68 | |
michael@0 | 69 | [ChromeOnly,Throws] |
michael@0 | 70 | DOMString toStringWithFormat(DOMString formatType, unsigned long flags, long wrapColumn); |
michael@0 | 71 | [ChromeOnly,Throws] |
michael@0 | 72 | void addSelectionListener(nsISelectionListener newListener); |
michael@0 | 73 | [ChromeOnly,Throws] |
michael@0 | 74 | void removeSelectionListener(nsISelectionListener listenerToRemove); |
michael@0 | 75 | |
michael@0 | 76 | [ChromeOnly] |
michael@0 | 77 | readonly attribute short type; |
michael@0 | 78 | |
michael@0 | 79 | [ChromeOnly,Throws,Pref="dom.testing.selection.GetRangesForInterval"] |
michael@0 | 80 | sequence<Range> GetRangesForInterval(Node beginNode, long beginOffset, Node endNode, long endOffset, |
michael@0 | 81 | boolean allowAdjacent); |
michael@0 | 82 | |
michael@0 | 83 | [ChromeOnly,Throws] |
michael@0 | 84 | void scrollIntoView(short aRegion, boolean aIsSynchronous, short aVPercent, short aHPercent); |
michael@0 | 85 | }; |