| 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/html/HTMLTextFormControlElement.h" | 5 #include "core/html/HTMLTextFormControlElement.h" |
| 6 | 6 |
| 7 #include "core/dom/Text.h" | 7 #include "core/dom/Text.h" |
| 8 #include "core/editing/FrameSelection.h" | 8 #include "core/editing/FrameSelection.h" |
| 9 #include "core/editing/Position.h" | 9 #include "core/editing/Position.h" |
| 10 #include "core/editing/VisibleSelection.h" | 10 #include "core/editing/VisibleSelection.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 HTMLTextFormControlElement& textControl() const { return *m_textControl; } | 34 HTMLTextFormControlElement& textControl() const { return *m_textControl; } |
| 35 HTMLInputElement& input() const { return *m_input; } | 35 HTMLInputElement& input() const { return *m_input; } |
| 36 | 36 |
| 37 int layoutCount() const { return page().frameView().layoutCount(); } | 37 int layoutCount() const { return page().frameView().layoutCount(); } |
| 38 void forceLayoutFlag(); | 38 void forceLayoutFlag(); |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 OwnPtr<SpellCheckerClient> m_spellCheckerClient; | 41 OwnPtr<SpellCheckerClient> m_spellCheckerClient; |
| 42 OwnPtr<DummyPageHolder> m_dummyPageHolder; | 42 OwnPtr<DummyPageHolder> m_dummyPageHolder; |
| 43 | 43 |
| 44 RefPtrWillBePersistent<HTMLDocument> m_document; | 44 Persistent<HTMLDocument> m_document; |
| 45 RefPtrWillBePersistent<HTMLTextFormControlElement> m_textControl; | 45 Persistent<HTMLTextFormControlElement> m_textControl; |
| 46 RefPtrWillBePersistent<HTMLInputElement> m_input; | 46 Persistent<HTMLInputElement> m_input; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 class DummySpellCheckerClient : public EmptySpellCheckerClient { | 49 class DummySpellCheckerClient : public EmptySpellCheckerClient { |
| 50 public: | 50 public: |
| 51 virtual ~DummySpellCheckerClient() { } | 51 virtual ~DummySpellCheckerClient() { } |
| 52 | 52 |
| 53 bool isContinuousSpellCheckingEnabled() override { return true; } | 53 bool isContinuousSpellCheckingEnabled() override { return true; } |
| 54 | 54 |
| 55 TextCheckerClient& textChecker() override { return m_emptyTextCheckerClient;
} | 55 TextCheckerClient& textChecker() override { return m_emptyTextCheckerClient;
} |
| 56 | 56 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 HTMLInputElement* input = toHTMLInputElement(document().getElementById("inpu
t")); | 200 HTMLInputElement* input = toHTMLInputElement(document().getElementById("inpu
t")); |
| 201 input->focus(); | 201 input->focus(); |
| 202 input->setValue("Hello, input field"); | 202 input->setValue("Hello, input field"); |
| 203 VisibleSelection oldSelection = document().frame()->selection().selection(); | 203 VisibleSelection oldSelection = document().frame()->selection().selection(); |
| 204 | 204 |
| 205 Position newPosition(input->innerEditorElement()->firstChild(), 3); | 205 Position newPosition(input->innerEditorElement()->firstChild(), 3); |
| 206 VisibleSelection newSelection(newPosition, TextAffinity::Downstream); | 206 VisibleSelection newSelection(newPosition, TextAffinity::Downstream); |
| 207 document().frame()->selection().setSelection(newSelection, FrameSelection::C
loseTyping | FrameSelection::ClearTypingStyle | FrameSelection::DoNotUpdateAppea
rance); | 207 document().frame()->selection().setSelection(newSelection, FrameSelection::C
loseTyping | FrameSelection::ClearTypingStyle | FrameSelection::DoNotUpdateAppea
rance); |
| 208 ASSERT_EQ(3, input->selectionStart()); | 208 ASSERT_EQ(3, input->selectionStart()); |
| 209 | 209 |
| 210 OwnPtrWillBePersistent<SpellChecker> spellChecker(SpellChecker::create(page(
).frame())); | 210 Persistent<SpellChecker> spellChecker(SpellChecker::create(page().frame())); |
| 211 forceLayoutFlag(); | 211 forceLayoutFlag(); |
| 212 int startCount = layoutCount(); | 212 int startCount = layoutCount(); |
| 213 spellChecker->respondToChangedSelection(oldSelection, FrameSelection::CloseT
yping | FrameSelection::ClearTypingStyle); | 213 spellChecker->respondToChangedSelection(oldSelection, FrameSelection::CloseT
yping | FrameSelection::ClearTypingStyle); |
| 214 EXPECT_EQ(startCount, layoutCount()); | 214 EXPECT_EQ(startCount, layoutCount()); |
| 215 } | 215 } |
| 216 | 216 |
| 217 } // namespace blink | 217 } // namespace blink |
| OLD | NEW |