Changeset 143568 in webkit


Ignore:
Timestamp:
Feb 20, 2013 11:53:49 PM (11 years ago)
Author:
vsevik@chromium.org
Message:

Web Inspector: TabbedEditorContainer and OpenResourceDialog should show uiSourceCode path and name instead of parsedURL
https://bugs.webkit.org/show_bug.cgi?id=110334

Reviewed by Alexander Pavlov.

Source/WebCore:

Introduced uiSourceCode.name() that returns a name based on uiSourceCode path.
OpenResourceDialog now shows uiSourceCode workspace path as a subtitle.
TabbedEditorContainer now shows uiSourceCode name in the tab header.

  • inspector/front-end/FilteredItemSelectionDialog.js:

(WebInspector.OpenResourceDialog.filterOutEmptyURLs):
(WebInspector.OpenResourceDialog):
(WebInspector.OpenResourceDialog.prototype.itemTitleAt):
(WebInspector.OpenResourceDialog.prototype.itemSubtitleAt):
(WebInspector.OpenResourceDialog.prototype.itemKeyAt):

  • inspector/front-end/NavigatorView.js:

(WebInspector.NavigatorView.prototype._updateScriptTitle):

  • inspector/front-end/TabbedEditorContainer.js:

(WebInspector.TabbedEditorContainer.prototype._titleForFile):

  • inspector/front-end/UISourceCode.js:

(WebInspector.UISourceCode.prototype.name):

