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

Unified Diff: LayoutTests/editing/selection/resources/block-cursor-utils.js

Issue 14859008: Use a block cursor in overtype mode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 6 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
Index: LayoutTests/editing/selection/resources/block-cursor-utils.js
diff --git a/LayoutTests/editing/selection/resources/block-cursor-utils.js b/LayoutTests/editing/selection/resources/block-cursor-utils.js
new file mode 100644
index 0000000000000000000000000000000000000000..5ed1edb9de92a68d3a0750fc075c8046753e4464
--- /dev/null
+++ b/LayoutTests/editing/selection/resources/block-cursor-utils.js
@@ -0,0 +1,36 @@
+var blockCursorStartPosition;
+var blockCursor;
+var textNode;
+
+function verifyBlockCursorLeftPositionAndWidth(elementId, expected)
+{
+ blockCursorStartPosition = new Array();
+
+ var element = document.getElementById(elementId);
+ textNode = element.firstChild;
+ debug("Verifying block cursor position and width for each position in '" + textNode.nodeValue + "' in a " + element.style.direction + " block");
+
+ for (var i = 0; i < textNode.length; i++) {
+ evalAndLog("getSelection().collapse(textNode, "+i+")");
+
+ blockCursor = internals.selectionBounds();
+ blockCursorStartPosition.push(blockCursor.left);
+
+ if (i > 0 && i < textNode.length) {
+ if (expected[i-1] == ">")
+ shouldBeTrue("blockCursorStartPosition["+(i-1)+"] > blockCursorStartPosition["+i+"]");
+ else
+ shouldBeTrue("blockCursorStartPosition["+(i-1)+"] < blockCursorStartPosition["+i+"]");
+ }
+
+ shouldBeTrue("getSelection().isCollapsed");
+ shouldBeTrue("blockCursor.width > 1");
+ shouldBe("internals.absoluteCaretBounds().width", "1");
+ }
+
+ evalAndLog("getSelection().collapse(textNode, "+i+")");
+ blockCursor = internals.selectionBounds();
+ shouldBeZero("blockCursor.width");
+ shouldBe("internals.absoluteCaretBounds().width", "1");
+ debug("");
+}
« no previous file with comments | « LayoutTests/editing/selection/block-cursor-overtype-mode-rtl-expected.txt ('k') | Source/core/editing/Editor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698