Bug 1596506 - Remove special-case for <xul:label> accesskey. r=smaug
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 14 Nov 2019 22:03:00 +0000
changeset 502134 45374ab225daf31a9dc7f765e4587dd1cd7be7d9
parent 502133 c7c61985bf36098a2ef0d038a7fdc94e1b2624c1
child 502135 51dc2e048fa0512dccc5495bb86b43452dddc63d
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1596506
milestone72.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 1596506 - Remove special-case for <xul:label> accesskey. r=smaug We don't have any NAC which is a <xul:label>. We could keep it for shadow dom but it doesn't seem to me like this code is working correctly. nsXULLabelFrame::RegUnregAccessKey doesn't have similar code, and uses the <label> node to register / unregister. Finally, we do have non-anon labels, and those would be broken... So just remove the special-case. Depends on D53058 Differential Revision: https://phabricator.services.mozilla.com/D53059
dom/xul/nsXULElement.cpp
--- a/dom/xul/nsXULElement.cpp
+++ b/dom/xul/nsXULElement.cpp
@@ -702,34 +702,19 @@ void nsXULElement::DoneAddingChildren(bo
   }
 }
 
 void nsXULElement::UnregisterAccessKey(const nsAString& aOldValue) {
   // If someone changes the accesskey, unregister the old one
   //
   Document* doc = GetComposedDoc();
   if (doc && !aOldValue.IsEmpty()) {
-    PresShell* presShell = doc->GetPresShell();
-
-    if (presShell) {
-      Element* element = this;
-
-      // find out what type of content node this is
-      if (mNodeInfo->Equals(nsGkAtoms::label)) {
-        // For anonymous labels the unregistering must
-        // occur on the binding parent control.
-        // XXXldb: And what if the binding parent is null?
-        nsIContent* bindingParent = GetBindingParent();
-        element = bindingParent ? bindingParent->AsElement() : nullptr;
-      }
-
-      if (element) {
-        presShell->GetPresContext()->EventStateManager()->UnregisterAccessKey(
-            element, aOldValue.First());
-      }
+    if (PresShell* presShell = doc->GetPresShell()) {
+      presShell->GetPresContext()->EventStateManager()->UnregisterAccessKey(
+          this, aOldValue.First());
     }
   }
 }
 
 nsresult nsXULElement::BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
                                      const nsAttrValueOrString* aValue,
                                      bool aNotify) {
   if (aNamespaceID == kNameSpaceID_None && aName == nsGkAtoms::accesskey &&