michael@0: /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: * michael@0: * The origin of this IDL file is michael@0: * https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#concept-selection michael@0: * michael@0: * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C michael@0: * liability, trademark and document use rules apply. michael@0: */ michael@0: michael@0: interface Selection { michael@0: readonly attribute Node? anchorNode; michael@0: readonly attribute unsigned long anchorOffset; michael@0: readonly attribute Node? focusNode; michael@0: readonly attribute unsigned long focusOffset; michael@0: michael@0: readonly attribute boolean isCollapsed; michael@0: [Throws] michael@0: void collapse(Node node, unsigned long offset); michael@0: [Throws] michael@0: void collapseToStart(); michael@0: [Throws] michael@0: void collapseToEnd(); michael@0: michael@0: [Throws] michael@0: void extend(Node node, unsigned long offset); michael@0: michael@0: [Throws] michael@0: void selectAllChildren(Node node); michael@0: [Throws] michael@0: void deleteFromDocument(); michael@0: michael@0: readonly attribute unsigned long rangeCount; michael@0: [Throws] michael@0: Range getRangeAt(unsigned long index); michael@0: [Throws] michael@0: void addRange(Range range); michael@0: [Throws] michael@0: void removeRange(Range range); michael@0: [Throws] michael@0: void removeAllRanges(); michael@0: michael@0: stringifier; michael@0: }; michael@0: michael@0: // Additional methods not currently in the spec michael@0: partial interface Selection { michael@0: [Throws] michael@0: boolean containsNode(Node? node, boolean partlyContained); michael@0: michael@0: [Throws] michael@0: void modify(DOMString alter, DOMString direction, michael@0: DOMString granularity); michael@0: }; michael@0: michael@0: // Additional chrome-only methods from nsISelectionPrivate michael@0: interface nsISelectionListener; michael@0: partial interface Selection { michael@0: [ChromeOnly] michael@0: const short ENDOFPRECEDINGLINE = 0; michael@0: [ChromeOnly] michael@0: const short STARTOFNEXTLINE = 1; michael@0: michael@0: [ChromeOnly,Throws] michael@0: attribute boolean interlinePosition; michael@0: michael@0: [ChromeOnly,Throws] michael@0: DOMString toStringWithFormat(DOMString formatType, unsigned long flags, long wrapColumn); michael@0: [ChromeOnly,Throws] michael@0: void addSelectionListener(nsISelectionListener newListener); michael@0: [ChromeOnly,Throws] michael@0: void removeSelectionListener(nsISelectionListener listenerToRemove); michael@0: michael@0: [ChromeOnly] michael@0: readonly attribute short type; michael@0: michael@0: [ChromeOnly,Throws,Pref="dom.testing.selection.GetRangesForInterval"] michael@0: sequence GetRangesForInterval(Node beginNode, long beginOffset, Node endNode, long endOffset, michael@0: boolean allowAdjacent); michael@0: michael@0: [ChromeOnly,Throws] michael@0: void scrollIntoView(short aRegion, boolean aIsSynchronous, short aVPercent, short aHPercent); michael@0: };