Diff
Modified: trunk/LayoutTests/ChangeLog (102251 => 102252)
--- trunk/LayoutTests/ChangeLog 2011-12-07 18:58:43 UTC (rev 102251)
+++ trunk/LayoutTests/ChangeLog 2011-12-07 19:05:50 UTC (rev 102252)
@@ -1,3 +1,29 @@
+2011-12-07 Xiaomei Ji <[email protected]>
+
+ Turn on move caret by word visually for windows platform.
+ https://bugs.webkit.org/show_bug.cgi?id=59652
+
+ Reviewed by Ryosuke Niwa.
+
+ * editing/selection/caret-mode-paragraph-keys-navigation.html:
+ * editing/selection/move-by-word-visually-crash-test-1.html:
+ * editing/selection/move-by-word-visually-crash-test-2.html:
+ * editing/selection/move-by-word-visually-crash-test-3.html:
+ * editing/selection/move-by-word-visually-crash-test-4.html:
+ * editing/selection/move-by-word-visually-crash-test-textarea.html:
+ * editing/selection/move-by-word-visually-inline-block-positioned-element.html:
+ * editing/selection/move-by-word-visually-multi-line.html:
+ * editing/selection/move-by-word-visually-multi-space.html:
+ * editing/selection/move-by-word-visually-null-box.html:
+ * editing/selection/move-by-word-visually-single-space-inline-element.html:
+ * editing/selection/move-by-word-visually-single-space-one-element.html:
+ * editing/selection/move-by-word-visually-textarea.html:
+ * editing/selection/move-left-right-by-word-mac-expected.txt: Added.
+ * editing/selection/move-left-right-by-word-mac.html: Added.
+ * editing/selection/resources/move-by-word-visually.js:
+ (moveByWord):
+ (moveByWordOnEveryChar):
+
2011-12-07 Balazs Kelemen <[email protected]>
Unreviewed gardening.
Modified: trunk/LayoutTests/editing/selection/caret-mode-paragraph-keys-navigation.html (102251 => 102252)
--- trunk/LayoutTests/editing/selection/caret-mode-paragraph-keys-navigation.html 2011-12-07 18:58:43 UTC (rev 102251)
+++ trunk/LayoutTests/editing/selection/caret-mode-paragraph-keys-navigation.html 2011-12-07 19:05:50 UTC (rev 102252)
@@ -13,6 +13,7 @@
if (window.layoutTestController) {
layoutTestController.overridePreference("WebKitEnableCaretBrowsing", true);
layoutTestController.dumpAsText();
+ layoutTestController.setEditingBehavior('mac');
var target = document.getElementById("target");
target.focus();
Modified: trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-1.html (102251 => 102252)
--- trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-1.html 2011-12-07 18:58:43 UTC (rev 102251)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-1.html 2011-12-07 19:05:50 UTC (rev 102252)
@@ -9,8 +9,10 @@
}
};
-if (window.layoutTestController)
+if (window.layoutTestController) {
layoutTestController.dumpAsText();
+ layoutTestController.setEditingBehavior('win');
+}
</script>
<textarea></textarea>
<base><div title="0|0" class="test_move_by_word">
Modified: trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-2.html (102251 => 102252)
--- trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-2.html 2011-12-07 18:58:43 UTC (rev 102251)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-2.html 2011-12-07 19:05:50 UTC (rev 102252)
@@ -9,8 +9,10 @@
}
};
-if (window.layoutTestController)
+if (window.layoutTestController) {
layoutTestController.dumpAsText();
+ layoutTestController.setEditingBehavior('win');
+}
</script>
<vkern></vkern><marquee><div title="0|0" class="test_move_by_word">abc def
Modified: trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-3.html (102251 => 102252)
--- trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-3.html 2011-12-07 18:58:43 UTC (rev 102251)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-3.html 2011-12-07 19:05:50 UTC (rev 102252)
@@ -9,8 +9,10 @@
}
};
-if (window.layoutTestController)
+if (window.layoutTestController) {
layoutTestController.dumpAsText();
+ layoutTestController.setEditingBehavior('win');
+}
</script>
<video></video><meter><image class="test_move_by_word" title="0|0">
Modified: trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-4.html (102251 => 102252)
--- trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-4.html 2011-12-07 18:58:43 UTC (rev 102251)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-4.html 2011-12-07 19:05:50 UTC (rev 102252)
@@ -9,7 +9,9 @@
}
};
-if (window.layoutTestController)
+if (window.layoutTestController) {
layoutTestController.dumpAsText();
+ layoutTestController.setEditingBehavior('win');
+}
</script>
><div title="0|0" class="test_move_by_word" dir=ltr><keygen><base>
Modified: trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-textarea.html (102251 => 102252)
--- trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-textarea.html 2011-12-07 18:58:43 UTC (rev 102251)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-crash-test-textarea.html 2011-12-07 19:05:50 UTC (rev 102252)
@@ -15,8 +15,10 @@
document.body.innerHTML = "Crash test passed";
};
-if (window.layoutTestController)
+if (window.layoutTestController) {
layoutTestController.dumpAsText();
+ layoutTestController.setEditingBehavior('win');
+}
</script>
<textarea dir=ltr title="0|0" id="test_move_by_word">At where are you</textarea>
Modified: trunk/LayoutTests/editing/selection/move-by-word-visually-inline-block-positioned-element.html (102251 => 102252)
--- trunk/LayoutTests/editing/selection/move-by-word-visually-inline-block-positioned-element.html 2011-12-07 18:58:43 UTC (rev 102251)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-inline-block-positioned-element.html 2011-12-07 19:05:50 UTC (rev 102252)
@@ -9,8 +9,10 @@
}
};
-if (window.layoutTestController)
+if (window.layoutTestController) {
layoutTestController.dumpAsText();
+ layoutTestController.setEditingBehavior('win');
+}
</script>
<div id="testMoveByWord" contenteditable style="width:2000px; height:2000px">
Modified: trunk/LayoutTests/editing/selection/move-by-word-visually-multi-line.html (102251 => 102252)
--- trunk/LayoutTests/editing/selection/move-by-word-visually-multi-line.html 2011-12-07 18:58:43 UTC (rev 102251)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-multi-line.html 2011-12-07 19:05:50 UTC (rev 102252)
@@ -17,8 +17,10 @@
}
};
-if (window.layoutTestController)
+if (window.layoutTestController) {
layoutTestController.dumpAsText();
+ layoutTestController.setEditingBehavior('win');
+}
</script>
</head>
<body>
Modified: trunk/LayoutTests/editing/selection/move-by-word-visually-multi-space.html (102251 => 102252)
--- trunk/LayoutTests/editing/selection/move-by-word-visually-multi-space.html 2011-12-07 18:58:43 UTC (rev 102251)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-multi-space.html 2011-12-07 19:05:50 UTC (rev 102252)
@@ -17,8 +17,10 @@
}
};
-if (window.layoutTestController)
+if (window.layoutTestController) {
layoutTestController.dumpAsText();
+ layoutTestController.setEditingBehavior('win');
+}
</script>
</head>
<body>
Modified: trunk/LayoutTests/editing/selection/move-by-word-visually-null-box.html (102251 => 102252)
--- trunk/LayoutTests/editing/selection/move-by-word-visually-null-box.html 2011-12-07 18:58:43 UTC (rev 102251)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-null-box.html 2011-12-07 19:05:50 UTC (rev 102252)
@@ -15,8 +15,10 @@
}
};
-if (window.layoutTestController)
+if (window.layoutTestController) {
layoutTestController.dumpAsText();
+ layoutTestController.setEditingBehavior('win');
+}
</script>
<div id="console"></div>
<div id="testMoveByWord">
Modified: trunk/LayoutTests/editing/selection/move-by-word-visually-single-space-inline-element.html (102251 => 102252)
--- trunk/LayoutTests/editing/selection/move-by-word-visually-single-space-inline-element.html 2011-12-07 18:58:43 UTC (rev 102251)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-single-space-inline-element.html 2011-12-07 19:05:50 UTC (rev 102252)
@@ -17,8 +17,10 @@
}
};
-if (window.layoutTestController)
+if (window.layoutTestController) {
layoutTestController.dumpAsText();
+ layoutTestController.setEditingBehavior('win');
+}
</script>
</head>
<body>
Modified: trunk/LayoutTests/editing/selection/move-by-word-visually-single-space-one-element.html (102251 => 102252)
--- trunk/LayoutTests/editing/selection/move-by-word-visually-single-space-one-element.html 2011-12-07 18:58:43 UTC (rev 102251)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-single-space-one-element.html 2011-12-07 19:05:50 UTC (rev 102252)
@@ -17,8 +17,10 @@
}
};
-if (window.layoutTestController)
+if (window.layoutTestController) {
layoutTestController.dumpAsText();
+ layoutTestController.setEditingBehavior('win');
+}
</script>
</head>
<body>
Modified: trunk/LayoutTests/editing/selection/move-by-word-visually-textarea.html (102251 => 102252)
--- trunk/LayoutTests/editing/selection/move-by-word-visually-textarea.html 2011-12-07 18:58:43 UTC (rev 102251)
+++ trunk/LayoutTests/editing/selection/move-by-word-visually-textarea.html 2011-12-07 19:05:50 UTC (rev 102252)
@@ -17,7 +17,7 @@
var i;
for (i = 0; i < 5; ++i) {
var start = test.selectionStart;
- sel.modify("move", "right", "-webkit-visual-word");
+ sel.modify("move", "right", "word");
var wordBreak;
if (i >= wordBreaks.length)
wordBreak = wordBreaks[wordBreaks.length - 1];
@@ -33,8 +33,10 @@
testPassed("Pass");
}
-if (window.layoutTestController)
+if (window.layoutTestController) {
layoutTestController.dumpAsText();
+ layoutTestController.setEditingBehavior('win');
+}
</script>
<textarea title = "5 10 17 27" dir=ltr id="test_move_by_word"></textarea>
Added: trunk/LayoutTests/editing/selection/move-left-right-by-word-mac-expected.txt (0 => 102252)
--- trunk/LayoutTests/editing/selection/move-left-right-by-word-mac-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/selection/move-left-right-by-word-mac-expected.txt 2011-12-07 19:05:50 UTC (rev 102252)
@@ -0,0 +1,86 @@
+Test 1, LTR:
+Move right by one word
+"abc def hij opq rst"[0, 3, 7, 11, 15, 19]
+Move left by one word
+"abc def hij opq rst"[19, 16, 12, 8, 4, 0]
+Test 2, RTL:
+Move right by one word
+"abc def hij opq rst"[0, 3, 7, 11, 15, 19]
+Move left by one word
+"abc def hij opq rst"[19, 16, 12, 8, 4, 0]
+Test 3, LTR:
+Move right by one word
+"ZZZ QQQ BBB CCC XXX"[0, 3, 7, 11, 15, 19]
+Move left by one word
+"ZZZ QQQ BBB CCC XXX"[19, 16, 12, 8, 4, 0]
+Test 4, RTL:
+Move right by one word
+"ZZZ QQQ BBB CCC XXX"[0, 3, 7, 11, 15, 19]
+Move left by one word
+"ZZZ QQQ BBB CCC XXX"[19, 16, 12, 8, 4, 0]
+Test 5, LTR:
+Move right by one word
+"abc def hij AAA BBB WWW opr uvw xyz"[0, 3, 7, 11, 15, 19, 23, 27, 31, 35]
+Move left by one word
+"abc def hij AAA BBB WWW opr uvw xyz"[35, 32, 28, 24, 20, 16, 12, 8, 4, 0]
+Test 6, RTL:
+Move right by one word
+"abc def hij AAA BBB WWW opr uvw xyz"[0, 3, 7, 11, 15, 19, 23, 27, 31, 35]
+Move left by one word
+"abc def hij AAA BBB WWW opr uvw xyz"[35, 32, 28, 24, 20, 16, 12, 8, 4, 0]
+Test 7, LTR:
+Move right by one word
+"abc def ZQB RIG uvw xyz"[0, 3, 7, 11, 15, 19, 23]
+Move left by one word
+"abc def ZQB RIG uvw xyz"[23, 20, 16, 12, 8, 4, 0]
+Test 8, RTL:
+Move right by one word
+"abc def ZQB RIG uvw xyz"[0, 3, 7, 11, 15, 19, 23]
+Move left by one word
+"abc def ZQB RIG uvw xyz"[23, 20, 16, 12, 8, 4, 0]
+Test 9, LTR:
+Move right by one word
+"aaa AAA bbb"[0, 3, 7, 11]
+Move left by one word
+"aaa AAA bbb"[11, 8, 4, 0]
+Test 10, RTL:
+Move right by one word
+"aaa AAA bbb"[0, 3, 7, 11]
+Move left by one word
+"aaa AAA bbb"[11, 8, 4, 0]
+Test 11, LTR:
+Move right by one word
+"AAA BBB WWW aaa bbb ccc DDD SSS UUU"[0, 3, 7, 11, 15, 19, 23, 27, 31, 35]
+Move left by one word
+"AAA BBB WWW aaa bbb ccc DDD SSS UUU"[35, 32, 28, 24, 20, 16, 12, 8, 4, 0]
+Test 12, RTL:
+Move right by one word
+"AAA BBB WWW aaa bbb ccc DDD SSS UUU"[0, 3, 7, 11, 15, 19, 23, 27, 31, 35]
+Move left by one word
+"AAA BBB WWW aaa bbb ccc DDD SSS UUU"[35, 32, 28, 24, 20, 16, 12, 8, 4, 0]
+Test 13, LTR:
+Move right by one word
+"AAA BBB aaa bbb WWW DDD"[0, 3, 7, 11, 15, 19, 23]
+Move left by one word
+"AAA BBB aaa bbb WWW DDD"[23, 20, 16, 12, 8, 4, 0]
+Test 14, RTL:
+Move right by one word
+"AAA BBB aaa bbb WWW DDD"[0, 3, 7, 11, 15, 19, 23]
+Move left by one word
+"AAA BBB aaa bbb WWW DDD"[23, 20, 16, 12, 8, 4, 0]
+Test 15, LTR:
+Move right by one word
+"ZQB abc RIG"[0, 3, 7, 11]
+Move left by one word
+"ZQB abc RIG"[11, 8, 4, 0]
+Test 16, RTL:
+Move right by one word
+"ZQB abc RIG"[0, 3, 7, 11]
+Move left by one word
+"ZQB abc RIG"[11, 8, 4, 0]
+Test 17, LTR:
+Move right by one word
+"abc def hij opq"[0, 3, 7, 14, 18]
+Move left by one word
+"abc def hij opq"[18, 15, 8, 4, 0]
+
Added: trunk/LayoutTests/editing/selection/move-left-right-by-word-mac.html (0 => 102252)
--- trunk/LayoutTests/editing/selection/move-left-right-by-word-mac.html (rev 0)
+++ trunk/LayoutTests/editing/selection/move-left-right-by-word-mac.html 2011-12-07 19:05:50 UTC (rev 102252)
@@ -0,0 +1,86 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<link rel="stylesheet" type="text/css" href="" />
+<style>
+test_move_by_word {display: none;}
+</style>
+<script src=""
+<script>
+
+_onload_ = function() {
+ try {
+ var tests = document.getElementsByClassName("test_move_by_word");
+ var sel = getSelection();
+ for (var i = 0; i < tests.length; ++i) {
+ if (tests[i].getAttribute("dir") == 'ltr')
+ log("Test " + (i + 1) + ", LTR:\n");
+ else
+ log("Test " + (i + 1) + ", RTL:\n");
+ sel.setPosition(tests[i], 0);
+ moveByWord(sel, tests[i], "right");
+ moveByWord(sel, tests[i], "left");
+ }
+ if (document.getElementById("testMoveByWord"))
+ document.getElementById("testMoveByWord").style.display = "none";
+ } finally {
+ flushLog();
+ }
+};
+
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.setEditingBehavior('mac');
+}
+</script>
+</head>
+<body>
+<div id="testMoveByWord">
+<!--
+Title saves the word breaks.
+The format of title is "xxx|xxxx".
+
+The sequence on the left of "|" is word boundaries when moving caret from left to right.
+The sequence on the right of "|" is word boundaries when moving caret from right to left.
+
+If there is a single node in the line, the sequence are offsets.
+If there are multiple nodes in the line, the sequence is array of [anchor_node_id, offset, child_node_index],
+where child_node_index is optional, default is the first child of the anchor node.
+-->
+<!-- pure English -->
+<div dir=ltr class="test_move_by_word" title="0 3 7 11 15 19|19 16 12 8 4 0" contenteditable>abc def hij opq rst</div>
+<div dir=rtl class="test_move_by_word" title="0 3 7 11 15 19|19 16 12 8 4 0" contenteditable>abc def hij opq rst</div>
+
+<!-- pure Hebrew -->
+<div dir=ltr class="test_move_by_word" title="0 3 7 11 15 19|19 16 12 8 4 0" contenteditable>ששש נננ בבב גגג קקק</div>
+<div dir=rtl class="test_move_by_word" title="0 3 7 11 15 19|19 16 12 8 4 0" contenteditable>ששש נננ בבב גגג קקק</div>
+
+<!-- bidi text -->
+<!-- English Hebrew English -->
+<div dir=ltr class="test_move_by_word" title="0 3 7 11 15 19 23 27 31 35|35 32 28 24 20 16 12 8 4 0" contenteditable>abc def hij אאא בבב צצצ opr uvw xyz</div>
+<div dir=rtl class="test_move_by_word" title="0 3 7 11 15 19 23 27 31 35|35 32 28 24 20 16 12 8 4 0" contenteditable>abc def hij אאא בבב צצצ opr uvw xyz</div>
+
+<div dir=ltr class="test_move_by_word" title="0 3 7 11 15 19 23|23 20 16 12 8 4 0" contenteditable>abc def שנב סטז uvw xyz</div>
+<div dir=rtl class="test_move_by_word" title="0 3 7 11 15 19 23|23 20 16 12 8 4 0" contenteditable>abc def שנב סטז uvw xyz</div>
+
+<div dir=ltr class="test_move_by_word" title="0 3 7 11|11 8 4 0" contenteditable>aaa אאא bbb</div>
+<div dir=rtl class="test_move_by_word" title="0 3 7 11|11 8 4 0" contenteditable>aaa אאא bbb</div>
+
+<!-- Hebrew English Hebrew -->
+<div dir=ltr class="test_move_by_word" title="0 3 7 11 15 19 23 27 31 35|35 32 28 24 20 16 12 8 4 0" contenteditable>אאא בבב צצצ aaa bbb ccc דדד עעע פפפ</div>
+<div dir=rtl class="test_move_by_word" title="0 3 7 11 15 19 23 27 31 35|35 32 28 24 20 16 12 8 4 0" contenteditable>אאא בבב צצצ aaa bbb ccc דדד עעע פפפ</div>
+
+<div dir=ltr class="test_move_by_word" title="0 3 7 11 15 19 23|23 20 16 12 8 4 0" contenteditable>אאא בבב aaa bbb צצצ דדד</div>
+<div dir=rtl class="test_move_by_word" title="0 3 7 11 15 19 23|23 20 16 12 8 4 0" contenteditable>אאא בבב aaa bbb צצצ דדד</div>
+
+<div dir=ltr class="test_move_by_word" title="0 3 7 11|11 8 4 0" contenteditable>שנב abc סטז</div>
+<div dir=rtl class="test_move_by_word" title="0 3 7 11|11 8 4 0" contenteditable>שנב abc סטז</div>
+
+<div id="multispace" dir=ltr class="test_move_by_word" title="0 3 7 14 18|18 15 8 4 0" contenteditable>abc def hij opq</div>
+
+</div>
+
+<pre id="console"></pre>
+</body>
+</html>
Modified: trunk/LayoutTests/editing/selection/resources/move-by-word-visually.js (102251 => 102252)
--- trunk/LayoutTests/editing/selection/resources/move-by-word-visually.js 2011-12-07 18:58:43 UTC (rev 102251)
+++ trunk/LayoutTests/editing/selection/resources/move-by-word-visually.js 2011-12-07 19:05:50 UTC (rev 102252)
@@ -155,7 +155,7 @@
positions.push({ node: sel.anchorNode, offset: sel.anchorOffset });
while (1) {
- sel.modify("move", searchDirection, "-webkit-visual-word");
+ sel.modify("move", searchDirection, "word");
if (prevNode == sel.anchorNode && prevOffset == sel.anchorOffset)
break;
positions.push({ node: sel.anchorNode, offset: sel.anchorOffset });
@@ -178,7 +178,7 @@
while (1) {
var positions = [];
positions.push({ node: sel.anchorNode, offset: sel.anchorOffset });
- sel.modify("move", searchDirection, "-webkit-visual-word");
+ sel.modify("move", searchDirection, "word");
var position = { node: sel.anchorNode, offset: sel.anchorOffset };
Modified: trunk/Source/WebCore/ChangeLog (102251 => 102252)
--- trunk/Source/WebCore/ChangeLog 2011-12-07 18:58:43 UTC (rev 102251)
+++ trunk/Source/WebCore/ChangeLog 2011-12-07 19:05:50 UTC (rev 102252)
@@ -1,3 +1,50 @@
+2011-12-07 Xiaomei Ji <[email protected]>
+
+ Turn on move caret by word visually for Windows platform.
+ https://bugs.webkit.org/show_bug.cgi?id=59652
+
+ Reviewed by Ryosuke Niwa.
+
+ We already support (arrow key) moving cursor by character in visual order.
+ This patch implements (ctrl/alt-arrow) moving cursor by word in visual order (in Windows).
+ It matches Firefox's default behavior.
+
+ Without this patch, ctrl(alt for mac)-arrow key or
+ selection.modify("move", "left"/"right", "word") moves cursor by word in logical order.
+
+ IE implements moving cursor by logical order for both arrow key and ctrl-arrow key.
+ Firefox implements moving cursor by visual order for both operations.
+ From Chromium bug report, native speakers would like moving cursor by visual order since it
+ is more intuitive.
+
+ The patch is only enabled for Windows (by EditingBehavior) because current implementation
+ matches Windows' native behavior.
+ For exmaple, if the logical text is "abc def hij", the cursor positions are
+ "|abc |def |hij|" no matter pressing ctrl-left-arrow or ctrl-right-arrow.
+
+ Mac and Linux's native behavior is slightly different. In which, when pressing
+ ctrl-left-arrow, the cursor positions are "|abc |def |hij|". When pressing ctrl-right-arrow,
+ the cursor positions are "|abc| def| hij|". We will implement it next.
+
+ Test: editing/selection/move-left-right-by-word-mac.html
+
+ * editing/EditingBehavior.h:
+ (WebCore::EditingBehavior::shouldMoveLeftRightByWordInVisualOrder):
+ * editing/FrameSelection.cpp: Remove experimental enum WebKitVisualWordGranularity.
+ (WebCore::FrameSelection::modifyExtendingRight):
+ (WebCore::FrameSelection::modifyExtendingForward):
+ (WebCore::FrameSelection::modifyMovingRight):
+ (WebCore::FrameSelection::modifyMovingForward):
+ (WebCore::FrameSelection::modifyExtendingLeft):
+ (WebCore::FrameSelection::modifyExtendingBackward):
+ (WebCore::FrameSelection::modifyMovingLeft):
+ (WebCore::FrameSelection::modifyMovingBackward):
+ * editing/TextGranularity.h: Remove experimental enum WebKitVisualWordGranularity.
+ * editing/VisibleSelection.cpp: Remove experimental enum WebKitVisualWordGranularity.
+ (WebCore::VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity):
+ * page/DOMSelection.cpp: Remove experimental experimental flag -webkit-visual-word.
+ (WebCore::DOMSelection::modify):
+
2011-12-07 Jonathan Backer <[email protected]>
[chromium] Plumb damage from WebExternalTextureLayer and WebPluginContainer to CCDamageTracker
Modified: trunk/Source/WebCore/editing/EditingBehavior.h (102251 => 102252)
--- trunk/Source/WebCore/editing/EditingBehavior.h 2011-12-07 18:58:43 UTC (rev 102251)
+++ trunk/Source/WebCore/editing/EditingBehavior.h 2011-12-07 19:05:50 UTC (rev 102252)
@@ -59,6 +59,10 @@
// On Mac, when processing a contextual click, the object being clicked upon should be selected.
bool shouldSelectOnContextualMenuClick() const { return m_type == EditingMacBehavior; }
+
+ // On Windows, moving caret left or right by word moves the caret by word in visual order.
+ // It moves the caret by word in logical order in other platforms.
+ bool shouldMoveLeftRightByWordInVisualOrder() const { return m_type == EditingWindowsBehavior; }
// On Mac and Windows, pressing backspace (when it isn't handled otherwise) should navigate back.
bool shouldNavigateBackOnBackspace() const { return m_type != EditingUnixBehavior; }
Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (102251 => 102252)
--- trunk/Source/WebCore/editing/FrameSelection.cpp 2011-12-07 18:58:43 UTC (rev 102251)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp 2011-12-07 19:05:50 UTC (rev 102252)
@@ -572,8 +572,6 @@
// FIXME: implement all of the above?
pos = modifyExtendingForward(granularity);
break;
- case WebKitVisualWordGranularity:
- break;
}
return pos;
}
@@ -613,8 +611,6 @@
else
pos = endOfDocument(pos);
break;
- case WebKitVisualWordGranularity:
- break;
}
return pos;
@@ -634,7 +630,8 @@
pos = VisiblePosition(m_selection.extent(), m_selection.affinity()).right(true);
break;
case WordGranularity:
- if (visualWordMovementEnabled()) {
+ if (visualWordMovementEnabled()
+ || (m_frame && m_frame->editor()->behavior().shouldMoveLeftRightByWordInVisualOrder())) {
pos = rightWordPosition(VisiblePosition(m_selection.extent(), m_selection.affinity()));
break;
}
@@ -650,9 +647,6 @@
case LineBoundary:
pos = rightBoundaryOfLine(startForPlatform(), directionOfEnclosingBlock());
break;
- case WebKitVisualWordGranularity:
- pos = rightWordPosition(VisiblePosition(m_selection.extent(), m_selection.affinity()));
- break;
}
return pos;
}
@@ -701,8 +695,6 @@
else
pos = endOfDocument(pos);
break;
- case WebKitVisualWordGranularity:
- break;
}
return pos;
}
@@ -743,8 +735,6 @@
case DocumentBoundary:
pos = modifyExtendingBackward(granularity);
break;
- case WebKitVisualWordGranularity:
- break;
}
return pos;
}
@@ -789,8 +779,6 @@
else
pos = startOfDocument(pos);
break;
- case WebKitVisualWordGranularity:
- break;
}
return pos;
}
@@ -809,7 +797,8 @@
pos = VisiblePosition(m_selection.extent(), m_selection.affinity()).left(true);
break;
case WordGranularity:
- if (visualWordMovementEnabled()) {
+ if (visualWordMovementEnabled()
+ || (m_frame && m_frame->editor()->behavior().shouldMoveLeftRightByWordInVisualOrder())) {
pos = leftWordPosition(VisiblePosition(m_selection.extent(), m_selection.affinity()));
break;
}
@@ -825,9 +814,6 @@
case LineBoundary:
pos = leftBoundaryOfLine(startForPlatform(), directionOfEnclosingBlock());
break;
- case WebKitVisualWordGranularity:
- pos = leftWordPosition(VisiblePosition(m_selection.extent(), m_selection.affinity()));
- break;
}
return pos;
}
@@ -870,8 +856,6 @@
else
pos = startOfDocument(pos);
break;
- case WebKitVisualWordGranularity:
- break;
}
return pos;
}
Modified: trunk/Source/WebCore/editing/TextGranularity.h (102251 => 102252)
--- trunk/Source/WebCore/editing/TextGranularity.h 2011-12-07 18:58:43 UTC (rev 102251)
+++ trunk/Source/WebCore/editing/TextGranularity.h 2011-12-07 19:05:50 UTC (rev 102252)
@@ -39,10 +39,7 @@
SentenceBoundary,
LineBoundary,
ParagraphBoundary,
- DocumentBoundary,
- // FIXME: this is added temporarily for experiment with visually move
- // caret by wordGranularity. Once all patches are landed, it should be removed.
- WebKitVisualWordGranularity
+ DocumentBoundary
};
}
Modified: trunk/Source/WebCore/editing/VisibleSelection.cpp (102251 => 102252)
--- trunk/Source/WebCore/editing/VisibleSelection.cpp 2011-12-07 18:58:43 UTC (rev 102251)
+++ trunk/Source/WebCore/editing/VisibleSelection.cpp 2011-12-07 19:05:50 UTC (rev 102252)
@@ -386,8 +386,6 @@
m_start = startOfSentence(VisiblePosition(m_start, m_affinity)).deepEquivalent();
m_end = endOfSentence(VisiblePosition(m_end, m_affinity)).deepEquivalent();
break;
- case WebKitVisualWordGranularity:
- break;
}
// Make sure we do not have a dangling start or end.
Modified: trunk/Source/WebCore/page/DOMSelection.cpp (102251 => 102252)
--- trunk/Source/WebCore/page/DOMSelection.cpp 2011-12-07 18:58:43 UTC (rev 102251)
+++ trunk/Source/WebCore/page/DOMSelection.cpp 2011-12-07 19:05:50 UTC (rev 102252)
@@ -333,8 +333,6 @@
granularity = ParagraphBoundary;
else if (equalIgnoringCase(granularityString, "documentboundary"))
granularity = DocumentBoundary;
- else if (equalIgnoringCase(granularityString, "-webkit-visual-word"))
- granularity = WebKitVisualWordGranularity;
else
return;