dom/interfaces/range/nsIDOMRange.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/interfaces/range/nsIDOMRange.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,77 @@
     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
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "domstubs.idl"
    1.10 +
    1.11 +/**
    1.12 + * The nsIDOMRange interface is an interface to a DOM range object.
    1.13 + *
    1.14 + * For more information on this interface please see
    1.15 + * http://www.w3.org/TR/DOM-Level-2-Traversal-Range/
    1.16 + */
    1.17 +
    1.18 +[scriptable, builtinclass, uuid(1f94055c-42e7-4a30-96a1-6a804f1c2d1e)]
    1.19 +interface nsIDOMRange : nsISupports
    1.20 +{
    1.21 +  readonly attribute nsIDOMNode       startContainer;
    1.22 +  readonly attribute long             startOffset;
    1.23 +  readonly attribute nsIDOMNode       endContainer;
    1.24 +  readonly attribute long             endOffset;
    1.25 +  readonly attribute boolean          collapsed;
    1.26 +  readonly attribute nsIDOMNode       commonAncestorContainer;
    1.27 +
    1.28 +  void               setStart(in nsIDOMNode refNode, in long offset);
    1.29 +  void               setEnd(in nsIDOMNode refNode, in long offset);
    1.30 +  void               setStartBefore(in nsIDOMNode refNode);
    1.31 +  void               setStartAfter(in nsIDOMNode refNode);
    1.32 +  void               setEndBefore(in nsIDOMNode refNode);
    1.33 +  void               setEndAfter(in nsIDOMNode refNode);
    1.34 +  void               collapse(in boolean toStart);
    1.35 +  void               selectNode(in nsIDOMNode refNode);
    1.36 +  void               selectNodeContents(in nsIDOMNode refNode);
    1.37 +
    1.38 +  // CompareHow
    1.39 +  const unsigned short      START_TO_START                 = 0;
    1.40 +  const unsigned short      START_TO_END                   = 1;
    1.41 +  const unsigned short      END_TO_END                     = 2;
    1.42 +  const unsigned short      END_TO_START                   = 3;
    1.43 +
    1.44 +  short              compareBoundaryPoints(in unsigned short how,
    1.45 +                                           in nsIDOMRange sourceRange);
    1.46 +  void               deleteContents();
    1.47 +  nsIDOMDocumentFragment extractContents();
    1.48 +  nsIDOMDocumentFragment cloneContents();
    1.49 +  void               insertNode(in nsIDOMNode newNode);
    1.50 +  void               surroundContents(in nsIDOMNode newParent);
    1.51 +  nsIDOMRange        cloneRange();
    1.52 +  DOMString          toString();
    1.53 +  void               detach();
    1.54 +  
    1.55 +  // This method comes from
    1.56 +  // http://html5.org/specs/dom-parsing.html#extensions-to-the-range-interface
    1.57 +  nsIDOMDocumentFragment    createContextualFragment(in DOMString fragment);
    1.58 +
    1.59 +  // This returns true if parent+offset equals either
    1.60 +  // of the boundary points or is between them.
    1.61 +  boolean                   isPointInRange(in nsIDOMNode parent,
    1.62 +                                           in long offset);
    1.63 +
    1.64 +  // comparePoint returns
    1.65 +  //   -1 if point is before the start boundary point,
    1.66 +  //    0 if point is either of the boundary points or between them,
    1.67 +  //    1 if point is after the end boundary point.
    1.68 +  // Sort of a strcmp for ranges.
    1.69 +  short                     comparePoint(in nsIDOMNode parent, in long offset);
    1.70 +
    1.71 +  /**
    1.72 +   * Returns whether the range intersects node.
    1.73 +   */
    1.74 +  boolean                   intersectsNode(in nsIDOMNode node);
    1.75 +
    1.76 +  // These methods come from 
    1.77 +  // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-range-interface
    1.78 +  nsIDOMClientRectList getClientRects();
    1.79 +  nsIDOMClientRect getBoundingClientRect();
    1.80 +};

mercurial