Bug 1377980 part 4. Remove nsIDOMRange. r=mccr8
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 17 May 2018 12:01:38 -0400
changeset 475462 0846a3df31b4e6c7f3e5bb3912896e9cb4cc40f8
parent 475461 cbd8ba61e49c3561d550a3098ca7821e7673a238
child 475463 77be093ecde94975498c9f5cf51cf97c733dc0a8
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1377980
milestone62.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 1377980 part 4. Remove nsIDOMRange. r=mccr8
dom/base/nsRange.cpp
dom/base/nsRange.h
dom/interfaces/range/moz.build
dom/interfaces/range/nsIDOMRange.idl
dom/moz.build
--- a/dom/base/nsRange.cpp
+++ b/dom/base/nsRange.cpp
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 /*
- * Implementation of the DOM nsIDOMRange object.
+ * Implementation of the DOM Range object.
  */
 
 #include "nscore.h"
 #include "nsRange.h"
 
 #include "nsString.h"
 #include "nsReadableUtils.h"
 #include "nsIDOMNode.h"
@@ -323,41 +323,16 @@ nsRange::CreateRange(nsINode* aStartCont
     return rv;
   }
   range.forget(aRange);
   return NS_OK;
 }
 
 /* static */
 nsresult
-nsRange::CreateRange(nsIDOMNode* aStartContainer, uint32_t aStartOffset,
-                     nsIDOMNode* aEndParent, uint32_t aEndOffset,
-                     nsRange** aRange)
-{
-  nsCOMPtr<nsINode> startContainer = do_QueryInterface(aStartContainer);
-  nsCOMPtr<nsINode> endContainer = do_QueryInterface(aEndParent);
-  return CreateRange(startContainer, aStartOffset,
-                     endContainer, aEndOffset, aRange);
-}
-
-/* static */
-nsresult
-nsRange::CreateRange(nsIDOMNode* aStartContainer, uint32_t aStartOffset,
-                     nsIDOMNode* aEndParent, uint32_t aEndOffset,
-                     nsIDOMRange** aRange)
-{
-  RefPtr<nsRange> range;
-  nsresult rv = nsRange::CreateRange(aStartContainer, aStartOffset, aEndParent,
-                                     aEndOffset, getter_AddRefs(range));
-  range.forget(aRange);
-  return rv;
-}
-
-/* static */
-nsresult
 nsRange::CreateRange(const RawRangeBoundary& aStart,
                      const RawRangeBoundary& aEnd,
                      nsRange** aRange)
 {
   RefPtr<nsRange> range = new nsRange(aStart.Container());
   nsresult rv = range->SetStartAndEnd(aStart, aEnd);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
@@ -372,19 +347,18 @@ nsRange::CreateRange(const RawRangeBound
 
 NS_IMPL_MAIN_THREAD_ONLY_CYCLE_COLLECTING_ADDREF(nsRange)
 NS_IMPL_MAIN_THREAD_ONLY_CYCLE_COLLECTING_RELEASE_WITH_LAST_RELEASE(
   nsRange, DoSetRange(RawRangeBoundary(), RawRangeBoundary(), nullptr))
 
 // QueryInterface implementation for nsRange
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsRange)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_INTERFACE_MAP_ENTRY(nsIDOMRange)
   NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMRange)
+  NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsRange)
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsRange)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mOwner);
 
@@ -3151,18 +3125,17 @@ nsRange::GetBoundingClientRect(bool aCla
 
 already_AddRefed<DOMRectList>
 nsRange::GetClientRects(bool aClampToEdge, bool aFlushLayout)
 {
   if (!mStart.Container()) {
     return nullptr;
   }
 
-  RefPtr<DOMRectList> rectList =
-    new DOMRectList(static_cast<nsIDOMRange*>(this));
+  RefPtr<DOMRectList> rectList = new DOMRectList(this);
 
   nsLayoutUtils::RectListBuilder builder(rectList);
 
   CollectClientRectsAndText(&builder, nullptr, this, mStart.Container(),
     mStart.Offset(), mEnd.Container(), mEnd.Offset(), aClampToEdge, aFlushLayout);
   return rectList.forget();
 }
 
@@ -3170,17 +3143,17 @@ void
 nsRange::GetClientRectsAndTexts(
   mozilla::dom::ClientRectsAndTexts& aResult,
   ErrorResult& aErr)
 {
   if (!mStart.Container()) {
     return;
   }
 
-  aResult.mRectList = new DOMRectList(static_cast<nsIDOMRange*>(this));
+  aResult.mRectList = new DOMRectList(this);
 
   nsLayoutUtils::RectListBuilder builder(aResult.mRectList);
 
   CollectClientRectsAndText(&builder, &aResult.mTextList, this,
     mStart.Container(), mStart.Offset(), mEnd.Container(), mEnd.Offset(), true, true);
 }
 
 nsresult
--- a/dom/base/nsRange.h
+++ b/dom/base/nsRange.h
@@ -1,22 +1,21 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 /*
- * Implementation of the DOM nsIDOMRange object.
+ * Implementation of the DOM Range object.
  */
 
 #ifndef nsRange_h___
 #define nsRange_h___
 
-#include "nsIDOMRange.h"
 #include "nsCOMPtr.h"
 #include "nsINode.h"
 #include "nsIDocument.h"
 #include "nsIDOMNode.h"
 #include "nsLayoutUtils.h"
 #include "prmon.h"
 #include "nsStubMutationObserver.h"
 #include "nsWrapperCache.h"
@@ -33,64 +32,50 @@ class DocGroup;
 class DocumentFragment;
 class DOMRect;
 class DOMRectList;
 class InspectorFontFace;
 class Selection;
 } // namespace dom
 } // namespace mozilla
 
