| OLD | NEW |
| 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/FrameSelection.h" | 5 #include "core/editing/FrameSelection.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
| 10 #include "core/dom/Element.h" | 10 #include "core/dom/Element.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 145 |
| 146 // crbug.com/657996 | 146 // crbug.com/657996 |
| 147 TEST_F(FrameSelectionTest, SelectWordAroundPosition2) { | 147 TEST_F(FrameSelectionTest, SelectWordAroundPosition2) { |
| 148 setBodyContent( | 148 setBodyContent( |
| 149 "<p style='width:70px; font-size:14px'>foo bar<em>+</em> baz</p>"); | 149 "<p style='width:70px; font-size:14px'>foo bar<em>+</em> baz</p>"); |
| 150 // "foo bar | 150 // "foo bar |
| 151 // b|az" | 151 // b|az" |
| 152 Node* const baz = document().body()->firstChild()->lastChild(); | 152 Node* const baz = document().body()->firstChild()->lastChild(); |
| 153 EXPECT_TRUE(selection().selectWordAroundPosition( | 153 EXPECT_TRUE(selection().selectWordAroundPosition( |
| 154 createVisiblePosition(Position(baz, 2)))); | 154 createVisiblePosition(Position(baz, 2)))); |
| 155 // TODO(yoichio): We should select only "baz". | 155 EXPECT_EQ_SELECTED_TEXT("baz"); |
| 156 EXPECT_EQ_SELECTED_TEXT(" baz"); | |
| 157 } | 156 } |
| 158 | 157 |
| 159 TEST_F(FrameSelectionTest, ModifyExtendWithFlatTree) { | 158 TEST_F(FrameSelectionTest, ModifyExtendWithFlatTree) { |
| 160 setBodyContent("<span id=host></span>one"); | 159 setBodyContent("<span id=host></span>one"); |
| 161 setShadowContent("two<content></content>", "host"); | 160 setShadowContent("two<content></content>", "host"); |
| 162 Element* host = document().getElementById("host"); | 161 Element* host = document().getElementById("host"); |
| 163 Node* const two = FlatTreeTraversal::firstChild(*host); | 162 Node* const two = FlatTreeTraversal::firstChild(*host); |
| 164 // Select "two" for selection in DOM tree | 163 // Select "two" for selection in DOM tree |
| 165 // Select "twoone" for selection in Flat tree | 164 // Select "twoone" for selection in Flat tree |
| 166 selection().setSelection(SelectionInFlatTree::Builder() | 165 selection().setSelection(SelectionInFlatTree::Builder() |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 selection().setSelectedRange( | 319 selection().setSelectedRange( |
| 321 EphemeralRange(Position(text, 0), Position(text, 12)), | 320 EphemeralRange(Position(text, 0), Position(text, 12)), |
| 322 VP_DEFAULT_AFFINITY, SelectionDirectionalMode::NonDirectional, 0); | 321 VP_DEFAULT_AFFINITY, SelectionDirectionalMode::NonDirectional, 0); |
| 323 | 322 |
| 324 EXPECT_TRUE(selection().isHandleVisible()) | 323 EXPECT_TRUE(selection().isHandleVisible()) |
| 325 << "If handles were present before" | 324 << "If handles were present before" |
| 326 "selectSetSelectedRange they should be present after it."; | 325 "selectSetSelectedRange they should be present after it."; |
| 327 } | 326 } |
| 328 | 327 |
| 329 } // namespace blink | 328 } // namespace blink |
| OLD | NEW |