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 "config.h" | 5 #include "config.h" |
6 #include "core/html/HTMLTextFormControlElement.h" | 6 #include "core/html/HTMLTextFormControlElement.h" |
7 | 7 |
8 #include "core/dom/Text.h" | 8 #include "core/dom/Text.h" |
9 #include "core/editing/FrameSelection.h" | 9 #include "core/editing/FrameSelection.h" |
10 #include "core/editing/Position.h" | 10 #include "core/editing/Position.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 } | 205 } |
206 | 206 |
207 TEST_F(HTMLTextFormControlElementTest, SpellCheckDoesNotCauseUpdateLayout) | 207 TEST_F(HTMLTextFormControlElementTest, SpellCheckDoesNotCauseUpdateLayout) |
208 { | 208 { |
209 HTMLInputElement* input = toHTMLInputElement(document().getElementById("inpu
t")); | 209 HTMLInputElement* input = toHTMLInputElement(document().getElementById("inpu
t")); |
210 input->focus(); | 210 input->focus(); |
211 input->setValue("Hello, input field"); | 211 input->setValue("Hello, input field"); |
212 VisibleSelection oldSelection = document().frame()->selection().selection(); | 212 VisibleSelection oldSelection = document().frame()->selection().selection(); |
213 | 213 |
214 Position newPosition(input->innerEditorElement()->firstChild(), 3); | 214 Position newPosition(input->innerEditorElement()->firstChild(), 3); |
215 VisibleSelection newSelection(newPosition, DOWNSTREAM); | 215 VisibleSelection newSelection(newPosition, TextAffinity::Downstream); |
216 document().frame()->selection().setSelection(newSelection, FrameSelection::C
loseTyping | FrameSelection::ClearTypingStyle | FrameSelection::DoNotUpdateAppea
rance); | 216 document().frame()->selection().setSelection(newSelection, FrameSelection::C
loseTyping | FrameSelection::ClearTypingStyle | FrameSelection::DoNotUpdateAppea
rance); |
217 ASSERT_EQ(3, input->selectionStart()); | 217 ASSERT_EQ(3, input->selectionStart()); |
218 | 218 |
219 OwnPtrWillBePersistent<SpellChecker> spellChecker(SpellChecker::create(page(
).frame())); | 219 OwnPtrWillBePersistent<SpellChecker> spellChecker(SpellChecker::create(page(
).frame())); |
220 forceLayoutFlag(); | 220 forceLayoutFlag(); |
221 int startCount = layoutCount(); | 221 int startCount = layoutCount(); |
222 spellChecker->respondToChangedSelection(oldSelection, FrameSelection::CloseT
yping | FrameSelection::ClearTypingStyle); | 222 spellChecker->respondToChangedSelection(oldSelection, FrameSelection::CloseT
yping | FrameSelection::ClearTypingStyle); |
223 EXPECT_EQ(startCount, layoutCount()); | 223 EXPECT_EQ(startCount, layoutCount()); |
224 } | 224 } |
225 | 225 |
226 } // namespace blink | 226 } // namespace blink |
OLD | NEW |