Title: [241980] trunk/Source/WebInspectorUI
- Revision
- 241980
- Author
- [email protected]
- Date
- 2019-02-22 20:07:58 -0800 (Fri, 22 Feb 2019)
Log Message
Web Inspector: Styles Redesign: clicking CSS property or selector should always select its text
https://bugs.webkit.org/show_bug.cgi?id=180791
<rdar://problem/36038366>
Reviewed by Brian Burg.
* UserInterface/Views/SpreadsheetSelectorField.js:
(WI.SpreadsheetSelectorField):
(WI.SpreadsheetSelectorField.prototype.startEditing):
(WI.SpreadsheetSelectorField.prototype.stopEditing):
(WI.SpreadsheetSelectorField.prototype._handleMouseDown): Added.
(WI.SpreadsheetSelectorField.prototype._handleMouseUp): Added.
(WI.SpreadsheetSelectorField.prototype._handleFocus): Deleted.
* UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:
(WI.SpreadsheetCSSStyleDeclarationSection.prototype.initialLayout):
* UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.css:
(.spreadsheet-css-declaration .selector.editing:focus, .spreadsheet-css-declaration .selector > .matched): Added.
(.spreadsheet-css-declaration .selector.spreadsheet-selector-field):
(.spreadsheet-css-declaration .selector:focus, .spreadsheet-css-declaration .selector > .matched): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (241979 => 241980)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-02-23 04:05:55 UTC (rev 241979)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-02-23 04:07:58 UTC (rev 241980)
@@ -1,3 +1,26 @@
+2019-02-22 Devin Rousso <[email protected]>
+
+ Web Inspector: Styles Redesign: clicking CSS property or selector should always select its text
+ https://bugs.webkit.org/show_bug.cgi?id=180791
+ <rdar://problem/36038366>
+
+ Reviewed by Brian Burg.
+
+ * UserInterface/Views/SpreadsheetSelectorField.js:
+ (WI.SpreadsheetSelectorField):
+ (WI.SpreadsheetSelectorField.prototype.startEditing):
+ (WI.SpreadsheetSelectorField.prototype.stopEditing):
+ (WI.SpreadsheetSelectorField.prototype._handleMouseDown): Added.
+ (WI.SpreadsheetSelectorField.prototype._handleMouseUp): Added.
+ (WI.SpreadsheetSelectorField.prototype._handleFocus): Deleted.
+
+ * UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:
+ (WI.SpreadsheetCSSStyleDeclarationSection.prototype.initialLayout):
+ * UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.css:
+ (.spreadsheet-css-declaration .selector.editing:focus, .spreadsheet-css-declaration .selector > .matched): Added.
+ (.spreadsheet-css-declaration .selector.spreadsheet-selector-field):
+ (.spreadsheet-css-declaration .selector:focus, .spreadsheet-css-declaration .selector > .matched): Deleted.
+
2019-02-22 Nikita Vasilyev <[email protected]>
Web Inspector: Dark Mode: DOM Content Loaded blue marker is too dark
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.css (241979 => 241980)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.css 2019-02-23 04:05:55 UTC (rev 241979)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.css 2019-02-23 04:07:58 UTC (rev 241980)
@@ -103,7 +103,7 @@
color: var(--text-color-secondary);
}
-.spreadsheet-css-declaration .selector:focus,
+.spreadsheet-css-declaration .selector.editing:focus,
.spreadsheet-css-declaration .selector > .matched {
color: var(--text-color);
}
@@ -119,7 +119,7 @@
}
.spreadsheet-css-declaration .selector.spreadsheet-selector-field {
- outline-offset: -3px;
+ outline: none;
}
.spreadsheet-css-declaration .selector.spreadsheet-selector-field.editing {
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js (241979 => 241980)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js 2019-02-23 04:05:55 UTC (rev 241979)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js 2019-02-23 04:07:58 UTC (rev 241980)
@@ -81,9 +81,14 @@
if (this._style.selectorEditable) {
this._selectorTextField = new WI.SpreadsheetSelectorField(this, this._selectorElement);
+ this._selectorTextField.addEventListener(WI.SpreadsheetSelectorField.Event.StartedEditing, (event) => {
+ this._headerElement.classList.add("editing-selector");
+ });
+ this._selectorTextField.addEventListener(WI.SpreadsheetSelectorField.Event.StoppedEditing, (event) => {
+ this._headerElement.classList.remove("editing-selector");
+ });
+
this._selectorElement.tabIndex = 0;
- this._selectorElement.addEventListener("focus", () => this._headerElement.classList.add("editing-selector"));
- this._selectorElement.addEventListener("blur", () => this._headerElement.classList.remove("editing-selector"));
}
this._propertiesEditor = new WI.SpreadsheetCSSStyleDeclarationEditor(this, this._style);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetSelectorField.js (241979 => 241980)
--- trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetSelectorField.js 2019-02-23 04:05:55 UTC (rev 241979)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetSelectorField.js 2019-02-23 04:07:58 UTC (rev 241980)
@@ -23,19 +23,23 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-WI.SpreadsheetSelectorField = class SpreadsheetSelectorField
+WI.SpreadsheetSelectorField = class SpreadsheetSelectorField extends WI.Object
{
constructor(delegate, element)
{
+ super();
+
this._delegate = delegate;
this._element = element;
this._element.classList.add("spreadsheet-selector-field");
- this._element.addEventListener("focus", this._handleFocus.bind(this));
+ this._element.addEventListener("mousedown", this._handleMouseDown.bind(this));
+ this._element.addEventListener("mouseup", this._handleMouseUp.bind(this));
this._element.addEventListener("blur", this._handleBlur.bind(this));
this._element.addEventListener("keydown", this._handleKeyDown.bind(this));
this._editing = false;
+ this._handledMouseDown = false;
}
// Public
@@ -59,6 +63,8 @@
element.textContent = element.textContent;
this._selectText();
+
+ this.dispatchEventToListeners(WI.SpreadsheetSelectorField.Event.StartedEditing);
}
stopEditing()
@@ -69,6 +75,8 @@
this._editing = false;
this._element.classList.remove("editing");
this._element.contentEditable = false;
+
+ this.dispatchEventToListeners(WI.SpreadsheetSelectorField.Event.StoppedEditing);
}
// Private
@@ -78,8 +86,18 @@
window.getSelection().selectAllChildren(this._element);
}
- _handleFocus(event)
+ _handleMouseDown(event)
{
+ this._handledMouseDown = true;
+ }
+
+ _handleMouseUp(event)
+ {
+ if (!this._handledMouseDown)
+ return;
+
+ this._handledMouseDown = false;
+
this.startEditing();
}
@@ -130,3 +148,8 @@
}
}
};
+
+WI.SpreadsheetSelectorField.Event = {
+ StartedEditing: "spreadsheet-selector-field-started-editing",
+ StoppedEditing: "spreadsheet-selector-field-stopped-editing",
+};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes