Commit 722c739a authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Utilize GetSelectionTextInFlatTreeFromBody() in...

Utilize GetSelectionTextInFlatTreeFromBody() in VisibleSelectionTest.ExpandUsingGranularityWithEmptyCell

This patch changes |VisibleSelectionTest.ExpandUsingGranularityWithEmptyCell| to
use |GetSelectionTextInFlatTreeFromBody()| for ease of maintenance.

This patch is a preparation for the patch[1].

[1] http://crrev.com/c/737981 Introduce TextOffsetMapping to simplify
word/paragraph selection

Change-Id: Id4212be8044fe05a15abd77d72fd8bf9524fa646
Reviewed-on: https://chromium-review.googlesource.com/892800Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533116}
parent b337febc
......@@ -213,20 +213,21 @@ TEST_F(VisibleSelectionTest, expandUsingGranularity) {
// For http://wkb.ug/32622
TEST_F(VisibleSelectionTest, ExpandUsingGranularityWithEmptyCell) {
SetBodyContent(
const SelectionInDOMTree& selection_in_dom_tree = SetSelectionTextToBody(
"<div contentEditable><table cellspacing=0><tr>"
"<td id='first' width='50' height='25pt'></td>"
"<td id='first' width='50' height='25pt'>|</td>"
"<td id='second' width='50' height='25pt'></td>"
"</tr></table></div>");
Element* const first = GetDocument().getElementById("first");
const VisibleSelectionInFlatTree& selection =
CreateVisibleSelectionWithGranularity(
SelectionInFlatTree::Builder()
.Collapse(PositionInFlatTree(first, 0))
.Build(),
ConvertToSelectionInFlatTree(selection_in_dom_tree),
TextGranularity::kWord);
EXPECT_EQ(PositionInFlatTree(first, 0), selection.Start());
EXPECT_EQ(PositionInFlatTree(first, 0), selection.End());
EXPECT_EQ(
"<div contenteditable><table cellspacing=\"0\"><tbody><tr>"
"<td height=\"25pt\" id=\"first\" width=\"50\">|</td>"
"<td height=\"25pt\" id=\"second\" width=\"50\"></td>"
"</tr></tbody></table></div>",
GetSelectionTextInFlatTreeFromBody(selection.AsSelection()));
}
TEST_F(VisibleSelectionTest, Initialisation) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment