Changeset 250618 in webkit


Ignore:
Timestamp:
Oct 2, 2019 11:49:53 AM (5 years ago)
Author:
Devin Rousso
Message:

Web Inspector: REGRESSION(r250149): changing CSS via the Styles details sidebar panel doesn't update the associated resource
https://bugs.webkit.org/show_bug.cgi?id=202446

Reviewed by Joseph Pecoraro.

When updating the text of a WI.CSSProperty (or the selector of a WI.CSSRule) is updated,
Web Inspector will update the backend style sheet, which will notify the WI.CSSManager of
the change, without ever going through the associated WI.SourceCode. WI.CSSManager then
updates the content of the WI.SourceCode to reflect these changes, but at that point the
WI.SourceCode hadn't yet "moved" it's currentRevision forward of it's originalRevision
which means it would get overridden the first time the WI.SourceCode updates itself.

Modify WI.SourceCode such that every path to get the currentRevision ensures that it is
"moved" forward before the WI.SourceCodeRevision value is returned.

  • UserInterface/Models/SourceCode.js:

(WI.SourceCode.prototype.get currentRevision):
(WI.SourceCode.prototype.get content):
(WI.SourceCode.prototype.revisionContentDidChange):
(WI.SourceCode.prototype._initializeCurrentRevisionIfNeeded): Added.
(WI.SourceCode.prototype._processContent):

Location:
trunk/Source/WebInspectorUI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r250580 r250618  
     12019-10-02  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: REGRESSION(r250149): changing CSS via the Styles details sidebar panel doesn't update the associated resource
     4        https://bugs.webkit.org/show_bug.cgi?id=202446
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        When updating the text of a `WI.CSSProperty` (or the selector of a `WI.CSSRule`) is updated,
     9        Web Inspector will update the backend style sheet, which will notify the `WI.CSSManager` of
     10        the change, without ever going through the associated `WI.SourceCode`. `WI.CSSManager` then
     11        updates the content of the `WI.SourceCode` to reflect these changes, but at that point the
     12        `WI.SourceCode` hadn't yet "moved" it's `currentRevision` forward of it's `originalRevision`
     13        which means it would get overridden the first time the `WI.SourceCode` updates itself.
     14
     15        Modify `WI.SourceCode` such that every path to get the `currentRevision` ensures that it is
     16        "moved" forward before the `WI.SourceCodeRevision` value is returned.
     17
     18        * UserInterface/Models/SourceCode.js:
     19        (WI.SourceCode.prototype.get currentRevision):
     20        (WI.SourceCode.prototype.get content):
     21        (WI.SourceCode.prototype.revisionContentDidChange):
     22        (WI.SourceCode.prototype._initializeCurrentRevisionIfNeeded): Added.
     23        (WI.SourceCode.prototype._processContent):
     24
    1252019-10-01  Devin Rousso  <drousso@apple.com>
    226
  • trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js

    r250149 r250618  
    6767    get currentRevision()
    6868    {
     69        this._initializeCurrentRevisionIfNeeded();
    6970        return this._currentRevision;
    7071    }
     
    8788    get content()
    8889    {
    89         return this._currentRevision.content;
     90        return this.currentRevision.content;
    9091    }
    9192
     
    181182            return;
    182183
    183         if (revision !== this._currentRevision)
     184        if (revision !== this.currentRevision)
    184185            return;
    185186
     
    220221
    221222    // Private
     223
     224    _initializeCurrentRevisionIfNeeded()
     225    {
     226        if (this._currentRevision === this._originalRevision)
     227            this.currentRevision = this._originalRevision.copy();
     228    }
    222229
    223230    _processContent(parameters)
     
    238245        this._ignoreRevisionContentDidChangeEvent = false;
    239246
    240         if (this._currentRevision === this._originalRevision)
    241             this.currentRevision = this._originalRevision.copy();
     247        this._initializeCurrentRevisionIfNeeded();
    242248
    243249        // FIXME: Returning the content in this promise is misleading. It may not be current content
Note: See TracChangeset for help on using the changeset viewer.