Bug 529912: <setting/> should provide type='integer' [r=mark.finkle]
authorVivien Nicolas <21@vingtetun.org>
Mon, 30 Nov 2009 14:20:17 -0500
changeset 65861 3b9f72d0c8712353baf879ae1b1e9c5104589444
parent 65860 f4d8f7b31e37e61d7674a59818e4b0267f698df3
child 65862 6384e80a580ec8a840b4e6b161a46ea35e4b97df
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmark
bugs529912
Bug 529912: <setting/> should provide type='integer' [r=mark.finkle]
mobile/chrome/content/bindings/setting.xml
mobile/chrome/content/browser.css
mobile/themes/hildon/images/arrowdown-16.png
mobile/themes/hildon/jar.mn
mobile/themes/hildon/platform.css
mobile/themes/wince/images/arrowdown-16.png
mobile/themes/wince/jar.mn
mobile/themes/wince/platform.css
--- a/mobile/chrome/content/bindings/setting.xml
+++ b/mobile/chrome/content/bindings/setting.xml
@@ -247,16 +247,54 @@
         </body>
       </method>
 
       <property name="value" onget="return this.input.checked;" onset="return this.input.setChecked(val);"/>
       <property name="inverted" readonly="true" onget="return this.getAttribute('inverted');"/>
     </implementation>
   </binding>
 
+  <binding id="setting-integer" extends="chrome://browser/content/bindings/setting.xml#setting-base">
+    <content>
+      <xul:box flex="1" class="prefbox">
+        <xul:vbox flex="1">
+          <xul:label class="preftitle" xbl:inherits="value=title" crop="end" flex="1"/>
+          <xul:label class="prefdesc" xbl:inherits="value=desc" crop="end" flex="1">
+            <children/>
+          </xul:label>
+        </xul:vbox>
+        <xul:hbox anonid="input-container">
+          <xul:textbox type="number" anonid="input" xbl:inherits="disabled,emptytext,min,max,increment,hidespinbuttons,wraparound" oncommand="inputChanged();"/>
+        </xul:hbox>
+      </xul:box>
+    </content>
+
+    <implementation>
+      <method name="valueFromPreference">
+        <body>
+        <![CDATA[
+          let val = this._prefs.getIntPref(this.pref);
+          this.value = val;
+         ]]>
+        </body>
+      </method>
+
+      <method name="valueToPreference">
+        <body>
+        <![CDATA[
+          this._prefs.setIntPref(this.pref, this.value);
+        ]]>
+        </body>
+      </method>
+
+      <property name="type" readonly="true" onget="return this.getAttribute('type');"/>
+      <property name="value" onget="return this.input.value;" onset="return this.input.value = val;"/>
+    </implementation>
+  </binding>
+
   <binding id="setting-control" extends="chrome://browser/content/bindings/setting.xml#setting-base">
     <content>
       <xul:box flex="1" class="prefbox">
         <xul:vbox flex="1">
           <xul:label class="preftitle" xbl:inherits="value=title" crop="end" flex="1"/>
           <xul:label class="prefdesc" xbl:inherits="value=desc" crop="end" flex="1">
             <children/>
           </xul:label>
@@ -273,17 +311,17 @@
       <xul:box flex="1" class="prefbox">
         <xul:vbox flex="1">
           <xul:label class="preftitle" xbl:inherits="value=title" crop="end" flex="1"/>
           <xul:label class="prefdesc" xbl:inherits="value=desc" crop="end" flex="1">
             <children/>
           </xul:label>
         </xul:vbox>
         <xul:hbox anonid="input-container">
