Title: [131353] trunk
Revision
131353
Author
mk...@chromium.org
Date
2012-10-15 14:00:26 -0700 (Mon, 15 Oct 2012)

Log Message

Console messages containing long URLs should cut at some reasonable length.
https://bugs.webkit.org/show_bug.cgi?id=97980

Reviewed by Pavel Feldman.

Source/WebCore:

This patch lightly modifies the current styling of linkified URLs inside
console messages in order to cut them down to some reasonable size for
viewing. The middle of the URL is snipped out such that the whole
thing fits into 150 characters. This only effects the displayed text;
the link's href isn't changed; the link remains available via the
context menu, accessible via the title attribute, and clicking it still
takes the user directly to the resource in question.

Test: inspector/console/console-trim-long-urls.html

* inspector/front-end/ResourceUtils.js:
(WebInspector.linkifyURLAsNode):
    Trim the middle of the URL to bring the whole string down to  down
    to 150 characters, and set the link's title to the full URL.

LayoutTests:

* inspector/console/console-trim-long-urls-expected.txt: Added.
* inspector/console/console-trim-long-urls.html: Added.
* inspector/styles/inject-stylesheet-expected.txt:
* platform/chromium/inspector/styles/inject-stylesheet-expected.txt:
    Updating test expectations.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (131352 => 131353)


--- trunk/LayoutTests/ChangeLog	2012-10-15 20:56:11 UTC (rev 131352)
+++ trunk/LayoutTests/ChangeLog	2012-10-15 21:00:26 UTC (rev 131353)
@@ -1,3 +1,16 @@
+2012-10-15  Mike West  <mk...@chromium.org>
+
+        Console messages containing long URLs should cut at some reasonable length.
+        https://bugs.webkit.org/show_bug.cgi?id=97980
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/console/console-trim-long-urls-expected.txt: Added.
+        * inspector/console/console-trim-long-urls.html: Added.
+        * inspector/styles/inject-stylesheet-expected.txt:
+        * platform/chromium/inspector/styles/inject-stylesheet-expected.txt:
+            Updating test expectations.
+
 2012-10-15  Mihnea Ovidenie  <mih...@adobe.com>
 
         [CSSRegions]Add support for auto-height regions (without region-breaks)

Added: trunk/LayoutTests/inspector/console/console-trim-long-urls-expected.txt (0 => 131353)


--- trunk/LayoutTests/inspector/console/console-trim-long-urls-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/console/console-trim-long-urls-expected.txt	2012-10-15 21:00:26 UTC (rev 131353)
@@ -0,0 +1,7 @@
+CONSOLE MESSAGE: line 11: The URL is: %s
+CONSOLE MESSAGE: line 12: http://example.com/2---------3---------4---------5---------6---------7---------8---------9---------0---------1---------2---------3---------4---------5---------6---------7---------8---------9---------0
+Tests that a URL logged to the console is trimmed down to 150 characters.
+
+The URL is: http://example.com/2---------3---------4---------5---------6---------7-----…---3---------4---------5---------6---------7---------8---------9---------0 console-trim-long-urls.html:11
+http://example.com/2---------3---------4---------5---------6---------7-----…---3---------4---------5---------6---------7---------8---------9---------0 console-trim-long-urls.html:12
+

Added: trunk/LayoutTests/inspector/console/console-trim-long-urls.html (0 => 131353)


--- trunk/LayoutTests/inspector/console/console-trim-long-urls.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/console/console-trim-long-urls.html	2012-10-15 21:00:26 UTC (rev 131353)
@@ -0,0 +1,31 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+function onload()
+{
+    //        0---------1---------2---------3---------4---------5---------6---------7---------8---------9---------0---------1---------2---------3---------4---------5---------6---------7---------8---------9---------0
+    var url = ""
+
+    console.log("The URL is: %s", url);
+    console.log(url);
+
+    runTest();
+}
+
+function test()
+{
+    InspectorTest.expandConsoleMessages();
+    InspectorTest.dumpConsoleMessages();
+    InspectorTest.completeTest();
+}
+</script>
+</head>
+
+<body _onload_="onload()">
+<p>
+Tests that a URL logged to the console is trimmed down to 150 characters.
+</p>
+</body>
+</html>

