Bug 1387143 part 16. Remove nsISelectionPrivate::GetType. r=mats
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 08 May 2018 13:52:38 -0400
changeset 474168 db8412ba88f25342985edf421e63d09c2428a6ab
parent 474167 4d6054f4b7e9494ce6a57c365a4565bd69ab1ad4
child 474169 146396f37e7d030a5b4fb904dc9ccf885f75e252
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)
reviewersmats
bugs1387143
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 1387143 part 16. Remove nsISelectionPrivate::GetType. r=mats
accessible/base/Logging.cpp
accessible/base/Logging.h
dom/base/Selection.cpp
dom/base/nsISelectionPrivate.idl
--- a/accessible/base/Logging.cpp
+++ b/accessible/base/Logging.cpp
@@ -11,24 +11,25 @@
 #include "DocAccessible.h"
 #include "nsAccessibilityService.h"
 #include "nsCoreUtils.h"
 #include "OuterDocAccessible.h"
 
 #include "nsDocShellLoadTypes.h"
 #include "nsIChannel.h"
 #include "nsIInterfaceRequestorUtils.h"
-#include "nsISelectionPrivate.h"
+#include "nsISelectionController.h"
 #include "nsTraceRefcnt.h"
 #include "nsIWebProgress.h"
 #include "prenv.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIURI.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/HTMLBodyElement.h"
+#include "mozilla/dom/Selection.h"
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // Logging helpers
 
 static uint32_t sModules = 0;
@@ -585,28 +586,25 @@ void
 logging::FocusDispatched(Accessible* aTarget)
 {
   SubMsgBegin();
   AccessibleNNode("A11y target", aTarget);
   SubMsgEnd();
 }
 
 void
-logging::SelChange(nsISelection* aSelection, DocAccessible* aDocument,
+logging::SelChange(dom::Selection* aSelection, DocAccessible* aDocument,
                    int16_t aReason)
 {
-  nsCOMPtr<nsISelectionPrivate> privSel(do_QueryInterface(aSelection));
-
-  int16_t type = 0;
-  privSel->GetType(&type);
+  SelectionType type = aSelection->GetType();
 
   const char* strType = 0;
-  if (type == nsISelectionController::SELECTION_NORMAL)
+  if (type == SelectionType::eNormal)
     strType = "normal";
-  else if (type == nsISelectionController::SELECTION_SPELLCHECK)
+  else if (type == SelectionType::eSpellCheck)
     strType = "spellcheck";
   else
     strType = "unknown";
 
   bool isIgnored = !aDocument || !aDocument->IsContentLoaded();
   printf("\nSelection changed, selection type: %s, notification %s, reason: %d\n",
          strType, (isIgnored ? "ignored" : "pending"), aReason);
 
--- a/accessible/base/Logging.h
+++ b/accessible/base/Logging.h
@@ -9,21 +9,25 @@
 
 #include "nscore.h"
 #include "nsStringFwd.h"
 #include "mozilla/Attributes.h"
 
 class nsIDocument;
 class nsINode;
 class nsIRequest;
-class nsISelection;
 class nsISupports;
 class nsIWebProgress;
 
 namespace mozilla {
+
+namespace dom {
+class Selection;
+} // namespace dom
+
 namespace a11y {
 
 class AccEvent;
 class Accessible;
 class DocAccessible;
 class OuterDocAccessible;
 
 namespace logging {
@@ -123,17 +127,17 @@ void ActiveWidget(Accessible* aWidget);
 /**
  * Log the focus event was dispatched (submessage).
  */
 void FocusDispatched(Accessible* aTarget);
 
 /**
  * Log the selection change.
  */
-void SelChange(nsISelection* aSelection, DocAccessible* aDocument,
+void SelChange(dom::Selection* aSelection, DocAccessible* aDocument,
                int16_t aReason);
 
 /**
  * Log the given accessible elements info.
  */
 void TreeInfo(const char* aMsg, uint32_t aExtraFlags, ...);
 void TreeInfo(const char* aMsg, uint32_t aExtraFlags,
               const char* aMsg1, Accessible* aAcc,
--- a/dom/base/Selection.cpp
+++ b/dom/base/Selection.cpp
@@ -1290,24 +1290,16 @@ Selection::Clear(nsPresContext* aPresCon
       mFrameSelection->GetDisplaySelection() ==
       nsISelectionController::SELECTION_ATTENTION) {
     mFrameSelection->SetDisplaySelection(nsISelectionController::SELECTION_ON);
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP
-Selection::GetType(int16_t* aType)
-{
-  NS_ENSURE_ARG_POINTER(aType);
-  *aType = ToRawSelectionType(Type());
-  return NS_OK;
-}
-
 // RangeMatches*Point
 //
 //    Compares the range beginning or ending point, and returns true if it
 //    exactly matches the given DOM point.
 
 static inline bool
 RangeMatchesBeginPoint(nsRange* aRange, nsINode* aNode, int32_t aOffset)
 {
--- a/dom/base/nsISelectionPrivate.idl
+++ b/dom/base/nsISelectionPrivate.idl
@@ -27,22 +27,16 @@ struct ScrollAxis;
 [ref] native nsPointRef(nsPoint);
 native nsDirection(nsDirection);
 native ScrollAxis(nsIPresShell::ScrollAxis);
 
 [uuid(0c9f4f74-ee7e-4fe9-be6b-0ba856368178)]
 interface nsISelectionPrivate : nsISupports
 {
     /**
-     * Returns the type of the selection (see nsISelectionController for
-     * available constants).
-     */
-    readonly attribute short type;
-
-    /**
      * Return array of ranges intersecting with the given DOM interval.
      */
     void GetRangesForInterval(
         in nsIDOMNode beginNode, in int32_t beginOffset,
         in nsIDOMNode endNode, in int32_t endOffset,
         in boolean allowAdjacent,
         out uint32_t resultCount,
         [retval, array, size_is(resultCount)] out nsIDOMRange results);