| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 EXPECT_TRUE(selection().isCaretBoundsDirty()); | 169 EXPECT_TRUE(selection().isCaretBoundsDirty()); |
| 170 // "H" remains so early previousCaret invalidation isn't needed. | 170 // "H" remains so early previousCaret invalidation isn't needed. |
| 171 EXPECT_TRUE(isPreviousCaretDirtyForTesting()); | 171 EXPECT_TRUE(isPreviousCaretDirtyForTesting()); |
| 172 selection().invalidateCaretRect(); | 172 selection().invalidateCaretRect(); |
| 173 EXPECT_FALSE(selection().isCaretBoundsDirty()); | 173 EXPECT_FALSE(selection().isCaretBoundsDirty()); |
| 174 EXPECT_TRUE(isPreviousCaretDirtyForTesting()); | 174 EXPECT_TRUE(isPreviousCaretDirtyForTesting()); |
| 175 | 175 |
| 176 // Simulate to remove the last character. | 176 // Simulate to remove the last character. |
| 177 document().body()->removeChild(text); | 177 document().body()->removeChild(text); |
| 178 // This line is the objective of this test. | 178 // This line is the objective of this test. |
| 179 // As removing the last character, early previousCaret invalidation is execute
d. | 179 // As removing the last character, early previousCaret invalidation is |
| 180 // executed. |
| 180 EXPECT_FALSE(isPreviousCaretDirtyForTesting()); | 181 EXPECT_FALSE(isPreviousCaretDirtyForTesting()); |
| 181 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 182 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| 182 selection().setCaretRectNeedsUpdate(); | 183 selection().setCaretRectNeedsUpdate(); |
| 183 EXPECT_TRUE(selection().isCaretBoundsDirty()); | 184 EXPECT_TRUE(selection().isCaretBoundsDirty()); |
| 184 EXPECT_FALSE(isPreviousCaretDirtyForTesting()); | 185 EXPECT_FALSE(isPreviousCaretDirtyForTesting()); |
| 185 selection().invalidateCaretRect(); | 186 selection().invalidateCaretRect(); |
| 186 EXPECT_FALSE(selection().isCaretBoundsDirty()); | 187 EXPECT_FALSE(selection().isCaretBoundsDirty()); |
| 187 EXPECT_TRUE(isPreviousCaretDirtyForTesting()); | 188 EXPECT_TRUE(isPreviousCaretDirtyForTesting()); |
| 188 } | 189 } |
| 189 | 190 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 selection().updateIfNeeded(); | 350 selection().updateIfNeeded(); |
| 350 | 351 |
| 351 // TODO(yosin): Once lazy canonicalization implemented, selection.start | 352 // TODO(yosin): Once lazy canonicalization implemented, selection.start |
| 352 // should be Position(HTML, 0). | 353 // should be Position(HTML, 0). |
| 353 EXPECT_EQ(Position(), selection().start()) | 354 EXPECT_EQ(Position(), selection().start()) |
| 354 << "updateIfNeeded() makes selection to null."; | 355 << "updateIfNeeded() makes selection to null."; |
| 355 EXPECT_EQ(selection().start(), caretPosition().position()); | 356 EXPECT_EQ(selection().start(), caretPosition().position()); |
| 356 } | 357 } |
| 357 | 358 |
| 358 } // namespace blink | 359 } // namespace blink |
| OLD | NEW |