Bug 682611 - Part 3: Remove ns(I)RangeUtils; r=smaug
authorDavid Zbarsky <dzbarsky@gmail.com>
Sat, 28 Jan 2012 16:42:14 +0100
changeset 85665 d78b890eae96f68e8c0c29003c60448284b57d94
parent 85664 2c215e31b7d0185a75f3602047b74549a37bd332
child 85666 0529bd4e33bd98387942bdf433c3c8657d53d332
push id484
push usertim.taubert@gmx.de
push dateMon, 30 Jan 2012 10:04:22 +0000
treeherderfx-team@e33539a90ae2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs682611
milestone12.0a1
Bug 682611 - Part 3: Remove ns(I)RangeUtils; r=smaug
content/base/public/Makefile.in
content/base/public/nsContentCID.h
content/base/public/nsContentUtils.h
content/base/public/nsIRangeUtils.h
content/base/src/nsContentUtils.cpp
content/base/src/nsRange.cpp
content/base/src/nsRange.h
editor/libeditor/html/nsHTMLEditRules.cpp
editor/libeditor/html/nsHTMLEditor.cpp
editor/libeditor/html/nsHTMLEditor.h
editor/libeditor/html/nsWSRunObject.cpp
editor/txtsvc/src/nsFilteredContentIterator.cpp
editor/txtsvc/src/nsFilteredContentIterator.h
editor/txtsvc/src/nsTextServicesDocument.cpp
editor/txtsvc/src/nsTextServicesDocument.h
layout/build/nsLayoutModule.cpp
layout/build/nsLayoutStatics.cpp
--- a/content/base/public/Makefile.in
+++ b/content/base/public/Makefile.in
@@ -57,17 +57,16 @@ nsIDocument.h \
 nsDeprecatedOperationList.h \
 nsIDocumentObserver.h \
 nsIMutationObserver.h \
 nsIMutationObserver2.h \
 nsINameSpaceManager.h \
 nsINode.h \
 nsINodeInfo.h \
 nsINodeList.h \
-nsIRangeUtils.h \
 nsIScriptElement.h \
 nsIStyleSheetLinkingElement.h \
 nsIContentSerializer.h \
 nsIHTMLToTextSink.h \
 nsIXPathEvaluatorInternal.h \
 mozISanitizingSerializer.h \
 nsCaseTreatment.h \
 nsContentCID.h \
