| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 .build()); | 286 .build()); |
| 288 EXPECT_TRUE(selection().isHandleVisible()); | 287 EXPECT_TRUE(selection().isHandleVisible()); |
| 289 selection().selectAll(); | 288 selection().selectAll(); |
| 290 EXPECT_TRUE(selection().isHandleVisible()) | 289 EXPECT_TRUE(selection().isHandleVisible()) |
| 291 << "If handles were present before" | 290 << "If handles were present before" |
| 292 "selectAll. Then they should be present" | 291 "selectAll. Then they should be present" |
| 293 "after it."; | 292 "after it."; |
| 294 } | 293 } |
| 295 | 294 |
| 296 } // namespace blink | 295 } // namespace blink |
| OLD | NEW |