| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 static VisiblePosition endOfWord(const VisiblePosition& position) | 150 static VisiblePosition endOfWord(const VisiblePosition& position) |
| 151 { | 151 { |
| 152 return endOfWord(position, RightWordIfOnBoundary); | 152 return endOfWord(position, RightWordIfOnBoundary); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void testBoundary(HTMLDocument& document, HTMLTextFormControlElement& textContro
l) | 155 void testBoundary(HTMLDocument& document, HTMLTextFormControlElement& textContro
l) |
| 156 { | 156 { |
| 157 for (unsigned i = 0; i < textControl.innerEditorValue().length(); i++) { | 157 for (unsigned i = 0; i < textControl.innerEditorValue().length(); i++) { |
| 158 textControl.setSelectionRange(i, i); | 158 textControl.setSelectionRange(i, i); |
| 159 Position position = document.frame()->selection().start(); | 159 Position position = document.frame()->selection().start(); |
| 160 SCOPED_TRACE(::testing::Message() << "offset " << position.deprecatedEdi
tingOffset() << " of " << nodePositionAsStringForTesting(position.deprecatedNode
()).ascii().data()); | 160 SCOPED_TRACE(::testing::Message() << "offset " << position.deprecatedEdi
tingOffset() << " of " << nodePositionAsStringForTesting(position.anchorNode()).
ascii().data()); |
| 161 { | 161 { |
| 162 SCOPED_TRACE("HTMLTextFormControlElement::startOfWord"); | 162 SCOPED_TRACE("HTMLTextFormControlElement::startOfWord"); |
| 163 testFunctionEquivalence(position, HTMLTextFormControlElement::startO
fWord, startOfWord); | 163 testFunctionEquivalence(position, HTMLTextFormControlElement::startO
fWord, startOfWord); |
| 164 } | 164 } |
| 165 { | 165 { |
| 166 SCOPED_TRACE("HTMLTextFormControlElement::endOfWord"); | 166 SCOPED_TRACE("HTMLTextFormControlElement::endOfWord"); |
| 167 testFunctionEquivalence(position, HTMLTextFormControlElement::endOfW
ord, endOfWord); | 167 testFunctionEquivalence(position, HTMLTextFormControlElement::endOfW
ord, endOfWord); |
| 168 } | 168 } |
| 169 { | 169 { |
| 170 SCOPED_TRACE("HTMLTextFormControlElement::startOfSentence"); | 170 SCOPED_TRACE("HTMLTextFormControlElement::startOfSentence"); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |