Bug 1425440 - Get rid of GetChildAt_Deprecated in nsMenuBarX, r=catalinb
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 09 Jan 2018 11:44:54 +0100
changeset 450144 8011797b1542dc75f3522437055087520baec71e
parent 450143 90492852dfc9021f4b34b77f24b07e335b1629db
child 450145 28f972e51e333e3e6e66dbc7634200047723b444
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 nsMenuBarX, r=catalinb
widget/cocoa/nsMenuBarX.mm
--- a/widget/cocoa/nsMenuBarX.mm
+++ b/widget/cocoa/nsMenuBarX.mm
@@ -158,21 +158,19 @@ nsresult nsMenuBarX::Create(nsIWidget* a
   // Give this to the parent window. The parent takes ownership.
   static_cast<nsCocoaWindow*>(mParentWindow)->SetMenuBar(this);
 
   return NS_OK;
 }
 
 void nsMenuBarX::ConstructNativeMenus()
 {
-  uint32_t count = mContent->GetChildCount();
-  for (uint32_t i = 0; i < count; i++) {
-    nsIContent *menuContent = mContent->GetChildAt_Deprecated(i);
-    if (menuContent &&
-        menuContent->IsXULElement(nsGkAtoms::menu)) {
+  for (nsIContent* menuContent = mContent->GetFirstChild();
+       menuContent; menuContent = menuContent->GetNextSibling()) {
+    if (menuContent->IsXULElement(nsGkAtoms::menu)) {
       nsMenuX* newMenu = new nsMenuX();
       if (newMenu) {
         nsresult rv = newMenu->Create(this, this, menuContent->AsElement());
         if (NS_SUCCEEDED(rv))
           InsertMenuAtIndex(newMenu, GetMenuCount());
         else
           delete newMenu;
       }