Changeset 238882 in webkit


Ignore:
Timestamp:
Dec 4, 2018 5:37:03 PM (5 years ago)
Author:
Nikita Vasilyev
Message:

Web Inspector: Add style editing debug mode
https://bugs.webkit.org/show_bug.cgi?id=192282
<rdar://problem/46399176>

Reviewed by Matt Baker.

Introduce a style editing debug mode to help to troubleshoot complex bugs in the style editor.

  • Log CSS changes;
  • Display red border for locked style declarations.
  • UserInterface/Base/Setting.js:
  • UserInterface/Models/CSSProperty.js:

(WI.CSSProperty.prototype._updateOwnerStyleText):

  • UserInterface/Views/SettingsTabContentView.js:

(WI.SettingsTabContentView.prototype._createDebugSettingsView):

  • UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.css:

(.spreadsheet-style-declaration-editor.debug-style-locked::after):

  • UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js:

(WI.SpreadsheetCSSStyleDeclarationEditor.prototype.layout):
(WI.SpreadsheetCSSStyleDeclarationEditor.prototype._updateStyleLock):
(WI.SpreadsheetCSSStyleDeclarationEditor.prototype._updateDebugLockStatus):

Location:
trunk/Source/WebInspectorUI
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r238871 r238882  
     12018-12-04  Nikita Vasilyev  <nvasilyev@apple.com>
     2
     3        Web Inspector: Add style editing debug mode
     4        https://bugs.webkit.org/show_bug.cgi?id=192282
     5        <rdar://problem/46399176>
     6
     7        Reviewed by Matt Baker.
     8
     9        Introduce a style editing debug mode to help to troubleshoot complex bugs in the style editor.
     10
     11          - Log CSS changes;
     12          - Display red border for locked style declarations.
     13
     14        * UserInterface/Base/Setting.js:
     15        * UserInterface/Models/CSSProperty.js:
     16        (WI.CSSProperty.prototype._updateOwnerStyleText):
     17        * UserInterface/Views/SettingsTabContentView.js:
     18        (WI.SettingsTabContentView.prototype._createDebugSettingsView):
     19        * UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.css:
     20        (.spreadsheet-style-declaration-editor.debug-style-locked::after):
     21        * UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js:
     22        (WI.SpreadsheetCSSStyleDeclarationEditor.prototype.layout):
     23        (WI.SpreadsheetCSSStyleDeclarationEditor.prototype._updateStyleLock):
     24        (WI.SpreadsheetCSSStyleDeclarationEditor.prototype._updateDebugLockStatus):
     25
    1262018-12-04  Matt Baker  <mattbaker@apple.com>
    227
  • trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js

    r238649 r238882  
    139139    autoLogTimeStats: new WI.Setting("auto-collect-time-stats", false),
    140140    enableLayoutFlashing: new WI.Setting("enable-layout-flashing", false),
     141    enableStyleEditingDebugMode: new WI.Setting("enable-style-editing-debug-mode", false),
    141142    enableUncaughtExceptionReporter: new WI.Setting("enable-uncaught-exception-reporter", true),
    142143    filterMultiplexingBackendInspectorProtocolMessages: new WI.Setting("filter-multiplexing-backend-inspector-protocol-messages", true),
  • trunk/Source/WebInspectorUI/UserInterface/Models/CSSProperty.js

    r237659 r238882  
    370370        console.assert(oldText === styleText.slice(range.startOffset, range.endOffset), "_styleSheetTextRange data is invalid.");
    371371
     372        if (WI.settings.enableStyleEditingDebugMode.value) {
     373            let prefix = styleText.slice(0, range.startOffset);
     374            let postfix = styleText.slice(range.endOffset);
     375            console.info(`${prefix}%c${oldText}%c${newText}%c${postfix}`, `background: hsl(356, 100%, 90%); color: black`, `background: hsl(100, 100%, 91%); color: black`, `background: transparent`);
     376        }
     377
    372378        let newStyleText = this._appendSemicolonIfNeeded(styleText.slice(0, range.startOffset)) + newText + styleText.slice(range.endOffset);
    373379
  • trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js

    r238649 r238882  
    318318        this._debugSettingsView.addSeparator();
    319319
     320        this._debugSettingsView.addSetting(WI.unlocalizedString("Styles:"), WI.settings.enableStyleEditingDebugMode, WI.unlocalizedString("Enable style editing debug mode"));
     321
     322        this._debugSettingsView.addSeparator();
     323
    320324        this._debugSettingsView.addSetting(WI.unlocalizedString("Debugging:"), WI.settings.pauseForInternalScripts, WI.unlocalizedString("Pause in WebKit-internal scripts"));
    321325
  • trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.css

    r238762 r238882  
    165165}
    166166
     167.spreadsheet-style-declaration-editor.debug-style-locked::after {
     168    content: "";
     169    position: absolute;
     170    top: 0;
     171    bottom: 0;
     172    right: 0;
     173    width: 2px;
     174    background-color: red;
     175    pointer-events: none;
     176}
     177
    167178@media (prefers-dark-interface) {
    168179    .spreadsheet-style-declaration-editor {
  • trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetCSSStyleDeclarationEditor.js

    r238813 r238882  
    113113        else if (this.hasSelectedProperties())
    114114            this.selectProperties(this._anchorIndex, this._focusIndex);
     115
     116        this._updateDebugLockStatus();
    115117    }
    116118
     
    611613
    612614        this._style.locked = this._focused || this._inlineSwatchActive;
     615        this._updateDebugLockStatus();
     616    }
     617
     618    _updateDebugLockStatus()
     619    {
     620        if (!this._style || !WI.settings.enableStyleEditingDebugMode.value)
     621            return;
     622
     623        this.element.classList.toggle("debug-style-locked", this._style.locked);
    613624    }
    614625};
Note: See TracChangeset for help on using the changeset viewer.