-          <xul:textbox xbl:inherits="disabled,emptytext,type=inputtype,min,max,increment,hidespinbuttons,wraparound,decimalplaces" anonid="input" oninput="inputChanged();"/>
+          <xul:textbox xbl:inherits="disabled,emptytext,type=inputtype,min,max,increment,hidespinbuttons,decimalplaces,wraparound" anonid="input" oninput="inputChanged();"/>
         </xul:hbox>
       </xul:box>
     </content>
 
     <implementation>
       <method name="valueFromPreference">
         <body>
         <![CDATA[
--- a/mobile/chrome/content/browser.css
+++ b/mobile/chrome/content/browser.css
@@ -17,16 +17,20 @@ settings {
 setting[type="bool"] {
   -moz-binding: url("chrome://browser/content/bindings/setting.xml#setting-bool");
 }
 
 setting[type="boolint"] {
   -moz-binding: url("chrome://browser/content/bindings/setting.xml#setting-boolint");
 }
 
+setting[type="integer"] {
+  -moz-binding: url("chrome://browser/content/bindings/setting.xml#setting-integer");
+}
+
 setting[type="control"] {
   -moz-binding: url("chrome://browser/content/bindings/setting.xml#setting-control");
 }
 
 setting[type="string"] {
   -moz-binding: url("chrome://browser/content/bindings/setting.xml#setting-string");
 }
 
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c982426f2ade2fdb8e56304cdd333e7fd924e668
GIT binary patch
literal 246
zc%17D@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|Hh8)?hFF}w
zI%zNOAp?O{dnLAnrWV1Vo2|1qFhnZO-oT}OfXVN%QsyQm1J1K2z2+QNlHGIc(#zWS
zbtylp-!k-+@?K!LUdYield#5`N%lg&^9$~k)eo3_j_tByzJ5R@jz2(U9`l2(0xK&&
zx`=u$4n3hRk)WT?YBP1h<(#7;>mCU%^`6=CB&655LYK*`#ic^@gX;;VuzroUu*TaW
tVd^t{i`epvf9(4?Tk5q}<jeN2Y)_oc_He%Ju>rcB!PC{xWt~$(69CB-T~z=8
--- a/mobile/themes/hildon/jar.mn
+++ b/mobile/themes/hildon/jar.mn
@@ -13,16 +13,17 @@ chrome.jar:
 % override chrome://global/skin/about.css chrome://browser/skin/about.css
 
   images/addons.png                    (images/addons.png)
   images/weave.png                     (images/weave.png)
   images/aboutBackground.png           (images/aboutBackground.png)
   images/panel-shadow.png              (images/panel-shadow.png)
   images/arrowright-16.png             (images/arrowright-16.png)
   images/arrowup-16.png                (images/arrowup-16.png)
+  images/arrowdown-16.png              (images/arrowdown-16.png)
   images/arrowleftdark-16.png          (images/arrowleftdark-16.png)
   images/arrowrightdark-16.png         (images/arrowrightdark-16.png)
   images/ratings-18.png                (images/ratings-18.png)
   images/favicon-default-30.png        (images/favicon-default-30.png)
   images/star-40.png                   (images/star-40.png)
   images/star-24.png                   (images/star-24.png)
   images/throbber.png                  (images/throbber.png)
   images/navigation-magnifier-30.png   (images/navigation-magnifier-30.png)
--- a/mobile/themes/hildon/platform.css
+++ b/mobile/themes/hildon/platform.css
@@ -60,17 +60,17 @@ label {
 /* Override any OS inverse themes */
 richlistbox,
 textbox {
   color: black;
   background-color: white;
 }
 
 /* textboxes --------------------------------------------------------------- */
-textbox {
+textbox:not([type="number"]) {
   min-height: 48px;
   border: 3px solid #262629;
   -moz-border-radius: 8px;
   -moz-border-top-colors: -moz-initial;
   -moz-border-right-colors: -moz-initial;
   -moz-border-bottom-colors: -moz-initial;
   -moz-border-left-colors: -moz-initial;
 }
@@ -171,16 +171,58 @@ button.button-dark:not([disabled="true"]
 notification button:not([disabled="true"]):active:hover {
   -moz-border-image: url("chrome://browser/skin/images/buttondark-active-64.png") 8 repeat repeat;
 }
 
 button.button-dark[disabled="true"] {
   color: #7e7e7e !important;
 }
 
+/* spinbuttons ------------------------------------------------------------- */
+textbox hbox.numberbox-input-box {
+  max-width: 128px;
+  border: 3px solid #262629;
+  border-right: 0px solid transparent;
+  -moz-border-radius-topleft: 8px;
+  -moz-border-radius-bottomleft: 8px;
+  -moz-border-top-colors: -moz-initial;
+  -moz-border-bottom-colors: -moz-initial;
+  -moz-border-left-colors: -moz-initial;
+}
+
+spinbuttons .spinbuttons-box {
+  -moz-box-orient: horizontal !important;
+  -moz-box-direction: reverse !important;
+}
+
+spinbuttons .spinbuttons-up .button-icon,
+spinbuttons .spinbuttons-down .button-icon {
+  display: block;
+}
+
+spinbuttons .spinbuttons-up {
+  border-width: 8px;
+  -moz-border-image: url("chrome://browser/skin/images/toggleoff-inactive-64.png") 8 repeat repeat !important;
+  list-style-image: url("chrome://browser/skin/images/arrowup-16.png");
+}
+
+spinbuttons .spinbuttons-up:hover:active:not([disabled=true]) {
+  -moz-border-image: url("chrome://browser/skin/images/toggleoff-active-64.png") 8 repeat repeat !important;
+}
+
+spinbuttons .spinbuttons-down {
+  border-width: 8px;
+  -moz-border-image: url("chrome://browser/skin/images/togglemiddle-inactive-64.png") 8 repeat repeat !important;
+  list-style-image: url("chrome://browser/skin/images/arrowdown-16.png");
+}
+
+spinbuttons .spinbuttons-down:hover:active:not([disabled=true]) {
+  -moz-border-image: url("chrome://browser/skin/images/togglemiddle-active-64.png") 8 repeat repeat !important;
+}
+
 /* toolbar buttons --------------------------------------------------------- */
 toolbarbutton {
   min-width: 64px !important; /* primary button size */
   min-height: 64px !important; /* primary button size */
   -moz-appearance: none !important;
   margin: 0;
   padding: 2px;
 }
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c982426f2ade2fdb8e56304cdd333e7fd924e668
GIT binary patch
literal 246
zc%17D@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|Hh8)?hFF}w
zI%zNOAp?O{dnLAnrWV1Vo2|1qFhnZO-oT}OfXVN%QsyQm1J1K2z2+QNlHGIc(#zWS
zbtylp-!k-+@?K!LUdYield#5`N%lg&^9$~k)eo3_j_tByzJ5R@jz2(U9`l2(0xK&&
zx`=u$4n3hRk)WT?YBP1h<(#7;>mCU%^`6=CB&655LYK*`#ic^@gX;;VuzroUu*TaW
tVd^t{i`epvf9(4?Tk5q}<jeN2Y)_oc_He%Ju>rcB!PC{xWt~$(69CB-T~z=8
--- a/mobile/themes/wince/jar.mn
+++ b/mobile/themes/wince/jar.mn
@@ -13,16 +13,17 @@ chrome.jar:
   notification.css                     (notification.css)
 
   images/addons.png                    (images/addons.png)
   images/weave.png                     (images/weave.png)
   images/panel-shadow.png              (images/panel-shadow.png)
   images/aboutBackground.png           (images/aboutBackground.png)
   images/arrowright-16.png             (images/arrowright-16.png)
   images/arrowup-16.png                (images/arrowup-16.png)
+  images/arrowdown-16.png              (images/arrowdown-16.png)
   images/arrowleftdark-16.png          (images/arrowleftdark-16.png)
   images/arrowrightdark-16.png         (images/arrowrightdark-16.png)
   images/ratings-18.png                (images/ratings-18.png)
   images/favicon-default-30.png        (images/favicon-default-30.png)
   images/star-40.png                   (images/star-40.png)
   images/throbber.png                  (images/throbber.png)
   images/navigation-magnifier-30.png   (images/navigation-magnifier-30.png)
   images/folder-32.png                 (images/folder-32.png)
--- a/mobile/themes/wince/platform.css
+++ b/mobile/themes/wince/platform.css
@@ -183,16 +183,84 @@ button.button-dark[disabled="true"] {
   
   button.button-dark[type="checkbox"][checked="true"],
   button.button-dark:not([disabled="true"]):active:hover,
   notification button:not([disabled="true"]):active:hover {
     -moz-border-image: url("chrome://browser/skin/images/buttondark-active-36.png") 4 repeat repeat;
   }
 }
 
+/* spinbuttons ------------------------------------------------------------- */
+textbox hbox.numberbox-input-box {
+  max-width: 96px;
+  border: 0.35mm solid #262629;
+  border-right: 0px solid transparent;
+  -moz-border-radius-topleft: 1mm;
+  -moz-border-radius-bottomleft: 1mm;
+  -moz-border-top-colors: -moz-initial;
+  -moz-border-bottom-colors: -moz-initial;
+  -moz-border-left-colors: -moz-initial;
+}
+
+spinbuttons .spinbuttons-box {
+  -moz-box-orient: horizontal !important;
+  -moz-box-direction: reverse !important;
+}
+
+spinbuttons .spinbuttons-up .button-icon,
+spinbuttons .spinbuttons-down .button-icon {
+  display: block;
+}
+
+/* high-res screens */
+@media all and (min-device-width: 401px) {
+  spinbuttons .spinbuttons-up {
+    border-width: 8px;
+    -moz-border-image: url("chrome://browser/skin/images/toggleoff-inactive-64.png") 8 repeat repeat !important;
+    list-style-image: url("chrome://browser/skin/images/arrowup-16.png");
+  }
+
+  spinbuttons .spinbuttons-up:hover:active:not([disabled=true]) {
+    -moz-border-image: url("chrome://browser/skin/images/toggleoff-active-64.png") 8 repeat repeat !important;
+  }
+
+  spinbuttons .spinbuttons-down {
+    border-width: 8px;
+    -moz-border-image: url("chrome://browser/skin/images/togglemiddle-inactive-64.png") 8 repeat repeat !important;
+    list-style-image: url("chrome://browser/skin/images/arrowdown-16.png");
+  }
+
+  spinbuttons .spinbuttons-down:hover:active:not([disabled=true]) {
+    -moz-border-image: url("chrome://browser/skin/images/togglemiddle-active-64.png") 8 repeat repeat !important;
+  }
+}
+
+/* low-res screens */
+@media all and (max-device-width: 400px) {
+  spinbuttons .spinbuttons-up {
+    border-width: 4px;
+    -moz-border-image: url("chrome://browser/skin/images/toggleoff-inactive-36.png") 4 repeat repeat !important;
+    list-style-image: url("chrome://browser/skin/images/arrowup-16.png");
+  }
+
+  spinbuttons .spinbuttons-up:hover:active:not([disabled=true]) {
+    -moz-border-image: url("chrome://browser/skin/images/toggleoff-active-36.png") 4 repeat repeat !important;
+  }
+
+  spinbuttons .spinbuttons-down {
+    border-width: 4px;
+    -moz-border-image: url("chrome://browser/skin/images/togglemiddle-inactive-36.png") 4 repeat repeat !important;
+    list-style-image: url("chrome://browser/skin/images/arrowdown-16.png");
+  }
+
+  spinbuttons .spinbuttons-down:hover:active:not([disabled=true]) {
+    -moz-border-image: url("chrome://browser/skin/images/togglemiddle-active-36.png") 4 repeat repeat !important;
+  }
+}
+
 /* toolbar buttons --------------------------------------------------------- */
 toolbarbutton {
   -moz-appearance: none !important;
   margin: 0;
   padding: 0.25mm;
 }
 
 toolbarbutton:not(.show-text) .toolbarbutton-text {