Title: [88936] trunk
Revision
88936
Author
[email protected]
Date
2011-06-15 08:17:57 -0700 (Wed, 15 Jun 2011)

Log Message

2011-06-15  Pavel Podivilov  <[email protected]>

        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  <[email protected]>

        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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (88935 => 88936)


--- trunk/LayoutTests/ChangeLog	2011-06-15 15:16:12 UTC (rev 88935)
+++ trunk/LayoutTests/ChangeLog	2011-06-15 15:17:57 UTC (rev 88936)
@@ -1,3 +1,13 @@
+2011-06-15  Pavel Podivilov  <[email protected]>
+
+        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  Noel Gordon  <[email protected]>
 
         Reviewed by Eric Seidel.

Modified: trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt (88935 => 88936)


--- trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt	2011-06-15 15:16:12 UTC (rev 88935)
+++ trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt	2011-06-15 15:17:57 UTC (rev 88936)
@@ -10,13 +10,16 @@
 Page reloaded.
 
 Running: testFilesSelect
-text: script.js, tooltip: ...foo/bar/script.js
-text: script.js, tooltip: ...foo/bar/script.js?a=1
-text: script.js, tooltip: ...foo/bar/script.js?a=2
-text: script.js, tooltip: ...foo/baz/script.js
-text: Content scripts, tooltip: ...
-text: contentScript.js, tooltip: ...foo/bar/contentScript.js?a=1
-text: contentScript.js, tooltip: ...foo/bar/contentScript.js?a=2
-text: contentScript2.js, tooltip: ...foo/bar/contentScript2.js?a=1
+text: ?a=b, tooltip: ?a=b
+text: example.com/, tooltip: http://example.com/?a=b
+text: script.js, tooltip: <root>/foo/bar/script.js
+text: script.js, tooltip: <root>/foo/bar/script.js?a=1
+text: script.js, tooltip: <root>/foo/bar/script.js?a=2
+text: script.js, tooltip: <root>/foo/baz/script.js
+text: very_loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo..., tooltip: very_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_url
+text: Content scripts, tooltip: 
+text: contentScript.js, tooltip: <root>/foo/bar/contentScript.js?a=1
+text: contentScript.js, tooltip: <root>/foo/bar/contentScript.js?a=2
+text: contentScript2.js, tooltip: <root>/foo/bar/contentScript2.js?a=1
 Debugger was disabled.
 

Modified: trunk/LayoutTests/inspector/debugger/scripts-panel.html (88935 => 88936)


--- trunk/LayoutTests/inspector/debugger/scripts-panel.html	2011-06-15 15:16:12 UTC (rev 88935)
+++ trunk/LayoutTests/inspector/debugger/scripts-panel.html	2011-06-15 15:17:57 UTC (rev 88936)
@@ -129,29 +129,25 @@
             var panel = new WebInspector.ScriptsPanel();
             var rootURL = WebInspector.mainResource.url.substring(0, WebInspector.mainResource.url.lastIndexOf("/") + 1);
             var nextId = 0;
-
             function addOption(url, isContentScript)
             {
-                var displayName = url;
-                var indexOfQuery = displayName.indexOf("?");
-                if (indexOfQuery !== -1)
-                    displayName = displayName.substring(0, indexOfQuery);
-                var lastSlashIndex = displayName.lastIndexOf("/");
-                if (lastSlashIndex !== -1)
-                    displayName = displayName.substring(lastSlashIndex + 1);
-                panel._addOptionToFilesSelect({ id: nextId++, url: rootURL + url, displayName: displayName, isContentScript: isContentScript });
+                panel._addOptionToFilesSelect({ id: nextId++, url: url, isContentScript: isContentScript });
             }
-            addOption("foo/bar/script.js", false);
-            addOption("foo/bar/contentScript2.js?a=1", true);
-            addOption("foo/bar/script.js?a=2", false);
-            addOption("foo/bar/contentScript.js?a=2", true);
-            addOption("foo/bar/script.js?a=1", false);
-            addOption("foo/baz/script.js", false);
-            addOption("foo/bar/contentScript.js?a=1", true);
+            addOption(rootURL + "foo/bar/script.js", false);
+            addOption(rootURL + "foo/bar/contentScript2.js?a=1", true);
+            addOption(rootURL + "foo/bar/script.js?a=2", false);
+            addOption(rootURL + "foo/bar/contentScript.js?a=2", true);
+            addOption(rootURL + "foo/bar/script.js?a=1", false);
+            addOption(rootURL + "foo/baz/script.js", false);
+            addOption(rootURL + "foo/bar/contentScript.js?a=1", true);
+            addOption("http://example.com/?a=b", false);
+            addOption("?a=b", false);
+            addOption("very_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_url", false);
+
             var select = panel._filesSelectElement;
             for (var i = 0; i < select.length; ++i) {
                 var option = select[i];
-                var tooltip = "..." + option.title.substring(rootURL.length);
+                var tooltip = option.title.replace(rootURL, "<root>/");
                 InspectorTest.addResult("text: " + option.text + ", tooltip: " + tooltip);
             }
             next();

