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

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

Issue 2664253002: Revert "Blink handle selection handle visibility" (Closed)
Patch Set: Created 3 years, 10 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/SelectionController.h" 5 #include "core/editing/SelectionController.h"
6 6
7 #include "core/editing/EditingTestBase.h" 7 #include "core/editing/EditingTestBase.h"
8 #include "core/editing/FrameSelection.h" 8 #include "core/editing/FrameSelection.h"
9 #include "core/input/EventHandler.h" 9 #include "core/input/EventHandler.h"
10 10
(...skipping 18 matching lines...) Expand all
29 DISALLOW_COPY_AND_ASSIGN(SelectionControllerTest); 29 DISALLOW_COPY_AND_ASSIGN(SelectionControllerTest);
30 }; 30 };
31 31
32 void SelectionControllerTest::setNonDirectionalSelectionIfNeeded( 32 void SelectionControllerTest::setNonDirectionalSelectionIfNeeded(
33 const VisibleSelectionInFlatTree& newSelection, 33 const VisibleSelectionInFlatTree& newSelection,
34 TextGranularity granularity) { 34 TextGranularity granularity) {
35 frame() 35 frame()
36 .eventHandler() 36 .eventHandler()
37 .selectionController() 37 .selectionController()
38 .setNonDirectionalSelectionIfNeeded( 38 .setNonDirectionalSelectionIfNeeded(
39 newSelection, granularity, SelectionController::DoNotAdjustEndpoints, 39 newSelection, granularity, SelectionController::DoNotAdjustEndpoints);
40 HandleVisibility::NotVisible);
41 } 40 }
42 41
43 TEST_F(SelectionControllerTest, setNonDirectionalSelectionIfNeeded) { 42 TEST_F(SelectionControllerTest, setNonDirectionalSelectionIfNeeded) {
44 const char* bodyContent = "<span id=top>top</span><span id=host></span>"; 43 const char* bodyContent = "<span id=top>top</span><span id=host></span>";
45 const char* shadowContent = "<span id=bottom>bottom</span>"; 44 const char* shadowContent = "<span id=bottom>bottom</span>";
46 setBodyContent(bodyContent); 45 setBodyContent(bodyContent);
47 ShadowRoot* shadowRoot = setShadowContent(shadowContent, "host"); 46 ShadowRoot* shadowRoot = setShadowContent(shadowContent, "host");
48 47
49 Node* top = document().getElementById("top")->firstChild(); 48 Node* top = document().getElementById("top")->firstChild();
50 Node* bottom = shadowRoot->getElementById("bottom")->firstChild(); 49 Node* bottom = shadowRoot->getElementById("bottom")->firstChild();
(...skipping 30 matching lines...) Expand all
81 EXPECT_EQ(Position(bottom, 0), visibleSelectionInDOMTree().start()); 80 EXPECT_EQ(Position(bottom, 0), visibleSelectionInDOMTree().start());
82 EXPECT_EQ(Position(bottom, 3), visibleSelectionInDOMTree().end()); 81 EXPECT_EQ(Position(bottom, 3), visibleSelectionInDOMTree().end());
83 82
84 EXPECT_EQ(PositionInFlatTree(bottom, 3), visibleSelectionInFlatTree().base()); 83 EXPECT_EQ(PositionInFlatTree(bottom, 3), visibleSelectionInFlatTree().base());
85 EXPECT_EQ(PositionInFlatTree(top, 1), visibleSelectionInFlatTree().extent()); 84 EXPECT_EQ(PositionInFlatTree(top, 1), visibleSelectionInFlatTree().extent());
86 EXPECT_EQ(PositionInFlatTree(top, 1), visibleSelectionInFlatTree().start()); 85 EXPECT_EQ(PositionInFlatTree(top, 1), visibleSelectionInFlatTree().start());
87 EXPECT_EQ(PositionInFlatTree(bottom, 3), visibleSelectionInFlatTree().end()); 86 EXPECT_EQ(PositionInFlatTree(bottom, 3), visibleSelectionInFlatTree().end());
88 } 87 }
89 88
90 } // namespace blink 89 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/SelectionController.cpp ('k') | third_party/WebKit/Source/core/frame/FrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698