Changeset 242063 in webkit


Ignore:
Timestamp:
Feb 25, 2019 5:50:44 PM (5 years ago)
Author:
Nikita Vasilyev
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):

Location:
trunk/Source/WebInspectorUI
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r242061 r242063  
     12019-02-25  Nikita Vasilyev  <nvasilyev@apple.com>
     2
     3        Web Inspector: Styles: Command-/ should toggle edited property
     4        https://bugs.webkit.org/show_bug.cgi?id=194967
     5        <rdar://problem/48329852>
     6
     7        Reviewed by Devin Rousso.
     8
     9        * UserInterface/Models/CSSProperty.js:
     10        (WI.CSSProperty.prototype.commentOut):
     11        * UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js:
     12        (WI.SpreadsheetCSSStyleDeclarationEditor.prototype.spreadsheetStylePropertySelect):
     13        * UserInterface/Views/SpreadsheetStyleProperty.js:
     14        (WI.SpreadsheetStyleProperty.prototype.update):
     15        (WI.SpreadsheetStyleProperty.prototype._toggle):
     16        (WI.SpreadsheetStyleProperty.prototype._select):
     17
    1182019-02-25  Devin Rousso  <drousso@apple.com>
    219
  • trunk/Source/WebInspectorUI/UserInterface/Models/CSSProperty.js

    r241209 r242063  
    144144    commentOut(disabled)
    145145    {
    146         console.assert(this._enabled === disabled, "CSS property is already " + (disabled ? "disabled" : "enabled"));
    147146        if (this._enabled === !disabled)
    148147            return;
  • trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js

    r240314 r242063  
    451451    }
    452452
     453    spreadsheetStylePropertySelect(index)
     454    {
     455        this.selectProperties(index, index);
     456    }
     457
    453458    spreadsheetStylePropertyAddBlankPropertySoon(propertyView, {index})
    454459    {
  • trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js

    r241740 r242063  
    6868            });
    6969
     70            new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, WI.KeyboardShortcut.Key.Slash, () => {
     71                this._toggle();
     72                this._select();
     73            }, this._element);
     74
    7075            this._element.copyHandler = this;
    7176        }
     
    157162            this._checkboxElement.addEventListener("click", (event) => {
    158163                event.stopPropagation();
    159                 let disabled = !this._checkboxElement.checked;
    160                 this._property.commentOut(disabled);
    161                 this.update();
     164                this._toggle();
     165                console.assert(this._checkboxElement.checked === this._property.enabled);
    162166            });
    163167        }
     
    408412
    409413    // Private
     414
     415    _toggle()
     416    {
     417        this._property.commentOut(this.property.enabled);
     418        this.update();
     419    }
     420
     421    _select()
     422    {
     423        if (this._delegate && this._delegate.spreadsheetStylePropertySelect) {
     424            let index = parseInt(this._element.dataset.propertyIndex);
     425            this._delegate.spreadsheetStylePropertySelect(index);
     426        }
     427    }
    410428
    411429    _isEditable()
Note: See TracChangeset for help on using the changeset viewer.