Modified: trunk/LayoutTests/inspector/styles/inject-stylesheet-expected.txt (131352 => 131353)


--- trunk/LayoutTests/inspector/styles/inject-stylesheet-expected.txt	2012-10-15 20:56:11 UTC (rev 131352)
+++ trunk/LayoutTests/inspector/styles/inject-stylesheet-expected.txt	2012-10-15 21:00:26 UTC (rev 131353)
@@ -7,7 +7,7 @@
 -webkit-background-clip: border-box;
 -webkit-background-origin: padding-box;
 -webkit-background-size: auto;
--webkit-border-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAiElEQVR42r2RsQrDMAxEBRdl8SDcX8lQPGg1GBI6lvz/h7QyRRXV0qUULwfvwZ1tenw5PxToRPWMC52eA9+WDnlh3HFQ/xBQl86NFYJqeGflkiogrOvVlIFhqURFVho3x1moGAa3deMs+LS30CAhBN5nNxeT5hbJ1zwmji2k+aF6NENIPf/hs54f0sZFUVAMigAAAABJRU5ErkJggg==) 100% / 1 / 0px stretch;
+-webkit-border-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAiElEQ…Ms+LS30CAhBN5nNxeT5hbJ1zwmji2k+aF6NENIPf/hs54f0sZFUVAMigAAAABJRU5ErkJggg==) 100% / 1 / 0px stretch;
     #main - url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAiElEQVR42r2RsQrDMAxEBRdl8SDcX8lQPGg1GBI6lvz/h7QyRRXV0qUULwfvwZ1tenw5PxToRPWMC52eA9+WDnlh3HFQ/xBQl86NFYJqeGflkiogrOvVlIFhqURFVho3x1moGAa3deMs+LS30CAhBN5nNxeT5hbJ1zwmji2k+aF6NENIPf/hs54f0sZFUVAMigAAAABJRU5ErkJggg==) user stylesheet
 background-attachment: scroll;
     #main - initial inject-stylesheet.html:5
@@ -48,7 +48,7 @@
 [expanded] 
 #main  { (user stylesheet)
 color: red;
--webkit-border-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAiElEQVR42r2RsQrDMAxEBRdl8SDcX8lQPGg1GBI6lvz/h7QyRRXV0qUULwfvwZ1tenw5PxToRPWMC52eA9+WDnlh3HFQ/xBQl86NFYJqeGflkiogrOvVlIFhqURFVho3x1moGAa3deMs+LS30CAhBN5nNxeT5hbJ1zwmji2k+aF6NENIPf/hs54f0sZFUVAMigAAAABJRU5ErkJggg==);
+-webkit-border-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAiElEQ…Ms+LS30CAhBN5nNxeT5hbJ1zwmji2k+aF6NENIPf/hs54f0sZFUVAMigAAAABJRU5ErkJggg==);
 
 [expanded] 
 div  { (user agent stylesheet)

Modified: trunk/LayoutTests/platform/chromium/inspector/styles/inject-stylesheet-expected.txt (131352 => 131353)


--- trunk/LayoutTests/platform/chromium/inspector/styles/inject-stylesheet-expected.txt	2012-10-15 20:56:11 UTC (rev 131352)
+++ trunk/LayoutTests/platform/chromium/inspector/styles/inject-stylesheet-expected.txt	2012-10-15 21:00:26 UTC (rev 131353)
@@ -7,7 +7,7 @@
 -webkit-background-clip: border-box;
 -webkit-background-origin: padding-box;
 -webkit-background-size: auto;
--webkit-border-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAiElEQVR42r2RsQrDMAxEBRdl8SDcX8lQPGg1GBI6lvz/h7QyRRXV0qUULwfvwZ1tenw5PxToRPWMC52eA9+WDnlh3HFQ/xBQl86NFYJqeGflkiogrOvVlIFhqURFVho3x1moGAa3deMs+LS30CAhBN5nNxeT5hbJ1zwmji2k+aF6NENIPf/hs54f0sZFUVAMigAAAABJRU5ErkJggg==) 100% / 1 / 0px stretch;
+-webkit-border-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAiElEQ…Ms+LS30CAhBN5nNxeT5hbJ1zwmji2k+aF6NENIPf/hs54f0sZFUVAMigAAAABJRU5ErkJggg==) 100% / 1 / 0px stretch;
     #main - url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAiElEQVR42r2RsQrDMAxEBRdl8SDcX8lQPGg1GBI6lvz/h7QyRRXV0qUULwfvwZ1tenw5PxToRPWMC52eA9+WDnlh3HFQ/xBQl86NFYJqeGflkiogrOvVlIFhqURFVho3x1moGAa3deMs+LS30CAhBN5nNxeT5hbJ1zwmji2k+aF6NENIPf/hs54f0sZFUVAMigAAAABJRU5ErkJggg==) user stylesheet
 background-attachment: scroll;
     #main - initial inject-stylesheet.html:5
