OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/spellcheck/SpellChecker.h" | 5 #include "core/editing/spellcheck/SpellChecker.h" |
6 | 6 |
7 #include "core/editing/Editor.h" | 7 #include "core/editing/Editor.h" |
8 #include "core/editing/markers/DocumentMarkerController.h" | 8 #include "core/editing/markers/DocumentMarkerController.h" |
9 #include "core/editing/markers/SpellCheckMarker.h" | 9 #include "core/editing/markers/SpellCheckMarker.h" |
10 #include "core/editing/spellcheck/SpellCheckRequester.h" | 10 #include "core/editing/spellcheck/SpellCheckRequester.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 GetSpellChecker().AdvanceToNextMisspelling(false); | 58 GetSpellChecker().AdvanceToNextMisspelling(false); |
59 } | 59 } |
60 | 60 |
61 // Regression test for crbug.com/728801 | 61 // Regression test for crbug.com/728801 |
62 TEST_F(SpellCheckerTest, AdvancedToNextMisspellingWrapSearchNoCrash) { | 62 TEST_F(SpellCheckerTest, AdvancedToNextMisspellingWrapSearchNoCrash) { |
63 SetBodyContent("<div contenteditable> zz zz zz </div>"); | 63 SetBodyContent("<div contenteditable> zz zz zz </div>"); |
64 | 64 |
65 Element* div = GetDocument().QuerySelector("div"); | 65 Element* div = GetDocument().QuerySelector("div"); |
66 div->focus(); | 66 div->focus(); |
67 Selection().SetSelection(SelectionInDOMTree::Builder() | 67 Selection().SetSelection(SelectionInDOMTree::Builder() |
68 .Collapse(Position::LastPositionInNode(div)) | 68 .Collapse(Position::LastPositionInNode(*div)) |
69 .Build()); | 69 .Build()); |
70 UpdateAllLifecyclePhases(); | 70 UpdateAllLifecyclePhases(); |
71 | 71 |
72 GetSpellChecker().AdvanceToNextMisspelling(false); | 72 GetSpellChecker().AdvanceToNextMisspelling(false); |
73 } | 73 } |
74 | 74 |
75 TEST_F(SpellCheckerTest, SpellCheckDoesNotCauseUpdateLayout) { | 75 TEST_F(SpellCheckerTest, SpellCheckDoesNotCauseUpdateLayout) { |
76 SetBodyContent("<input>"); | 76 SetBodyContent("<input>"); |
77 HTMLInputElement* input = | 77 HTMLInputElement* input = |
78 toHTMLInputElement(GetDocument().QuerySelector("input")); | 78 toHTMLInputElement(GetDocument().QuerySelector("input")); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 | 373 |
374 Optional<std::pair<Node*, SpellCheckMarker*>> result = | 374 Optional<std::pair<Node*, SpellCheckMarker*>> result = |
375 GetDocument() | 375 GetDocument() |
376 .GetFrame() | 376 .GetFrame() |
377 ->GetSpellChecker() | 377 ->GetSpellChecker() |
378 .GetSpellCheckMarkerTouchingSelection(); | 378 .GetSpellCheckMarkerTouchingSelection(); |
379 EXPECT_FALSE(result); | 379 EXPECT_FALSE(result); |
380 } | 380 } |
381 | 381 |
382 } // namespace blink | 382 } // namespace blink |
OLD | NEW |