Bug 1390499 - Show all second level headers in Preferences search result. r=jaws, a=gchang
authorRicky Chien <ricky060709@gmail.com>
Thu, 17 Aug 2017 18:31:42 +0800
changeset 423718 0584276b1f585e06ca2a602aae6730608837cb98
parent 423717 d50b54209adbe823316f65332269bc840087e24e
child 423719 ce166fe03511b29916c6f2cba5234af75fc05266
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, gchang
bugs1390499
milestone56.0
Bug 1390499 - Show all second level headers in Preferences search result. r=jaws, a=gchang
browser/components/preferences/in-content-new/findInPage.js
browser/components/preferences/in-content-new/main.xul
browser/components/preferences/in-content-new/privacy.xul
--- a/browser/components/preferences/in-content-new/findInPage.js
+++ b/browser/components/preferences/in-content-new/findInPage.js
@@ -225,16 +225,21 @@ var gSearchResultsPane = {
       gotoPref("paneSearchResults");
 
       let resultsFound = false;
 
       // Building the range for highlighted areas
       let rootPreferencesChildren = document
         .querySelectorAll("#mainPrefPane > *:not([data-hidden-from-search])");
 
+      // Show all second level headers in search result
+      for (let element of document.querySelectorAll("caption.search-header")) {
+        element.hidden = false;
+      }
+
       // Showing all the children to bind JS, Access Keys, etc
       for (let i = 0; i < rootPreferencesChildren.length; i++) {
         rootPreferencesChildren[i].hidden = false;
       }
 
       // Showing or Hiding specific section depending on if words in query are found
       for (let i = 0; i < rootPreferencesChildren.length; i++) {
         if (!rootPreferencesChildren[i].classList.contains("header") &&
@@ -274,16 +279,21 @@ var gSearchResultsPane = {
             Services.telemetry.keyedScalarAdd("preferences.search_query", this.query, 1);
           }, 1000);
         }
       }
     } else {
       document.getElementById("sorry-message").textContent = "";
       // Going back to General when cleared
       gotoPref("paneGeneral");
+
+      // Hide some special second level headers in normal view
+      for (let element of document.querySelectorAll("caption.search-header")) {
+        element.hidden = true;
+      }
     }
   },
 
   /**
    * Finding leaf nodes and checking their content for words to search,
    * It is a recursive function
    *
    * @param Node nodeObject
--- a/browser/components/preferences/in-content-new/main.xul
+++ b/browser/components/preferences/in-content-new/main.xul
@@ -749,16 +749,18 @@
       class="subcategory"
       hidden="true"
       data-category="paneGeneral">
   <label class="header-name" flex="1">&updateApplication.label;</label>
 </hbox>
 
 <!-- Update -->
 <groupbox id="updateApp" data-category="paneGeneral" hidden="true">
+  <caption class="search-header" hidden="true"><label>&updateApplication.label;</label></caption>
+
   <label>&updateApplicationDescription.label;</label>
   <separator/>
   <hbox align="start">
     <vbox flex="1">
       <description>
         &updateApplication.version.pre;<label id="version"/>&updateApplication.version.post;
         <label id="releasenotes" class="learnMore text-link" hidden="true">&releaseNotes.link;</label>
       </description>
@@ -901,16 +903,18 @@
       class="subcategory"
       hidden="true"
       data-category="paneGeneral">
   <label class="header-name" flex="1">&performance.label;</label>
 </hbox>
 
 <!-- Performance -->
 <groupbox id="performanceGroup" data-category="paneGeneral" hidden="true">
+  <caption class="search-header" hidden="true"><label>&performance.label;</label></caption>
+
   <hbox align="center">
     <checkbox id="useRecommendedPerformanceSettings"
               label="&useRecommendedPerformanceSettings2.label;"
               accesskey="&useRecommendedPerformanceSettings2.accesskey;"
               preference="browser.preferences.defaultPerformanceSettings.enabled"/>
     <label id="performanceSettingsLearnMore" class="learnMore text-link">&performanceSettingsLearnMore.label;</label>
   </hbox>
   <description class="indent">&useRecommendedPerformanceSettings2.description;</description>
@@ -943,16 +947,18 @@
       class="subcategory"
       hidden="true"
       data-category="paneGeneral">
   <label class="header-name" flex="1">&browsing.label;</label>
 </hbox>
 
 <!-- Browsing -->
 <groupbox id="browsingGroup" data-category="paneGeneral" hidden="true">
+  <caption class="search-header" hidden="true"><label>&browsing.label;</label></caption>
+
   <checkbox id="useAutoScroll"
             label="&useAutoScroll.label;"
             accesskey="&useAutoScroll.accesskey;"
             preference="general.autoScroll"/>
   <checkbox id="useSmoothScrolling"
             label="&useSmoothScrolling.label;"
             accesskey="&useSmoothScrolling.accesskey;"
             preference="general.smoothScroll"/>
@@ -978,16 +984,18 @@
       class="subcategory"
       hidden="true"
       data-category="paneGeneral">
   <label class="header-name" flex="1">&networkProxy.label;</label>
 </hbox>
 
 <!-- Network Proxy-->
 <groupbox id="connectionGroup" data-category="paneGeneral" hidden="true">
+  <caption class="search-header" hidden="true"><label>&networkProxy.label;</label></caption>
+
   <hbox align="center">
     <description flex="1" control="connectionSettings">&connectionDesc.label;</description>
     <!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
     <hbox>
       <button id="connectionSettings"
               class="accessory-button"
               icon="network"
               label="&connectionSettings.label;"
--- a/browser/components/preferences/in-content-new/privacy.xul
+++ b/browser/components/preferences/in-content-new/privacy.xul
@@ -529,16 +529,18 @@
       class="subcategory"
       hidden="true"
       data-category="panePrivacy">
   <label class="header-name" flex="1">&permissions.label;</label>
 </hbox>
 
 <!-- Permissions -->
 <groupbox id="permissionsGroup" data-category="panePrivacy" hidden="true">
+  <caption class="search-header" hidden="true"><label>&permissions.label;</label></caption>
+
   <grid>
     <columns>
       <column flex="1"/>
       <column/>
     </columns>
     <rows>
       <row id="notificationsPolicyRow" align="center">
         <description flex="1">
@@ -611,21 +613,22 @@
       data-category="panePrivacy"
       data-subcategory="reports">
   <label class="header-name" flex="1">&dataCollection.label;</label>
 </hbox>
 
 <!-- Firefox Data Collection and Use -->
 #ifdef MOZ_DATA_REPORTING
 <groupbox id="dataCollectionGroup" data-category="panePrivacy" data-subcategory="reports" hidden="true">
-  <description>
-    &dataCollectionDesc.label;<label id="dataCollectionPrivacyNotice" class="learnMore text-link">&dataCollectionPrivacyNotice.label;</label>
-  </description>
+  <caption class="search-header" hidden="true"><label>&dataCollection.label;</label></caption>
 
   <vbox>
+    <description>
+      &dataCollectionDesc.label;<label id="dataCollectionPrivacyNotice" class="learnMore text-link">&dataCollectionPrivacyNotice.label;</label>
+    </description>
     <description flex="1">
       <checkbox id="submitHealthReportBox" label="&enableHealthReport1.label;"
                 accesskey="&enableHealthReport1.accesskey;"/>
       <label id="FHRLearnMore"
              class="learnMore text-link">&healthReportLearnMore.label;</label>
     </description>
 #ifndef MOZ_TELEMETRY_REPORTING
     <description id="TelemetryDisabledDesc" class="indent" control="telemetryGroup">&healthReportingDisabled.label;</description>