Bug 1425440 - Get rid of GetChildAt_Deprecated in nsTypeAheadFind, r=catalinb
authorAndrea Marchesini <amarchesini@mozilla.com>
Fri, 12 Jan 2018 15:33:14 +0100
changeset 453325 f3975b636f8d6917489f802399f74b9c42785e15
parent 453324 7a9a1c11053a404c9eda71266984cab6d17c1d6d
child 453326 37ac87b44ae33f71fd218ec0d164f61a8d190eac
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscatalinb
bugs1425440
milestone59.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 1425440 - Get rid of GetChildAt_Deprecated in nsTypeAheadFind, r=catalinb
toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
toolkit/components/typeaheadfind/nsTypeAheadFind.h
--- a/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
+++ b/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp
@@ -452,18 +452,18 @@ nsTypeAheadFind::FindItNow(nsIPresShell 
       if (!returnRange)
         break;  // Nothing found in this doc, go to outer loop (try next doc)
 
       // ------- Test resulting found range for success conditions ------
       bool isInsideLink = false, isStartingLink = false;
 
       if (aIsLinksOnly) {
         // Don't check if inside link when searching all text
-        RangeStartsInsideLink(returnRange, presShell, &isInsideLink,
-                              &isStartingLink);
+        RangeStartsInsideLink(static_cast<nsRange*>(returnRange.get()),
+                              presShell, &isInsideLink, &isStartingLink);
       }
 
       bool usesIndependentSelection;
       if (!IsRangeVisible(presShell, presContext, returnRange,
                           aIsFirstVisiblePreferred, false,
                           getter_AddRefs(mStartPointRange),
                           &usesIndependentSelection) ||
           (aIsLinksOnly && !isInsideLink) ||
@@ -869,17 +869,17 @@ nsTypeAheadFind::GetSearchContainers(nsI
 
   presShell.forget(aPresShell);
   presContext.forget(aPresContext);
 
   return NS_OK;
 }
 
 void
-nsTypeAheadFind::RangeStartsInsideLink(nsIDOMRange *aRange,
+nsTypeAheadFind::RangeStartsInsideLink(nsRange *aRange,
                                        nsIPresShell *aPresShell,
                                        bool *aIsInsideLink,
                                        bool *aIsStartingLink)
 {
   *aIsInsideLink = false;
   *aIsStartingLink = true;
 
   // ------- Get nsIContent to test -------
@@ -892,17 +892,17 @@ nsTypeAheadFind::RangeStartsInsideLink(n
   startContent = do_QueryInterface(startNode);
   if (!startContent) {
     NS_NOTREACHED("startContent should never be null");
     return;
   }
   origContent = startContent;
 
   if (startContent->IsElement()) {
-    nsIContent *childContent = startContent->GetChildAt_Deprecated(startOffset);
+    nsIContent *childContent = aRange->GetChildAtStartOffset();
     if (childContent) {
       startContent = childContent;
     }
   }
   else if (startOffset > 0) {
     const nsTextFragment *textFrag = startContent->GetText();
     if (textFrag) {
       // look for non whitespace character before start offset
--- a/toolkit/components/typeaheadfind/nsTypeAheadFind.h
+++ b/toolkit/components/typeaheadfind/nsTypeAheadFind.h
@@ -17,16 +17,17 @@
 #include "nsIDOMRange.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsITypeAheadFind.h"
 #include "nsISound.h"
 
 class nsPIDOMWindowInner;
 class nsIPresShell;
 class nsPresContext;
+class nsRange;
 
 #define TYPEAHEADFIND_NOTFOUND_WAV_URL \
         "chrome://global/content/notfound.wav"
 
 class nsTypeAheadFind : public nsITypeAheadFind,
                         public nsIObserver,
                         public nsSupportsWeakReference
 {
@@ -44,17 +45,17 @@ protected:
 
   nsresult PrefsReset();
 
   void SaveFind();
   void PlayNotFoundSound();
   nsresult GetWebBrowserFind(nsIDocShell *aDocShell,
                              nsIWebBrowserFind **aWebBrowserFind);
 
-  void RangeStartsInsideLink(nsIDOMRange *aRange, nsIPresShell *aPresShell,
+  void RangeStartsInsideLink(nsRange *aRange, nsIPresShell *aPresShell,
                              bool *aIsInsideLink, bool *aIsStartingLink);
 
   void GetSelection(nsIPresShell *aPresShell, nsISelectionController **aSelCon,
                     nsISelection **aDomSel);
   // *aNewRange may not be collapsed.  If you want to collapse it in a
   // particular way, you need to do it yourself.
   bool IsRangeVisible(nsIPresShell *aPresShell, nsPresContext *aPresContext,
                         nsIDOMRange *aRange, bool aMustBeVisible,