Title: [189845] trunk/Source/WebInspectorUI
Revision
189845
Author
commit-qu...@webkit.org
Date
2015-09-15 21:22:21 -0700 (Tue, 15 Sep 2015)

Log Message

Web Inspector: Picking unchanged for font-size does not reset back to the unchanged value
https://bugs.webkit.org/show_bug.cgi?id=148351

Patch by Devin Rousso <dcrousso+web...@gmail.com> on 2015-09-15
Reviewed by Brian Burg.

Visual number editors now save any new values in the special placeholder element
to display it whenever the "Unchanged" option is selected by the user.

* UserInterface/Views/VisualStyleNumberInputBox.js:
(WebInspector.VisualStyleNumberInputBox.prototype.set value):
(WebInspector.VisualStyleNumberInputBox.prototype.set units):
(WebInspector.VisualStyleNumberInputBox.prototype._setNumberInputIsEditable):
(WebInspector.VisualStyleNumberInputBox.prototype._keywordChanged):
(WebInspector.VisualStyleNumberInputBox.prototype._valueNumberInputKeyDown.adjustValue):
(WebInspector.VisualStyleNumberInputBox.prototype._valueNumberInputKeyDown):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (189844 => 189845)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-09-16 03:52:20 UTC (rev 189844)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-09-16 04:22:21 UTC (rev 189845)
@@ -1,3 +1,21 @@
+2015-09-15  Devin Rousso  <dcrousso+web...@gmail.com>
+
+        Web Inspector: Picking unchanged for font-size does not reset back to the unchanged value
+        https://bugs.webkit.org/show_bug.cgi?id=148351
+
+        Reviewed by Brian Burg.
+
+        Visual number editors now save any new values in the special placeholder element
+        to display it whenever the "Unchanged" option is selected by the user.
+
+        * UserInterface/Views/VisualStyleNumberInputBox.js:
+        (WebInspector.VisualStyleNumberInputBox.prototype.set value):
+        (WebInspector.VisualStyleNumberInputBox.prototype.set units):
+        (WebInspector.VisualStyleNumberInputBox.prototype._setNumberInputIsEditable):
+        (WebInspector.VisualStyleNumberInputBox.prototype._keywordChanged):
+        (WebInspector.VisualStyleNumberInputBox.prototype._valueNumberInputKeyDown.adjustValue):
+        (WebInspector.VisualStyleNumberInputBox.prototype._valueNumberInputKeyDown):
+
 2015-09-15  Brian Burg  <bb...@apple.com>
 
         Web Inspector: command-click in NewTabContentView should open new tab without switching to it

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleNumberInputBox.js (189844 => 189845)


--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleNumberInputBox.js	2015-09-16 03:52:20 UTC (rev 189844)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStyleNumberInputBox.js	2015-09-16 04:22:21 UTC (rev 189845)
@@ -111,12 +111,16 @@
         if (value && value === this.value)
             return;
 
-        if (this._updatedValues.propertyMissing && isNaN(value)) {
-            this._unchangedOptionElement.selected = true;
-            this._numberInputIsEditable = false;
-            this.contentElement.classList.remove("number-input-editable");
-            this.specialPropertyPlaceholderElement.hidden = false;
-            return;
+        if (this._updatedValues.propertyMissing) {
+            if (value || this._updatedValues.placeholder)
+                this.specialPropertyPlaceholderElement.textContent = (value || this._updatedValues.placeholder) + (this._updatedValues.units || "");
+
+            if (isNaN(value)) {
+                this._unchangedOptionElement.selected = true;
+                this._setNumberInputIsEditable();
+                this.specialPropertyPlaceholderElement.hidden = false;
+                return;
+            }
         }
 
         this.specialPropertyPlaceholderElement.hidden = true;
@@ -128,16 +132,14 @@
         }
 
         if (!isNaN(value)) {
-            this._numberInputIsEditable = true;
-            this.contentElement.classList.add("number-input-editable");
+            this._setNumberInputIsEditable(true);
             this._valueNumberInputElement.value = Math.round(value * 100) / 100;
             this._markUnitsContainerIfInputHasValue();
             return;
         }
 
         if (this.valueIsSupportedKeyword(value)) {
-            this._numberInputIsEditable = false;
-            this.contentElement.classList.remove("number-input-editable");
+            this._setNumberInputIsEditable();
             this._keywordSelectElement.value = value;
             return;
         }
@@ -169,8 +171,7 @@
         if (this._valueIsSupportedAdvancedUnit(unit))
             this._addAdvancedUnits();
 
-        this._numberInputIsEditable = true;
-        this.contentElement.classList.add("number-input-editable");
+        this._setNumberInputIsEditable(true);
         this._keywordSelectElement.value = unit;
         this._unitsElementTextContent = unit;
     }
@@ -231,6 +232,12 @@
         this._markUnitsContainerIfInputHasValue();
     }
 
+    _setNumberInputIsEditable(flag)
+    {
+        this._numberInputIsEditable = flag || false;
+        this.contentElement.classList.toggle("number-input-editable", this._numberInputIsEditable);
+    }
+
     _markUnitsContainerIfInputHasValue()
     {
         let numberInputValue = this._valueNumberInputElement.value;
@@ -246,9 +253,9 @@
                 this._valueNumberInputElement.value = null;
 
             this._unitsElementTextContent = this._keywordSelectElement.value;
-            this._numberInputIsEditable = selectedKeywordIsUnit;
-            this.contentElement.classList.toggle("number-input-editable", selectedKeywordIsUnit);
-        }
+            this._setNumberInputIsEditable(selectedKeywordIsUnit);
+        } else
+            this._setNumberInputIsEditable(false);
 
         this._valueDidChange();
         this.specialPropertyPlaceholderElement.hidden = !unchangedOptionSelected;
@@ -272,6 +279,7 @@
             if (!this._allowNegativeValues && newValue < 0)
                 newValue = 0;
 
+            this._updatedValues.propertyMissing = false;
             this.value = Math.round(newValue * 100) / 100;
             this._valueDidChange();
         }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to