dom/webidl/Selection.webidl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/webidl/Selection.webidl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,85 @@
     1.4 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.7 + * You can obtain one at http://mozilla.org/MPL/2.0/.
     1.8 + *
     1.9 + * The origin of this IDL file is
    1.10 + * https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#concept-selection
    1.11 + *
    1.12 + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
    1.13 + * liability, trademark and document use rules apply.
    1.14 + */
    1.15 +
    1.16 +interface Selection {
    1.17 +  readonly attribute Node? anchorNode;
    1.18 +  readonly attribute unsigned long anchorOffset;
    1.19 +  readonly attribute Node? focusNode;
    1.20 +  readonly attribute unsigned long focusOffset;
    1.21 +
    1.22 +  readonly attribute boolean isCollapsed;
    1.23 +  [Throws]
    1.24 +  void               collapse(Node node, unsigned long offset);
    1.25 +  [Throws]
    1.26 +  void               collapseToStart();
    1.27 +  [Throws]
    1.28 +  void               collapseToEnd();
    1.29 +
    1.30 +  [Throws]
    1.31 +  void               extend(Node node, unsigned long offset);
    1.32 +
    1.33 +  [Throws]
    1.34 +  void               selectAllChildren(Node node);
    1.35 +  [Throws]
    1.36 +  void               deleteFromDocument();
    1.37 +
    1.38 +  readonly attribute unsigned long rangeCount;
    1.39 +  [Throws]
    1.40 +  Range              getRangeAt(unsigned long index);
    1.41 +  [Throws]
    1.42 +  void               addRange(Range range);
    1.43 +  [Throws]
    1.44 +  void               removeRange(Range range);
    1.45 +  [Throws]
    1.46 +  void               removeAllRanges();
    1.47 +
    1.48 +  stringifier;
    1.49 +};
    1.50 +
    1.51 +// Additional methods not currently in the spec
    1.52 +partial interface Selection {
    1.53 +  [Throws]
    1.54 +  boolean containsNode(Node? node, boolean partlyContained);
    1.55 +
    1.56 +  [Throws]
    1.57 +  void modify(DOMString alter, DOMString direction,
    1.58 +              DOMString granularity);
    1.59 +};
    1.60 +
    1.61 +// Additional chrome-only methods from nsISelectionPrivate
    1.62 +interface nsISelectionListener;
    1.63 +partial interface Selection {
    1.64 +  [ChromeOnly]
    1.65 +  const short ENDOFPRECEDINGLINE = 0;
    1.66 +  [ChromeOnly]
    1.67 +  const short STARTOFNEXTLINE = 1;
    1.68 +
    1.69 +  [ChromeOnly,Throws]
    1.70 +  attribute boolean interlinePosition;
    1.71 +
    1.72 +  [ChromeOnly,Throws]
    1.73 +  DOMString  toStringWithFormat(DOMString formatType, unsigned long flags, long wrapColumn);
    1.74 +  [ChromeOnly,Throws]
    1.75 +  void  addSelectionListener(nsISelectionListener newListener);
    1.76 +  [ChromeOnly,Throws]
    1.77 +  void  removeSelectionListener(nsISelectionListener listenerToRemove);
    1.78 +
    1.79 +  [ChromeOnly]
    1.80 +  readonly attribute short type;
    1.81 +
    1.82 +  [ChromeOnly,Throws,Pref="dom.testing.selection.GetRangesForInterval"]
    1.83 +  sequence<Range> GetRangesForInterval(Node beginNode, long beginOffset, Node endNode, long endOffset,
    1.84 +                                       boolean allowAdjacent);
    1.85 +
    1.86 +  [ChromeOnly,Throws]
    1.87 +  void scrollIntoView(short aRegion, boolean aIsSynchronous, short aVPercent, short aHPercent);
    1.88 +};

mercurial