| 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/Position.h" | 8 #include "core/dom/Position.h" |
| 9 #include "core/dom/Text.h" | 9 #include "core/dom/Text.h" |
| 10 #include "core/editing/FrameSelection.h" | 10 #include "core/editing/FrameSelection.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 HTMLInputElement* input = toHTMLInputElement(document().getElementById("inpu
t")); | 211 HTMLInputElement* input = toHTMLInputElement(document().getElementById("inpu
t")); |
| 212 input->focus(); | 212 input->focus(); |
| 213 input->setValue("Hello, input field"); | 213 input->setValue("Hello, input field"); |
| 214 VisibleSelection oldSelection = document().frame()->selection().selection(); | 214 VisibleSelection oldSelection = document().frame()->selection().selection(); |
| 215 | 215 |
| 216 Position newPosition(input->innerEditorElement()->firstChild(), 3, Position:
:PositionIsOffsetInAnchor); | 216 Position newPosition(input->innerEditorElement()->firstChild(), 3, Position:
:PositionIsOffsetInAnchor); |
| 217 VisibleSelection newSelection(newPosition, DOWNSTREAM); | 217 VisibleSelection newSelection(newPosition, DOWNSTREAM); |
| 218 document().frame()->selection().setSelection(newSelection, FrameSelection::C
loseTyping | FrameSelection::ClearTypingStyle | FrameSelection::DoNotUpdateAppea
rance); | 218 document().frame()->selection().setSelection(newSelection, FrameSelection::C
loseTyping | FrameSelection::ClearTypingStyle | FrameSelection::DoNotUpdateAppea
rance); |
| 219 ASSERT_EQ(3, input->selectionStart()); | 219 ASSERT_EQ(3, input->selectionStart()); |
| 220 | 220 |
| 221 OwnPtr<SpellChecker> spellChecker(SpellChecker::create(page().frame())); | 221 OwnPtrWillBePersistent<SpellChecker> spellChecker(SpellChecker::create(page(
).frame())); |
| 222 forceLayoutFlag(); | 222 forceLayoutFlag(); |
| 223 int startCount = layoutCount(); | 223 int startCount = layoutCount(); |
| 224 spellChecker->respondToChangedSelection(oldSelection, FrameSelection::CloseT
yping | FrameSelection::ClearTypingStyle); | 224 spellChecker->respondToChangedSelection(oldSelection, FrameSelection::CloseT
yping | FrameSelection::ClearTypingStyle); |
| 225 EXPECT_EQ(startCount, layoutCount()); | 225 EXPECT_EQ(startCount, layoutCount()); |
| 226 } | 226 } |
| 227 | 227 |
| 228 } | 228 } |
| OLD | NEW |