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/EditingTestBase.h" | 7 #include "core/editing/EditingTestBase.h" |
8 #include "core/editing/Editor.h" | 8 #include "core/editing/Editor.h" |
9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 input->setValue("Hello, input field"); | 49 input->setValue("Hello, input field"); |
50 document().updateStyleAndLayout(); | 50 document().updateStyleAndLayout(); |
51 VisibleSelection oldSelection = | 51 VisibleSelection oldSelection = |
52 document() | 52 document() |
53 .frame() | 53 .frame() |
54 ->selection() | 54 ->selection() |
55 .computeVisibleSelectionInDOMTreeDeprecated(); | 55 .computeVisibleSelectionInDOMTreeDeprecated(); |
56 | 56 |
57 Position newPosition(input->innerEditorElement()->firstChild(), 3); | 57 Position newPosition(input->innerEditorElement()->firstChild(), 3); |
58 document().frame()->selection().setSelection( | 58 document().frame()->selection().setSelection( |
59 SelectionInDOMTree::Builder().collapse(newPosition).build(), | 59 SelectionInDOMTree::Builder().collapse(newPosition).build()); |
60 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle | | |
61 FrameSelection::DoNotUpdateAppearance); | |
62 ASSERT_EQ(3u, input->selectionStart()); | 60 ASSERT_EQ(3u, input->selectionStart()); |
63 | 61 |
64 Persistent<SpellChecker> spellChecker(SpellChecker::create(page().frame())); | 62 Persistent<SpellChecker> spellChecker(SpellChecker::create(page().frame())); |
65 forceLayout(); | 63 forceLayout(); |
66 int startCount = layoutCount(); | 64 int startCount = layoutCount(); |
67 spellChecker->respondToChangedSelection( | 65 spellChecker->respondToChangedSelection( |
68 oldSelection.start(), | 66 oldSelection.start(), |
69 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle); | 67 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle); |
70 EXPECT_EQ(startCount, layoutCount()); | 68 EXPECT_EQ(startCount, layoutCount()); |
71 } | 69 } |
72 | 70 |
73 } // namespace blink | 71 } // namespace blink |
OLD | NEW |