| 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/VisibleSelection.h" | 5 #include "core/editing/VisibleSelection.h" |
| 6 | 6 |
| 7 #include "core/dom/Range.h" | 7 #include "core/dom/Range.h" |
| 8 #include "core/editing/EditingTestBase.h" | 8 #include "core/editing/EditingTestBase.h" |
| 9 #include "core/editing/SelectionAdjuster.h" | 9 #include "core/editing/SelectionAdjuster.h" |
| 10 | 10 |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 EXPECT_EQ(Position(sample->firstChild(), 0), selection.start()); | 474 EXPECT_EQ(Position(sample->firstChild(), 0), selection.start()); |
| 475 | 475 |
| 476 // Simulates modifying DOM tree to invalidate distribution. | 476 // Simulates modifying DOM tree to invalidate distribution. |
| 477 Element* host = document().getElementById("host"); | 477 Element* host = document().getElementById("host"); |
| 478 host->appendChild(sample); | 478 host->appendChild(sample); |
| 479 document().updateStyleAndLayout(); | 479 document().updateStyleAndLayout(); |
| 480 | 480 |
| 481 // Simulates to restore selection from undo stack. | 481 // Simulates to restore selection from undo stack. |
| 482 selection.updateIfNeeded(); | 482 selection.updateIfNeeded(); |
| 483 EXPECT_EQ(Position(sample->firstChild(), 0), selection.start()); | 483 EXPECT_EQ(Position(sample->firstChild(), 0), selection.start()); |
| 484 | |
| 485 VisibleSelectionInFlatTree selectionInFlatTree; | |
| 486 SelectionAdjuster::adjustSelectionInFlatTree(&selectionInFlatTree, selection); | |
| 487 EXPECT_EQ(PositionInFlatTree(sample->firstChild(), 0), | |
| 488 selectionInFlatTree.start()); | |
| 489 } | 484 } |
| 490 | 485 |
| 491 } // namespace blink | 486 } // namespace blink |
| OLD | NEW |