| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // To force layout in next updateLayout calling, widen view. | 114 // To force layout in next updateLayout calling, widen view. |
| 115 FrameView& frameView = dummyPageHolder().frameView(); | 115 FrameView& frameView = dummyPageHolder().frameView(); |
| 116 IntRect frameRect = frameView.frameRect(); | 116 IntRect frameRect = frameView.frameRect(); |
| 117 frameRect.setWidth(frameRect.width() + 1); | 117 frameRect.setWidth(frameRect.width() + 1); |
| 118 frameRect.setHeight(frameRect.height() + 1); | 118 frameRect.setHeight(frameRect.height() + 1); |
| 119 dummyPageHolder().frameView().setFrameRect(frameRect); | 119 dummyPageHolder().frameView().setFrameRect(frameRect); |
| 120 } | 120 } |
| 121 std::unique_ptr<PaintController> paintController = PaintController::create()
; | 121 std::unique_ptr<PaintController> paintController = PaintController::create()
; |
| 122 { | 122 { |
| 123 GraphicsContext context(*paintController); | 123 GraphicsContext context(*paintController); |
| 124 DrawingRecorder drawingRecorder(context, *dummyPageHolder().frameView().
layoutView(), DisplayItem::Caret, LayoutRect::infiniteIntRect()); | |
| 125 selection().paintCaret(context, LayoutPoint()); | 124 selection().paintCaret(context, LayoutPoint()); |
| 126 } | 125 } |
| 127 paintController->commitNewDisplayItems(); | 126 paintController->commitNewDisplayItems(); |
| 128 EXPECT_EQ(startCount, layoutCount()); | 127 EXPECT_EQ(startCount, layoutCount()); |
| 129 } | 128 } |
| 130 | 129 |
| 131 TEST_F(FrameSelectionTest, InvalidatePreviousCaretAfterRemovingLastCharacter) | 130 TEST_F(FrameSelectionTest, InvalidatePreviousCaretAfterRemovingLastCharacter) |
| 132 { | 131 { |
| 133 Text* text = appendTextNode("Hello, World!"); | 132 Text* text = appendTextNode("Hello, World!"); |
| 134 document().view()->updateAllLifecyclePhases(); | 133 document().view()->updateAllLifecyclePhases(); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 selection().updateIfNeeded(); | 311 selection().updateIfNeeded(); |
| 313 | 312 |
| 314 // TODO(yosin): Once lazy canonicalization implemented, selection.start | 313 // TODO(yosin): Once lazy canonicalization implemented, selection.start |
| 315 // should be Position(HTML, 0). | 314 // should be Position(HTML, 0). |
| 316 EXPECT_EQ(Position(), selection().start()) | 315 EXPECT_EQ(Position(), selection().start()) |
| 317 << "updateIfNeeded() makes selection to null."; | 316 << "updateIfNeeded() makes selection to null."; |
| 318 EXPECT_EQ(selection().start(), caretPosition().position()); | 317 EXPECT_EQ(selection().start(), caretPosition().position()); |
| 319 } | 318 } |
| 320 | 319 |
| 321 } // namespace blink | 320 } // namespace blink |
| OLD | NEW |