Bug 682611 - Part 1: Merge nsIDOMRange and nsIDOMNSRange; r=Ms2ger r=smaug
authorDavid Zbarsky <dzbarsky@gmail.com>
Tue, 10 Jan 2012 15:19:54 +0100
changeset 84119 6e016e20e726a465058c3ae64e893d6050af528d
parent 84098 25fe3fddc59e8d04dbcb48edb0745aa62d0772bd
child 84120 3c6cfdfe7d4650eaeb2a393ef5cc146a930ac5cf
push id21828
push userbmo@edmorley.co.uk
push dateWed, 11 Jan 2012 02:40:23 +0000
treeherdermozilla-central@e79ef0ffcb09 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMs2ger, smaug
bugs682611
milestone12.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 682611 - Part 1: Merge nsIDOMRange and nsIDOMNSRange; r=Ms2ger r=smaug
accessible/src/html/nsHyperTextAccessible.cpp
content/base/src/nsRange.cpp
content/base/src/nsRange.h
content/base/test/test_bug451376.html
content/test/unit/test_range.js
dom/base/nsDOMClassInfo.cpp
dom/interfaces/range/Makefile.in
dom/interfaces/range/nsIDOMNSRange.idl
dom/interfaces/range/nsIDOMRange.idl
editor/libeditor/base/nsEditorEventListener.cpp
editor/libeditor/html/nsHTMLDataTransfer.cpp
editor/libeditor/html/nsHTMLEditRules.cpp
editor/libeditor/html/nsHTMLEditor.cpp
editor/libeditor/html/nsHTMLEditor.h
editor/libeditor/html/nsHTMLEditorEventListener.cpp
editor/libeditor/text/nsPlaintextDataTransfer.cpp
editor/libeditor/text/nsTextEditRules.cpp
editor/txtsvc/src/nsFilteredContentIterator.cpp
editor/txtsvc/src/nsFilteredContentIterator.h
extensions/spellcheck/src/mozInlineSpellChecker.cpp
extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
mobile/xul/chrome/content/content.js
--- a/accessible/src/html/nsHyperTextAccessible.cpp
+++ b/accessible/src/html/nsHyperTextAccessible.cpp
@@ -45,17 +45,16 @@
 #include "nsTextAttrs.h"
 
 #include "nsIClipboard.h"
 #include "nsContentCID.h"
 #include "nsFocusManager.h"
 #include "nsIDOMCharacterData.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMRange.h"
-#include "nsIDOMNSRange.h"
 #include "nsIDOMXULDocument.h"
 #include "nsIEditingSession.h"
 #include "nsIEditor.h"
 #include "nsIFrame.h"
 #include "nsFrameSelection.h"
 #include "nsILineIterator.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIPlaintextEditor.h"
@@ -2350,21 +2349,20 @@ nsHyperTextAccessible::GetSpellTextAttri
   GetSelectionDOMRanges(nsISelectionController::SELECTION_SPELLCHECK, &ranges);
 
   PRInt32 rangeCount = ranges.Count();
   if (!rangeCount)
     return NS_OK;
 
   for (PRInt32 index = 0; index < rangeCount; index++) {
     nsCOMPtr<nsIDOMRange> range = ranges[index];
-    nsCOMPtr<nsIDOMNSRange> nsrange(do_QueryInterface(range));
-    NS_ENSURE_STATE(nsrange);
+    NS_ENSURE_STATE(range);
 
     PRInt16 result;
-    nsresult rv = nsrange->ComparePoint(aNode, aNodeOffset, &result);
+    nsresult rv = range->ComparePoint(aNode, aNodeOffset, &result);
     NS_ENSURE_SUCCESS(rv, rv);
     // ComparePoint checks boundary points, but we need to check that
     // text at aNodeOffset is inside the range.
     // See also bug 460690.
     if (result == 0) {
       nsCOMPtr<nsIDOMNode> end;
       rv = range->GetEndContainer(getter_AddRefs(end));
       NS_ENSURE_SUCCESS(rv, rv);
--- a/content/base/src/nsRange.cpp
+++ b/content/base/src/nsRange.cpp
@@ -331,17 +331,16 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(nsRange)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(nsRange)
 
 DOMCI_DATA(Range, nsRange)
 
 // QueryInterface implementation for nsRange
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsRange)
   NS_INTERFACE_MAP_ENTRY(nsIDOMRange)
   NS_INTERFACE_MAP_ENTRY(nsIRange)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMNSRange)
   NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIRange)
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Range)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsRange)
   tmp->Reset();
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
@@ -660,19 +659,19 @@ nsRange::ParentChainChanged(nsIContent *
   NS_ASSERTION(newRoot, "No valid boundary or root found!");
   NS_ASSERTION(newRoot == IsValidBoundary(mEndParent),
                "Start parent and end parent give different root!");
   // This is safe without holding a strong ref to self as long as the change
   // of mRoot is the last thing in DoSetRange.
   DoSetRange(mStartParent, mStartOffset, mEndParent, mEndOffset, newRoot);
 }
 
