Bug 1450654: Remove ResolveTag usage in cocoa code. r=mstange
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 02 Apr 2018 13:29:58 +0200
changeset 411442 edbbd00906426ed221f277f44bd7b8fac70e450d
parent 411430 2ee160335e150f20df3471b60b5e58ce873e2ff6
child 411443 a2e0f2e299bcc1cad4ea74e55d4d7b9c0f6c1a49
push id33760
push useraciure@mozilla.com
push dateTue, 03 Apr 2018 21:52:50 +0000
treeherdermozilla-central@ad27045cac84 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1450654
milestone61.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 1450654: Remove ResolveTag usage in cocoa code. r=mstange We don't have any binding in the tree that extends="xul:menupopup", which is the only thing that would change the result. Also, I constrained it to the XUL namespace instead of just checking the node name. But again, we don't have non-XUL menupopups. MozReview-Commit-ID: 7M0beoJI86Y
widget/cocoa/nsMenuX.mm
--- a/widget/cocoa/nsMenuX.mm
+++ b/widget/cocoa/nsMenuX.mm
@@ -634,35 +634,29 @@ bool nsMenuX::OnClose()
 // of a very few children so we won't be iterating over a bazillion menu items to find
 // it (so the strcmp won't kill us).
 void nsMenuX::GetMenuPopupContent(nsIContent** aResult)
 {
   if (!aResult)
     return;
   *aResult = nullptr;
 
-  int32_t dummy;
 
   // Check to see if we are a "menupopup" node (if we are a native menu).
-  {
-    RefPtr<nsAtom> tag = mContent->OwnerDoc()->BindingManager()->ResolveTag(mContent, &dummy);
-    if (tag == nsGkAtoms::menupopup) {
-      NS_ADDREF(*aResult = mContent);
-      return;
-    }
+  if (mContent->IsXULElement(nsGkAtoms::menupopup)) {
+    NS_ADDREF(*aResult = mContent);
+    return;
   }
 
   // Otherwise check our child nodes.
 
   for (nsIContent* child = mContent->GetFirstChild();
        child; child = child->GetNextSibling()) {
-    RefPtr<nsAtom> tag = child->OwnerDoc()->BindingManager()->ResolveTag(child, &dummy);
-    if (tag == nsGkAtoms::menupopup) {
-      *aResult = child;
-      NS_ADDREF(*aResult);
+    if (child->IsXULElement(nsGkAtoms::menupopup)) {
+      NS_ADDREF(*aResult = child);
       return;
     }
   }
 }
 
 NSMenuItem* nsMenuX::NativeMenuItem()
 {
   return mNativeMenuItem;