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 "bindings/core/v8/ExceptionStatePlaceholder.h" | 7 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
10 #include "core/dom/Text.h" | 10 #include "core/dom/Text.h" |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 }; | 297 }; |
298 | 298 |
299 // TODO(yosin): We should move this function to "SelectionControllerTest.cpp" | 299 // TODO(yosin): We should move this function to "SelectionControllerTest.cpp" |
300 void SelectionControllerTest::setNonDirectionalSelectionIfNeeded( | 300 void SelectionControllerTest::setNonDirectionalSelectionIfNeeded( |
301 const VisibleSelectionInFlatTree& newSelection, | 301 const VisibleSelectionInFlatTree& newSelection, |
302 TextGranularity granularity) { | 302 TextGranularity granularity) { |
303 frame() | 303 frame() |
304 .eventHandler() | 304 .eventHandler() |
305 .selectionController() | 305 .selectionController() |
306 .setNonDirectionalSelectionIfNeeded( | 306 .setNonDirectionalSelectionIfNeeded( |
307 newSelection, granularity, SelectionController::DoNotAdjustEndpoints); | 307 newSelection, granularity, SelectionController::DoNotAdjustEndpoints, |
| 308 HandleVisibility::NotVisible); |
308 } | 309 } |
309 | 310 |
310 // TODO(yosin): We should move this test to "SelectionControllerTest.cpp" | 311 // TODO(yosin): We should move this test to "SelectionControllerTest.cpp" |
311 TEST_F(SelectionControllerTest, setNonDirectionalSelectionIfNeeded) { | 312 TEST_F(SelectionControllerTest, setNonDirectionalSelectionIfNeeded) { |
312 const char* bodyContent = "<span id=top>top</span><span id=host></span>"; | 313 const char* bodyContent = "<span id=top>top</span><span id=host></span>"; |
313 const char* shadowContent = "<span id=bottom>bottom</span>"; | 314 const char* shadowContent = "<span id=bottom>bottom</span>"; |
314 setBodyContent(bodyContent); | 315 setBodyContent(bodyContent); |
315 ShadowRoot* shadowRoot = setShadowContent(shadowContent, "host"); | 316 ShadowRoot* shadowRoot = setShadowContent(shadowContent, "host"); |
316 | 317 |
317 Node* top = document().getElementById("top")->firstChild(); | 318 Node* top = document().getElementById("top")->firstChild(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 selection().updateIfNeeded(); | 383 selection().updateIfNeeded(); |
383 | 384 |
384 // TODO(yosin): Once lazy canonicalization implemented, selection.start | 385 // TODO(yosin): Once lazy canonicalization implemented, selection.start |
385 // should be Position(HTML, 0). | 386 // should be Position(HTML, 0). |
386 EXPECT_EQ(Position(), selection().start()) | 387 EXPECT_EQ(Position(), selection().start()) |
387 << "updateIfNeeded() makes selection to null."; | 388 << "updateIfNeeded() makes selection to null."; |
388 EXPECT_EQ(selection().start(), caretPosition().position()); | 389 EXPECT_EQ(selection().start(), caretPosition().position()); |
389 } | 390 } |
390 | 391 |
391 } // namespace blink | 392 } // namespace blink |
OLD | NEW |