Bug 853361 - moving by words is inconsistent, r=roc

This commit is contained in:
Alexander Surkov 2013-03-27 09:57:29 +09:00
Родитель 043e016d9c
Коммит 9c783dca75
3 изменённых файлов: 9 добавлений и 22 удалений

Просмотреть файл

@ -66,9 +66,9 @@
"textarea", kTodo, kTodo, kTodo);
testTextAfterOffset(8, BOUNDARY_WORD_START, "two ", 9, 13,
"div", kTodo, kTodo, kTodo,
"divbr", kTodo, kTodo, kTodo,
"divbr", kTodo, kTodo, kOk,
"editable", kTodo, kTodo, kTodo,
"editablebr", kTodo, kTodo, kTodo,
"editablebr", kTodo, kTodo, kOk,
"textarea", kTodo, kTodo, kTodo);
testTextAfterOffset(9, BOUNDARY_WORD_START, "words\n", 13, 19,
"div", kTodo, kTodo, kTodo,
@ -384,12 +384,7 @@
"textarea", kOk, kOk, kOk);
// BOUNDARY_WORD_START
testTextAtOffset(0, BOUNDARY_WORD_START, "oneword\n\n", 0, 9,
"div", kTodo, kOk, kTodo,
"divbr", kOk, kOk, kOk,
"editable", kTodo, kOk, kTodo,
"editablebr", kOk, kOk, kOk,
"textarea", kTodo, kOk, kTodo);
testTextAtOffset(0, BOUNDARY_WORD_START, "oneword\n\n", 0, 9, IDs);
testTextAtOffset(8, BOUNDARY_WORD_START, "oneword\n\n", 0, 9,
"div", kOk, kOk, kOk,
"divbr", kTodo, kTodo, kTodo,
@ -413,17 +408,12 @@
"editablebr", kTodo, kTodo, kTodo,
"textarea", kOk, kOk, kOk);
testTextAtOffset(9, BOUNDARY_WORD_END, "\n\ntwo", 7, 12,
"div", kTodo, kTodo, kOk,
"div", kOk, kOk, kOk,
"divbr", kTodo, kTodo, kTodo,
"editable", kTodo, kTodo, kOk,
"editable", kOk, kOk, kOk,
"editablebr", kTodo, kTodo, kTodo,
"textarea", kTodo, kTodo, kOk);
testTextAtOffset(12, BOUNDARY_WORD_END, "\n\ntwo", 7, 12,
"div", kTodo, kTodo, kOk,
"divbr", kOk, kOk, kOk,
"editable", kTodo, kTodo, kOk,
"editablebr", kOk, kOk, kOk,
"textarea", kTodo, kTodo, kOk);
"textarea", kOk, kOk, kOk);
testTextAtOffset(12, BOUNDARY_WORD_END, "\n\ntwo", 7, 12, IDs);
testTextAtOffset(13, BOUNDARY_WORD_END, " words", 12, 18,
"div", kOk, kOk, kOk,
"divbr", kOk, kOk, kOk,

Просмотреть файл

@ -6827,7 +6827,8 @@ nsTextFrame::PeekOffsetWord(bool aForward, bool aWordSelectEatSpace, bool aIsKey
// Japanese and Chinese.
canBreak = true;
} else {
canBreak = isWordBreakBefore && aState->mSawBeforeType;
canBreak = isWordBreakBefore && aState->mSawBeforeType &&
(aWordSelectEatSpace != isWhitespace);
}
if (canBreak) {
*aOffset = cIter.GetBeforeOffset() - mContentOffset;

Просмотреть файл

@ -123,10 +123,8 @@ function test() {
testRight(editor.firstChild, 10);
testRight(editor.firstChild.nextSibling.nextSibling, 5);
testLeft(editor.firstChild.nextSibling.firstChild, 1);
testLeft(editor.firstChild, 10);
testLeft(editor.firstChild, 8);
testLeft(editor.firstChild, 5);
testLeft(editor.firstChild, 3);
testLeft(editor.firstChild, 0);
var ChineseChars = "漢字";
@ -239,10 +237,8 @@ function test() {
testRight(editor.firstChild.nextSibling.firstChild, 0);
testRight(editor.firstChild.nextSibling.nextSibling, 5);
testLeft(editor.firstChild.nextSibling.firstChild, 1);
testLeft(editor.firstChild, 10);
testLeft(editor.firstChild, 8);
testLeft(editor.firstChild, 5);
testLeft(editor.firstChild, 3);
testLeft(editor.firstChild, 0);
editor.innerHTML = ChineseChars + HiraganaChars + ChineseChars;