Bug 1340643 - Making some labels and all buttons highlightable. r?jaws, r?mconley draft
authorZack Herrick <herrickz@msu.edu>
Wed, 12 Apr 2017 17:43:13 -0400
changeset 561774 e91c0e2ec5d65ba80ab11e757a1b22f0bfc3c7e1
parent 561773 401fc38db895aee26e04e21e55d68c4349e4c866
child 561775 b70d1598d69dbf3161433328a71f0cf462b13e1f
push id53859
push userbmo:manotejmeka@gmail.com
push dateThu, 13 Apr 2017 06:42:30 +0000
reviewersjaws, mconley
bugs1340643
milestone55.0a1
Bug 1340643 - Making some labels and all buttons highlightable. r?jaws, r?mconley MozReview-Commit-ID: BPpdbatn9gf
browser/components/preferences/in-content/containers.xul
browser/components/preferences/in-content/findInPage.js
browser/components/preferences/in-content/main.xul
browser/components/preferences/in-content/privacy.xul
toolkit/content/widgets/button.xml
toolkit/content/xul.css
--- a/browser/components/preferences/in-content/containers.xul
+++ b/browser/components/preferences/in-content/containers.xul
@@ -13,17 +13,17 @@
               name="privacy.userContext.enabled"
               type="bool"/>
 
 </preferences>
 
 <hbox hidden="true"
       class="container-header-links"
       data-category="paneContainers">
-  <label class="text-link" id="backContainersLink" value="&backLink.label;" />
+  <label class="text-link" id="backContainersLink" >&backLink.label;</label>
 </hbox>
 
 <hbox id="header-containers"
       class="header"
       hidden="true"
       data-category="paneContainers">
   <label class="header-name" flex="1">&paneContainers.title;</label>
 </hbox>
--- a/browser/components/preferences/in-content/findInPage.js
+++ b/browser/components/preferences/in-content/findInPage.js
@@ -285,16 +285,20 @@ var gSearchResultsPane = {
         labelResult = this.stringMatchesFilters(nodeObject.getAttribute("label"), searchPhrase);
       }
 
       //  Searching some elements, such as xul:label, store their user-visible text in a "value" attribute.
       if (nodeObject.getAttribute("value")) {
         valueResult = this.stringMatchesFilters(nodeObject.getAttribute("value"), searchPhrase);
       }
 
