Bug 860013 part2: mimic WebKitGtk behavior for text_at_offset word_end boundary, r=tbsaunde

This commit is contained in:
Alexander Surkov 2013-05-07 18:18:37 +09:00
parent e7d3bbfbdf
commit b284715c05
4 changed files with 15 additions and 21 deletions

View File

@ -1084,8 +1084,11 @@ HyperTextAccessible::GetTextAtOffset(int32_t aOffset,
return GetText(*aStartOffset, *aEndOffset, aText);
case BOUNDARY_WORD_END:
*aStartOffset = FindWordBoundary(offset, eDirPrevious, eEndWord);
*aEndOffset = FindWordBoundary(*aStartOffset, eDirNext, eEndWord);
// Ignore the spec and follow what WebKitGtk does because Orca expects it,
// i.e. return a next word at word end offset of the current word
// (WebKitGtk behavior) instead the current word (AKT spec).
*aEndOffset = FindWordBoundary(offset, eDirNext, eEndWord);
*aStartOffset = FindWordBoundary(*aEndOffset, eDirPrevious, eEndWord);
return GetText(*aStartOffset, *aEndOffset, aText);
case BOUNDARY_LINE_START:

View File

@ -336,19 +336,9 @@
// BOUNDARY_WORD_END
testTextAtOffset(0, BOUNDARY_WORD_END, "oneword", 0, 7, IDs);
testTextAtOffset(8, BOUNDARY_WORD_END, "\n\ntwo", 7, 12,
"div", kOk, kOk, kOk,
"divbr", kTodo, kTodo, kTodo,
"editable", kOk, kOk, kOk,
"editablebr", kTodo, kTodo, kTodo,
"textarea", kOk, kOk, kOk);
testTextAtOffset(9, BOUNDARY_WORD_END, "\n\ntwo", 7, 12,
"div", kOk, kOk, kOk,
"divbr", kTodo, kTodo, kTodo,
"editable", kOk, kOk, kOk,
"editablebr", kTodo, kTodo, kTodo,
"textarea", kOk, kOk, kOk);
testTextAtOffset(12, BOUNDARY_WORD_END, "\n\ntwo", 7, 12, IDs);
testTextAtOffset(8, BOUNDARY_WORD_END, "\n\ntwo", 7, 12, IDs);
testTextAtOffset(9, BOUNDARY_WORD_END, "\n\ntwo", 7, 12, IDs);
testTextAtOffset(12, BOUNDARY_WORD_END, " words", 12, 18, IDs);
testTextAtOffset(13, BOUNDARY_WORD_END, " words", 12, 18,
"div", kOk, kOk, kOk,
"divbr", kOk, kOk, kOk,

View File

@ -315,10 +315,10 @@
// BOUNDARY_WORD_END
testTextAtOffset(0, BOUNDARY_WORD_END, "hello", 0, 5, IDs);
testTextAtOffset(1, BOUNDARY_WORD_END, "hello", 0, 5, IDs);
testTextAtOffset(5, BOUNDARY_WORD_END, "hello", 0, 5, IDs);
testTextAtOffset(5, BOUNDARY_WORD_END, " my", 5, 8, IDs);
testTextAtOffset(6, BOUNDARY_WORD_END, " my", 5, 8, IDs);
testTextAtOffset(7, BOUNDARY_WORD_END, " my", 5, 8, IDs);
testTextAtOffset(8, BOUNDARY_WORD_END, " my", 5, 8, IDs);
testTextAtOffset(8, BOUNDARY_WORD_END, " friend", 8, 15, IDs);
testTextAtOffset(9, BOUNDARY_WORD_END, " friend", 8, 15, IDs);
testTextAtOffset(10, BOUNDARY_WORD_END, " friend", 8, 15, IDs);
testTextAtOffset(14, BOUNDARY_WORD_END, " friend", 8, 15, IDs);

View File

@ -342,20 +342,21 @@
// BOUNDARY_WORD_END
testTextAtOffset(0, BOUNDARY_WORD_END, "Brave", 0, 5, IDs);
testTextAtOffset(4, BOUNDARY_WORD_END, "Brave", 0, 5, IDs);
testTextAtOffset(5, BOUNDARY_WORD_END, "Brave", 0, 5, IDs);
testTextAtOffset(5, BOUNDARY_WORD_END, " Sir", 5, 9, IDs);
testTextAtOffset(6, BOUNDARY_WORD_END, " Sir", 5, 9, IDs);
testTextAtOffset(8, BOUNDARY_WORD_END, " Sir", 5, 9, IDs);
testTextAtOffset(9, BOUNDARY_WORD_END, " Sir", 5, 9, IDs);
testTextAtOffset(9, BOUNDARY_WORD_END, " Robin", 9, 16, IDs);
testTextAtOffset(10, BOUNDARY_WORD_END, " Robin", 9, 16, IDs);
testTextAtOffset(11, BOUNDARY_WORD_END, " Robin", 9, 16, IDs);
testTextAtOffset(15, BOUNDARY_WORD_END, " Robin", 9, 16, IDs);
testTextAtOffset(16, BOUNDARY_WORD_END, " Robin", 9, 16, IDs);
testTextAtOffset(16, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
testTextAtOffset(17, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
testTextAtOffset(18, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
testTextAtOffset(19, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
testTextAtOffset(20, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
testTextAtOffset(21, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
testTextAtOffset(22, BOUNDARY_WORD_END, " ran", 16, 22, IDs);
testTextAtOffset(22, BOUNDARY_WORD_END, " ran", 16, 22, ["input", "div", "editable"]);
testTextAtOffset(22, BOUNDARY_WORD_END, " ran\n", 16, 23, [ "textarea" ]);
SimpleTest.finish();
}