LayoutTests:

  • inspector/debugger/scripts-file-selector-expected.txt:
  • inspector/debugger/ui-source-code-display-name-expected.txt:
  • inspector/debugger/ui-source-code-display-name.html:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r143560 r143568  
     12013-02-20  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: TabbedEditorContainer and OpenResourceDialog should show uiSourceCode path and name instead of parsedURL
     4        https://bugs.webkit.org/show_bug.cgi?id=110334
     5
     6        Reviewed by Alexander Pavlov.
     7
     8        * inspector/debugger/scripts-file-selector-expected.txt:
     9        * inspector/debugger/ui-source-code-display-name-expected.txt:
     10        * inspector/debugger/ui-source-code-display-name.html:
     11
    1122013-02-20  Mike West  <mkwst@chromium.org>
    213
  • trunk/LayoutTests/inspector/debugger/ui-source-code-display-name-expected.txt

    r103812 r143568  
    33UISourceCode display name for url "http://localhost:8080/folder/filename?parameter=value&nnn=1" is "filename?parameter=value&nnn=1".
    44UISourceCode display name for url "http://localhost:8080/folder/very-long-filename-123456?nn=1" is "very-long-filename-123456?nn=1".
    5 UISourceCode display name for url "http://localhost:8080/folder/too-long-filename-1234567890?nn=1" is "too-long-fil…e-1234567890?nn=1".
    6 UISourceCode display name for url "http://localhost:8080/folder/long-filename?parameter=value&nnn=1" is "long-filename?parameter=value…".
    7 UISourceCode display name for url "http://localhost:8080/folder/too-long-filename-1234567890?parameter=value&nnn=1" is "too-long-fil…e-1234567890?par…".
     5UISourceCode display name for url "http://localhost:8080/folder/too-long-filename-1234567890?nn=1" is "too-long-filena…234567890?nn=1".
     6UISourceCode display name for url "http://localhost:8080/folder/long-filename?parameter=value&nnn=1" is "long-filename?p…er=value&nnn=1".
     7UISourceCode display name for url "http://localhost:8080/folder/too-long-filename-1234567890?parameter=value&nnn=1" is "too-long-filena…er=value&nnn=1".
    88
  • trunk/LayoutTests/inspector/debugger/ui-source-code-display-name.html

    r142259 r143568  
    66{
    77    WebInspector.showPanel("scripts");
     8
     9    function createContentProvider(url)
     10    {
     11        var contentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Script, "", "text/javascript");
     12        contentProvider.requestContent = function(callback)
     13        {
     14            InspectorTest.addResult("Source requested for " + url);
     15            callback("");
     16        };
     17        return contentProvider;
     18    }
     19
     20    var workspace = new WebInspector.Workspace();
     21    workspace.networkWorkspaceProvider = new WebInspector.SimpleWorkspaceProvider(workspace, WebInspector.projectTypes.Network);
     22
     23    function addNetworkFile(url)
     24    {
     25        return workspace.networkWorkspaceProvider.addFileForURL(url, createContentProvider(url), false);
     26    }
     27
    828    function dumpUISourceCodeDisplayName(url)
    929    {
    10         var uiSourceCode = new WebInspector.UISourceCode(null, url, url, url, null);
     30        var uiSourceCode = addNetworkFile(url);
    1131        InspectorTest.addResult("UISourceCode display name for url \"" + url + "\" is \"" + WebInspector.TabbedEditorContainer.prototype._titleForFile(uiSourceCode) + "\".");
    1232    }
  • trunk/Source/WebCore/ChangeLog

    r143567 r143568  
     12013-02-20  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: TabbedEditorContainer and OpenResourceDialog should show uiSourceCode path and name instead of parsedURL
     4        https://bugs.webkit.org/show_bug.cgi?id=110334
     5
     6        Reviewed by Alexander Pavlov.
     7
     8        Introduced uiSourceCode.name() that returns a name based on uiSourceCode path.
     9        OpenResourceDialog now shows uiSourceCode workspace path as a subtitle.
     10        TabbedEditorContainer now shows uiSourceCode name in the tab header.
     11
     12        * inspector/front-end/FilteredItemSelectionDialog.js:
     13        (WebInspector.OpenResourceDialog.filterOutEmptyURLs):
     14        (WebInspector.OpenResourceDialog):
     15        (WebInspector.OpenResourceDialog.prototype.itemTitleAt):
     16        (WebInspector.OpenResourceDialog.prototype.itemSubtitleAt):
     17        (WebInspector.OpenResourceDialog.prototype.itemKeyAt):
     18        * inspector/front-end/NavigatorView.js:
     19        (WebInspector.NavigatorView.prototype._updateScriptTitle):
     20        * inspector/front-end/TabbedEditorContainer.js:
     21        (WebInspector.TabbedEditorContainer.prototype._titleForFile):
     22        * inspector/front-end/UISourceCode.js:
     23        (WebInspector.UISourceCode.prototype.name):
     24
    1252013-02-20  Pavel Feldman  <pfeldman@chromium.org>
    226
  • trunk/Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js

    r141989 r143568  
    586586    function filterOutEmptyURLs(uiSourceCode)
    587587    {
    588         return !!uiSourceCode.parsedURL.lastPathComponent;
     588        return !!uiSourceCode.name();
    589589    }
    590590    this._uiSourceCodes = this._uiSourceCodes.filter(filterOutEmptyURLs);
     
    598598    itemTitleAt: function(itemIndex)
    599599    {
    600         return this._uiSourceCodes[itemIndex].parsedURL.lastPathComponent;
     600        return this._uiSourceCodes[itemIndex].name().trimEnd(100);
    601601    },
    602602
     
    616616    itemSubtitleAt: function(itemIndex)
    617617    {
    618         return this._uiSourceCodes[itemIndex].parsedURL.folderPathComponents;
     618        var uiSourceCode = this._uiSourceCodes[itemIndex]
     619        var projectName = uiSourceCode.project().displayName();
     620        var path = uiSourceCode.path().slice();
     621        path.pop();
     622        path.unshift(projectName);
     623        return path.join("/");
    619624    },
    620625
     
    625630    itemKeyAt: function(itemIndex)
    626631    {
    627         return this._uiSourceCodes[itemIndex].parsedURL.lastPathComponent;
     632        return this._uiSourceCodes[itemIndex].name();
    628633    },
    629634
  • trunk/Source/WebCore/inspector/front-end/TabbedEditorContainer.js

    r141589 r143568  
    171171        const minDisplayQueryParamLength = 5;
    172172
    173         var title;
    174         var parsedURL = uiSourceCode.parsedURL;
    175         if (!parsedURL.isValid)
    176             title = parsedURL.url ? parsedURL.url.trimMiddle(maxDisplayNameLength) : WebInspector.UIString("(program)");
    177         else {
    178             var maxDisplayQueryParamLength = Math.max(minDisplayQueryParamLength, maxDisplayNameLength - parsedURL.lastPathComponent.length);
    179             var displayQueryParams = parsedURL.queryParams ? "?" + parsedURL.queryParams.trimEnd(maxDisplayQueryParamLength - 1) : "";
    180             var displayLastPathComponent = parsedURL.lastPathComponent.trimMiddle(maxDisplayNameLength - displayQueryParams.length);
    181             var displayName = displayLastPathComponent + displayQueryParams;
    182             title = displayName || WebInspector.UIString("(program)");
    183         }
    184        
     173        var title = uiSourceCode.name();
     174        title = title ? title.trimMiddle(maxDisplayNameLength) : WebInspector.UIString("(program)");
    185175        if (uiSourceCode.isDirty())
    186176            title += "*";
  • trunk/Source/WebCore/inspector/front-end/UISourceCode.js

    r143451 r143568  
    9797    {
    9898        return this._path;
     99    },
     100
     101    /**
     102     * @return {string}
     103     */
     104    name: function()
     105    {
     106        return this._path[this._path.length - 1];
    99107    },
    100108
Note: See TracChangeset for help on using the changeset viewer.