| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 document().view()->updateAllLifecyclePhases(); | 71 document().view()->updateAllLifecyclePhases(); |
| 72 | 72 |
| 73 document().body()->setContentEditable("true", ASSERT_NO_EXCEPTION); | 73 document().body()->setContentEditable("true", ASSERT_NO_EXCEPTION); |
| 74 document().body()->focus(); | 74 document().body()->focus(); |
| 75 EXPECT_TRUE(document().body()->isFocused()); | 75 EXPECT_TRUE(document().body()->isFocused()); |
| 76 | 76 |
| 77 selection().setCaretVisible(true); | 77 selection().setCaretVisible(true); |
| 78 selection().setSelection( | 78 selection().setSelection( |
| 79 SelectionInDOMTree::Builder().collapse(Position(text, 0)).build()); | 79 SelectionInDOMTree::Builder().collapse(Position(text, 0)).build()); |
| 80 document().view()->updateAllLifecyclePhases(); | 80 document().view()->updateAllLifecyclePhases(); |
| 81 EXPECT_TRUE(selection().isCaret()); | 81 EXPECT_TRUE( |
| 82 selection().computeVisibleSelectionInDOMTreeDeprecated().isCaret()); |
| 82 EXPECT_TRUE(toLayoutBlock(document().body()->layoutObject()) | 83 EXPECT_TRUE(toLayoutBlock(document().body()->layoutObject()) |
| 83 ->shouldPaintCursorCaret()); | 84 ->shouldPaintCursorCaret()); |
| 84 | 85 |
| 85 int startCount = layoutCount(); | 86 int startCount = layoutCount(); |
| 86 { | 87 { |
| 87 // To force layout in next updateLayout calling, widen view. | 88 // To force layout in next updateLayout calling, widen view. |
| 88 FrameView& frameView = dummyPageHolder().frameView(); | 89 FrameView& frameView = dummyPageHolder().frameView(); |
| 89 IntRect frameRect = frameView.frameRect(); | 90 IntRect frameRect = frameView.frameRect(); |
| 90 frameRect.setWidth(frameRect.width() + 1); | 91 frameRect.setWidth(frameRect.width() + 1); |
| 91 frameRect.setHeight(frameRect.height() + 1); | 92 frameRect.setHeight(frameRect.height() + 1); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 EXPECT_EQ(selection().start(), caretPosition().position()); | 272 EXPECT_EQ(selection().start(), caretPosition().position()); |
| 272 document().updateStyleAndLayout(); | 273 document().updateStyleAndLayout(); |
| 273 selection().updateIfNeeded(); | 274 selection().updateIfNeeded(); |
| 274 | 275 |
| 275 EXPECT_EQ(Position(), selection().start()) | 276 EXPECT_EQ(Position(), selection().start()) |
| 276 << "selection().updateIfNeeded() does nothing."; | 277 << "selection().updateIfNeeded() does nothing."; |
| 277 EXPECT_EQ(selection().start(), caretPosition().position()); | 278 EXPECT_EQ(selection().start(), caretPosition().position()); |
| 278 } | 279 } |
| 279 | 280 |
| 280 } // namespace blink | 281 } // namespace blink |
| OLD | NEW |