| 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" |
| 11 #include "core/editing/SpellChecker.h" | 11 #include "core/editing/SpellChecker.h" |
| 12 #include "core/editing/VisibleSelection.h" | 12 #include "core/editing/VisibleSelection.h" |
| 13 #include "core/editing/VisibleUnits.h" | 13 #include "core/editing/VisibleUnits.h" |
| 14 #include "core/frame/FrameView.h" | 14 #include "core/frame/FrameView.h" |
| 15 #include "core/html/HTMLBRElement.h" | 15 #include "core/html/HTMLBRElement.h" |
| 16 #include "core/html/HTMLDocument.h" | 16 #include "core/html/HTMLDocument.h" |
| 17 #include "core/html/HTMLInputElement.h" | 17 #include "core/html/HTMLInputElement.h" |
| 18 #include "core/html/HTMLTextAreaElement.h" | 18 #include "core/html/HTMLTextAreaElement.h" |
| 19 #include "core/layout/LayoutTreeAsText.h" | 19 #include "core/layout/LayoutTreeAsText.h" |
| 20 #include "core/loader/EmptyClients.h" | 20 #include "core/loader/EmptyClients.h" |
| 21 #include "core/page/SpellCheckerClient.h" | 21 #include "core/page/SpellCheckerClient.h" |
| 22 #include "core/testing/DummyPageHolder.h" | 22 #include "core/testing/DummyPageHolder.h" |
| 23 #include "platform/testing/UnitTestHelpers.h" | 23 #include "platform/testing/UnitTestHelpers.h" |
| 24 #include "wtf/OwnPtr.h" | 24 #include "wtf/OwnPtr.h" |
| 25 #include <gtest/gtest.h> | 25 #include <gtest/gtest.h> |
| 26 | 26 |
| 27 using namespace blink; | 27 namespace blink { |
| 28 | |
| 29 namespace { | |
| 30 | 28 |
| 31 class HTMLTextFormControlElementTest : public ::testing::Test { | 29 class HTMLTextFormControlElementTest : public ::testing::Test { |
| 32 protected: | 30 protected: |
| 33 virtual void SetUp() override; | 31 void SetUp() override; |
| 34 | 32 |
| 35 DummyPageHolder& page() const { return *m_dummyPageHolder; } | 33 DummyPageHolder& page() const { return *m_dummyPageHolder; } |
| 36 HTMLDocument& document() const { return *m_document; } | 34 HTMLDocument& document() const { return *m_document; } |
| 37 HTMLTextFormControlElement& textControl() const { return *m_textControl; } | 35 HTMLTextFormControlElement& textControl() const { return *m_textControl; } |
| 38 HTMLInputElement& input() const { return *m_input; } | 36 HTMLInputElement& input() const { return *m_input; } |
| 39 | 37 |
| 40 int layoutCount() const { return page().frameView().layoutCount(); } | 38 int layoutCount() const { return page().frameView().layoutCount(); } |
| 41 void forceLayoutFlag(); | 39 void forceLayoutFlag(); |
| 42 | 40 |
| 43 private: | 41 private: |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 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); |
| 219 ASSERT_EQ(3, input->selectionStart()); | 217 ASSERT_EQ(3, input->selectionStart()); |
| 220 | 218 |
| 221 OwnPtrWillBePersistent<SpellChecker> spellChecker(SpellChecker::create(page(
).frame())); | 219 OwnPtrWillBePersistent<SpellChecker> spellChecker(SpellChecker::create(page(
).frame())); |
| 222 forceLayoutFlag(); | 220 forceLayoutFlag(); |
| 223 int startCount = layoutCount(); | 221 int startCount = layoutCount(); |
| 224 spellChecker->respondToChangedSelection(oldSelection, FrameSelection::CloseT
yping | FrameSelection::ClearTypingStyle); | 222 spellChecker->respondToChangedSelection(oldSelection, FrameSelection::CloseT
yping | FrameSelection::ClearTypingStyle); |
| 225 EXPECT_EQ(startCount, layoutCount()); | 223 EXPECT_EQ(startCount, layoutCount()); |
| 226 } | 224 } |
| 227 | 225 |
| 228 } | 226 } // namespace blink |
| OLD | NEW |