@@ -48,7 +48,7 @@
 [expanded] 
 #main  { (user stylesheet)
 color: red;
--webkit-border-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAiElEQVR42r2RsQrDMAxEBRdl8SDcX8lQPGg1GBI6lvz/h7QyRRXV0qUULwfvwZ1tenw5PxToRPWMC52eA9+WDnlh3HFQ/xBQl86NFYJqeGflkiogrOvVlIFhqURFVho3x1moGAa3deMs+LS30CAhBN5nNxeT5hbJ1zwmji2k+aF6NENIPf/hs54f0sZFUVAMigAAAABJRU5ErkJggg==);
+-webkit-border-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAQAAAC1+jfqAAAAiElEQ…Ms+LS30CAhBN5nNxeT5hbJ1zwmji2k+aF6NENIPf/hs54f0sZFUVAMigAAAABJRU5ErkJggg==);
 
 [expanded] 
 div  { (user agent stylesheet)

Modified: trunk/Source/WebCore/ChangeLog (131352 => 131353)


--- trunk/Source/WebCore/ChangeLog	2012-10-15 20:56:11 UTC (rev 131352)
+++ trunk/Source/WebCore/ChangeLog	2012-10-15 21:00:26 UTC (rev 131353)
@@ -1,3 +1,25 @@
+2012-10-15  Mike West  <mk...@chromium.org>
+
+        Console messages containing long URLs should cut at some reasonable length.
+        https://bugs.webkit.org/show_bug.cgi?id=97980
+
+        Reviewed by Pavel Feldman.
+
+        This patch lightly modifies the current styling of linkified URLs inside
+        console messages in order to cut them down to some reasonable size for
+        viewing. The middle of the URL is snipped out such that the whole
+        thing fits into 150 characters. This only effects the displayed text;
+        the link's href isn't changed; the link remains available via the
+        context menu, accessible via the title attribute, and clicking it still
+        takes the user directly to the resource in question.
+
+        Test: inspector/console/console-trim-long-urls.html
+
+        * inspector/front-end/ResourceUtils.js:
+        (WebInspector.linkifyURLAsNode):
+            Trim the middle of the URL to bring the whole string down to  down
+            to 150 characters, and set the link's title to the full URL.
+
 2012-10-15  Tony Chang  <t...@chromium.org>
 
         Add computeLogicalHeight override methods to RenderView and RenderMultiColumnSet

Modified: trunk/Source/WebCore/inspector/front-end/ResourceUtils.js (131352 => 131353)


--- trunk/Source/WebCore/inspector/front-end/ResourceUtils.js	2012-10-15 20:56:11 UTC (rev 131352)
+++ trunk/Source/WebCore/inspector/front-end/ResourceUtils.js	2012-10-15 21:00:26 UTC (rev 131353)
@@ -177,8 +177,7 @@
         a.title = url;
     else if (typeof tooltipText !== "string" || tooltipText.length)
         a.title = tooltipText;
-    a.textContent = linkText;
-    a.style.maxWidth = "100%";
+    a.textContent = linkText.trimMiddle(150);
     if (isExternal)
         a.setAttribute("target", "_blank");
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to