-/********************************************************
- * Utilities for comparing points: API from nsIDOMNSRange
- ********************************************************/
+/******************************************************
+ * Utilities for comparing points: API from nsIDOMRange
+ ******************************************************/
 NS_IMETHODIMP
 nsRange::IsPointInRange(nsIDOMNode* aParent, PRInt32 aOffset, bool* aResult)
 {
   PRInt16 compareResult = 0;
   nsresult rv = ComparePoint(aParent, aOffset, &compareResult);
   // If the node isn't in the range's document, it clearly isn't in the range.
   if (rv == NS_ERROR_DOM_WRONG_DOCUMENT_ERR) {
     *aResult = false;
@@ -2372,17 +2371,16 @@ nsRange::Detach()
 
   mIsDetached = true;
 
   DoSetRange(nsnull, 0, nsnull, 0, nsnull);
   
   return NS_OK;
 }
 
-// nsIDOMNSRange interface
 NS_IMETHODIMP    
 nsRange::CreateContextualFragment(const nsAString& aFragment,
                                   nsIDOMDocumentFragment** aReturn)
 {
   if (mIsPositioned) {
     return nsContentUtils::CreateContextualFragment(mStartParent, aFragment,
                                                     false, aReturn);
   }
--- a/content/base/src/nsRange.h
+++ b/content/base/src/nsRange.h
@@ -40,17 +40,16 @@
  */
 
 #ifndef nsRange_h___
 #define nsRange_h___
 
 #include "nsIRange.h"
 #include "nsIDOMRange.h"
 #include "nsIRangeUtils.h"
-#include "nsIDOMNSRange.h"
 #include "nsCOMPtr.h"
 #include "nsIDOMDocumentFragment.h"
 #include "nsIContent.h"
 #include "nsIDOMNode.h"
 #include "prmon.h"
 #include "nsStubMutationObserver.h"
 
 // -------------------------------------------------------------------------------
@@ -68,31 +67,27 @@ public:
                                 nsIDOMRange* aRange,
                                 bool *outNodeBefore,
                                 bool *outNodeAfter);
 };
 
 // -------------------------------------------------------------------------------
 
 class nsRange : public nsIRange,
-                public nsIDOMNSRange,
                 public nsStubMutationObserver
 {
 public:
   nsRange(){}
   virtual ~nsRange();
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsRange, nsIRange)
 
   // nsIDOMRange interface
   NS_DECL_NSIDOMRANGE
-
-  // nsIDOMNSRange interface
-  NS_DECL_NSIDOMNSRANGE
   
   // nsIRange interface
   virtual nsINode* GetCommonAncestor() const;
   virtual void Reset();
   virtual nsresult SetStart(nsINode* aParent, PRInt32 aOffset);
   virtual nsresult SetEnd(nsINode* aParent, PRInt32 aOffset);
   virtual nsresult CloneRange(nsIRange** aNewRange) const;
 
--- a/content/base/test/test_bug451376.html
+++ b/content/base/test/test_bug451376.html
@@ -25,18 +25,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 
     function testRange(aRangeID,
                        aStartNode, aStartOffset,
                        aEndNode, aEndOffset,
                        aBeforeRangeNode, aBeforeRangeOffset,
                        aInRangeNode, aInRangeOffset,
                        aAfterRangeNode, aAfterRangeOffset)
     {
-      var range = document.createRange().
-        QueryInterface(Components.interfaces.nsIDOMNSRange);
+      var range = document.createRange();
 
       range.setStart(aStartNode, aStartOffset);
       range.setEnd(aEndNode, aEndOffset);
 
       if (aBeforeRangeNode)
         is(range.comparePoint(aBeforeRangeNode, aBeforeRangeOffset), -1,
            "Wrong result for the point before the range '" + aRangeID + "'");
       if (aInRangeNode)
--- a/content/test/unit/test_range.js
+++ b/content/test/unit/test_range.js
@@ -498,17 +498,16 @@ function run_miscellaneous_tests() {
 
   baseRange.setEnd(externalRange.endContainer, 0);
   do_check_eq(baseRange.startContainer, externalRange.endContainer);
   do_check_eq(baseRange.startOffset, 0);
   do_check_true(baseRange.collapsed);
 
   /*
   // XXX ajvincent if rv == WRONG_DOCUMENT_ERR, return false?
-  do_check_true(baseRange instanceof C_i.nsIDOMNSRange);
   do_check_false(baseRange.isPointInRange(startContainer, startOffset));
   do_check_false(baseRange.isPointInRange(startContainer, startOffset + 1));
   do_check_false(baseRange.isPointInRange(endContainer, endOffset));
   */
 
   // Requested by smaug:  A range involving a comment as a document child.
   doc = parser.parseFromString("<!-- foo --><foo/>", "application/xml");
   do_check_true(doc instanceof C_i.nsIDOMDocument);
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -324,17 +324,16 @@
 #include "nsIDOMMozCSSKeyframesRule.h"
 #include "nsIDOMCSSPrimitiveValue.h"
 #include "nsIDOMCSSStyleRule.h"
 #include "nsIDOMCSSStyleSheet.h"
 #include "nsDOMCSSValueList.h"
 #include "nsIDOMDeviceOrientationEvent.h"
 #include "nsIDOMDeviceMotionEvent.h"
 #include "nsIDOMRange.h"
-#include "nsIDOMNSRange.h"
 #include "nsIDOMRangeException.h"
 #include "nsIDOMNodeIterator.h"
 #include "nsIDOMTreeWalker.h"
 #include "nsIDOMXULDocument.h"
 #include "nsIDOMXULElement.h"
 #include "nsIDOMXULCommandDispatcher.h"
 #include "nsIDOMCrypto.h"
 #include "nsIDOMCRMFObject.h"
@@ -2950,17 +2949,16 @@ nsDOMClassInfo::Init()
 
   DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(CSSRGBColor, nsIDOMRGBColor)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMRGBColor)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSRGBAColor)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(Range, nsIDOMRange)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMRange)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSRange)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(NodeIterator, nsIDOMNodeIterator)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMNodeIterator)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(TreeWalker, nsIDOMTreeWalker)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMTreeWalker)
