Changeset 88936 in webkit


Ignore:
Timestamp:
Jun 15, 2011 8:17:57 AM (13 years ago)
Author:
podivilov@chromium.org
Message:

2011-06-15 Pavel Podivilov <podivilov@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: script select can be too wide.
https://bugs.webkit.org/show_bug.cgi?id=62701

  • inspector/debugger/scripts-panel-expected.txt:
  • inspector/debugger/scripts-panel.html:

2011-06-15 Pavel Podivilov <podivilov@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: script select can be too wide.
https://bugs.webkit.org/show_bug.cgi?id=62701

  • inspector/front-end/ScriptsPanel.js: (WebInspector.ScriptsPanel.prototype._displayNameForScriptURL): (WebInspector.ScriptsPanel.prototype._createSourceFrame): (WebInspector.SourceFrameDelegateForScriptsPanel): (WebInspector.SourceFrameDelegateForScriptsPanel.prototype.suggestedFileName):
  • inspector/front-end/SourceFile.js:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r88934 r88936  
     12011-06-15  Pavel Podivilov  <podivilov@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: script select can be too wide.
     6        https://bugs.webkit.org/show_bug.cgi?id=62701
     7
     8        * inspector/debugger/scripts-panel-expected.txt:
     9        * inspector/debugger/scripts-panel.html:
     10
    1112011-06-15  Noel Gordon  <noel.gordon@gmail.com>
    212
  • trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt

    r88931 r88936  
    1111
    1212Running: testFilesSelect
    13 text: script.js, tooltip: ...foo/bar/script.js
    14 text: script.js, tooltip: ...foo/bar/script.js?a=1
    15 text: script.js, tooltip: ...foo/bar/script.js?a=2
    16 text: script.js, tooltip: ...foo/baz/script.js
    17 text: Content scripts, tooltip: ...
    18 text: contentScript.js, tooltip: ...foo/bar/contentScript.js?a=1
    19 text: contentScript.js, tooltip: ...foo/bar/contentScript.js?a=2
    20 text: contentScript2.js, tooltip: ...foo/bar/contentScript2.js?a=1
     13text: ?a=b, tooltip: ?a=b
     14text: example.com/, tooltip: http://example.com/?a=b
     15text: script.js, tooltip: <root>/foo/bar/script.js
     16text: script.js, tooltip: <root>/foo/bar/script.js?a=1
     17text: script.js, tooltip: <root>/foo/bar/script.js?a=2
     18text: script.js, tooltip: <root>/foo/baz/script.js
     19text: very_loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo..., tooltip: very_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_url
     20text: Content scripts, tooltip:
     21text: contentScript.js, tooltip: <root>/foo/bar/contentScript.js?a=1
     22text: contentScript.js, tooltip: <root>/foo/bar/contentScript.js?a=2
     23text: contentScript2.js, tooltip: <root>/foo/bar/contentScript2.js?a=1
    2124Debugger was disabled.
    2225
  • trunk/LayoutTests/inspector/debugger/scripts-panel.html

    r88931 r88936  
    130130            var rootURL = WebInspector.mainResource.url.substring(0, WebInspector.mainResource.url.lastIndexOf("/") + 1);
    131131            var nextId = 0;
    132 
    133132            function addOption(url, isContentScript)
    134133            {
    135                 var displayName = url;
    136                 var indexOfQuery = displayName.indexOf("?");
    137                 if (indexOfQuery !== -1)
    138                     displayName = displayName.substring(0, indexOfQuery);
    139                 var lastSlashIndex = displayName.lastIndexOf("/");
    140                 if (lastSlashIndex !== -1)
    141                     displayName = displayName.substring(lastSlashIndex + 1);
    142                 panel._addOptionToFilesSelect({ id: nextId++, url: rootURL + url, displayName: displayName, isContentScript: isContentScript });
     134                panel._addOptionToFilesSelect({ id: nextId++, url: url, isContentScript: isContentScript });
    143135            }
    144             addOption("foo/bar/script.js", false);
    145             addOption("foo/bar/contentScript2.js?a=1", true);
    146             addOption("foo/bar/script.js?a=2", false);
    147             addOption("foo/bar/contentScript.js?a=2", true);
    148             addOption("foo/bar/script.js?a=1", false);
    149             addOption("foo/baz/script.js", false);
    150             addOption("foo/bar/contentScript.js?a=1", true);
     136            addOption(rootURL + "foo/bar/script.js", false);
     137            addOption(rootURL + "foo/bar/contentScript2.js?a=1", true);
     138            addOption(rootURL + "foo/bar/script.js?a=2", false);
     139            addOption(rootURL + "foo/bar/contentScript.js?a=2", true);
     140            addOption(rootURL + "foo/bar/script.js?a=1", false);
     141            addOption(rootURL + "foo/baz/script.js", false);
     142            addOption(rootURL + "foo/bar/contentScript.js?a=1", true);
     143            addOption("http://example.com/?a=b", false);
     144            addOption("?a=b", false);
     145            addOption("very_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_url", false);
     146
    151147            var select = panel._filesSelectElement;
    152148            for (var i = 0; i < select.length; ++i) {
    153149                var option = select[i];
    154                 var tooltip = "..." + option.title.substring(rootURL.length);
     150                var tooltip = option.title.replace(rootURL, "<root>/");
    155151                InspectorTest.addResult("text: " + option.text + ", tooltip: " + tooltip);
    156152            }
  • trunk/Source/WebCore/ChangeLog

    r88934 r88936  
     12011-06-15  Pavel Podivilov  <podivilov@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: script select can be too wide.
     6        https://bugs.webkit.org/show_bug.cgi?id=62701
     7
     8        * inspector/front-end/ScriptsPanel.js:
     9        (WebInspector.ScriptsPanel.prototype._displayNameForScriptURL):
     10        (WebInspector.ScriptsPanel.prototype._createSourceFrame):
     11        (WebInspector.SourceFrameDelegateForScriptsPanel):
     12        (WebInspector.SourceFrameDelegateForScriptsPanel.prototype.suggestedFileName):
     13        * inspector/front-end/SourceFile.js:
     14
    1152011-06-15  Noel Gordon  <noel.gordon@gmail.com>
    216
  • trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js

    r88931 r88936  
    253253        var select = this._filesSelectElement;
    254254        var option = document.createElement("option");
    255         option.text = sourceFile.displayName;
     255        option.text = this._displayNameForScriptURL(sourceFile.url) || WebInspector.UIString("(program)");
    256256        option.title = sourceFile.url;
    257257        option.isContentScript = sourceFile.isContentScript;
     
    291291        option._sourceFileId = sourceFile.id;
    292292        this._sourceFileIdToFilesSelectOption[sourceFile.id] = option;
     293    },
     294
     295    _displayNameForScriptURL: function(url)
     296    {
     297        var displayName = url;
     298        var indexOfQuery = displayName.indexOf("?");
     299        if (indexOfQuery > 0)
     300            displayName = displayName.substring(0, indexOfQuery);
     301        var fromIndex = displayName.lastIndexOf("/", displayName.length - 2);
     302        if (fromIndex !== -1)
     303            displayName = displayName.substring(fromIndex + 1);
     304        if (displayName.length > 100)
     305            displayName = displayName.substring(0, 80) + "...";
     306        return displayName;
    293307    },
    294308
     
    591605    {
    592606        var sourceFile = this._presentationModel.sourceFile(sourceFileId);
    593         var delegate = new WebInspector.SourceFrameDelegateForScriptsPanel(this._presentationModel, sourceFileId, sourceFile.displayName);
     607        var delegate = new WebInspector.SourceFrameDelegateForScriptsPanel(this._presentationModel, sourceFileId);
    594608        var sourceFrame = new WebInspector.SourceFrame(delegate, sourceFile.url);
    595609        sourceFrame._sourceFileId = sourceFileId;
     
    10561070
    10571071
    1058 WebInspector.SourceFrameDelegateForScriptsPanel = function(model, sourceFileId, scriptName)
     1072WebInspector.SourceFrameDelegateForScriptsPanel = function(model, sourceFileId)
    10591073{
    10601074    WebInspector.SourceFrameDelegate.call(this);
     
    10621076    this._sourceFileId = sourceFileId;
    10631077    this._popoverObjectGroup = "popover";
    1064     this._scriptName = scriptName;
    10651078}
    10661079
     
    11361149    suggestedFileName: function()
    11371150    {
    1138         return this._scriptName;
     1151        var sourceFile = this._model.sourceFile(this._sourceFileId);
     1152        return WebInspector.panels.scripts._displayNameForScriptURL(sourceFile.url) || "untitled.js";
    11391153    }
    11401154}
  • trunk/Source/WebCore/inspector/front-end/SourceFile.js

    r88931 r88936  
    6464    },
    6565
    66     get displayName()
    67     {
    68         return this.url ? WebInspector.displayNameForURL(this.url) : WebInspector.UIString("(program)");
    69     },
    70 
    7166    get content()
    7267    {
Note: See TracChangeset for help on using the changeset viewer.