Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(599)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js

Issue 2644753002: DevTools: untruncate links on copy (Closed)
Patch Set: ac Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/console/console-copy-truncated-text.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js
index c4ac59cd0c26e0e9c7e82724e1a77649bcad6b86..20016947a011603c8af0655944e24589838525b9 100644
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js
@@ -425,4 +425,31 @@ InspectorTest.waitForConsoleMessages = function(expectedCount, callback)
}
}
+InspectorTest.selectConsoleMessages = function(fromMessage, fromTextOffset, toMessage, toTextOffset, useTextContainer)
+{
+ var consoleView = Console.ConsoleView.instance();
+ var from = selectionContainerAndOffset(consoleView.itemElement(fromMessage).element(), fromTextOffset);
+ var to = selectionContainerAndOffset(consoleView.itemElement(toMessage).element(), toTextOffset);
+ window.getSelection().setBaseAndExtent(from.container, from.offset, to.container, to.offset);
+
+ function selectionContainerAndOffset(container, offset)
+ {
+ if (offset === 0 && container.nodeType !== Node.TEXT_NODE)
+ container = container.traverseNextTextNode();
+ var charCount = 0;
+ var node = container;
+ while (node = node.traverseNextTextNode(true)) {
+ var length = node.textContent.length;
+ if (charCount + length >= offset) {
+ return {
+ container: node,
+ offset: offset - charCount
+ };
+ }
+ charCount += length;
+ }
+ return null;
+ }
+}
+
}
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/console/console-copy-truncated-text.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698