--- a/dom/interfaces/range/Makefile.in
+++ b/dom/interfaces/range/Makefile.in
@@ -41,18 +41,17 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= dom
 XPIDL_MODULE	= dom_range
 GRE_MODULE	= 1
 
-SDK_XPIDLSRCS = 				\
-	nsIDOMRange.idl				\
+SDK_XPIDLSRCS =		\
+	nsIDOMRange.idl	\
 	$(NULL)
 
-XPIDLSRCS =					\
-	nsIDOMNSRange.idl			\
+XPIDLSRCS =						\
 	nsIDOMRangeException.idl	\
 	$(NULL)
 
 include $(topsrcdir)/config/rules.mk
deleted file mode 100644
--- a/dom/interfaces/range/nsIDOMNSRange.idl
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Vidur Apparao <vidur@netscape.com> (original author)
- *   Johnny Stenback <jst@netscape.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include "domstubs.idl"
-
-[scriptable, uuid(fed93d11-f24d-41d8-ae55-4197927999bb)]
-interface nsIDOMNSRange : nsISupports
-{
-  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);
-
-  nsIDOMClientRectList getClientRects();
-  nsIDOMClientRect getBoundingClientRect();
-};
--- a/dom/interfaces/range/nsIDOMRange.idl
+++ b/dom/interfaces/range/nsIDOMRange.idl
@@ -41,17 +41,17 @@
 
 /**
  * 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/
  */
 
-[scriptable, uuid(a6cf90ce-15b3-11d2-932e-00805f8add32)]
+[scriptable, uuid(a059eea8-fece-4c14-93d3-7f50a944ae43)]
 interface nsIDOMRange : nsISupports
 {
   readonly attribute nsIDOMNode       startContainer;
                                         // raises(DOMException) on retrieval
 
   readonly attribute long             startOffset;
                                         // raises(DOMException) on retrieval
 
@@ -105,9 +105,30 @@ interface nsIDOMRange : nsISupports
                                         raises(DOMException, RangeException);
   void               surroundContents(in nsIDOMNode newParent)
                                         raises(DOMException, RangeException);
   nsIDOMRange        cloneRange()
                                         raises(DOMException);
   DOMString          toString()
                                         raises(DOMException);
   void               detach();
+  
+  // 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);
+
+  // These methods come from 
+  // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-range-interface
+  nsIDOMClientRectList getClientRects();
+  nsIDOMClientRect getBoundingClientRect();
 };
--- a/editor/libeditor/base/nsEditorEventListener.cpp
+++ b/editor/libeditor/base/nsEditorEventListener.cpp
@@ -60,17 +60,17 @@
 
 // Drag & Drop, Clipboard
 #include "nsIServiceManager.h"
 #include "nsIClipboard.h"
 #include "nsIDragService.h"
 #include "nsIDragSession.h"
 #include "nsIContent.h"
 #include "nsISupportsPrimitives.h"
-#include "nsIDOMNSRange.h"
+#include "nsIDOMRange.h"
 #include "nsEditorUtils.h"
 #include "nsISelectionPrivate.h"
 #include "nsIDOMDragEvent.h"
 #include "nsIFocusManager.h"
 #include "nsIDOMWindow.h"
 #include "nsContentUtils.h"
 #include "nsIBidiKeyboard.h"
 
@@ -881,22 +881,21 @@ nsEditorEventListener::CanDrop(nsIDOMDra
       PRInt32 rangeCount;
       rv = selection->GetRangeCount(&rangeCount);
       NS_ENSURE_SUCCESS(rv, false);
 
       for (PRInt32 i = 0; i < rangeCount; i++)
       {
         nsCOMPtr<nsIDOMRange> range;
         rv = selection->GetRangeAt(i, getter_AddRefs(range));
-        nsCOMPtr<nsIDOMNSRange> nsrange(do_QueryInterface(range));
-        if (NS_FAILED(rv) || !nsrange) 
+        if (NS_FAILED(rv) || !range) 
           continue; //don't bail yet, iterate through them all
 
         bool inRange = true;
-        (void)nsrange->IsPointInRange(parent, offset, &inRange);
+        (void)range->IsPointInRange(parent, offset, &inRange);
         if (inRange)
           return false;  //okay, now you can bail, we are over the orginal selection
       }
     }
   }
   
   return true;
 }
