Changeset 241980 in webkit


Ignore:
Timestamp:
Feb 22, 2019 8:07:58 PM (5 years ago)
Author:
Devin Rousso
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.

Location:
trunk/Source/WebInspectorUI
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r241975 r241980  
     12019-02-22  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Styles Redesign: clicking CSS property or selector should always select its text
     4        https://bugs.webkit.org/show_bug.cgi?id=180791
     5        <rdar://problem/36038366>
     6
     7        Reviewed by Brian Burg.
     8
     9        * UserInterface/Views/SpreadsheetSelectorField.js:
     10        (WI.SpreadsheetSelectorField):
     11        (WI.SpreadsheetSelectorField.prototype.startEditing):
     12        (WI.SpreadsheetSelectorField.prototype.stopEditing):
     13        (WI.SpreadsheetSelectorField.prototype._handleMouseDown): Added.
     14        (WI.SpreadsheetSelectorField.prototype._handleMouseUp): Added.
     15        (WI.SpreadsheetSelectorField.prototype._handleFocus): Deleted.
     16
     17        * UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js:
     18        (WI.SpreadsheetCSSStyleDeclarationSection.prototype.initialLayout):
     19        * UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.css:
     20        (.spreadsheet-css-declaration .selector.editing:focus, .spreadsheet-css-declaration .selector > .matched): Added.
     21        (.spreadsheet-css-declaration .selector.spreadsheet-selector-field):
     22        (.spreadsheet-css-declaration .selector:focus, .spreadsheet-css-declaration .selector > .matched): Deleted.
     23
    1242019-02-22  Nikita Vasilyev  <nvasilyev@apple.com>
    225
  • trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.css

    r241638 r241980  
    104104}
    105105
    106 .spreadsheet-css-declaration .selector:focus,
     106.spreadsheet-css-declaration .selector.editing:focus,
    107107.spreadsheet-css-declaration .selector > .matched {
    108108    color: var(--text-color);
     
    120120
    121121.spreadsheet-css-declaration .selector.spreadsheet-selector-field {
    122     outline-offset: -3px;
     122    outline: none;
    123123}
    124124
  • trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationSection.js

    r241226 r241980  
    8282        if (this._style.selectorEditable) {
    8383            this._selectorTextField = new WI.SpreadsheetSelectorField(this, this._selectorElement);
     84            this._selectorTextField.addEventListener(WI.SpreadsheetSelectorField.Event.StartedEditing, (event) => {
     85                this._headerElement.classList.add("editing-selector");
     86            });
     87            this._selectorTextField.addEventListener(WI.SpreadsheetSelectorField.Event.StoppedEditing, (event) => {
     88                this._headerElement.classList.remove("editing-selector");
     89            });
     90
    8491            this._selectorElement.tabIndex = 0;
    85             this._selectorElement.addEventListener("focus", () => this._headerElement.classList.add("editing-selector"));
    86             this._selectorElement.addEventListener("blur", () => this._headerElement.classList.remove("editing-selector"));
    8792        }
    8893
  • trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetSelectorField.js

    r239527 r241980  
    2424 */
    2525
    26 WI.SpreadsheetSelectorField = class SpreadsheetSelectorField
     26WI.SpreadsheetSelectorField = class SpreadsheetSelectorField extends WI.Object
    2727{
    2828    constructor(delegate, element)
    2929    {
     30        super();
     31
    3032        this._delegate = delegate;
    3133        this._element = element;
    3234        this._element.classList.add("spreadsheet-selector-field");
    3335
    34         this._element.addEventListener("focus", this._handleFocus.bind(this));
     36        this._element.addEventListener("mousedown", this._handleMouseDown.bind(this));
     37        this._element.addEventListener("mouseup", this._handleMouseUp.bind(this));
    3538        this._element.addEventListener("blur", this._handleBlur.bind(this));
    3639        this._element.addEventListener("keydown", this._handleKeyDown.bind(this));
    3740
    3841        this._editing = false;
     42        this._handledMouseDown = false;
    3943    }
    4044
     
    6064
    6165        this._selectText();
     66
     67        this.dispatchEventToListeners(WI.SpreadsheetSelectorField.Event.StartedEditing);
    6268    }
    6369
     
    7076        this._element.classList.remove("editing");
    7177        this._element.contentEditable = false;
     78
     79        this.dispatchEventToListeners(WI.SpreadsheetSelectorField.Event.StoppedEditing);
    7280    }
    7381
     
    7987    }
    8088
    81     _handleFocus(event)
     89    _handleMouseDown(event)
    8290    {
     91        this._handledMouseDown = true;
     92    }
     93
     94    _handleMouseUp(event)
     95    {
     96        if (!this._handledMouseDown)
     97            return;
     98
     99        this._handledMouseDown = false;
     100
    83101        this.startEditing();
    84102    }
     
    131149    }
    132150};
     151
     152WI.SpreadsheetSelectorField.Event = {
     153    StartedEditing: "spreadsheet-selector-field-started-editing",
     154    StoppedEditing: "spreadsheet-selector-field-stopped-editing",
     155};
Note: See TracChangeset for help on using the changeset viewer.