Changeset 51156 in webkit


Ignore:
Timestamp:
Nov 18, 2009 4:52:47 PM (14 years ago)
Author:
eric@webkit.org
Message:

2009-11-18 Patrick Mueller <Patrick_Mueller@us.ibm.com>

Reviewed by Pavel Feldman.

Web Inspector - remember last script displayed in Scripts panel
https://bugs.webkit.org/show_bug.cgi?id=27552

Manual test added

  • inspector/front-end/ScriptsPanel.js: (WebInspector.ScriptsPanel.prototype.showScript): (WebInspector.ScriptsPanel.prototype.showResource): (WebInspector.ScriptsPanel.prototype._showScriptOrResource): (WebInspector.ScriptsPanel.prototype._addScriptToFilesMenu): (WebInspector.ScriptsPanel.prototype._callFrameSelected): (WebInspector.ScriptsPanel.prototype._goBack): (WebInspector.ScriptsPanel.prototype._goForward):
  • manual-tests/inspector/remember-last-script.html: Added.
Location:
trunk/WebCore
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r51155 r51156  
     12009-11-18  Patrick Mueller  <Patrick_Mueller@us.ibm.com>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector - remember last script displayed in Scripts panel
     6        https://bugs.webkit.org/show_bug.cgi?id=27552
     7
     8        Manual test added
     9       
     10        * inspector/front-end/ScriptsPanel.js:
     11        (WebInspector.ScriptsPanel.prototype.showScript):
     12        (WebInspector.ScriptsPanel.prototype.showResource):
     13        (WebInspector.ScriptsPanel.prototype._showScriptOrResource):
     14        (WebInspector.ScriptsPanel.prototype._addScriptToFilesMenu):
     15        (WebInspector.ScriptsPanel.prototype._callFrameSelected):
     16        (WebInspector.ScriptsPanel.prototype._goBack):
     17        (WebInspector.ScriptsPanel.prototype._goForward):
     18        * manual-tests/inspector/remember-last-script.html: Added.
     19
    1202009-11-18  Shinichiro Hamaji  <hamaji@chromium.org>
    221
  • trunk/WebCore/inspector/front-end/ScriptsPanel.js

    r50880 r51156  
    502502    showScript: function(script, line)
    503503    {
    504         this._showScriptOrResource(script, line, true);
     504        this._showScriptOrResource(script, {line: line, shouldHighlightLine: true});
    505505    },
    506506
    507507    showResource: function(resource, line)
    508508    {
    509         this._showScriptOrResource(resource, line, true);
     509        this._showScriptOrResource(resource, {line: line, shouldHighlightLine: true});
    510510    },
    511511
     
    575575    },
    576576
    577     _showScriptOrResource: function(scriptOrResource, line, shouldHighlightLine, fromBackForwardAction)
    578     {
     577    _showScriptOrResource: function(scriptOrResource, options)
     578    {
     579        // options = {line:, shouldHighlightLine:, fromBackForwardAction:, initialLoad:}
     580        if (!options)
     581            options = {};
     582
    579583        if (!scriptOrResource)
    580584            return;
     
    602606            return;
    603607
    604         if (!fromBackForwardAction) {
     608        var url = scriptOrResource.url || scriptOrResource.sourceURL;
     609        if (url && !options.initialLoad)
     610            InspectorController.setSetting("LastViewedScriptFile", url);
     611
     612        if (!options.fromBackForwardAction) {
    605613            var oldIndex = this._currentBackForwardIndex;
    606614            if (oldIndex >= 0)
     
    623631        this.visibleView = view;
    624632
    625         if (line) {
     633        if (options.line) {
    626634            if (view.revealLine)
    627                 view.revealLine(line);
    628             if (view.highlightLine && shouldHighlightLine)
    629                 view.highlightLine(line);
     635                view.revealLine(options.line);
     636            if (view.highlightLine && options.shouldHighlightLine)
     637                view.highlightLine(options.line);
    630638        }
    631639
     
    643651            console.assert(option);
    644652        } else {
    645             var url = scriptOrResource.url;
    646653            var script = this._scriptsForURLsInFilesSelect[url];
    647654            if (script)
     
    700707        // This will happen for the first item added to the menu.
    701708        if (select.options[select.selectedIndex] === option)
    702             this._showScriptOrResource(option.representedObject);
     709            this._showScriptOrResource(option.representedObject, {initialLoad: true});
     710        else {
     711            // if not first item, check to see if this was the last viewed
     712            var url = option.representedObject.url || option.representedObject.sourceURL;
     713            var lastURL = InspectorController.setting("LastViewedScriptFile");
     714            if (url && url === lastURL)
     715                this._showScriptOrResource(option.representedObject, {initialLoad: true});
     716        }
    703717    },
    704718
     
    723737
    724738        var scriptOrResource = this._sourceIDMap[currentFrame.sourceID];
    725         this._showScriptOrResource(scriptOrResource, currentFrame.line);
     739        this._showScriptOrResource(scriptOrResource, {line: currentFrame.line});
    726740
    727741        this._executionSourceFrame = this._sourceFrameForScriptOrResource(scriptOrResource);
     
    842856        }
    843857
    844         this._showScriptOrResource(this._backForwardList[--this._currentBackForwardIndex], null, false, true);
     858        this._showScriptOrResource(this._backForwardList[--this._currentBackForwardIndex], {fromBackForwardAction: true});
    845859        this._updateBackAndForwardButtons();
    846860    },
     
    853867        }
    854868
    855         this._showScriptOrResource(this._backForwardList[++this._currentBackForwardIndex], null, false, true);
     869        this._showScriptOrResource(this._backForwardList[++this._currentBackForwardIndex], {fromBackForwardAction: true});
    856870        this._updateBackAndForwardButtons();
    857871    },
Note: See TracChangeset for help on using the changeset viewer.