Bug 1340643 - Making some labels and all buttons highlightable. draft
authorZack Herrick <herrickz@msu.edu>
Tue, 02 May 2017 18:09:22 +0800
changeset 574247 6a768ea4c5e74dc52bb9b5153980f697d2926bfa
parent 570993 42f89cd146543b14914138b21642197bc0290854
child 627519 539dc899962e3bbe42c0c0c531f3997799364016
push id57625
push userbmo:evan@tseng.io
push dateMon, 08 May 2017 14:48:05 +0000
bugs1340643
milestone55.0a1
Bug 1340643 - Making some labels and all buttons highlightable. MozReview-Commit-ID: 15o83lTMxUW
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
@@ -375,17 +375,17 @@
             label="&removeEngine.label;"
             accesskey="&removeEngine.accesskey;"
             disabled="true"/>
   </hbox>
 
   <separator class="thin"/>
 
   <hbox id="addEnginesBox" pack="start">
-    <label id="addEngines" class="text-link" value="&addMoreSearchEngines2.label;"/>
+    <label id="addEngines" class="text-link">&addMoreSearchEngines2.label;</label>
   </hbox>
 </groupbox>
 
 <!-- Tab preferences -->
 <groupbox data-category="paneGeneral"
           hidden="true">
     <caption><label>&tabsGroup.label;</label></caption>
 
--- a/browser/components/preferences/in-content/privacy.xul
+++ b/browser/components/preferences/in-content/privacy.xul
@@ -350,18 +350,17 @@
 <!-- Tracking -->
 <groupbox id="trackingGroup" data-category="panePrivacy" hidden="true">
   <caption><label>&trackingProtectionHeader2.label;</label></caption>
   <vbox id="trackingprotectionbox" hidden="true">
     <hbox align="start">
       <vbox flex="1">
         <description>
           &trackingProtection.description;
-          <label id="trackingProtectionLearnMore" class="learnMore text-link"
-                 value="&trackingProtectionLearnMore.label;"/>
+          <label id="trackingProtectionLearnMore" class="learnMore text-link">&trackingProtectionLearnMore.label;</label>
         </description>
         <description id="trackingProtectionDesc"
                      control="trackingProtectionRadioGroup">
           &trackingProtection.radioGroupLabel;
         </description>
       </vbox>
       <spacer flex="1"/>
       <vbox id="trackingProtectionAdvancedSettings">
@@ -392,18 +391,17 @@
   <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>
     <description>&doNotTrack.pre.label;<label
@@ -436,34 +434,32 @@
       <column flex="1"/>
       <column/>
     </columns>
     <rows>
       <row id="notificationsPolicyRow" align="center">
         <hbox flex="1">
           <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"
                   class="accessory-button"
                   label="&notificationsPolicyButton.label;"
                   accesskey="&notificationsPolicyButton.accesskey;"/>
         </hbox>
       </row>
     </rows>
   </grid>
   <vbox id="notificationsDoNotDisturbBox" hidden="true">
     <checkbox id="notificationsDoNotDisturb" label="&notificationsDoNotDisturb.label;"
               accesskey="&notificationsDoNotDisturb.accesskey;"/>
     <label id="notificationsDoNotDisturbDetails"
-           class="indent"
-           value="&notificationsDoNotDisturbDetails.value;"/>
+           class="indent">&notificationsDoNotDisturbDetails.value;</label>
   </vbox>
 </groupbox>
 
 <!-- Location Bar -->
 <groupbox id="locationBarGroup"
           data-category="panePrivacy"
           hidden="true">
   <caption><label>&locationBar.label;</label></caption>
@@ -565,35 +561,38 @@
       <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></caption>
     <hbox align="center">
       <checkbox id="browserContainersCheckbox"
                 label="&browserContainersEnabled.label;"
                 accesskey="&browserContainersEnabled.accesskey;"
                 preference="privacy.userContext.enabled"
                 onsyncfrompreference="return gPrivacyPane.readBrowserContainersCheckbox();"/>
-      <label id="browserContainersLearnMore" class="learnMore text-link"
-             value="&browserContainersLearnMore.label;"/>
+      <label id="browserContainersLearnMore" class="learnMore text-link">
+        &browserContainersLearnMore.label;
+      </label>
       <spacer flex="1"/>
       <button id="browserContainersSettings"
               class="accessory-button"
               label="&browserContainersSettings.label;"
               accesskey="&browserContainersSettings.accesskey;"/>
     </hbox>
   </vbox>
 </groupbox>
--- 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
@@ -1220,8 +1220,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;
+}
\ No newline at end of file