Bug 960904 - Allow number pickers that don't stretch the full width in <setting>; r=Unfocused
authorGeoff Lankow <geoff@darktrojan.net>
Sat, 18 Jan 2014 15:52:53 +1300
changeset 164115 eb1b7ba48d220586c31355ddc640489c839b20bb
parent 164114 41a0bf080410736d4971c148ca2c22a7c5d180ec
child 164116 288705e6fd293a3c16fdc3eaf5d480b11d96b6a1
push id26026
push userphilringnalda@gmail.com
push dateSat, 18 Jan 2014 23:17:27 +0000
treeherdermozilla-central@61fd0f987cf2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersUnfocused
bugs960904
milestone29.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 960904 - Allow number pickers that don't stretch the full width in <setting>; r=Unfocused
toolkit/mozapps/extensions/content/extensions.css
toolkit/mozapps/extensions/content/setting.xml
toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1/options.xul
toolkit/mozapps/extensions/test/browser/browser_inlinesettings.js
--- a/toolkit/mozapps/extensions/content/extensions.css
+++ b/toolkit/mozapps/extensions/content/extensions.css
@@ -79,16 +79,20 @@ setting[type="boolint"] {
   -moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-boolint");
 }
 
 setting[type="integer"] {
   display: -moz-grid-line;
   -moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-integer");
 }
 
+setting[type="integer"]:not([size]) textbox {
+  -moz-box-flex: 1;
+}
+
 setting[type="control"] {
   display: -moz-grid-line;
   -moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-control");
 }
 
 setting[type="string"] {
   display: -moz-grid-line;
   -moz-binding: url("chrome://mozapps/content/extensions/setting.xml#setting-string");
--- a/toolkit/mozapps/extensions/content/setting.xml
+++ b/toolkit/mozapps/extensions/content/setting.xml
@@ -225,18 +225,18 @@
     <content>
       <xul:vbox>
         <xul:hbox class="preferences-alignment">
           <xul:label class="preferences-title" flex="1" xbl:inherits="xbl:text=title"/>
         </xul:hbox>
         <xul:description class="preferences-description" flex="1" xbl:inherits="xbl:text=desc"/>
       </xul:vbox>
       <xul:hbox class="preferences-alignment">
-        <xul:textbox type="number" anonid="input" flex="1" oninput="inputChanged();" onchange="inputChanged();"
-                     xbl:inherits="disabled,emptytext,min,max,increment,hidespinbuttons,wraparound"/>
+        <xul:textbox type="number" anonid="input" oninput="inputChanged();" onchange="inputChanged();"
+                     xbl:inherits="disabled,emptytext,min,max,increment,hidespinbuttons,wraparound,size"/>
       </xul:hbox>
     </content>
 
     <implementation>
       <method name="valueFromPreference">
         <body>
         <![CDATA[
           let val = Services.prefs.getIntPref(this.pref);
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1/options.xul
+++ b/toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1/options.xul
@@ -11,9 +11,10 @@
         <menuitem label="Bravo" value="2" />
         <menuitem label="Charlie" value="3" />
       </menupopup>
     </menulist>
   </setting>
   <setting pref="extensions.inlinesettings1.color" type="color" title="Color"/>
   <setting pref="extensions.inlinesettings1.file" type="file" title="File"/>
   <setting pref="extensions.inlinesettings1.directory" type="directory" title="Directory"/>
+  <setting pref="extensions.inlinesettings1.integer-size" type="integer" title="Integer with size" size="1" />
 </vbox>
--- a/toolkit/mozapps/extensions/test/browser/browser_inlinesettings.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_inlinesettings.js
@@ -3,17 +3,17 @@
  */
 
 // Tests various aspects of the details view
 
 var gManagerWindow;
 var gCategoryUtilities;
 var gProvider;
 
-const SETTINGS_ROWS = 8;
+const SETTINGS_ROWS = 9;
 
 var MockFilePicker = SpecialPowers.MockFilePicker;
 MockFilePicker.init(window);
 
 var observer = {
   lastDisplayed: null,
   callback: null,
   checkDisplayed: function(aExpected) {
@@ -319,16 +319,19 @@ add_test(function() {
       MockFilePicker.returnFiles = [curProcD];
       MockFilePicker.returnValue = Ci.nsIFilePicker.returnCancel;
       EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
       is(MockFilePicker.mode, Ci.nsIFilePicker.modeGetFolder, "File picker mode should be directory");
       is(input.value, profD.path, "Label value should not have changed");
       is(input.tooltipText, profD.path, "Label tooltip should not have changed");
       is(Services.prefs.getCharPref("extensions.inlinesettings1.directory"), profD.path, "Directory pref should not have changed");
 
+      var unsizedInput = gManagerWindow.document.getAnonymousElementByAttribute(settings[2], "anonid", "input");
+      var sizedInput = gManagerWindow.document.getAnonymousElementByAttribute(settings[8], "anonid", "input");
+      is(unsizedInput.clientWidth > sizedInput.clientWidth, true, "Input with size attribute should be smaller than input without");
     } finally {
       button = gManagerWindow.document.getElementById("detail-prefs-btn");
       is_element_hidden(button, "Preferences button should not be visible");
 
       gCategoryUtilities.openType("extension", run_next_test);
     }
   });
 });