Title: [242063] trunk/Source/WebInspectorUI
Revision
242063
Author
[email protected]
Date
2019-02-25 17:50:44 -0800 (Mon, 25 Feb 2019)

Log Message

Web Inspector: Styles: Command-/ should toggle edited property
https://bugs.webkit.org/show_bug.cgi?id=194967
<rdar://problem/48329852>

Reviewed by Devin Rousso.

* UserInterface/Models/CSSProperty.js:
(WI.CSSProperty.prototype.commentOut):
* UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js:
(WI.SpreadsheetCSSStyleDeclarationEditor.prototype.spreadsheetStylePropertySelect):
* UserInterface/Views/SpreadsheetStyleProperty.js:
(WI.SpreadsheetStyleProperty.prototype.update):
(WI.SpreadsheetStyleProperty.prototype._toggle):
(WI.SpreadsheetStyleProperty.prototype._select):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (242062 => 242063)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-02-26 01:14:43 UTC (rev 242062)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-02-26 01:50:44 UTC (rev 242063)
@@ -1,3 +1,20 @@
+2019-02-25  Nikita Vasilyev  <[email protected]>
+
+        Web Inspector: Styles: Command-/ should toggle edited property
+        https://bugs.webkit.org/show_bug.cgi?id=194967
+        <rdar://problem/48329852>
+
+        Reviewed by Devin Rousso.
+
+        * UserInterface/Models/CSSProperty.js:
+        (WI.CSSProperty.prototype.commentOut):
+        * UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js:
+        (WI.SpreadsheetCSSStyleDeclarationEditor.prototype.spreadsheetStylePropertySelect):
+        * UserInterface/Views/SpreadsheetStyleProperty.js:
+        (WI.SpreadsheetStyleProperty.prototype.update):
+        (WI.SpreadsheetStyleProperty.prototype._toggle):
+        (WI.SpreadsheetStyleProperty.prototype._select):
+
 2019-02-25  Devin Rousso  <[email protected]>
 
         Web Inspector: REGRESSION(r242018): Timelines shows no results

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CSSProperty.js (242062 => 242063)


--- trunk/Source/WebInspectorUI/UserInterface/Models/CSSProperty.js	2019-02-26 01:14:43 UTC (rev 242062)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CSSProperty.js	2019-02-26 01:50:44 UTC (rev 242063)
@@ -143,7 +143,6 @@
 
     commentOut(disabled)
     {
-        console.assert(this._enabled === disabled, "CSS property is already " + (disabled ? "disabled" : "enabled"));
         if (this._enabled === !disabled)
             return;
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js (242062 => 242063)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js	2019-02-26 01:14:43 UTC (rev 242062)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js	2019-02-26 01:50:44 UTC (rev 242063)
@@ -450,6 +450,11 @@
         }
     }
 
+    spreadsheetStylePropertySelect(index)
+    {
+        this.selectProperties(index, index);
+    }
+
     spreadsheetStylePropertyAddBlankPropertySoon(propertyView, {index})
     {
         if (isNaN(index))

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js (242062 => 242063)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js	2019-02-26 01:14:43 UTC (rev 242062)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js	2019-02-26 01:50:44 UTC (rev 242063)
@@ -67,6 +67,11 @@
                     this._delegate.spreadsheetStylePropertyMouseEnter(event, this);
             });
 
+            new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.Slash, () => {
+                this._toggle();
+                this._select();
+            }, this._element);
+
             this._element.copyHandler = this;
         }
     }
@@ -156,9 +161,8 @@
             this._checkboxElement.tabIndex = -1;
             this._checkboxElement.addEventListener("click", (event) => {
                 event.stopPropagation();
-                let disabled = !this._checkboxElement.checked;
-                this._property.commentOut(disabled);
-                this.update();
+                this._toggle();
+                console.assert(this._checkboxElement.checked === this._property.enabled);
             });
         }
 
@@ -408,6 +412,20 @@
 
     // Private
 
+    _toggle()
+    {
+        this._property.commentOut(this.property.enabled);
+        this.update();
+    }
+
+    _select()
+    {
+        if (this._delegate && this._delegate.spreadsheetStylePropertySelect) {
+            let index = parseInt(this._element.dataset.propertyIndex);
+            this._delegate.spreadsheetStylePropertySelect(index);
+        }
+    }
+
     _isEditable()
     {
         return !this._readOnly && this._property.editable;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to