--- a/editor/libeditor/html/nsHTMLDataTransfer.cpp
+++ b/editor/libeditor/html/nsHTMLDataTransfer.cpp
@@ -59,17 +59,16 @@
 
 #include "nsIDocumentObserver.h"
 #include "nsIDocumentStateListener.h"
 
 #include "nsIEnumerator.h"
 #include "nsIContent.h"
 #include "nsIContentIterator.h"
 #include "nsIDOMRange.h"
-#include "nsIDOMNSRange.h"
 #include "nsCOMArray.h"
 #include "nsIFile.h"
 #include "nsIURL.h"
 #include "nsIComponentManager.h"
 #include "nsIServiceManager.h"
 #include "nsIDocumentEncoder.h"
 #include "nsIDOMDocumentFragment.h"
 #include "nsIPresShell.h"
@@ -207,23 +206,21 @@ NS_IMETHODIMP nsHTMLEditor::LoadHTML(con
       NS_ENSURE_SUCCESS(res, res);
     }
 
     // Get the first range in the selection, for context:
     nsCOMPtr<nsIDOMRange> range;
     res = selection->GetRangeAt(0, getter_AddRefs(range));
     NS_ENSURE_SUCCESS(res, res);
     NS_ENSURE_TRUE(range, NS_ERROR_NULL_POINTER);
-    nsCOMPtr<nsIDOMNSRange> nsrange (do_QueryInterface(range));
-    NS_ENSURE_TRUE(nsrange, NS_ERROR_NO_INTERFACE);
 
     // create fragment for pasted html
     nsCOMPtr<nsIDOMDocumentFragment> docfrag;
     {
-      res = nsrange->CreateContextualFragment(aInputString, getter_AddRefs(docfrag));
+      res = range->CreateContextualFragment(aInputString, getter_AddRefs(docfrag));
       NS_ENSURE_SUCCESS(res, res);
     }
     // put the fragment into the document
     nsCOMPtr<nsIDOMNode> parent, junk;
     res = range->GetStartContainer(getter_AddRefs(parent));
     NS_ENSURE_SUCCESS(res, res);
     NS_ENSURE_TRUE(parent, NS_ERROR_NULL_POINTER);
     PRInt32 childOffset;
