Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Side by Side Diff: third_party/WebKit/Source/core/editing/SelectionAdjusterTest.cpp

Issue 2432383002: Get rid of flat tree version of createVisibleSelection() taking two PositionInFlatTree (Closed)
Patch Set: 2016-10-20T15:59:37 Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/editing/SelectionAdjuster.h" 5 #include "core/editing/SelectionAdjuster.h"
6 6
7 #include "core/editing/EditingTestBase.h" 7 #include "core/editing/EditingTestBase.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 13 matching lines...) Expand all
24 EXPECT_EQ(PositionInFlatTree(foo, 3), selectionInFlatTree.end()); 24 EXPECT_EQ(PositionInFlatTree(foo, 3), selectionInFlatTree.end());
25 } 25 }
26 26
27 TEST_F(SelectionAdjusterTest, adjustSelectionInDOMTree) { 27 TEST_F(SelectionAdjusterTest, adjustSelectionInDOMTree) {
28 setBodyContent("<div id=sample>foo</div>"); 28 setBodyContent("<div id=sample>foo</div>");
29 VisibleSelection selection; 29 VisibleSelection selection;
30 30
31 Node* const sample = document().getElementById("sample"); 31 Node* const sample = document().getElementById("sample");
32 Node* const foo = sample->firstChild(); 32 Node* const foo = sample->firstChild();
33 // Select "foo" 33 // Select "foo"
34 VisibleSelectionInFlatTree selectionInFlatTree = createVisibleSelection( 34 VisibleSelectionInFlatTree selectionInFlatTree =
35 PositionInFlatTree(foo, 0), PositionInFlatTree(foo, 3)); 35 createVisibleSelection(SelectionInFlatTree::Builder()
36 .collapse(PositionInFlatTree(foo, 0))
37 .extend(PositionInFlatTree(foo, 3))
38 .build());
36 SelectionAdjuster::adjustSelectionInDOMTree(&selection, selectionInFlatTree); 39 SelectionAdjuster::adjustSelectionInDOMTree(&selection, selectionInFlatTree);
37 EXPECT_EQ(Position(foo, 0), selection.start()); 40 EXPECT_EQ(Position(foo, 0), selection.start());
38 EXPECT_EQ(Position(foo, 3), selection.end()); 41 EXPECT_EQ(Position(foo, 3), selection.end());
39 } 42 }
40 43
41 } // namespace blink 44 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698