| OLD | NEW |
| 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 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class SelectionControllerTest : public EditingTestBase { | 13 class SelectionControllerTest : public EditingTestBase { |
| 14 protected: | 14 protected: |
| 15 SelectionControllerTest() = default; | 15 SelectionControllerTest() = default; |
| 16 | 16 |
| 17 const VisibleSelection& visibleSelectionInDOMTree() const { | 17 const VisibleSelection& visibleSelectionInDOMTree() const { |
| 18 return selection().selection(); | 18 return selection().selection(); |
| 19 } | 19 } |
| 20 | 20 |
| 21 const VisibleSelectionInFlatTree& visibleSelectionInFlatTree() const { | 21 const VisibleSelectionInFlatTree& visibleSelectionInFlatTree() const { |
| 22 return selection().selectionInFlatTree(); | 22 return selection().computeVisibleSelectionInFlatTree(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void setNonDirectionalSelectionIfNeeded(const VisibleSelectionInFlatTree&, | 25 void setNonDirectionalSelectionIfNeeded(const VisibleSelectionInFlatTree&, |
| 26 TextGranularity); | 26 TextGranularity); |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 DISALLOW_COPY_AND_ASSIGN(SelectionControllerTest); | 29 DISALLOW_COPY_AND_ASSIGN(SelectionControllerTest); |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 void SelectionControllerTest::setNonDirectionalSelectionIfNeeded( | 32 void SelectionControllerTest::setNonDirectionalSelectionIfNeeded( |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 EXPECT_EQ(Position(bottom, 0), visibleSelectionInDOMTree().start()); | 80 EXPECT_EQ(Position(bottom, 0), visibleSelectionInDOMTree().start()); |
| 81 EXPECT_EQ(Position(bottom, 3), visibleSelectionInDOMTree().end()); | 81 EXPECT_EQ(Position(bottom, 3), visibleSelectionInDOMTree().end()); |
| 82 | 82 |
| 83 EXPECT_EQ(PositionInFlatTree(bottom, 3), visibleSelectionInFlatTree().base()); | 83 EXPECT_EQ(PositionInFlatTree(bottom, 3), visibleSelectionInFlatTree().base()); |
| 84 EXPECT_EQ(PositionInFlatTree(top, 1), visibleSelectionInFlatTree().extent()); | 84 EXPECT_EQ(PositionInFlatTree(top, 1), visibleSelectionInFlatTree().extent()); |
| 85 EXPECT_EQ(PositionInFlatTree(top, 1), visibleSelectionInFlatTree().start()); | 85 EXPECT_EQ(PositionInFlatTree(top, 1), visibleSelectionInFlatTree().start()); |
| 86 EXPECT_EQ(PositionInFlatTree(bottom, 3), visibleSelectionInFlatTree().end()); | 86 EXPECT_EQ(PositionInFlatTree(bottom, 3), visibleSelectionInFlatTree().end()); |
| 87 } | 87 } |
| 88 | 88 |
| 89 } // namespace blink | 89 } // namespace blink |
| OLD | NEW |