--- a/content/base/public/nsContentCID.h
+++ b/content/base/public/nsContentCID.h
@@ -173,20 +173,16 @@
 // {1abdcc96-1dd2-11b2-b520-f8f59cdd67bc}
 #define NS_XULTREEBUILDER_CID \
 { 0x1abdcc96, 0x1dd2, 0x11b2, { 0xb5, 0x20, 0xf8, 0xf5, 0x9c, 0xdd, 0x67, 0xbc } }
 
 // {541AFCB2-A9A3-11d2-8EC5-00805F29F370}
 #define NS_XULDOCUMENT_CID \
 { 0x541afcb2, 0xa9a3, 0x11d2, { 0x8e, 0xc5, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
 
-// {a6cf9126-15b3-11d2-932e-00805f8add32}
-#define NS_RANGEUTILS_CID \
-{ 0xa6cf9126, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
-
 #define NS_SVGDOCUMENT_CID                        \
 { /* b7f44954-1dd1-11b2-8c2e-c2feab4186bc */      \
   0xb7f44954, 0x11d1, 0x11b2,                     \
   {0x8c, 0x2e, 0xc2, 0xfe, 0xab, 0x41, 0x86, 0xbc}}
 
 #ifdef MOZ_MEDIA
 
 // {d899a152-9412-46b2-b651-2e71c5c2f05f}
--- a/content/base/public/nsContentUtils.h
+++ b/content/base/public/nsContentUtils.h
@@ -328,16 +328,19 @@ public:
    *  0 if error or if point1 == point2.
    *  NOTE! If the two nodes aren't in the same connected subtree,
    *  the result is 1, and the optional aDisconnected parameter
    *  is set to true.
    */
   static PRInt32 ComparePoints(nsINode* aParent1, PRInt32 aOffset1,
                                nsINode* aParent2, PRInt32 aOffset2,
                                bool* aDisconnected = nsnull);
+  static PRInt32 ComparePoints(nsIDOMNode* aParent1, PRInt32 aOffset1,
+                               nsIDOMNode* aParent2, PRInt32 aOffset2,
+                               bool* aDisconnected = nsnull);
 
   /**
    * Brute-force search of the element subtree rooted at aContent for
    * an element with the given id.  aId must be nonempty, otherwise
    * this method may return nodes even if they have no id!
    */
   static Element* MatchElementId(nsIContent *aContent, const nsAString& aId);
 
deleted file mode 100644
--- a/content/base/public/nsIRangeUtils.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C++; 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 Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * 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 ***** */
-
-/* A class for range utilities. */
-
-#ifndef nsIRangeUtils_h___
-#define nsIRangeUtils_h___
-
-#include "nsISupports.h"
-
-// Forward declarations
-class nsRange;
-class nsIDOMNode;
-class nsIContent;
-
-// IID for the nsIRangeUtils interface
-#define NS_IRANGEUTILS_IID       \
-{ 0xa6cf9127, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
-
-class nsIRangeUtils : public nsISupports {
-public:
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IRANGEUTILS_IID)
-
-  NS_IMETHOD_(PRInt32) ComparePoints(nsIDOMNode* aParent1, PRInt32 aOffset1,
-                                     nsIDOMNode* aParent2, PRInt32 aOffset2) = 0;
-                               
-  NS_IMETHOD CompareNodeToRange(nsIContent* aNode, 
-                                nsRange* aRange,
-                                bool *outNodeBefore,
-                                bool *outNodeAfter) = 0;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsIRangeUtils, NS_IRANGEUTILS_IID)
-
-#endif /* nsIRangeUtils_h___ */
-
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -1725,16 +1725,28 @@ nsContentUtils::ComparePoints(nsINode* a
     nsINode* child2 = parents2.ElementAt(--pos2);
     return aOffset1 <= parent->IndexOf(child2) ? -1 : 1;
   }
 
   nsINode* child1 = parents1.ElementAt(--pos1);
   return parent->IndexOf(child1) < aOffset2 ? -1 : 1;
 }
 
+/* static */
+PRInt32
+nsContentUtils::ComparePoints(nsIDOMNode* aParent1, PRInt32 aOffset1,
+                              nsIDOMNode* aParent2, PRInt32 aOffset2,
+                              bool* aDisconnected)
+{
+  nsCOMPtr<nsINode> parent1 = do_QueryInterface(aParent1);
+  nsCOMPtr<nsINode> parent2 = do_QueryInterface(aParent2);
+  NS_ENSURE_TRUE(parent1 && parent2, -1);
+  return ComparePoints(parent1, aOffset1, parent2, aOffset2);
+}
+
 inline bool
 IsCharInSet(const char* aSet,
             const PRUnichar aChar)
 {
   PRUnichar ch;
   while ((ch = *aSet)) {
     if (aChar == PRUnichar(ch)) {
       return true;
--- a/content/base/src/nsRange.cpp
+++ b/content/base/src/nsRange.cpp
@@ -230,62 +230,16 @@ nsRange::IsNodeSelected(nsINode* aNode, 
     if (data.mResult) {
       return true;
     }
   }
   return false;
 }
 
 /******************************************************
- * non members
- ******************************************************/
-
-nsresult
-NS_NewRangeUtils(nsIRangeUtils** aResult)
-{
-  NS_ENSURE_ARG_POINTER(aResult);
-
-  nsRangeUtils* rangeUtil = new nsRangeUtils();
-  if (!rangeUtil) {
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
-
-  return CallQueryInterface(rangeUtil, aResult);
-}
-
-/******************************************************
- * nsISupports
- ******************************************************/
-NS_IMPL_ISUPPORTS1(nsRangeUtils, nsIRangeUtils)
-
-/******************************************************
- * nsIRangeUtils methods
- ******************************************************/
- 
-NS_IMETHODIMP_(PRInt32) 
-nsRangeUtils::ComparePoints(nsIDOMNode* aParent1, PRInt32 aOffset1,
-                            nsIDOMNode* aParent2, PRInt32 aOffset2)
-{
-  nsCOMPtr<nsINode> parent1 = do_QueryInterface(aParent1);
-  nsCOMPtr<nsINode> parent2 = do_QueryInterface(aParent2);
-
-  NS_ENSURE_TRUE(parent1 && parent2, -1);
-
-  return nsContentUtils::ComparePoints(parent1, aOffset1, parent2, aOffset2);
-}
-
-NS_IMETHODIMP
-nsRangeUtils::CompareNodeToRange(nsIContent* aNode, nsRange* aRange,
-                                 bool *outNodeBefore, bool *outNodeAfter)
-{
-  return nsRange::CompareNodeToRange(aNode, aRange, outNodeBefore,
-                                     outNodeAfter);
-}
-
-/******************************************************
  * constructor/destructor
  ******************************************************/
 
 nsRange::~nsRange() 
 {
   NS_ASSERTION(!IsInSelection(), "deleting nsRange that is in use");
 
   // we want the side effects (releases and list removals)
--- a/content/base/src/nsRange.h
+++ b/content/base/src/nsRange.h
@@ -38,17 +38,16 @@
 /*
  * Implementation of the DOM nsIDOMRange object.
  */
 
 #ifndef nsRange_h___
 #define nsRange_h___
 
 #include "nsIDOMRange.h"
-#include "nsIRangeUtils.h"
 #include "nsCOMPtr.h"
 #include "nsIDOMDocumentFragment.h"
 #include "nsIContent.h"
 #include "nsIDOMNode.h"
 #include "prmon.h"
 #include "nsStubMutationObserver.h"
 
 class nsRange : public nsIDOMRange,
@@ -265,28 +264,9 @@ protected:
   PRInt32 mEndOffset;
 
   bool mIsPositioned;
   bool mIsDetached;
   bool mMaySpanAnonymousSubtrees;
   bool mInSelection;
 };
 
-
-class nsRangeUtils : public nsIRangeUtils
-{
-public:
-  NS_DECL_ISUPPORTS
-
-  // nsIRangeUtils interface
-  NS_IMETHOD_(PRInt32) ComparePoints(nsIDOMNode* aParent1, PRInt32 aOffset1,
-                                     nsIDOMNode* aParent2, PRInt32 aOffset2);
-                               
-  NS_IMETHOD CompareNodeToRange(nsIContent* aNode, 
-                                nsRange* aRange,
-                                bool *outNodeBefore,
-                                bool *outNodeAfter);
-};
-
-// Make a new nsIRangeUtils object
-nsresult NS_NewRangeUtils(nsIRangeUtils** aInstancePtrResult);
-
 #endif /* nsRange_h___ */
--- 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 "nsIRangeUtils.h"
 #include "nsIDOMCharacterData.h"
 #include "nsIEnumerator.h"
 #include "nsIDOMNamedNodeMap.h"
 #include "nsRange.h"
 
 #include "nsEditorUtils.h"
 #include "nsWSRunObject.h"
 
@@ -5252,17 +5251,17 @@ nsHTMLEditRules::ExpandSelectionForDelet
     nsRefPtr<nsRange> range = new nsRange();
     res = range->SetStart(selStartNode, selStartOffset);
     NS_ENSURE_SUCCESS(res, res);
     res = range->SetEnd(selEndNode, selEndOffset);
     NS_ENSURE_SUCCESS(res, res);
     
     // check if block is entirely inside range
     nsCOMPtr<nsIContent> brContentBlock = do_QueryInterface(brBlock);
-    res = mHTMLEditor->sRangeHelper->CompareNodeToRange(brContentBlock, range, &nodeBefore, &nodeAfter);
+    res = nsRange::CompareNodeToRange(brContentBlock, range, &nodeBefore, &nodeAfter);
     
     // if block isn't contained, forgo grabbing the br in the expanded selection
     if (nodeBefore || nodeAfter)
       doEndExpansion = false;
   }
   if (doEndExpansion)
   {
     res = aSelection->Extend(selEndNode, selEndOffset);
@@ -5484,19 +5483,21 @@ nsHTMLEditRules::NormalizeSelection(nsIS
   // that is not collapsed and yet does not contain any editable content, and satisfies some of the
   // above conditions that cause tweaking.  In this case we don't want to tweak the selection into
   // a block it was never in, etc.  There are a variety of strategies one might use to try to
   // detect these cases, but I think the most straightforward is to see if the adjusted locations
   // "cross" the old values: ie, new end before old start, or new start after old end.  If so 
   // then just leave things alone.
   
   PRInt16 comp;
-  comp = mHTMLEditor->sRangeHelper->ComparePoints(startNode, startOffset, newEndNode, newEndOffset);
+  comp = nsContentUtils::ComparePoints(startNode, startOffset,
+                                       newEndNode, newEndOffset);
   if (comp == 1) return NS_OK;  // new end before old start
-  comp = mHTMLEditor->sRangeHelper->ComparePoints(newStartNode, newStartOffset, endNode, endOffset);
+  comp = nsContentUtils::ComparePoints(newStartNode, newStartOffset,
+                                       endNode, endOffset);
   if (comp == 1) return NS_OK;  // new start after old end
   
   // otherwise set selection to new values.  
   inSelection->Collapse(newStartNode, newStartOffset);
   inSelection->Extend(newEndNode, newEndOffset);
   return NS_OK;
 }
 
@@ -7632,17 +7633,17 @@ nsHTMLEditRules::PinSelectionToNewBlock(
   nsRefPtr<nsRange> range = new nsRange();
   res = range->SetStart(selNode, selOffset);
   NS_ENSURE_SUCCESS(res, res);
   res = range->SetEnd(selNode, selOffset);
   NS_ENSURE_SUCCESS(res, res);
   nsCOMPtr<nsIContent> block (do_QueryInterface(mNewBlock));
   NS_ENSURE_TRUE(block, NS_ERROR_NO_INTERFACE);
   bool nodeBefore, nodeAfter;
-  res = mHTMLEditor->sRangeHelper->CompareNodeToRange(block, range, &nodeBefore, &nodeAfter);
+  res = nsRange::CompareNodeToRange(block, range, &nodeBefore, &nodeAfter);
   NS_ENSURE_SUCCESS(res, res);
   
   if (nodeBefore && nodeAfter)
     return NS_OK;  // selection is inside block
   else if (nodeBefore)
   {
     // selection is after block.  put at end of block.
     nsCOMPtr<nsIDOMNode> tmp = mNewBlock;
--- 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 "nsIRangeUtils.h"
 #include "nsISupportsArray.h"
 #include "nsContentUtils.h"
 #include "nsIDocumentEncoder.h"
 #include "nsIDOMDocumentFragment.h"
 #include "nsIPresShell.h"
 #include "nsPresContext.h"
 #include "SetDocTitleTxn.h"
 #include "nsFocusManager.h"
@@ -104,18 +103,16 @@
 using namespace mozilla;
 using namespace mozilla::widget;
 
 // Some utilities to handle annoying overloading of "A" tag for link and named anchor
 static char hrefText[] = "href";
 static char anchorTxt[] = "anchor";
 static char namedanchorText[] = "namedanchor";
 
-nsIRangeUtils* nsHTMLEditor::sRangeHelper;
-
 #define IsLinkTag(s) (s.EqualsIgnoreCase(hrefText))
 #define IsNamedAnchorTag(s) (s.EqualsIgnoreCase(anchorTxt) || s.EqualsIgnoreCase(namedanchorText))
 
 nsHTMLEditor::nsHTMLEditor()
 : nsPlaintextEditor()
 , mIgnoreSpuriousDragEvent(false)
 , mCRInParagraphCreatesParagraph(false)
 , mSelectedCellIndex(0)
@@ -191,23 +188,16 @@ nsHTMLEditor::HideAnonymousEditingUIs()
   if (mAbsolutelyPositionedObject)
     HideGrabber();
   if (mInlineEditedCell)
     HideInlineTableEditingUI();
   if (mResizedObject)
     HideResizers();
 }
 
-/* static */
-void
-nsHTMLEditor::Shutdown()
-{
-  NS_IF_RELEASE(sRangeHelper);
-}
-
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLEditor)
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLEditor, nsPlaintextEditor)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTypeInState)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTextServices)
 
   tmp->HideAnonymousEditingUIs();
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
@@ -266,23 +256,16 @@ nsHTMLEditor::Init(nsIDOMDocument *aDoc,
                    nsIContent *aRoot,
                    nsISelectionController *aSelCon,
                    PRUint32 aFlags)
 {
   NS_PRECONDITION(aDoc && !aSelCon, "bad arg");
   NS_ENSURE_TRUE(aDoc, NS_ERROR_NULL_POINTER);
 
   nsresult result = NS_OK, rulesRes = NS_OK;
-
-  // make a range util object for comparing dom points
-  if (!sRangeHelper) {
-    result = CallGetService("@mozilla.org/content/range-utils;1",
-                            &sRangeHelper);
-    NS_ENSURE_TRUE(sRangeHelper, result);
-  }
    
   if (1)
   {
     // block to scope nsAutoEditInitRulesTrigger
     nsAutoEditInitRulesTrigger rulesTrigger(static_cast<nsPlaintextEditor*>(this), rulesRes);
 
     // Init the plaintext editor
     result = nsPlaintextEditor::Init(aDoc, aRoot, nsnull, aFlags);
--- a/editor/libeditor/html/nsHTMLEditor.h
+++ b/editor/libeditor/html/nsHTMLEditor.h
@@ -74,17 +74,16 @@
 
 class nsIDOMKeyEvent;
 class nsITransferable;
 class nsIDocumentEncoder;
 class nsIClipboard;
 class TypeInState;
 class nsIContentFilter;
 class nsIURL;
-class nsIRangeUtils;
 class nsILinkHandler;
 struct PropItem;
 
 namespace mozilla {
 namespace widget {
 struct IMEState;
 } // namespace widget
 } // namespace mozilla
@@ -767,23 +766,16 @@ protected:
   nsTArray<nsRefPtr<nsCSSStyleSheet> > mStyleSheets;
   
   // an array for holding default style settings
   nsTArray<PropItem*> mDefaultStyles;
 
    // for real-time spelling
    nsCOMPtr<nsITextServicesDocument> mTextServices;
 
-  // And a static range utils service
-  static nsIRangeUtils* sRangeHelper;
-
-public:
-  // ... which means that we need to listen to shutdown
-  static void Shutdown();
-
 protected:
 
   /* ANONYMOUS UTILS */
   void     RemoveListenerAndDeleteRef(const nsAString& aEvent,
                                       nsIDOMEventListener* aListener,
                                       bool aUseCapture,
                                       nsIDOMElement* aElement,
                                       nsIContent* aParentContent,
--- a/editor/libeditor/html/nsWSRunObject.cpp
+++ b/editor/libeditor/html/nsWSRunObject.cpp
@@ -38,18 +38,18 @@
 #include "nsTextFragment.h"
 #include "nsWSRunObject.h"
 #include "nsIDOMNode.h"
 #include "nsHTMLEditor.h"
 #include "nsTextEditUtils.h"
 #include "nsIContent.h"
 #include "nsIDOMCharacterData.h"
 #include "nsCRT.h"
-#include "nsIRangeUtils.h"
 #include "nsRange.h"
+#include "nsContentUtils.h"
 
 const PRUnichar nbsp = 160;
 
 static bool IsBlockNode(nsIDOMNode* node)
 {
   bool isBlock (false);
   nsHTMLEditor::NodeIsBlockStatic(node, &isBlock);
   return isBlock;
@@ -1597,17 +1597,17 @@ nsWSRunObject::DeleteChars(nsIDOMNode *a
         range = new nsRange();
         res = range->SetStart(aStartNode, aStartOffset);
         NS_ENSURE_SUCCESS(res, res);
         res = range->SetEnd(aEndNode, aEndOffset);
         NS_ENSURE_SUCCESS(res, res);
       }
       bool nodeBefore, nodeAfter;
       nsCOMPtr<nsIContent> content (do_QueryInterface(node));
-      res = mHTMLEditor->sRangeHelper->CompareNodeToRange(content, range, &nodeBefore, &nodeAfter);
+      res = nsRange::CompareNodeToRange(content, range, &nodeBefore, &nodeAfter);
       NS_ENSURE_SUCCESS(res, res);
       if (nodeAfter)
       {
         break;
       }
       if (!nodeBefore)
       {
         res = mHTMLEditor->DeleteNode(node);
@@ -1856,31 +1856,33 @@ nsWSRunObject::FindRun(nsIDOMNode *aNode
   *outRun = nsnull;
   // given a dompoint, find the ws run that is before or after it, as caller needs
   NS_ENSURE_TRUE(aNode && outRun, NS_ERROR_NULL_POINTER);
     
   nsresult res = NS_OK;
   WSFragment *run = mStartRun;
   while (run)
   {
-    PRInt16 comp = mHTMLEditor->sRangeHelper->ComparePoints(aNode, aOffset, run->mStartNode, run->mStartOffset);
+    PRInt16 comp = nsContentUtils::ComparePoints(aNode, aOffset, run->mStartNode,
+                                                 run->mStartOffset);
     if (comp <= 0)
     {
       if (after)
       {
         *outRun = run;
         return res;
       }
       else // before
       {
         *outRun = nsnull;
         return res;
       }
     }
-    comp = mHTMLEditor->sRangeHelper->ComparePoints(aNode, aOffset, run->mEndNode, run->mEndOffset);
+    comp = nsContentUtils::ComparePoints(aNode, aOffset,
+                                         run->mEndNode, run->mEndOffset);
     if (comp < 0)
     {
       *outRun = run;
       return res;
     }
     else if (comp == 0)
     {
       if (after)
@@ -1943,17 +1945,17 @@ nsWSRunObject::GetWSPointAfter(nsIDOMNod
   nsCOMPtr<nsIDOMNode>  curNode;
   
   // begin binary search
   // we do this because we need to minimize calls to ComparePoints(),
   // which is mongo expensive
   while (curNum != lastNum)
   {
     curNode = mNodeArray[curNum];
-    cmp = mHTMLEditor->sRangeHelper->ComparePoints(aNode, aOffset, curNode, 0);
+    cmp = nsContentUtils::ComparePoints(aNode, aOffset, curNode, 0);
     if (cmp < 0)
       lastNum = curNum;
     else
       firstNum = curNum + 1;
     curNum = (lastNum - firstNum) / 2 + firstNum;
     NS_ASSERTION(firstNum <= curNum && curNum <= lastNum, "Bad binary search");
   }
 
@@ -1992,17 +1994,17 @@ nsWSRunObject::GetWSPointBefore(nsIDOMNo
   nsCOMPtr<nsIDOMNode>  curNode;
   
   // begin binary search
   // we do this because we need to minimize calls to ComparePoints(),
   // which is mongo expensive
   while (curNum != lastNum)
   {
     curNode = mNodeArray[curNum];
-    cmp = mHTMLEditor->sRangeHelper->ComparePoints(aNode, aOffset, curNode, 0);
+    cmp = nsContentUtils::ComparePoints(aNode, aOffset, curNode, 0);
     if (cmp < 0)
       lastNum = curNum;
     else
       firstNum = curNum + 1;
     curNum = (lastNum - firstNum) / 2 + firstNum;
     NS_ASSERTION(firstNum <= curNum && curNum <= lastNum, "Bad binary search");
   }
 
--- a/editor/txtsvc/src/nsFilteredContentIterator.cpp
+++ b/editor/txtsvc/src/nsFilteredContentIterator.cpp
@@ -37,17 +37,17 @@
 
 #include "nsFilteredContentIterator.h"
 #include "nsIContentIterator.h"
 #include "nsComponentManagerUtils.h"
 #include "nsIContent.h"
 #include "nsString.h"
 #include "nsIEnumerator.h"
 
-#include "nsTextServicesDocument.h"
+#include "nsContentUtils.h"
 
 #include "nsIDOMNode.h"
 
 //------------------------------------------------------------
 nsFilteredContentIterator::nsFilteredContentIterator(nsITextServicesFilter* aFilter) :
   mFilter(aFilter),
   mDidSkip(false),
   mIsOutOfRange(false),
@@ -249,24 +249,20 @@ ContentIsInTraversalRange(nsIContent *aC
 
   ContentToParentOffset(aContent, getter_AddRefs(parentNode), &indx);
 
   NS_ENSURE_TRUE(parentNode, false);
 
   if (!aIsPreMode)
     ++indx;
 
-  PRInt32 startRes;
-  PRInt32 endRes;
-  nsresult rv = nsTextServicesDocument::ComparePoints(aStartNode, aStartOffset, parentNode, indx, &startRes);
-  NS_ENSURE_SUCCESS(rv, false);
-
-  rv = nsTextServicesDocument::ComparePoints(aEndNode,   aEndOffset,   parentNode, indx,  &endRes);
-  NS_ENSURE_SUCCESS(rv, false);
-
+  PRInt32 startRes = nsContentUtils::ComparePoints(aStartNode, aStartOffset,
+                                                   parentNode, indx);
+  PRInt32 endRes = nsContentUtils::ComparePoints(aEndNode, aEndOffset,
+                                                 parentNode, indx);
   return (startRes <= 0) && (endRes >= 0);
 }
 
 static bool
 ContentIsInTraversalRange(nsIDOMRange *aRange, nsIDOMNode* aNextNode, bool aIsPreMode)
 {
   nsCOMPtr<nsIContent> content(do_QueryInterface(aNextNode));
   NS_ENSURE_TRUE(content && aRange, false);
--- a/editor/txtsvc/src/nsFilteredContentIterator.h
+++ b/editor/txtsvc/src/nsFilteredContentIterator.h
@@ -38,17 +38,16 @@
 #ifndef nsFilteredContentIterator_h__
 #define nsFilteredContentIterator_h__
 
 #include "nsIContentIterator.h"
 #include "nsCOMPtr.h"
 #include "nsIAtom.h"
 #include "nsITextServicesFilter.h"
 #include "nsRange.h"
-#include "nsIRangeUtils.h"
 #include "nsCycleCollectionParticipant.h"
 
 /**
  * 
  */
 class nsFilteredContentIterator : public nsIContentIterator
 {
 public:
--- a/editor/txtsvc/src/nsTextServicesDocument.cpp
+++ b/editor/txtsvc/src/nsTextServicesDocument.cpp
@@ -44,17 +44,17 @@
 #include "nsIAtom.h"
 #include "nsStaticAtom.h"
 #include "nsString.h"
 #include "nsIEnumerator.h"
 #include "nsIContent.h"
 #include "nsIContentIterator.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMRange.h"
-#include "nsIRangeUtils.h"
+#include "nsContentUtils.h"
 #include "nsISelection.h"
 #include "nsIPlaintextEditor.h"
 #include "nsTextServicesDocument.h"
 #include "nsFilteredContentIterator.h"
 
 #include "nsIDOMElement.h"
 #include "nsIDOMHTMLElement.h"
 #include "nsIDOMHTMLDocument.h"
@@ -98,18 +98,16 @@ public:
   bool    mIsInsertedText;
   bool    mIsValid;
 };
 
 #define TS_ATOM(name_, value_) nsIAtom* nsTextServicesDocument::name_ = 0;
 #include "nsTSAtomList.h"
 #undef TS_ATOM
 
-nsIRangeUtils* nsTextServicesDocument::sRangeHelper;
-
 nsTextServicesDocument::nsTextServicesDocument()
 {
   mRefCnt         = 0;
 
   mSelStartIndex  = -1;
   mSelStartOffset = -1;
   mSelEndIndex    = -1;
   mSelEndOffset   = -1;
@@ -134,23 +132,16 @@ nsTextServicesDocument::RegisterAtoms()
 #define TS_ATOM(name_, value_) NS_STATIC_ATOM(name_##_buffer, &name_),
 #include "nsTSAtomList.h"
 #undef TS_ATOM
   };
 
   NS_RegisterStaticAtoms(ts_atoms, ArrayLength(ts_atoms));
 }
 
-/* static */
-void
-nsTextServicesDocument::Shutdown()
-{
-  NS_IF_RELEASE(sRangeHelper);
-}
-
 NS_IMPL_CYCLE_COLLECTING_ADDREF(nsTextServicesDocument)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(nsTextServicesDocument)
 
 NS_INTERFACE_MAP_BEGIN(nsTextServicesDocument)
   NS_INTERFACE_MAP_ENTRY(nsITextServicesDocument)
   NS_INTERFACE_MAP_ENTRY(nsIEditActionListener)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsITextServicesDocument)
   NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsTextServicesDocument)
@@ -2663,23 +2654,20 @@ nsTextServicesDocument::GetCollapsedSele
   result = range->GetStartContainer(getter_AddRefs(parent));
 
   NS_ENSURE_SUCCESS(result, result);
 
   result = range->GetStartOffset(&offset);
 
   NS_ENSURE_SUCCESS(result, result);
 
-  result = ComparePoints(eStart->mNode, eStartOffset, parent, offset, &e1s1);
-
-  NS_ENSURE_SUCCESS(result, result);
-
-  result = ComparePoints(eEnd->mNode, eEndOffset, parent, offset, &e2s1);
-
-  NS_ENSURE_SUCCESS(result, result);
+  e1s1 = nsContentUtils::ComparePoints(eStart->mNode, eStartOffset,
+                                       parent, offset);
+  e2s1 = nsContentUtils::ComparePoints(eEnd->mNode, eEndOffset,
+                                       parent, offset);
 
   if (e1s1 > 0 || e2s1 < 0)
   {
     // We're done if the caret is outside the
     // current text block.
 
     return NS_OK;
   }
@@ -2957,23 +2945,20 @@ nsTextServicesDocument::GetUncollapsedSe
     NS_ENSURE_SUCCESS(result, result);
 
     result = GetRangeEndPoints(range,
                                getter_AddRefs(startParent), &startOffset,
                                getter_AddRefs(endParent), &endOffset);
 
     NS_ENSURE_SUCCESS(result, result);
 
-    result = ComparePoints(eStart->mNode, eStartOffset, endParent, endOffset, &e1s2);
-
-    NS_ENSURE_SUCCESS(result, result);
-
-    result = ComparePoints(eEnd->mNode, eEndOffset, startParent, startOffset, &e2s1);
-
-    NS_ENSURE_SUCCESS(result, result);
+    e1s2 = nsContentUtils::ComparePoints(eStart->mNode, eStartOffset,
+                                         endParent, endOffset);
+    e2s1 = nsContentUtils::ComparePoints(eEnd->mNode, eEndOffset,
+                                         startParent, startOffset);
 
     // Break out of the loop if the text block intersects the current range.
 
     if (e1s2 <= 0 && e2s1 >= 0)
       break;
   }
 
   // We're done if we didn't find an intersecting range.
@@ -2982,23 +2967,20 @@ nsTextServicesDocument::GetUncollapsedSe
   {
     *aSelStatus = nsITextServicesDocument::eBlockOutside;
     *aSelOffset = *aSelLength = -1;
     return NS_OK;
   }
 
   // Now that we have an intersecting range, find out more info:
 
-  result = ComparePoints(eStart->mNode, eStartOffset, startParent, startOffset, &e1s1);
-
-  NS_ENSURE_SUCCESS(result, result);
-
-  result = ComparePoints(eEnd->mNode, eEndOffset, endParent, endOffset, &e2s2);
-
-  NS_ENSURE_SUCCESS(result, result);
+  e1s1 = nsContentUtils::ComparePoints(eStart->mNode, eStartOffset,
+                                       startParent, startOffset);
+  e2s2 = nsContentUtils::ComparePoints(eEnd->mNode, eEndOffset,
+                                       endParent, endOffset);
 
   if (rangeCount > 1)
   {
     // There are multiple selection ranges, we only deal
     // with the first one that intersects the current,
     // text block, so mark this a as a partial.
 
     *aSelStatus = nsITextServicesDocument::eBlockPartial;
@@ -3207,34 +3189,16 @@ nsTextServicesDocument::SelectionIsColla
 
 bool
 nsTextServicesDocument::SelectionIsValid()
 {
   return(mSelStartIndex >= 0);
 }
 
 nsresult
-nsTextServicesDocument::ComparePoints(nsIDOMNode* aParent1, PRInt32 aOffset1,
-                                      nsIDOMNode* aParent2, PRInt32 aOffset2,
-                                      PRInt32 *aResult)
-{
-  *aResult = 0;
-
-  if (!sRangeHelper) {
-    nsresult result = CallGetService("@mozilla.org/content/range-utils;1",
-                                     &sRangeHelper);
-    NS_ENSURE_TRUE(sRangeHelper, result);
-  }
-
-  *aResult = sRangeHelper->ComparePoints(aParent1, aOffset1,
-                                         aParent2, aOffset2);
-  return NS_OK;
-}
-
-nsresult
 nsTextServicesDocument::GetRangeEndPoints(nsIDOMRange *aRange,
                                           nsIDOMNode **aStartParent, PRInt32 *aStartOffset,
                                           nsIDOMNode **aEndParent, PRInt32 *aEndOffset)
 {
   nsresult result;
 
   NS_ENSURE_TRUE(aRange && aStartParent && aStartOffset && aEndParent && aEndOffset, NS_ERROR_NULL_POINTER);
 
--- a/editor/txtsvc/src/nsTextServicesDocument.h
+++ b/editor/txtsvc/src/nsTextServicesDocument.h
@@ -47,17 +47,16 @@
 #include "nsIEditActionListener.h"
 #include "nsITextServicesDocument.h"
 #include "nsTArray.h"
 #include "nsISelectionController.h"
 #include "nsITextServicesFilter.h"
 #include "nsWeakReference.h"
 #include "nsCycleCollectionParticipant.h"
 
-class nsIRangeUtils;
 class OffsetEntry;
 
 /** implementation of a text services object.
  *
  */
 class nsTextServicesDocument : public nsITextServicesDocument,
                                public nsIEditActionListener
 {
@@ -109,36 +108,30 @@ private:
   PRInt32                         mSelStartOffset;
   PRInt32                         mSelEndIndex;
   PRInt32                         mSelEndOffset;
 
   nsCOMPtr<nsIDOMRange>           mExtent;
 
   nsCOMPtr<nsITextServicesFilter> mTxtSvcFilter;
 
-  static nsIRangeUtils* sRangeHelper;
-
 public:
 
   /** The default constructor.
    */
   nsTextServicesDocument();
 
   /** The default destructor.
    */
   virtual ~nsTextServicesDocument();
 
   /** To be called at module init
    */
   static void RegisterAtoms();
 
-  /** To be called at module shutdown
-   */
-  static void Shutdown();
-
   /* Macro for AddRef(), Release(), and QueryInterface() */
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsTextServicesDocument, nsITextServicesDocument)
 
   /* nsITextServicesDocument method implementations. */
   NS_IMETHOD InitWithEditor(nsIEditor *aEditor);
   NS_IMETHOD GetDocument(nsIDOMDocument **aDoc);
   NS_IMETHOD SetExtent(nsIDOMRange* aDOMRange);
@@ -187,17 +180,16 @@ public:
   NS_IMETHOD WillInsertText(nsIDOMCharacterData *aTextNode, PRInt32 aOffset, const nsAString &aString);
   NS_IMETHOD DidInsertText(nsIDOMCharacterData *aTextNode, PRInt32 aOffset, const nsAString &aString, nsresult aResult);
   NS_IMETHOD WillDeleteText(nsIDOMCharacterData *aTextNode, PRInt32 aOffset, PRInt32 aLength);
   NS_IMETHOD DidDeleteText(nsIDOMCharacterData *aTextNode, PRInt32 aOffset, PRInt32 aLength, nsresult aResult);
   NS_IMETHOD WillDeleteSelection(nsISelection *aSelection);
   NS_IMETHOD DidDeleteSelection(nsISelection *aSelection);
 
   /* Helper functions */
-  static nsresult ComparePoints(nsIDOMNode *aParent1, PRInt32 aOffset1, nsIDOMNode *aParent2, PRInt32 aOffset2, PRInt32 *aResult);
   static nsresult GetRangeEndPoints(nsIDOMRange *aRange, nsIDOMNode **aParent1, PRInt32 *aOffset1, nsIDOMNode **aParent2, PRInt32 *aOffset2);
   static nsresult CreateRange(nsIDOMNode *aStartParent, PRInt32 aStartOffset, nsIDOMNode *aEndParent, PRInt32 aEndOffset, nsIDOMRange **aRange);
 
 private:
   /* nsTextServicesDocument private methods. */
 
   nsresult CreateContentIterator(nsIDOMRange *aRange, nsIContentIterator **aIterator);
 
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -64,17 +64,16 @@
 #include "nsHTMLStyleSheet.h"
 #include "nsIHTMLToTextSink.h"
 #include "nsILayoutDebugger.h"
 #include "nsINameSpaceManager.h"
 #include "nsINodeInfo.h"
 #include "nsIObserver.h"
 #include "nsIObserverService.h"
 #include "nsIPresShell.h"
-#include "nsIRangeUtils.h"
 #include "nsIScriptNameSpaceManager.h"
 #include "nsISelection.h"
 #include "nsIXBLService.h"
 #include "nsCaret.h"
 #include "nsPlainTextSerializer.h"
 #include "mozSanitizingSerializer.h"
 #include "nsXMLContentSerializer.h"
 #include "nsXHTMLContentSerializer.h"
@@ -420,17 +419,16 @@ nsresult NS_NewTreeBoxObject(nsIBoxObjec
 nsresult NS_NewCanvasRenderingContext2D(nsIDOMCanvasRenderingContext2D** aResult);
 nsresult NS_NewCanvasRenderingContext2DThebes(nsIDOMCanvasRenderingContext2D** aResult);
 nsresult NS_NewCanvasRenderingContextWebGL(nsIDOMWebGLRenderingContext** aResult);
 
 nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult);
 
 nsresult NS_NewDomSelection(nsISelection** aResult);
 nsresult NS_NewContentViewer(nsIContentViewer** aResult);
-nsresult NS_NewRangeUtils(nsIRangeUtils** aResult);
 nsresult NS_NewContentIterator(nsIContentIterator** aResult);
 nsresult NS_NewPreContentIterator(nsIContentIterator** aResult);
 nsresult NS_NewGenRegularIterator(nsIContentIterator** aResult);
 nsresult NS_NewContentSubtreeIterator(nsIContentIterator** aResult);
 nsresult NS_NewGenSubtreeIterator(nsIContentIterator** aInstancePtrResult);
 nsresult NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
 nsresult NS_NewHTMLCopyTextEncoder(nsIDocumentEncoder** aResult);
 nsresult NS_NewTextEncoder(nsIDocumentEncoder** aResult);
@@ -488,17 +486,16 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(inDOMUtil
 
 MAKE_CTOR(CreateNameSpaceManager,         nsINameSpaceManager,         NS_GetNameSpaceManager)
 MAKE_CTOR(CreateContentViewer,            nsIContentViewer,            NS_NewContentViewer)
 MAKE_CTOR(CreateHTMLDocument,             nsIDocument,                 NS_NewHTMLDocument)
 MAKE_CTOR(CreateXMLDocument,              nsIDocument,                 NS_NewXMLDocument)
 MAKE_CTOR(CreateSVGDocument,              nsIDocument,                 NS_NewSVGDocument)
 MAKE_CTOR(CreateImageDocument,            nsIDocument,                 NS_NewImageDocument)
 MAKE_CTOR(CreateDOMSelection,             nsISelection,                NS_NewDomSelection)
-MAKE_CTOR(CreateRangeUtils,               nsIRangeUtils,               NS_NewRangeUtils)
 MAKE_CTOR(CreateContentIterator,          nsIContentIterator,          NS_NewContentIterator)
 MAKE_CTOR(CreatePreContentIterator,       nsIContentIterator,          NS_NewPreContentIterator)
 MAKE_CTOR(CreateSubtreeIterator,          nsIContentIterator,          NS_NewContentSubtreeIterator)
 // CreateHTMLImgElement, see below
 // CreateHTMLOptionElement, see below
 // CreateHTMLAudioElement, see below
 MAKE_CTOR(CreateTextEncoder,              nsIDocumentEncoder,          NS_NewTextEncoder)
 MAKE_CTOR(CreateHTMLCopyTextEncoder,      nsIDocumentEncoder,          NS_NewHTMLCopyTextEncoder)
@@ -681,17 +678,16 @@ NS_DEFINE_NAMED_CID(IN_CSSVALUESEARCH_CI
 NS_DEFINE_NAMED_CID(IN_DOMUTILS_CID);
 NS_DEFINE_NAMED_CID(NS_NAMESPACEMANAGER_CID);
 NS_DEFINE_NAMED_CID(NS_CONTENT_VIEWER_CID);
 NS_DEFINE_NAMED_CID(NS_HTMLDOCUMENT_CID);
 NS_DEFINE_NAMED_CID(NS_XMLDOCUMENT_CID);
 NS_DEFINE_NAMED_CID(NS_SVGDOCUMENT_CID);
 NS_DEFINE_NAMED_CID(NS_IMAGEDOCUMENT_CID);
 NS_DEFINE_NAMED_CID(NS_DOMSELECTION_CID);
-NS_DEFINE_NAMED_CID(NS_RANGEUTILS_CID);
 NS_DEFINE_NAMED_CID(NS_CONTENTITERATOR_CID);
 NS_DEFINE_NAMED_CID(NS_PRECONTENTITERATOR_CID);
 NS_DEFINE_NAMED_CID(NS_SUBTREEITERATOR_CID);
 NS_DEFINE_NAMED_CID(NS_HTMLIMAGEELEMENT_CID);
 NS_DEFINE_NAMED_CID(NS_HTMLOPTIONELEMENT_CID);
 #ifdef MOZ_MEDIA
 NS_DEFINE_NAMED_CID(NS_HTMLAUDIOELEMENT_CID);
 #endif
@@ -953,17 +949,16 @@ static const mozilla::Module::CIDEntry k
   { &kIN_DOMUTILS_CID, false, NULL, inDOMUtilsConstructor },
   { &kNS_NAMESPACEMANAGER_CID, false, NULL, CreateNameSpaceManager },
   { &kNS_CONTENT_VIEWER_CID, false, NULL, CreateContentViewer },
   { &kNS_HTMLDOCUMENT_CID, false, NULL, CreateHTMLDocument },
   { &kNS_XMLDOCUMENT_CID, false, NULL, CreateXMLDocument },
   { &kNS_SVGDOCUMENT_CID, false, NULL, CreateSVGDocument },
   { &kNS_IMAGEDOCUMENT_CID, false, NULL, CreateImageDocument },
   { &kNS_DOMSELECTION_CID, false, NULL, CreateDOMSelection },
-  { &kNS_RANGEUTILS_CID, false, NULL, CreateRangeUtils },
   { &kNS_CONTENTITERATOR_CID, false, NULL, CreateContentIterator },
   { &kNS_PRECONTENTITERATOR_CID, false, NULL, CreatePreContentIterator },
   { &kNS_SUBTREEITERATOR_CID, false, NULL, CreateSubtreeIterator },
   { &kNS_HTMLIMAGEELEMENT_CID, false, NULL, CreateHTMLImgElement },
   { &kNS_HTMLOPTIONELEMENT_CID, false, NULL, CreateHTMLOptionElement },
 #ifdef MOZ_MEDIA
   { &kNS_HTMLAUDIOELEMENT_CID, false, NULL, CreateHTMLAudioElement },
 #endif
@@ -1088,17 +1083,16 @@ static const mozilla::Module::ContractID
   { "@mozilla.org/inspector/deep-tree-walker;1", &kIN_DEEPTREEWALKER_CID },
   { "@mozilla.org/inspector/flasher;1", &kIN_FLASHER_CID },
   { "@mozilla.org/inspector/search;1?type=cssvalue", &kIN_CSSVALUESEARCH_CID },
   { "@mozilla.org/inspector/dom-utils;1", &kIN_DOMUTILS_CID },
   { NS_NAMESPACEMANAGER_CONTRACTID, &kNS_NAMESPACEMANAGER_CID },
   { "@mozilla.org/xml/xml-document;1", &kNS_XMLDOCUMENT_CID },
   { "@mozilla.org/svg/svg-document;1", &kNS_SVGDOCUMENT_CID },
   { "@mozilla.org/content/dom-selection;1", &kNS_DOMSELECTION_CID },
-  { "@mozilla.org/content/range-utils;1", &kNS_RANGEUTILS_CID },
   { "@mozilla.org/content/post-content-iterator;1", &kNS_CONTENTITERATOR_CID },
   { "@mozilla.org/content/pre-content-iterator;1", &kNS_PRECONTENTITERATOR_CID },
   { "@mozilla.org/content/subtree-content-iterator;1", &kNS_SUBTREEITERATOR_CID },
   { NS_HTMLIMGELEMENT_CONTRACTID, &kNS_HTMLIMAGEELEMENT_CID },
   { NS_HTMLOPTIONELEMENT_CONTRACTID, &kNS_HTMLOPTIONELEMENT_CID },
 #ifdef MOZ_MEDIA
   { NS_HTMLAUDIOELEMENT_CONTRACTID, &kNS_HTMLAUDIOELEMENT_CID },
 #endif
--- a/layout/build/nsLayoutStatics.cpp
+++ b/layout/build/nsLayoutStatics.cpp
@@ -339,19 +339,16 @@ nsLayoutStatics::Shutdown()
 
   nsJSRuntime::Shutdown();
   nsGlobalWindow::ShutDown();
   nsDOMClassInfo::ShutDown();
   nsListControlFrame::Shutdown();
   nsXBLWindowKeyHandler::ShutDown();
   nsAutoCopyListener::Shutdown();
 
-  nsHTMLEditor::Shutdown();
-  nsTextServicesDocument::Shutdown();
-
 #ifdef MOZ_SYDNEYAUDIO
   nsAudioStream::ShutdownLibrary();
 #endif
 
   nsCORSListenerProxy::Shutdown();
   
   nsIPresShell::ReleaseStatics();