Title: [238135] trunk/Source/WebInspectorUI
Revision
238135
Author
nvasil...@apple.com
Date
2018-11-13 10:40:00 -0800 (Tue, 13 Nov 2018)

Log Message

Web Inspector: Styles: Command-A should select all properties
https://bugs.webkit.org/show_bug.cgi?id=191435
<rdar://problem/45921373>

Reviewed by Devin Rousso.

When focused on a style property, Command-A on Mac (Control-A on other platforms)
should select all properties of the style rule.

* UserInterface/Base/Utilities.js:
* UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js:
(WI.SpreadsheetCSSStyleDeclarationEditor.prototype.selectProperties):
(WI.SpreadsheetCSSStyleDeclarationEditor.prototype._handleKeyDown):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (238134 => 238135)


--- trunk/Source/WebInspectorUI/ChangeLog	2018-11-13 17:35:56 UTC (rev 238134)
+++ trunk/Source/WebInspectorUI/ChangeLog	2018-11-13 18:40:00 UTC (rev 238135)
@@ -1,3 +1,19 @@
+2018-11-13  Nikita Vasilyev  <nvasil...@apple.com>
+
+        Web Inspector: Styles: Command-A should select all properties
+        https://bugs.webkit.org/show_bug.cgi?id=191435
+        <rdar://problem/45921373>
+
+        Reviewed by Devin Rousso.
+
+        When focused on a style property, Command-A on Mac (Control-A on other platforms)
+        should select all properties of the style rule.
+
+        * UserInterface/Base/Utilities.js:
+        * UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js:
+        (WI.SpreadsheetCSSStyleDeclarationEditor.prototype.selectProperties):
+        (WI.SpreadsheetCSSStyleDeclarationEditor.prototype._handleKeyDown):
+
 2018-11-12  Devin Rousso  <drou...@apple.com>
 
         Web Inspector: Network: show secure certificate details per-request

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js (238134 => 238135)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js	2018-11-13 17:35:56 UTC (rev 238134)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js	2018-11-13 18:40:00 UTC (rev 238135)
@@ -422,6 +422,14 @@
     }
 });
 
+Object.defineProperty(KeyboardEvent.prototype, "commandOrControlKey",
+{
+    get()
+    {
+        return WI.Platform.name === "mac" ? this.metaKey : this.ctrlKey;
+    }
+});
+
 Object.defineProperty(Array, "isTypedArray",
 {
     value(array)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js (238134 => 238135)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js	2018-11-13 17:35:56 UTC (rev 238134)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js	2018-11-13 18:40:00 UTC (rev 238135)
@@ -342,8 +342,10 @@
             propertyView.selected = isSelected;
         }
 
+        this._suppressBlur = true;
         let property = this._propertyViews[focusIndex];
         property.element.focus();
+        this._suppressBlur = false;
     }
 
     deselectProperties()
@@ -501,11 +503,7 @@
             let delta = event.key === "ArrowUp" ? -1 : 1;
             let focusIndex = Number.constrain(this._focusIndex + delta, 0, this._propertyViews.length - 1);
 
-            // Blur event deselects all properties.
-            this._suppressBlur = true;
             this.selectProperties(focusIndex, focusIndex);
-            this._suppressBlur = false;
-
             event.stop();
         } else if (event.key === "Tab" || event.key === "Enter") {
             if (!this._hasSelectedProperties())
@@ -534,15 +532,12 @@
             for (let i = endIndex; i >= startIndex; i--)
                 this._propertyViews[i].remove();
 
-            if (!isNaN(propertyIndexToSelect)) {
-                this._suppressBlur = true;
+            if (!isNaN(propertyIndexToSelect))
                 this.selectProperties(propertyIndexToSelect, propertyIndexToSelect);
-                this._suppressBlur = false;
-            }
 
             event.stop();
 
-        } else if ((event.code === "Space" && !event.shiftKey && !event.metaKey && !event.ctrlKey) || (event.key === "/" && (event.metaKey || event.ctrlKey) && !event.shiftKey)) {
+        } else if ((event.code === "Space" && !event.shiftKey && !event.metaKey && !event.ctrlKey) || (event.key === "/" && event.commandOrControlKey && !event.shiftKey)) {
             if (!this._hasSelectedProperties())
                 return;
 
@@ -559,6 +554,14 @@
 
             event.preventDefault();
 
+        } else if (event.key === "a" && event.commandOrControlKey) {
+            // FIXME: Check this.editing instead of _hasSelectedProperties() once <https://webkit.org/b/191567> is resolved.
+            if (!this._hasSelectedProperties() || !this._propertyViews.length)
+                return;
+
+            this.selectProperties(0, this._propertyViews.length - 1);
+            event.stop();
+
         } else if (event.key === "Esc")
             this.deselectProperties();
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to