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) { ...@@ -213,20 +213,21 @@ TEST_F(VisibleSelectionTest, expandUsingGranularity) {
// For http://wkb.ug/32622 // For http://wkb.ug/32622
TEST_F(VisibleSelectionTest, ExpandUsingGranularityWithEmptyCell) { TEST_F(VisibleSelectionTest, ExpandUsingGranularityWithEmptyCell) {
SetBodyContent( const SelectionInDOMTree& selection_in_dom_tree = SetSelectionTextToBody(
"<div contentEditable><table cellspacing=0><tr>" "<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>" "<td id='second' width='50' height='25pt'></td>"
"</tr></table></div>"); "</tr></table></div>");
Element* const first = GetDocument().getElementById("first");
const VisibleSelectionInFlatTree& selection = const VisibleSelectionInFlatTree& selection =
CreateVisibleSelectionWithGranularity( CreateVisibleSelectionWithGranularity(
SelectionInFlatTree::Builder() ConvertToSelectionInFlatTree(selection_in_dom_tree),
.Collapse(PositionInFlatTree(first, 0))
.Build(),
TextGranularity::kWord); TextGranularity::kWord);
EXPECT_EQ(PositionInFlatTree(first, 0), selection.Start()); EXPECT_EQ(
EXPECT_EQ(PositionInFlatTree(first, 0), selection.End()); "<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) { 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