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 |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "domstubs.idl" |
michael@0 | 7 | |
michael@0 | 8 | /** |
michael@0 | 9 | * The nsIDOMRange interface is an interface to a DOM range object. |
michael@0 | 10 | * |
michael@0 | 11 | * For more information on this interface please see |
michael@0 | 12 | * http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ |
michael@0 | 13 | */ |
michael@0 | 14 | |
michael@0 | 15 | [scriptable, builtinclass, uuid(1f94055c-42e7-4a30-96a1-6a804f1c2d1e)] |
michael@0 | 16 | interface nsIDOMRange : nsISupports |
michael@0 | 17 | { |
michael@0 | 18 | readonly attribute nsIDOMNode startContainer; |
michael@0 | 19 | readonly attribute long startOffset; |
michael@0 | 20 | readonly attribute nsIDOMNode endContainer; |
michael@0 | 21 | readonly attribute long endOffset; |
michael@0 | 22 | readonly attribute boolean collapsed; |
michael@0 | 23 | readonly attribute nsIDOMNode commonAncestorContainer; |
michael@0 | 24 | |
michael@0 | 25 | void setStart(in nsIDOMNode refNode, in long offset); |
michael@0 | 26 | void setEnd(in nsIDOMNode refNode, in long offset); |
michael@0 | 27 | void setStartBefore(in nsIDOMNode refNode); |
michael@0 | 28 | void setStartAfter(in nsIDOMNode refNode); |
michael@0 | 29 | void setEndBefore(in nsIDOMNode refNode); |
michael@0 | 30 | void setEndAfter(in nsIDOMNode refNode); |
michael@0 | 31 | void collapse(in boolean toStart); |
michael@0 | 32 | void selectNode(in nsIDOMNode refNode); |
michael@0 | 33 | void selectNodeContents(in nsIDOMNode refNode); |
michael@0 | 34 | |
michael@0 | 35 | // CompareHow |
michael@0 | 36 | const unsigned short START_TO_START = 0; |
michael@0 | 37 | const unsigned short START_TO_END = 1; |
michael@0 | 38 | const unsigned short END_TO_END = 2; |
michael@0 | 39 | const unsigned short END_TO_START = 3; |
michael@0 | 40 | |
michael@0 | 41 | short compareBoundaryPoints(in unsigned short how, |
michael@0 | 42 | in nsIDOMRange sourceRange); |
michael@0 | 43 | void deleteContents(); |
michael@0 | 44 | nsIDOMDocumentFragment extractContents(); |
michael@0 | 45 | nsIDOMDocumentFragment cloneContents(); |
michael@0 | 46 | void insertNode(in nsIDOMNode newNode); |
michael@0 | 47 | void surroundContents(in nsIDOMNode newParent); |
michael@0 | 48 | nsIDOMRange cloneRange(); |
michael@0 | 49 | DOMString toString(); |
michael@0 | 50 | void detach(); |
michael@0 | 51 | |
michael@0 | 52 | // This method comes from |
michael@0 | 53 | // http://html5.org/specs/dom-parsing.html#extensions-to-the-range-interface |
michael@0 | 54 | nsIDOMDocumentFragment createContextualFragment(in DOMString fragment); |
michael@0 | 55 | |
michael@0 | 56 | // This returns true if parent+offset equals either |
michael@0 | 57 | // of the boundary points or is between them. |
michael@0 | 58 | boolean isPointInRange(in nsIDOMNode parent, |
michael@0 | 59 | in long offset); |
michael@0 | 60 | |
michael@0 | 61 | // comparePoint returns |
michael@0 | 62 | // -1 if point is before the start boundary point, |
michael@0 | 63 | // 0 if point is either of the boundary points or between them, |
michael@0 | 64 | // 1 if point is after the end boundary point. |
michael@0 | 65 | // Sort of a strcmp for ranges. |
michael@0 | 66 | short comparePoint(in nsIDOMNode parent, in long offset); |
michael@0 | 67 | |
michael@0 | 68 | /** |
michael@0 | 69 | * Returns whether the range intersects node. |
michael@0 | 70 | */ |
michael@0 | 71 | boolean intersectsNode(in nsIDOMNode node); |
michael@0 | 72 | |
michael@0 | 73 | // These methods come from |
michael@0 | 74 | // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-range-interface |
michael@0 | 75 | nsIDOMClientRectList getClientRects(); |
michael@0 | 76 | nsIDOMClientRect getBoundingClientRect(); |
michael@0 | 77 | }; |