Modified: trunk/Source/WebCore/ChangeLog (88935 => 88936)


--- trunk/Source/WebCore/ChangeLog	2011-06-15 15:16:12 UTC (rev 88935)
+++ trunk/Source/WebCore/ChangeLog	2011-06-15 15:17:57 UTC (rev 88936)
@@ -1,3 +1,17 @@
+2011-06-15  Pavel Podivilov  <[email protected]>
+
+        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:
+
 2011-06-15  Noel Gordon  <[email protected]>
 
         Reviewed by Eric Seidel.

Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (88935 => 88936)


--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2011-06-15 15:16:12 UTC (rev 88935)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2011-06-15 15:17:57 UTC (rev 88936)
@@ -252,7 +252,7 @@
     {
         var select = this._filesSelectElement;
         var option = document.createElement("option");
-        option.text = sourceFile.displayName;
+        option.text = this._displayNameForScriptURL(sourceFile.url) || WebInspector.UIString("(program)");
         option.title = sourceFile.url;
         option.isContentScript = sourceFile.isContentScript;
         if (sourceFile.isContentScript)
@@ -292,6 +292,20 @@
         this._sourceFileIdToFilesSelectOption[sourceFile.id] = option;
     },
 
+    _displayNameForScriptURL: function(url)
+    {
+        var displayName = url;
+        var indexOfQuery = displayName.indexOf("?");
+        if (indexOfQuery > 0)
+            displayName = displayName.substring(0, indexOfQuery);
+        var fromIndex = displayName.lastIndexOf("/", displayName.length - 2);
+        if (fromIndex !== -1)
+            displayName = displayName.substring(fromIndex + 1);
+        if (displayName.length > 100)
+            displayName = displayName.substring(0, 80) + "...";
+        return displayName;
+    },
+
     setScriptSourceIsBeingEdited: function(sourceFileId, inEditMode)
     {
         var option = this._sourceFileIdToFilesSelectOption[sourceFileId];
@@ -590,7 +604,7 @@
     _createSourceFrame: function(sourceFileId)
     {
         var sourceFile = this._presentationModel.sourceFile(sourceFileId);
-        var delegate = new WebInspector.SourceFrameDelegateForScriptsPanel(this._presentationModel, sourceFileId, sourceFile.displayName);
+        var delegate = new WebInspector.SourceFrameDelegateForScriptsPanel(this._presentationModel, sourceFileId);
         var sourceFrame = new WebInspector.SourceFrame(delegate, sourceFile.url);
         sourceFrame._sourceFileId = sourceFileId;
         sourceFrame.addEventListener(WebInspector.SourceFrame.Events.Loaded, this._sourceFrameLoaded, this);
@@ -1055,13 +1069,12 @@
 WebInspector.ScriptsPanel.prototype.__proto__ = WebInspector.Panel.prototype;
 
 
-WebInspector.SourceFrameDelegateForScriptsPanel = function(model, sourceFileId, scriptName)
+WebInspector.SourceFrameDelegateForScriptsPanel = function(model, sourceFileId)
 {
     WebInspector.SourceFrameDelegate.call(this);
     this._model = model;
     this._sourceFileId = sourceFileId;
     this._popoverObjectGroup = "popover";
-    this._scriptName = scriptName;
 }
 
 WebInspector.SourceFrameDelegateForScriptsPanel.prototype = {
@@ -1135,7 +1148,8 @@
 
     suggestedFileName: function()
     {
-        return this._scriptName;
+        var sourceFile = this._model.sourceFile(this._sourceFileId);
+        return WebInspector.panels.scripts._displayNameForScriptURL(sourceFile.url) || "untitled.js";
     }
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/SourceFile.js (88935 => 88936)


--- trunk/Source/WebCore/inspector/front-end/SourceFile.js	2011-06-15 15:16:12 UTC (rev 88935)
+++ trunk/Source/WebCore/inspector/front-end/SourceFile.js	2011-06-15 15:17:57 UTC (rev 88936)
@@ -63,11 +63,6 @@
         this._requestContent();
     },
 
-    get displayName()
-    {
-        return this.url ? WebInspector.displayNameForURL(this.url) : WebInspector.UIString("(program)");
-    },
-
     get content()
     {
         return this._content;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to