Web Inspector: Styles: Undo reverts all changes at once
authornvasilyev@apple.com <nvasilyev@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Jan 2019 03:29:18 +0000 (03:29 +0000)
committernvasilyev@apple.com <nvasilyev@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Jan 2019 03:29:18 +0000 (03:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=177676
<rdar://problem/34745031>

Reviewed by Devin Rousso.

Command-Z used to revert all changes at once because Web Inspector never
set any history checkpoints in the style editor.

* UserInterface/Views/SpreadsheetStyleProperty.js:
(WI.SpreadsheetStyleProperty.prototype.spreadsheetTextFieldDidBlur):
* UserInterface/Views/SpreadsheetTextField.js:
(WI.SpreadsheetTextField.prototype._handleBlur):

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js
Source/WebInspectorUI/UserInterface/Views/SpreadsheetTextField.js

index 55dfb8e..84f0901 100644 (file)
@@ -1,5 +1,21 @@
 2019-01-08  Nikita Vasilyev  <nvasilyev@apple.com>
 
+        Web Inspector: Styles: Undo reverts all changes at once
+        https://bugs.webkit.org/show_bug.cgi?id=177676
+        <rdar://problem/34745031>
+
+        Reviewed by Devin Rousso.
+
+        Command-Z used to revert all changes at once because Web Inspector never
+        set any history checkpoints in the style editor.
+
+        * UserInterface/Views/SpreadsheetStyleProperty.js:
+        (WI.SpreadsheetStyleProperty.prototype.spreadsheetTextFieldDidBlur):
+        * UserInterface/Views/SpreadsheetTextField.js:
+        (WI.SpreadsheetTextField.prototype._handleBlur):
+
+2019-01-08  Nikita Vasilyev  <nvasilyev@apple.com>
+
         Web Inspector: Use prefers-color-scheme instead of prefers-dark-interface
         https://bugs.webkit.org/show_bug.cgi?id=193265
 
index d9957c7..8529fa3 100644 (file)
@@ -372,7 +372,7 @@ WI.SpreadsheetStyleProperty = class SpreadsheetStyleProperty extends WI.Object
             this.remove();
     }
 
-    spreadsheetTextFieldDidBlur(textField, event)
+    spreadsheetTextFieldDidBlur(textField, event, changed)
     {
         let focusedOutsideThisProperty = event.relatedTarget !== this._nameElement && event.relatedTarget !== this._valueElement;
         if (focusedOutsideThisProperty && (!this._nameTextField.value.trim() || !this._valueTextField.value.trim())) {
@@ -385,6 +385,9 @@ WI.SpreadsheetStyleProperty = class SpreadsheetStyleProperty extends WI.Object
 
         if (typeof this._delegate.spreadsheetStylePropertyFocusMoved === "function")
             this._delegate.spreadsheetStylePropertyFocusMoved(this, {direction: null});
+
+        if (changed && window.DOMAgent)
+            DOMAgent.markUndoableState();
     }
 
     spreadsheetTextFieldDidBackspace(textField)
index 109bbce..d6e232c 100644 (file)
@@ -220,7 +220,8 @@ WI.SpreadsheetTextField = class SpreadsheetTextField
         this._applyCompletionHint();
         this.discardCompletion();
 
-        this._delegate.spreadsheetTextFieldDidBlur(this, event);
+        let changed = this._valueBeforeEditing !== this.value;
+        this._delegate.spreadsheetTextFieldDidBlur(this, event, changed);
         this.stopEditing();
     }