-class nsRange final : public nsIDOMRange,
-                      public nsStubMutationObserver,
+class nsRange final : public nsStubMutationObserver,
                       public nsWrapperCache,
                       // For linking together selection-associated ranges.
                       public mozilla::LinkedListElement<nsRange>
 {
   typedef mozilla::ErrorResult ErrorResult;
   typedef mozilla::dom::DocGroup DocGroup;
   typedef mozilla::dom::DOMRect DOMRect;
   typedef mozilla::dom::DOMRectList DOMRectList;
   typedef mozilla::RangeBoundary RangeBoundary;
   typedef mozilla::RawRangeBoundary RawRangeBoundary;
 
   virtual ~nsRange();
 
 public:
   explicit nsRange(nsINode* aNode);
 
-  static nsresult CreateRange(nsIDOMNode* aStartContainer,
-                              uint32_t aStartOffset,
-                              nsIDOMNode* aEndContainer,
-                              uint32_t aEndOffset,
-                              nsRange** aRange);
-  static nsresult CreateRange(nsIDOMNode* aStartContainer,
-                              uint32_t aStartOffset,
-                              nsIDOMNode* aEndContainer,
-                              uint32_t aEndOffset,
-                              nsIDOMRange** aRange);
   static nsresult CreateRange(nsINode* aStartContainer,
                               uint32_t aStartOffset,
                               nsINode* aEndContainer,
                               uint32_t aEndOffset,
                               nsRange** aRange);
   static nsresult CreateRange(const RawRangeBoundary& aStart,
                               const RawRangeBoundary& aEnd,
                               nsRange** aRange);
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsRange, nsIDOMRange)
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsRange)
 
   nsrefcnt GetRefCount() const
   {
     return mRefCnt;
   }
 
-  // nsIDOMRange interface
-  NS_DECL_NSIDOMRANGE
-
   nsINode* GetRoot() const
   {
     return mRoot;
   }
 
   const RangeBoundary& StartRef() const
   {
     return mStart;
@@ -581,15 +566,9 @@ protected:
   RangeBoundary mEnd;
 
   bool mIsPositioned : 1;
   bool mMaySpanAnonymousSubtrees : 1;
   bool mIsGenerated : 1;
   bool mCalledByJS : 1;
 };
 
-inline nsISupports*
-ToSupports(nsRange* aRange)
-{
-  return static_cast<nsIDOMRange*>(aRange);
-}
-
 #endif /* nsRange_h___ */
deleted file mode 100644
--- a/dom/interfaces/range/moz.build
+++ /dev/null
@@ -1,15 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# 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/.
-
-with Files("**"):
-    BUG_COMPONENT = ("Core", "DOM")
-
-XPIDL_SOURCES += [
-    'nsIDOMRange.idl',
-]
-
-XPIDL_MODULE = 'dom_range'
-
deleted file mode 100644
--- a/dom/interfaces/range/nsIDOMRange.idl
+++ /dev/null
@@ -1,18 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-#include "domstubs.idl"
-
-/**
- * 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/
- */
-
-[shim(Range), uuid(1f94055c-42e7-4a30-96a1-6a804f1c2d1e)]
-interface nsIDOMRange : nsISupports
-{
-};
--- a/dom/moz.build
+++ b/dom/moz.build
@@ -14,17 +14,16 @@ with Files("plugins/**"):
 JAR_MANIFESTS += ['jar.mn']
 
 interfaces = [
     'base',
     'core',
     'html',
     'events',
     'sidebar',
-    'range',
     'xul',
     'security',
     'storage',
     'offline',
     'geolocation',
     'notification',
     'push',
     'payments',