Bug 1127288 - add header for DRM checkbox, fix link alignment, r=dolske
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Sat, 31 Jan 2015 10:36:54 +0000
changeset 250246 4d6e9e4e5e87
parent 250245 007cc5f2f96e
child 250247 38ce715f4de4
push id4526
push usergijskruitbosch@gmail.com
push date2015-03-05 00:08 +0000
treeherdermozilla-beta@0e44d113855f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske
bugs1127288
milestone37.0
Bug 1127288 - add header for DRM checkbox, fix link alignment, r=dolske
browser/components/preferences/in-content/content.js
browser/components/preferences/in-content/content.xul
browser/components/preferences/in-content/tests/browser_bug731866.js
browser/themes/shared/incontentprefs/preferences.inc.css
--- a/browser/components/preferences/in-content/content.js
+++ b/browser/components/preferences/in-content/content.js
@@ -39,18 +39,21 @@ var gContentPane = {
     setEventListener("translationAttributionImage", "click",
       gContentPane.openTranslationProviderAttribution);
     setEventListener("translateButton", "command",
       gContentPane.showTranslationExceptions);
 
     let drmInfoURL =
       Services.urlFormatter.formatURLPref("app.support.baseURL") + "drm-content";
     document.getElementById("playDRMContentLink").setAttribute("href", drmInfoURL);
-    document.getElementById("playDRMContentRow").hidden =
-      !Services.prefs.getBoolPref("browser.eme.ui.enabled");
+    if (!Services.prefs.getBoolPref("browser.eme.ui.enabled")) {
+      // Don't want to rely on .hidden for the toplevel groupbox because
+      // of the pane hiding/showing code potentially interfering:
+      document.getElementById("drmGroup").setAttribute("style", "display: none !important");
+    }
   },
 
   // UTILITY FUNCTIONS
 
   /**
    * Utility function to enable/disable the button specified by aButtonID based
    * on the value of the Boolean preference specified by aPreferenceID.
    */
--- a/browser/components/preferences/in-content/content.xul
+++ b/browser/components/preferences/in-content/content.xul
@@ -34,32 +34,45 @@
 
 <hbox id="header-content"
       class="header"
       hidden="true"
       data-category="paneContent">
   <label class="header-name">&paneContent.title;</label>
 </hbox>
 
+<groupbox id="drmGroup" data-category="paneContent" hidden="true">
+  <caption><label>DRM content</label></caption>
+  <grid id="contentGrid2">
+    <columns>
+      <column flex="1"/>
+      <column/>
+    </columns>
+    <rows id="contentRows-2">
+      <row id="playDRMContentRow">
+        <vbox align="start">
+          <checkbox id="playDRMContent" preference="media.eme.enabled"
+                    label="Play DRM content" accesskey="P"/>
+        </vbox>
+        <hbox pack="end" align="center">
+          <label id="playDRMContentLink" class="text-link" value="Learn more"/>
+        </hbox>
+      </row>
+    </rows>
+  </grid>
+</groupbox>
+
 <groupbox id="miscGroup" data-category="paneContent" hidden="true">
+  <caption><label>&popups.label;</label></caption>
   <grid id="contentGrid">
     <columns>
       <column flex="1"/>
       <column/>
     </columns>
     <rows id="contentRows-1">
-      <row id="playDRMContentRow">
-        <vbox align="start">
-          <checkbox id="playDRMContent" preference="media.eme.enabled"
-                    label="Play DRM content" accesskey="P"/>
-        </vbox>
-        <hbox pack="end">
-          <label id="playDRMContentLink" class="text-link" value="Learn more"/>
-        </hbox>
-      </row>
       <row id="popupPolicyRow">
         <vbox align="start">
           <checkbox id="popupPolicy" preference="dom.disable_open_during_load"
                     label="&blockPopups.label;" accesskey="&blockPopups.accesskey;"
                     onsyncfrompreference="return gContentPane.updateButtons('popupPolicyButton',
                                                                         'dom.disable_open_during_load');"/>
         </vbox>
         <hbox pack="end">
--- a/browser/components/preferences/in-content/tests/browser_bug731866.js
+++ b/browser/components/preferences/in-content/tests/browser_bug731866.js
@@ -22,16 +22,17 @@ function checkElements(expectedPane) {
       is_element_visible(element, expectedPane + " elements should be visible");
     } else {
       is_element_hidden(element, "Elements not in " + expectedPane + " should be hidden");
     }
   }
 }
 
 function runTest(win) {
+  Services.prefs.setBoolPref("browser.eme.ui.enabled", true);
   is(gBrowser.currentURI.spec, "about:preferences", "about:preferences loaded");
 
   let tab = win.document;
   gElements = tab.getElementById("mainPrefPane").children;
 
   let panes = [
     "General", "Search", "Content", "Applications",
     "Privacy", "Security", "Sync", "Advanced",
@@ -39,10 +40,11 @@ function runTest(win) {
 
   for (let pane of panes) {
     win.gotoPref("pane" + pane);
     checkElements(pane);
   }
 
   gBrowser.removeCurrentTab();
   win.close();
+  Services.prefs.clearUserPref("browser.eme.ui.enabled");
   finish();
 }
--- a/browser/themes/shared/incontentprefs/preferences.inc.css
+++ b/browser/themes/shared/incontentprefs/preferences.inc.css
@@ -126,16 +126,23 @@ treecol {
 #isNotDefaultLabel {
   font-weight: bold;
 }
 
 #downloadFolder {
   -moz-margin-start: 0;
 }
 
+/* Content pane */
+#playDRMContentLink {
+  /* Line up with the buttons in the other grid bits: */
+  margin-left: 4px !important;
+  margin-right: 4px !important;
+}
+
 /* Applications Pane Styles */
 
 #applicationsContent {
   padding: 15px 0;
 }
 
 #filter {
   -moz-margin-start: 0;