Bug 1475208 - (Part 2) Update order of units and upper bounds for font size component. r=gl
authorRazvan Caliman <rcaliman@mozilla.com>
Mon, 30 Jul 2018 23:32:03 +0200
changeset 430553 b65adfe68eafe92d4405fd724fd104fff37d94db
parent 430552 7e1542dad1be7f1a3ca3d1c6da83b852882b4abc
child 430554 8c8ef5ecd85f168a8362d7ccec5330510d237c2b
push id34409
push usertoros@mozilla.com
push dateThu, 09 Aug 2018 10:00:05 +0000
treeherdermozilla-central@eb9ff7de69ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgl
bugs1475208
milestone63.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 1475208 - (Part 2) Update order of units and upper bounds for font size component. r=gl MozReview-Commit-ID: 3QW9xTA9bRz
devtools/client/inspector/fonts/components/FontPropertyValue.js
devtools/client/inspector/fonts/components/FontSize.js
devtools/client/inspector/fonts/utils/font-utils.js
--- a/devtools/client/inspector/fonts/components/FontPropertyValue.js
+++ b/devtools/client/inspector/fonts/components/FontPropertyValue.js
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const { PureComponent } = require("devtools/client/shared/vendor/react");
 const dom = require("devtools/client/shared/vendor/react-dom-factories");
 const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
 
-const UNITS = ["px", "%", "em", "rem", "vh", "vw", "pt"];
+const UNITS = ["em", "rem", "%", "px", "vh", "vw"];
 
 class FontPropertyValue extends PureComponent {
   static get propTypes() {
     return {
       defaultValue: PropTypes.oneOfType([ PropTypes.string, PropTypes.number ]),
       label: PropTypes.string.isRequired,
       min: PropTypes.oneOfType([ PropTypes.string, PropTypes.number ]),
       max: PropTypes.oneOfType([ PropTypes.string, PropTypes.number ]),
--- a/devtools/client/inspector/fonts/components/FontSize.js
+++ b/devtools/client/inspector/fonts/components/FontSize.js
@@ -21,29 +21,29 @@ class FontSize extends PureComponent {
   }
 
   render() {
     const unit = getUnitFromValue(this.props.value);
     let max;
     switch (unit) {
       case "em":
       case "rem":
-        max = 10;
+        max = 4;
         break;
       case "vh":
       case "vw":
       case "vmin":
       case "vmax":
-        max = 100;
+        max = 10;
         break;
       case "%":
-        max = 500;
+        max = 200;
         break;
       default:
-        max = 300;
+        max = 72;
         break;
     }
 
     return FontPropertyValue({
       label: getStr("fontinspector.fontSizeLabel"),
       min: 0,
       max,
       name: "font-size",
--- a/devtools/client/inspector/fonts/utils/font-utils.js
+++ b/devtools/client/inspector/fonts/utils/font-utils.js
@@ -10,19 +10,28 @@ module.exports = {
    * Used as the step attribute in inputs of type "range" or "number".
    *
    * @param {String} unit
    *        CSS unit type (px, %, em, rem, vh, vw, ...)
    * @return {Number}
    *         Amount by which to increment.
    */
   getStepForUnit(unit) {
-    let step = 1;
-    if (unit === "em" || unit === "rem") {
-      step = 0.1;
+    let step;
+    switch (unit) {
+      case "em":
+      case "rem":
+      case "vw":
+      case "vh":
+      case "vmin":
+      case "vmax":
+        step = 0.1;
+        break;
+      default:
+        step = 1;
     }
 
     return step;
   },
 
   /**
    * Get the unit type from the end of a CSS value string.
    * Returns null for non-string input or unitless values.