@@ -1559,21 +1556,17 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromDr
         for (PRInt32 j = 0; j < rangeCount; j++)
         {
           nsCOMPtr<nsIDOMRange> range;
 
           rv = selection->GetRangeAt(j, getter_AddRefs(range));
           if (NS_FAILED(rv) || !range) 
             continue;//don't bail yet, iterate through them all
 
-          nsCOMPtr<nsIDOMNSRange> nsrange(do_QueryInterface(range));
-          if (NS_FAILED(rv) || !nsrange) 
-            continue;//don't bail yet, iterate through them all
-
-          rv = nsrange->IsPointInRange(newSelectionParent, newSelectionOffset, &cursorIsInSelection);
+          rv = range->IsPointInRange(newSelectionParent, newSelectionOffset, &cursorIsInSelection);
           if(cursorIsInSelection)
             break;
         }
         if (cursorIsInSelection)
         {
           // Dragging within same doc can't drop on itself -- leave!
           // (We shouldn't get here - drag event shouldn't have started if over selection)
           if (srcdomdoc == destdomdoc)
--- a/editor/libeditor/html/nsHTMLEditRules.cpp
+++ b/editor/libeditor/html/nsHTMLEditRules.cpp
@@ -55,17 +55,16 @@
 #include "nsIDOMNode.h"
 #include "nsIDOMText.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMNodeList.h"
 #include "nsISelection.h"
 #include "nsISelectionPrivate.h"
 #include "nsISelectionController.h"
 #include "nsIDOMRange.h"
-#include "nsIDOMNSRange.h"
 #include "nsIRangeUtils.h"
 #include "nsIDOMCharacterData.h"
 #include "nsIEnumerator.h"
 #include "nsIDOMNamedNodeMap.h"
 #include "nsIRange.h"
 
 #include "nsEditorUtils.h"
 #include "nsWSRunObject.h"
--- a/editor/libeditor/html/nsHTMLEditor.cpp
+++ b/editor/libeditor/html/nsHTMLEditor.cpp
@@ -67,17 +67,16 @@
 #include "mozilla/css/Loader.h"
 #include "nsCSSStyleSheet.h"
 #include "nsIDOMStyleSheet.h"
 
 #include "nsIEnumerator.h"
 #include "nsIContent.h"
 #include "nsIContentIterator.h"
 #include "nsIDOMRange.h"
-#include "nsIDOMNSRange.h"
 #include "nsIRangeUtils.h"
 #include "nsISupportsArray.h"
 #include "nsContentUtils.h"
 #include "nsIDocumentEncoder.h"
 #include "nsIDOMDocumentFragment.h"
 #include "nsIPresShell.h"
 #include "nsPresContext.h"
 #include "SetDocTitleTxn.h"
@@ -1598,21 +1597,19 @@ nsHTMLEditor::ReplaceHeadContentsWithHTM
   NS_ENSURE_SUCCESS(res, res);
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
 
   // Get the first range in the selection, for context:
   nsCOMPtr<nsIDOMRange> range;
   res = selection->GetRangeAt(0, getter_AddRefs(range));
   NS_ENSURE_SUCCESS(res, res);
 
-  nsCOMPtr<nsIDOMNSRange> nsrange (do_QueryInterface(range));
-  NS_ENSURE_TRUE(nsrange, NS_ERROR_NO_INTERFACE);
   nsCOMPtr<nsIDOMDocumentFragment> docfrag;
-  res = nsrange->CreateContextualFragment(inputString,
-                                          getter_AddRefs(docfrag));
+  res = range->CreateContextualFragment(inputString,
+                                        getter_AddRefs(docfrag));
 
   //XXXX BUG 50965: This is not returning the text between <title> ... </title>
   // Special code is needed in JS to handle title anyway, so it really doesn't matter!
 
   if (NS_FAILED(res))
   {
 #ifdef DEBUG
     printf("Couldn't create contextual fragment: error was %d\n", res);
@@ -1764,21 +1761,18 @@ nsHTMLEditor::RebuildDocumentFromSource(
   nsAutoString bodyTag;
   bodyTag.AssignLiteral("<div ");
   bodyTag.Append(Substring(endbody, endclosebody));
 
   nsCOMPtr<nsIDOMRange> range;
   res = selection->GetRangeAt(0, getter_AddRefs(range));
   NS_ENSURE_SUCCESS(res, res);
 
-  nsCOMPtr<nsIDOMNSRange> nsrange (do_QueryInterface(range));
-  NS_ENSURE_TRUE(nsrange, NS_ERROR_NO_INTERFACE);
-
   nsCOMPtr<nsIDOMDocumentFragment> docfrag;
-  res = nsrange->CreateContextualFragment(bodyTag, getter_AddRefs(docfrag));
+  res = range->CreateContextualFragment(bodyTag, getter_AddRefs(docfrag));
   NS_ENSURE_SUCCESS(res, res);
 
   nsCOMPtr<nsIDOMNode> fragmentAsNode (do_QueryInterface(docfrag));
   NS_ENSURE_TRUE(fragmentAsNode, NS_ERROR_NULL_POINTER);
   
   nsCOMPtr<nsIDOMNode> child;
   res = fragmentAsNode->GetFirstChild(getter_AddRefs(child));
   NS_ENSURE_SUCCESS(res, res);
--- a/editor/libeditor/html/nsHTMLEditor.h
+++ b/editor/libeditor/html/nsHTMLEditor.h
@@ -69,17 +69,16 @@
 #include "nsIDocumentObserver.h"
 
 #include "nsPoint.h"
 #include "nsTArray.h"
 #include "nsAutoPtr.h"
 
 class nsIDOMKeyEvent;
 class nsITransferable;
-class nsIDOMNSRange;
 class nsIDocumentEncoder;
 class nsIClipboard;
 class TypeInState;
 class nsIContentFilter;
 class nsIURL;
 class nsIRangeUtils;
 class nsILinkHandler;
 struct PropItem;
--- a/editor/libeditor/html/nsHTMLEditorEventListener.cpp
+++ b/editor/libeditor/html/nsHTMLEditorEventListener.cpp
@@ -42,17 +42,16 @@
 #include "nsString.h"
 
 #include "nsIDOMEvent.h"
 #include "nsIDOMNSEvent.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsISelection.h"
 #include "nsIDOMRange.h"
-#include "nsIDOMNSRange.h"
 #include "nsIDOMEventTarget.h"
 #include "nsIDOMHTMLTableElement.h"
 #include "nsIDOMHTMLTableCellElement.h"
 #include "nsIContent.h"
 
 #include "nsIHTMLObjectResizer.h"
 #include "nsEditProperty.h"
 #include "nsTextEditUtils.h"
@@ -173,21 +172,17 @@ nsHTMLEditorEventListener::MouseDown(nsI
         for (PRInt32 i = 0; i < rangeCount; i++)
         {
           nsCOMPtr<nsIDOMRange> range;
 
           res = selection->GetRangeAt(i, getter_AddRefs(range));
           if (NS_FAILED(res) || !range) 
             continue;//don't bail yet, iterate through them all
 
-          nsCOMPtr<nsIDOMNSRange> nsrange(do_QueryInterface(range));
-          if (NS_FAILED(res) || !nsrange) 
-            continue;//don't bail yet, iterate through them all
-
-          res = nsrange->IsPointInRange(parent, offset, &nodeIsInSelection);
+          res = range->IsPointInRange(parent, offset, &nodeIsInSelection);
 
           // Done when we find a range that we are in
           if (nodeIsInSelection)
             break;
         }
       }
     }
     nsCOMPtr<nsIDOMNode> node = do_QueryInterface(target);
--- a/editor/libeditor/text/nsPlaintextDataTransfer.cpp
+++ b/editor/libeditor/text/nsPlaintextDataTransfer.cpp
@@ -47,17 +47,16 @@
 #include "nsIDOMNSEvent.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsIDOMDragEvent.h"
 #include "nsISelection.h"
 #include "nsCRT.h"
 #include "nsServiceManagerUtils.h"
 
 #include "nsIDOMRange.h"
-#include "nsIDOMNSRange.h"
 #include "nsIDocumentEncoder.h"
 #include "nsISupportsPrimitives.h"
 
 // Drag & Drop, Clipboard
 #include "nsIClipboard.h"
 #include "nsITransferable.h"
 #include "nsIDragService.h"
 #include "nsIDOMUIEvent.h"
@@ -228,21 +227,20 @@ NS_IMETHODIMP nsPlaintextEditor::InsertF
     PRInt32 rangeCount;
     rv = selection->GetRangeCount(&rangeCount);
     NS_ENSURE_SUCCESS(rv, rv);
 
     for (PRInt32 j = 0; j < rangeCount; j++)
     {
       nsCOMPtr<nsIDOMRange> range;
       rv = selection->GetRangeAt(j, getter_AddRefs(range));
-      nsCOMPtr<nsIDOMNSRange> nsrange(do_QueryInterface(range));
-      if (NS_FAILED(rv) || !nsrange) 
+      if (NS_FAILED(rv) || !range) 
         continue;  // don't bail yet, iterate through them all
 
-      rv = nsrange->IsPointInRange(newSelectionParent, newSelectionOffset, &cursorIsInSelection);
+      rv = range->IsPointInRange(newSelectionParent, newSelectionOffset, &cursorIsInSelection);
       if (cursorIsInSelection)
         break;
     }
 
     // Source doc is null if source is *not* the current editor document
     // Current doc is destination (set earlier)
     nsCOMPtr<nsIDOMDocument> srcdomdoc;
     rv = dragSession->GetSourceDocument(getter_AddRefs(srcdomdoc));
--- a/editor/libeditor/text/nsTextEditRules.cpp
+++ b/editor/libeditor/text/nsTextEditRules.cpp
@@ -46,17 +46,16 @@
 #include "nsIDOMNode.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMText.h"
 #include "nsIDOMNodeList.h"
 #include "nsISelection.h"
 #include "nsISelectionPrivate.h"
 #include "nsISelectionController.h"
 #include "nsIDOMRange.h"
-#include "nsIDOMNSRange.h"
 #include "nsIDOMCharacterData.h"
 #include "nsIContent.h"
 #include "nsIContentIterator.h"
 #include "nsEditorUtils.h"
 #include "EditTxn.h"
 #include "nsEditProperty.h"
 #include "nsUnicharUtils.h"
 #include "DeleteTextTxn.h"
--- a/editor/txtsvc/src/nsFilteredContentIterator.cpp
+++ b/editor/txtsvc/src/nsFilteredContentIterator.cpp
@@ -273,23 +273,20 @@ ContentIsInTraversalRange(nsIContent *aC
 
   rv = nsTextServicesDocument::ComparePoints(aEndNode,   aEndOffset,   parentNode, indx,  &endRes);
   NS_ENSURE_SUCCESS(rv, false);
 
   return (startRes <= 0) && (endRes >= 0);
 }
 
 static bool
-ContentIsInTraversalRange(nsIDOMNSRange *aRange, nsIDOMNode* aNextNode, bool aIsPreMode)
+ContentIsInTraversalRange(nsIDOMRange *aRange, nsIDOMNode* aNextNode, bool aIsPreMode)
 {
-  nsCOMPtr<nsIContent>  content(do_QueryInterface(aNextNode));
-  nsCOMPtr<nsIDOMRange> range(do_QueryInterface(aRange));
-  NS_ENSURE_TRUE(content && range, false);
-
-
+  nsCOMPtr<nsIContent> content(do_QueryInterface(aNextNode));
+  NS_ENSURE_TRUE(content && aRange, false);
 
   nsCOMPtr<nsIDOMNode> sNode;
   nsCOMPtr<nsIDOMNode> eNode;
   PRInt32 sOffset;
   PRInt32 eOffset;
   range->GetStartContainer(getter_AddRefs(sNode));
   range->GetStartOffset(&sOffset);
   range->GetEndContainer(getter_AddRefs(eNode));
--- a/editor/txtsvc/src/nsFilteredContentIterator.h
+++ b/editor/txtsvc/src/nsFilteredContentIterator.h
@@ -37,17 +37,17 @@
 
 #ifndef nsFilteredContentIterator_h__
 #define nsFilteredContentIterator_h__
 
 #include "nsIContentIterator.h"
 #include "nsCOMPtr.h"
 #include "nsIAtom.h"
 #include "nsITextServicesFilter.h"
-#include "nsIDOMNSRange.h"
+#include "nsIDOMRange.h"
 #include "nsIRangeUtils.h"
 #include "nsCycleCollectionParticipant.h"
 
 /**
  * 
  */
 class nsFilteredContentIterator : public nsIContentIterator
 {
@@ -92,15 +92,15 @@ protected:
 
   nsCOMPtr<nsIAtom> mBlockQuoteAtom;
   nsCOMPtr<nsIAtom> mScriptAtom;
   nsCOMPtr<nsIAtom> mTextAreaAtom;
   nsCOMPtr<nsIAtom> mSelectAreaAtom;
   nsCOMPtr<nsIAtom> mMapAtom;
 
   nsCOMPtr<nsITextServicesFilter> mFilter;
-  nsCOMPtr<nsIDOMNSRange>         mRange;
+  nsCOMPtr<nsIDOMRange>           mRange;
   bool                            mDidSkip;
   bool                            mIsOutOfRange;
   eDirectionType                  mDirection;
 };
 
 #endif
--- a/extensions/spellcheck/src/mozInlineSpellChecker.cpp
+++ b/extensions/spellcheck/src/mozInlineSpellChecker.cpp
@@ -73,17 +73,16 @@
 #include "nsIDOMNode.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMEventTarget.h"
 #include "nsIDOMMouseEvent.h"
 #include "nsIDOMKeyEvent.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMNodeList.h"
-#include "nsIDOMNSRange.h"
 #include "nsIDOMRange.h"
 #include "nsIPlaintextEditor.h"
 #include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
 #include "nsIRunnable.h"
 #include "nsISelection.h"
 #include "nsISelectionPrivate.h"
 #include "nsISelectionController.h"
@@ -164,20 +163,18 @@ mozInlineSpellStatus::InitForEditorChang
   }
 
   mOp = eOpChange;
 
   // range to check
   mRange = new nsRange();
 
   // ...we need to put the start and end in the correct order
-  nsCOMPtr<nsIDOMNSRange> nsrange = do_QueryInterface(mAnchorRange, &rv);
-  NS_ENSURE_SUCCESS(rv, rv);
   PRInt16 cmpResult;
-  rv = nsrange->ComparePoint(aPreviousNode, aPreviousOffset, &cmpResult);
+  rv = mAnchorRange->ComparePoint(aPreviousNode, aPreviousOffset, &cmpResult);
   NS_ENSURE_SUCCESS(rv, rv);
   if (cmpResult < 0) {
     // previous anchor node is before the current anchor
     rv = mRange->SetStart(aPreviousNode, aPreviousOffset);
     NS_ENSURE_SUCCESS(rv, rv);
     rv = mRange->SetEnd(aAnchorNode, aAnchorOffset);
   } else {
     // previous anchor node is after (or the same as) the current anchor
@@ -189,27 +186,24 @@ mozInlineSpellStatus::InitForEditorChang
 
   // On insert save this range: DoSpellCheck optimizes things in this range.
   // Otherwise, just leave this NULL.
   if (aAction == mozInlineSpellChecker::kOpInsertText)
     mCreatedRange = mRange;
 
   // if we were given a range, we need to expand our range to encompass it
   if (aStartNode && aEndNode) {
-    nsrange = do_QueryInterface(mRange, &rv);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    rv = nsrange->ComparePoint(aStartNode, aStartOffset, &cmpResult);
+    rv = mRange->ComparePoint(aStartNode, aStartOffset, &cmpResult);
     NS_ENSURE_SUCCESS(rv, rv);
     if (cmpResult < 0) { // given range starts before
       rv = mRange->SetStart(aStartNode, aStartOffset);
       NS_ENSURE_SUCCESS(rv, rv);
     }
 
-    rv = nsrange->ComparePoint(aEndNode, aEndOffset, &cmpResult);
+    rv = mRange->ComparePoint(aEndNode, aEndOffset, &cmpResult);
     NS_ENSURE_SUCCESS(rv, rv);
     if (cmpResult > 0) { // given range ends after
       rv = mRange->SetEnd(aEndNode, aEndOffset);
       NS_ENSURE_SUCCESS(rv, rv);
     }
   }
 
   return NS_OK;
@@ -380,31 +374,28 @@ mozInlineSpellStatus::FinishNavigationEv
                                  getter_AddRefs(oldWord));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // aWordUtil.GetRangeForWord flushes pending notifications, check editor again.
   editor = do_QueryReferent(mSpellChecker->mEditor);
   if (! editor)
     return NS_ERROR_FAILURE; // editor is gone
 
-  nsCOMPtr<nsIDOMNSRange> oldWordNS = do_QueryInterface(oldWord, &rv);
-  NS_ENSURE_SUCCESS(rv, rv);
-
   // get the DOM position of the new caret, the range should be collapsed
   rv = mAnchorRange->GetStartContainer(getter_AddRefs(newAnchorNode));
   NS_ENSURE_SUCCESS(rv, rv);
   rv = mAnchorRange->GetStartOffset(&newAnchorOffset);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // see if the new cursor position is in the word of the old cursor position
   bool isInRange = false;
   if (! mForceNavigationWordCheck) {
-    rv = oldWordNS->IsPointInRange(newAnchorNode,
-                                   newAnchorOffset + mNewNavigationPositionOffset,
-                                   &isInRange);
+    rv = oldWord->IsPointInRange(newAnchorNode,
+                                 newAnchorOffset + mNewNavigationPositionOffset,
+                                 &isInRange);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   if (isInRange) {
     // caller should give up
     mRange = nsnull;
   } else {
     // check the old word
@@ -1346,23 +1337,16 @@ nsresult mozInlineSpellChecker::DoSpellC
     aWordUtil.SetEnd(endNode, endOffset);
     aWordUtil.SetPosition(beginNode, beginOffset);
   }
 
   // aWordUtil.SetPosition flushes pending notifications, check editor again.
   editor = do_QueryReferent(mEditor);
   if (! editor)
     return NS_ERROR_FAILURE;
-  
-  // we need to use IsPointInRange which is on a more specific interface
-  nsCOMPtr<nsIDOMNSRange> noCheckRange, createdRange;
-  if (aStatus->mNoCheckRange)
-    noCheckRange = do_QueryInterface(aStatus->mNoCheckRange);
-  if (aStatus->mCreatedRange)
-    createdRange = do_QueryInterface(aStatus->mCreatedRange);
 
   PRInt32 wordsSinceTimeCheck = 0;
   PRTime beginTime = PR_Now();
 
   nsAutoString wordText;
   nsCOMPtr<nsIRange> wordRange;
   bool dontCheckWord;
   while (NS_SUCCEEDED(aWordUtil.GetNextWord(wordText,
@@ -1389,18 +1373,18 @@ nsresult mozInlineSpellChecker::DoSpellC
 #endif
 
     // see if there is a spellcheck range that already intersects the word
     // and remove it. We only need to remove old ranges, so don't bother if
     // there were no ranges when we started out.
     if (originalRangeCount > 0) {
       // likewise, if this word is inside new text, we won't bother testing
       bool inCreatedRange = false;
-      if (createdRange)
-        createdRange->IsPointInRange(beginNode, beginOffset, &inCreatedRange);
+      if (aStatus->mCreatedRange)
+        aStatus->mCreatedRange->IsPointInRange(beginNode, beginOffset, &inCreatedRange);
       if (! inCreatedRange) {
         nsCOMArray<nsIDOMRange> ranges;
         rv = privSel->GetRangesForIntervalCOMArray(beginNode, beginOffset,
                                                    endNode, endOffset,
                                                    true, &ranges);
         NS_ENSURE_SUCCESS(rv, rv);
         for (PRInt32 i = 0; i < ranges.Count(); i ++)
           RemoveRange(aSpellCheckSelection, ranges[i]);
@@ -1420,19 +1404,20 @@ nsresult mozInlineSpellChecker::DoSpellC
 
     // Don't check spelling if we're inside the noCheckRange. This needs to
     // be done after we clear any old selection because the excluded word
     // might have been previously marked.
     //
     // We do a simple check to see if the beginning of our word is in the
     // exclusion range. Because the exclusion range is a multiple of a word,
     // this is sufficient.
-    if (noCheckRange) {
+    if (aStatus->mNoCheckRange) {
       bool inExclusion = false;
-      noCheckRange->IsPointInRange(beginNode, beginOffset, &inExclusion);
+      aStatus->mNoCheckRange->IsPointInRange(beginNode, beginOffset,
+                                             &inExclusion);
       if (inExclusion)
         continue;
     }
 
     // check spelling and add to selection if misspelled
     bool isMisspelled;
     aWordUtil.NormalizeWord(wordText);
     rv = mSpellCheck->CheckCurrentWordNoSuggest(wordText.get(), &isMisspelled);
--- a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
+++ b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
@@ -38,17 +38,16 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "mozInlineSpellWordUtil.h"
 #include "nsDebug.h"
 #include "nsIAtom.h"
 #include "nsComponentManagerUtils.h"
 #include "nsIDOMCSSStyleDeclaration.h"
 #include "nsIDOMElement.h"
-#include "nsIDOMNSRange.h"
 #include "nsIDOMRange.h"
 #include "nsIEditor.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMHTMLBRElement.h"
 #include "nsUnicharUtilCIID.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIContent.h"
 #include "nsTextFragment.h"
--- a/mobile/xul/chrome/content/content.js
+++ b/mobile/xul/chrome/content/content.js
@@ -1449,17 +1449,17 @@ var SelectionHandler = {
           // If we couldn't select the word at the given point, bail
           return;
         }
 
         // Find the selected text rect and send it back so the handles can position correctly
         if (selection.rangeCount == 0)
           return;
 
-        let range = selection.getRangeAt(0).QueryInterface(Ci.nsIDOMNSRange);
+        let range = selection.getRangeAt(0);
         if (!range)
           return;
 
         // Cache the selected text since the selection might be gone by the time we get the "end" message
         this.selectedText = selection.toString().trim();
 
         // If the range didn't have any text, let's bail
         if (!this.selectedText.length) {
@@ -1529,17 +1529,17 @@ var SelectionHandler = {
           utils.sendMouseEventToWindow("mouseup", end.x, end.y, 0, 1, Ci.nsIDOMNSEvent.SHIFT_MASK, true);
         }
 
         // Cache the selected text since the selection might be gone by the time we get the "end" message
         let selection = this.contentWindow.getSelection()
         this.selectedText = selection.toString().trim();
 
         // Update the rect we use to test when finishing the clipboard operation
-        let range = selection.getRangeAt(0).QueryInterface(Ci.nsIDOMNSRange);
+        let range = selection.getRangeAt(0)
         this.cache.rect = this._extractFromRange(range, this.cache.offset).rect;
         break;
       }
     }
   },
 
   _extractFromRange: function sh_extractFromRange(aRange, aOffset) {
     let cache = { start: {}, end: {}, rect: { left: Number.MAX_VALUE, top: Number.MAX_VALUE, right: 0, bottom: 0 } };