Web Inspector: round sub-pixel values we get from computed style in visual sidebar
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Aug 2015 01:18:49 +0000 (01:18 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Aug 2015 01:18:49 +0000 (01:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148105

Reviewed by Timothy Hatcher.

* UserInterface/Views/VisualStyleNumberInputBox.js:
(WebInspector.VisualStyleNumberInputBox.prototype.set value):
(WebInspector.VisualStyleNumberInputBox.prototype.set placeholder):
Now rounds the value and placeholder to the nearest 100th.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188616 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/VisualStyleNumberInputBox.js

index 47beb4e..9c13487 100644 (file)
@@ -1,3 +1,15 @@
+2015-08-18  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: round sub-pixel values we get from computed style in visual sidebar
+        https://bugs.webkit.org/show_bug.cgi?id=148105
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/VisualStyleNumberInputBox.js:
+        (WebInspector.VisualStyleNumberInputBox.prototype.set value):
+        (WebInspector.VisualStyleNumberInputBox.prototype.set placeholder):
+        Now rounds the value and placeholder to the nearest 100th.
+
 2015-08-18  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: transparent color swatches have lopsided checkered background on non-retina
index 4b8e410..f05421f 100644 (file)
@@ -105,7 +105,7 @@ WebInspector.VisualStyleNumberInputBox = class VisualStyleNumberInputBox extends
         if (!isNaN(value)) {
             this._numberInputIsEditable = true;
             this.contentElement.classList.add("number-input-editable");
-            this._valueNumberInputElement.value = value;
+            this._valueNumberInputElement.value = Math.round(value * 100) / 100;
             return;
         }
 
@@ -160,7 +160,7 @@ WebInspector.VisualStyleNumberInputBox = class VisualStyleNumberInputBox extends
         if (text === this.placeholder)
             return;
 
-        let onlyNumericalText = !isNaN(text) && text;
+        let onlyNumericalText = text && !isNaN(text) && (Math.round(text * 100) / 100);
         this._valueNumberInputElement.setAttribute("placeholder", onlyNumericalText || 0);
     }