Bug 1425440 - Get rid of GetChildAt_Deprecated in nsXULTooltipListener, r=catalinb
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 03 Jan 2018 16:29:13 +0100
changeset 449385 6e89e8d403125831080ce92a47ed74cde3d7769d
parent 449384 8817148653e9ba43697765b20e6d8488872e9a34
child 449386 75eea134e76ae1b8cc9dfedc8445456d1ba70e03
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [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 nsXULTooltipListener, r=catalinb
layout/xul/nsXULTooltipListener.cpp
--- a/layout/xul/nsXULTooltipListener.cpp
+++ b/layout/xul/nsXULTooltipListener.cpp
@@ -550,23 +550,20 @@ nsXULTooltipListener::HideTooltip()
   DestroyTooltip();
   return NS_OK;
 }
 
 static void
 GetImmediateChild(nsIContent* aContent, nsAtom *aTag, nsIContent** aResult)
 {
   *aResult = nullptr;
-  uint32_t childCount = aContent->GetChildCount();
-  for (uint32_t i = 0; i < childCount; i++) {
-    nsIContent *child = aContent->GetChildAt_Deprecated(i);
-
-    if (child->IsXULElement(aTag)) {
-      *aResult = child;
-      NS_ADDREF(*aResult);
+  for (nsCOMPtr<nsIContent> childContent = aContent->GetFirstChild();
+       childContent; childContent = childContent->GetNextSibling()) {
+    if (childContent->IsXULElement(aTag)) {
+      childContent.forget(aResult);
       return;
     }
   }
 }
 
 nsresult
 nsXULTooltipListener::FindTooltip(nsIContent* aTarget, nsIContent** aTooltip)
 {