+      if (nodeObject.tagName == "button" && (labelResult || valueResult)){
+        nodeObject.setAttribute("highlightable", "true");
+      }
+
       matchesFound = matchesFound || complexTextNodesResult || labelResult || valueResult;
     }
 
     for (let i = 0; i < nodeObject.childNodes.length; i++) {
       // Search only if child node is not hidden
       if (!nodeObject.childNodes[i].hidden) {
         let result = this.searchWithinNode(nodeObject.childNodes[i], searchPhrase);
         matchesFound = matchesFound || result;
--- a/browser/components/preferences/in-content/main.xul
+++ b/browser/components/preferences/in-content/main.xul
@@ -349,17 +349,17 @@
             accesskey="&removeEngine.accesskey;"
             disabled="true"
             />
   </hbox>
 
   <separator class="thin"/>
 
   <hbox id="addEnginesBox" pack="start">
-    <label id="addEngines" class="text-link" value="&addMoreSearchEngines.label;"/>
+    <label id="addEngines" class="text-link" >&addMoreSearchEngines.label;</label>
   </hbox>
 </groupbox>
 
 <!-- Tab preferences -->
 <groupbox data-category="paneGeneral"
           hidden="true" align="start">
     <caption><label>&tabsGroup.label;</label></caption>
 
--- a/browser/components/preferences/in-content/privacy.xul
+++ b/browser/components/preferences/in-content/privacy.xul
@@ -331,18 +331,17 @@
 </groupbox>
 
 <!-- Tracking -->
 <groupbox id="trackingGroup" data-category="panePrivacy" hidden="true">
   <vbox id="trackingprotectionbox" hidden="true">
     <hbox align="start">
       <vbox hidden="false">
         <caption><label>&trackingProtectionHeader2.label;
-          <label id="trackingProtectionLearnMore" class="learnMore text-link"
-                 value="&trackingProtectionLearnMore.label;"/>
+          <label id="trackingProtectionLearnMore" class="learnMore text-link">&trackingProtectionLearnMore.label;</label>
         </label></caption>
         <radiogroup id="trackingProtectionRadioGroup">
           <radio value="always"
                  label="&trackingProtectionAlways.label;"
                  accesskey="&trackingProtectionAlways.accesskey;"/>
           <radio value="private"
                  label="&trackingProtectionPrivate.label;"
                  accesskey="&trackingProtectionPrivate.accesskey;"/>
@@ -367,18 +366,19 @@
   <vbox id="trackingprotectionpbmbox">
     <caption><label>&tracking.label;</label></caption>
     <hbox align="center">
       <checkbox id="trackingProtectionPBM"
                 preference="privacy.trackingprotection.pbmode.enabled"
                 accesskey="&trackingProtectionPBM5.accesskey;"
                 label="&trackingProtectionPBM5.label;" />
       <label id="trackingProtectionPBMLearnMore"
-             class="learnMore text-link"
-             value="&trackingProtectionPBMLearnMore.label;"/>
+             class="learnMore text-link">
+             &trackingProtectionPBMLearnMore.label;
+      </label>
       <spacer flex="1" />
       <button id="changeBlockListPBM"
               label="&changeBlockList.label;" accesskey="&changeBlockList.accesskey;"
               preference="pref.privacy.disable_button.change_blocklist"/>
     </hbox>
   </vbox>
   <vbox hidden="false">
     <description>&doNotTrack.pre.label;<label
@@ -420,31 +420,33 @@
       <column flex="1"/>
       <column/>
     </columns>
     <rows>
       <row id="notificationsPolicyRow" align="center">
         <hbox align="start">
           <label id="notificationsPolicy">&notificationsPolicyDesc3.label;</label>
           <label id="notificationsPolicyLearnMore"
-                 class="learnMore text-link"
-                 value="&notificationsPolicyLearnMore.label;"/>
+                 class="learnMore text-link">
+                 &notificationsPolicyLearnMore.label;
+          </label>
         </hbox>
         <hbox pack="end">
           <button id="notificationsPolicyButton" label="&notificationsPolicyButton.label;"
                   accesskey="&notificationsPolicyButton.accesskey;"/>
         </hbox>
       </row>
       <row id="notificationsDoNotDisturbRow" hidden="true">
         <vbox align="start">
           <checkbox id="notificationsDoNotDisturb" label="&notificationsDoNotDisturb.label;"
                     accesskey="&notificationsDoNotDisturb.accesskey;"/>
           <label id="notificationsDoNotDisturbDetails"
-                 class="indent"
-                 value="&notificationsDoNotDisturbDetails.value;"/>
+                 class="indent">
+                 &notificationsDoNotDisturbDetails.value;
+          </label>
         </vbox>
       </row>
     </rows>
   </grid>
 </groupbox>
 
 <!-- Location Bar -->
 <groupbox id="locationBarGroup"
@@ -549,29 +551,30 @@
       <column flex="1"/>
       <column/>
     </columns>
     <rows id="contentRows-2">
       <row id="playDRMContentRow">
         <hbox align="center">
           <checkbox id="playDRMContent" preference="media.eme.enabled"
                     label="&playDRMContent.label;" accesskey="&playDRMContent.accesskey;"/>
-          <label id="playDRMContentLink" class="learnMore text-link" value="&playDRMContent.learnMore.label;"/>
+          <label id="playDRMContentLink" class="learnMore text-link">&playDRMContent.learnMore.label;</label>
         </hbox>
       </row>
     </rows>
   </grid>
 </groupbox>
 
 <!-- Containers -->
 <groupbox id="browserContainersGroup" data-category="panePrivacy" hidden="true">
   <vbox id="browserContainersbox" hidden="true">
     <caption><label>&browserContainersHeader.label;
-      <label id="browserContainersLearnMore" class="learnMore text-link"
-             value="&browserContainersLearnMore.label;"/>
+      <label id="browserContainersLearnMore" class="learnMore text-link">
+        &browserContainersLearnMore.label;
+      </label>
     </label></caption>
     <hbox align="start">
       <vbox>
         <checkbox id="browserContainersCheckbox"
                   label="&browserContainersEnabled.label;"
                   accesskey="&browserContainersEnabled.accesskey;"
                   preference="privacy.userContext.enabled"
                   onsyncfrompreference="return gPrivacyPane.readBrowserContainersCheckbox();"/>
--- a/toolkit/content/widgets/button.xml
+++ b/toolkit/content/widgets/button.xml
@@ -222,17 +222,18 @@
     </resources>
 
     <content>
       <children includes="observes|template|menupopup|panel|tooltip"/>
       <xul:hbox class="box-inherit button-box" xbl:inherits="align,dir,pack,orient"
                 align="center" pack="center" flex="1" anonid="button-box">
         <children>
           <xul:image class="button-icon" xbl:inherits="src=image"/>
-          <xul:label class="button-text" xbl:inherits="value=label,accesskey,crop"/>
+          <xul:label class="button-text" xbl:inherits="value=label,accesskey,crop,highlightable"/>
+          <xul:label class="button-highlightable-text" xbl:inherits="xbl:text=label,accesskey,crop,highlightable"/>
         </children>
       </xul:hbox>
     </content>
   </binding>
 
   <binding id="menu" display="xul:menu"
            extends="chrome://global/content/bindings/button.xml#button">
     <content>
--- a/toolkit/content/xul.css
+++ b/toolkit/content/xul.css
@@ -1210,8 +1210,13 @@ filefield {
 }
 
 /*********** tabmodalprompt ************/
 tabmodalprompt {
   -moz-binding: url("chrome://global/content/tabprompts.xml#tabmodalprompt");
   overflow: hidden;
   text-shadow: none;
 }
+
+.button-highlightable-text:not([highlightable="true"]),
+.button-text[highlightable="true"] {
+  display: none;
+}