Bug 1473748 - Part 1 - Use the type of element instead of the "subviewbutton" and "subviewkeynav" classes to initialize the list of navigable elements. r=johannh
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Thu, 26 Jul 2018 14:58:43 +0100
changeset 428608 2f77b09b34fb4ebc53b2a6040c7d5c2ad91531e5
parent 428607 a0f8e3ef3a72fe282e794a4138b7270c3ff49366
child 428609 88f0905f8d8c4fde409cb78fc054e72b39a62f20
push id34337
push userncsoregi@mozilla.com
push dateThu, 26 Jul 2018 21:58:45 +0000
treeherdermozilla-central@8f2f847b2f9d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1473748
milestone63.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 1473748 - Part 1 - Use the type of element instead of the "subviewbutton" and "subviewkeynav" classes to initialize the list of navigable elements. r=johannh MozReview-Commit-ID: IgxwGRNLsct
browser/base/content/browser-siteIdentity.js
browser/components/controlcenter/content/panel.inc.xul
browser/components/customizableui/PanelMultiView.jsm
browser/components/customizableui/content/panelUI.inc.xul
--- a/browser/base/content/browser-siteIdentity.js
+++ b/browser/base/content/browser-siteIdentity.js
@@ -1018,17 +1018,17 @@ var gIdentityHandler = {
     let isPolicyPermission = aPermission.scope == SitePermissions.SCOPE_POLICY;
 
     if (aPermission.id == "popup" && !isPolicyPermission) {
       let menulist = document.createElement("menulist");
       let menupopup = document.createElement("menupopup");
       let block = document.createElement("vbox");
       block.setAttribute("id", "identity-popup-popup-container");
       menulist.setAttribute("sizetopopup", "none");
-      menulist.setAttribute("class", "identity-popup-popup-menulist subviewkeynav");
+      menulist.setAttribute("class", "identity-popup-popup-menulist");
       menulist.setAttribute("id", "identity-popup-popup-menulist");
 
       for (let state of SitePermissions.getAvailableStates(aPermission.id)) {
         let menuitem = document.createElement("menuitem");
         // We need to correctly display the default/unknown state, which has its
         // own integer value (0) but represents one of the other states.
         if (state == SitePermissions.getDefault(aPermission.id)) {
           menuitem.setAttribute("value", "0");
@@ -1085,17 +1085,17 @@ var gIdentityHandler = {
     /* We return the permission item here without a remove button if the permission is a
        SCOPE_POLICY permission. Policy permissions cannot be removed/changed for the duration
        of the browser session. */
     if (isPolicyPermission) {
       return container;
     }
 
     let button = document.createElement("button");
-    button.setAttribute("class", "identity-popup-permission-remove-button subviewkeynav");
+    button.setAttribute("class", "identity-popup-permission-remove-button");
     let tooltiptext = gNavigatorBundle.getString("permissions.remove.tooltip");
     button.setAttribute("tooltiptext", tooltiptext);
     button.addEventListener("command", () => {
       let browser = gBrowser.selectedBrowser;
       this._permissionList.removeChild(container);
       if (aPermission.sharingState &&
           ["camera", "microphone", "screen"].includes(aPermission.id)) {
         let windowId = this._sharingState.windowId;
@@ -1141,17 +1141,17 @@ var gIdentityHandler = {
     indicator.setAttribute("align", "center");
     indicator.setAttribute("id", "blocked-popup-indicator-item");
 
     let icon = document.createElement("image");
     icon.setAttribute("class", "popup-subitem identity-popup-permission-icon");
 
     let text = document.createElement("label");
     text.setAttribute("flex", "1");
-    text.setAttribute("class", "identity-popup-permission-label text-link subviewkeynav");
+    text.setAttribute("class", "identity-popup-permission-label text-link");
 
     let popupCount = gBrowser.selectedBrowser.blockedPopups.length;
     let messageBase = gNavigatorBundle.getString("popupShowBlockedPopupsIndicatorText");
     let message = PluralForm.get(popupCount, messageBase)
                                  .replace("#1", popupCount);
     text.textContent = message;
 
     text.addEventListener("click", () => {
--- a/browser/components/controlcenter/content/panel.inc.xul
+++ b/browser/components/controlcenter/content/panel.inc.xul
@@ -42,17 +42,17 @@
                          when-mixedcontent="passive-loaded">&identity.passiveLoaded;</description>
             <description when-mixedcontent="active-loaded">&identity.activeLoaded;</description>
             <description class="identity-popup-warning-yellow"
                          when-ciphers="weak">&identity.weakEncryption;</description>
             <description when-loginforms="insecure">&identity.insecureLoginForms2;</description>
           </vbox>
         </vbox>
         <button id="identity-popup-security-expander"
-                class="identity-popup-expander subviewkeynav"
+                class="identity-popup-expander"
                 when-connection="not-secure secure secure-ev secure-cert-user-overridden"
                 oncommand="gIdentityHandler.showSecuritySubView();"/>
       </hbox>
 
       <!-- Tracking Protection Section -->
       <hbox id="tracking-protection-container"
             class="identity-popup-section"
             when-connection="not-secure secure secure-ev secure-cert-user-overridden extension">
@@ -79,32 +79,32 @@
           <description id="tracking-loaded-exception"
                        crop="end">&trackingProtection.detectedException;</description>
           <description id="tracking-not-detected-exception"
                        crop="end">&trackingProtection.notDetectedException;</description>
           <description id="tracking-reload-required"
                        crop="end">&trackingProtection.reloadRequired2;</description>
 
           <button id="tracking-action-reload"
-                  class="tracking-protection-button subviewkeynav"
+                  class="tracking-protection-button"
                   label="&trackingProtection.reload2.label;"
                   accesskey="&trackingProtection.reload2.accesskey;"
                   oncommand="TrackingProtection.hideIdentityPopupAndReload();" />
           <button id="tracking-action-unblock"
-                  class="tracking-protection-button subviewkeynav"
+                  class="tracking-protection-button"
                   label="&trackingProtection.unblock3.label;"
                   accesskey="&trackingProtection.unblock3.accesskey;"
                   oncommand="TrackingProtection.disableForCurrentPage();" />
           <button id="tracking-action-unblock-private"
-                  class="tracking-protection-button subviewkeynav"
+                  class="tracking-protection-button"
                   label="&trackingProtection.unblockPrivate3.label;"
                   accesskey="&trackingProtection.unblockPrivate3.accesskey;"
                   oncommand="TrackingProtection.disableForCurrentPage();" />
           <button id="tracking-action-block"
-                  class="tracking-protection-button subviewkeynav"
+                  class="tracking-protection-button"
                   label="&trackingProtection.block4.label;"
                   accesskey="&trackingProtection.block4.accesskey;"
                   oncommand="TrackingProtection.enableForCurrentPage();" />
         </vbox>
       </hbox>
 
       <!-- Permissions Section -->
       <hbox class="identity-popup-section"
@@ -126,18 +126,17 @@
           <description id="identity-popup-permission-empty-hint">&identity.permissionsEmpty;</description>
         </vbox>
       </hbox>
 
       <!-- Clear Site Data Button -->
       <vbox hidden="true"
             id="identity-popup-clear-sitedata-footer"
             class="identity-popup-footer">
-        <button class="subviewkeynav"
-                id="identity-popup-clear-sitedata-button"
+        <button id="identity-popup-clear-sitedata-button"
                 label="&identity.clearSiteData;"
                 oncommand="gIdentityHandler.clearSiteData(event);"/>
       </vbox>
     </panelview>
 
     <!-- Security SubView -->
     <panelview id="identity-popup-securityView"
                title="&identity.securityView.label;"
@@ -162,17 +161,16 @@
                      class="header"/>
         <description id="identity-popup-content-supplemental"
                      when-connection="secure-ev"/>
         <description id="identity-popup-content-verifier"
                      when-connection="secure secure-ev secure-cert-user-overridden"/>
 
         <!-- Remove Certificate Exception -->
         <button when-connection="secure-cert-user-overridden"
-                class="subviewkeynav"
                 label="&identity.removeCertException.label;"
                 accesskey="&identity.removeCertException.accesskey;"
                 oncommand="gIdentityHandler.removeCertException()"/>
 
         <!-- Connection is Not Secure -->
         <description when-connection="not-secure"
                      and-when-loginforms="secure">&identity.description.insecure;</description>
 
@@ -204,28 +202,28 @@
         <description when-mixedcontent="active-loaded"
                      and-when-loginforms="secure">&identity.description.activeLoaded2; <label observes="identity-popup-mcb-learn-more"/></description>
         <!-- Show only the first message when there are insecure login forms,
              and make sure the Learn More link is included. -->
         <description when-mixedcontent="active-loaded"
                      and-when-loginforms="insecure">&identity.description.activeLoaded; <label observes="identity-popup-mcb-learn-more"/></description>
 
         <!-- Buttons to enable/disable mixed content blocking. -->
-        <button when-mixedcontent="active-blocked" class="subviewkeynav"
+        <button when-mixedcontent="active-blocked"
                 label="&identity.disableMixedContentBlocking.label;"
                 accesskey="&identity.disableMixedContentBlocking.accesskey;"
                 oncommand="gIdentityHandler.disableMixedContentProtection()"/>
-        <button when-mixedcontent="active-loaded" class="subviewkeynav"
+        <button when-mixedcontent="active-loaded"
                 label="&identity.enableMixedContentBlocking.label;"
                 accesskey="&identity.enableMixedContentBlocking.accesskey;"
                 oncommand="gIdentityHandler.enableMixedContentProtection()"/>
       </vbox>
 
       <vbox id="identity-popup-more-info-footer" class="identity-popup-footer">
         <!-- More Security Information -->
-        <button id="identity-popup-more-info"  class="subviewkeynav"
+        <button id="identity-popup-more-info"
                 label="&identity.moreInfoLinkText2;"
                 oncommand="gIdentityHandler.handleMoreInfoClick(event);"/>
       </vbox>
 
     </panelview>
   </panelmultiview>
 </panel>
--- a/browser/components/customizableui/PanelMultiView.jsm
+++ b/browser/components/customizableui/PanelMultiView.jsm
@@ -1359,19 +1359,22 @@ var PanelView = class extends Associated
   /**
    * Retrieves the button elements that can be used for navigation using the
    * keyboard, that is all enabled buttons including the back button if visible.
    *
    * @return {Array}
    */
   _getNavigableElements() {
     let buttons = Array.from(this.node.querySelectorAll(
-      ".subviewbutton:not([disabled]), .subviewkeynav:not([disabled])"));
+      "button,toolbarbutton,menulist,.text-link"));
     let dwu = this._dwu;
     return buttons.filter(button => {
+      if (button.hasAttribute("disabled")) {
+        return false;
+      }
       let bounds = dwu.getBoundsWithoutFlushing(button);
       return bounds.width > 0 && bounds.height > 0;
     });
   }
 
   /**
    * Element that is currently selected with the keyboard, or null if no element
    * is selected. Since the reference is held weakly, it can become null or
--- a/browser/components/customizableui/content/panelUI.inc.xul
+++ b/browser/components/customizableui/content/panelUI.inc.xul
@@ -212,17 +212,16 @@
         <toolbaritem id="appMenu-tp-container" hidden="true" closemenu="none">
           <toolbarbutton id="appMenu-tp-label"
                          tooltiptext="&trackingProtection.tooltip;"
                          class="subviewbutton subviewbutton-iconic"
                          oncommand="TrackingProtection.openPreferences('appMenu-trackingprotection'); PanelUI.hide();"
                          label="&trackingProtection.title;"/>
           <toolbarseparator orient="vertical"/>
           <toolbarbutton id="appMenu-tp-toggle"
-                         class="subviewkeynav"
                          enabled="false"
                          oncommand="TrackingProtection.onGlobalToggleCommand();" />
         </toolbaritem>
         <toolbarseparator id="appMenu-tp-separator" hidden="true" />
         <toolbarbutton id="appMenu-new-window-button"
                        class="subviewbutton subviewbutton-iconic"
                        label="&newNavigatorCmd.label;"
                        key="key_newNavigator"