Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 21:42:36 +04:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2001-01-21 12:21:24 +03:00
|
|
|
|
|
|
|
#include "domstubs.idl"
|
2003-01-15 02:05:52 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The nsIDOMRange interface is an interface to a DOM range object.
|
|
|
|
*
|
|
|
|
* For more information on this interface please see
|
|
|
|
* http://www.w3.org/TR/DOM-Level-2-Traversal-Range/
|
|
|
|
*/
|
|
|
|
|
2012-07-18 14:36:08 +04:00
|
|
|
[scriptable, builtinclass, uuid(1f94055c-42e7-4a30-96a1-6a804f1c2d1e)]
|
2001-01-21 12:21:24 +03:00
|
|
|
interface nsIDOMRange : nsISupports
|
|
|
|
{
|
2003-01-15 02:05:52 +03:00
|
|
|
readonly attribute nsIDOMNode startContainer;
|
|
|
|
readonly attribute long startOffset;
|
|
|
|
readonly attribute nsIDOMNode endContainer;
|
|
|
|
readonly attribute long endOffset;
|
|
|
|
readonly attribute boolean collapsed;
|
|
|
|
readonly attribute nsIDOMNode commonAncestorContainer;
|
2001-05-15 10:09:47 +04:00
|
|
|
|
2012-03-01 22:35:13 +04:00
|
|
|
void setStart(in nsIDOMNode refNode, in long offset);
|
|
|
|
void setEnd(in nsIDOMNode refNode, in long offset);
|
|
|
|
void setStartBefore(in nsIDOMNode refNode);
|
|
|
|
void setStartAfter(in nsIDOMNode refNode);
|
|
|
|
void setEndBefore(in nsIDOMNode refNode);
|
|
|
|
void setEndAfter(in nsIDOMNode refNode);
|
|
|
|
void collapse(in boolean toStart);
|
|
|
|
void selectNode(in nsIDOMNode refNode);
|
|
|
|
void selectNodeContents(in nsIDOMNode refNode);
|
2001-05-15 10:09:47 +04:00
|
|
|
|
2003-01-15 02:05:52 +03:00
|
|
|
// CompareHow
|
|
|
|
const unsigned short START_TO_START = 0;
|
|
|
|
const unsigned short START_TO_END = 1;
|
|
|
|
const unsigned short END_TO_END = 2;
|
|
|
|
const unsigned short END_TO_START = 3;
|
2001-05-15 10:09:47 +04:00
|
|
|
|
2003-01-15 02:05:52 +03:00
|
|
|
short compareBoundaryPoints(in unsigned short how,
|
2012-03-01 22:35:13 +04:00
|
|
|
in nsIDOMRange sourceRange);
|
|
|
|
void deleteContents();
|
|
|
|
nsIDOMDocumentFragment extractContents();
|
|
|
|
nsIDOMDocumentFragment cloneContents();
|
|
|
|
void insertNode(in nsIDOMNode newNode);
|
|
|
|
void surroundContents(in nsIDOMNode newParent);
|
|
|
|
nsIDOMRange cloneRange();
|
|
|
|
DOMString toString();
|
2009-11-03 21:39:43 +03:00
|
|
|
void detach();
|
2012-01-10 18:19:54 +04:00
|
|
|
|
|
|
|
// This method comes from
|
|
|
|
// http://html5.org/specs/dom-parsing.html#extensions-to-the-range-interface
|
|
|
|
nsIDOMDocumentFragment createContextualFragment(in DOMString fragment);
|
|
|
|
|
|
|
|
// This returns true if parent+offset equals either
|
|
|
|
// of the boundary points or is between them.
|
|
|
|
boolean isPointInRange(in nsIDOMNode parent,
|
|
|
|
in long offset);
|
|
|
|
|
|
|
|
// comparePoint returns
|
|
|
|
// -1 if point is before the start boundary point,
|
|
|
|
// 0 if point is either of the boundary points or between them,
|
|
|
|
// 1 if point is after the end boundary point.
|
|
|
|
// Sort of a strcmp for ranges.
|
|
|
|
short comparePoint(in nsIDOMNode parent, in long offset);
|
|
|
|
|
2012-07-18 14:36:08 +04:00
|
|
|
/**
|
|
|
|
* Returns whether the range intersects node.
|
|
|
|
*/
|
|
|
|
boolean intersectsNode(in nsIDOMNode node);
|
|
|
|
|
2012-01-10 18:19:54 +04:00
|
|
|
// These methods come from
|
|
|
|
// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-range-interface
|
|
|
|
nsIDOMClientRectList getClientRects();
|
|
|
|
nsIDOMClientRect getBoundingClientRect();
|
2001-01-21 12:21:24 +03:00
|
|
|
};
|