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

Unified Diff: third_party/WebKit/Source/devtools/front_end/console/ConsoleViewport.js

Issue 2695193002: Selection API: setBaseAndExtent() and selectAllChildren() should create new Range based on the spec… (Closed)
Patch Set: rebase Created 3 years, 10 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 | « third_party/WebKit/Source/core/editing/DOMSelection.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/console/ConsoleViewport.js
diff --git a/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewport.js b/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewport.js
index 3388cd73f3779e16cabf143a725430296e9543e6..944282be3dd8b5647b36ed9dcb394a9b6c967063 100644
--- a/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewport.js
+++ b/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewport.js
@@ -476,9 +476,17 @@ Console.ConsoleViewport = class {
* @return {number}
*/
_textOffsetInNode(itemElement, container, offset) {
+ if (container.nodeType !== Node.TEXT_NODE) {
+ if (offset < container.childNodes.length) {
+ container = /** @type {!Node} */ (container.childNodes.item(offset));
+ offset = 0;
+ } else {
+ offset = container.textContent.length;
+ }
+ }
var chars = 0;
var node = itemElement;
- while ((node = node.traverseNextTextNode()) && !node.isSelfOrDescendant(container))
+ while ((node = node.traverseNextTextNode(itemElement)) && !node.isSelfOrDescendant(container))
chars += node.textContent.length;
return chars + offset;
}
« no previous file with comments | « third_party/WebKit/Source/core/editing/DOMSelection.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698