Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLTextFormControlElementTest.cpp

Issue 2278373002: Fix selectionEnd value in a case of dragging out from an INPUT element. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLTextFormControlElement.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/Document.h" 7 #include "core/dom/Document.h"
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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 document().frame()->selection().setSelection(newSelection, FrameSelection::C loseTyping | FrameSelection::ClearTypingStyle | FrameSelection::DoNotUpdateAppea rance); 208 document().frame()->selection().setSelection(newSelection, FrameSelection::C loseTyping | FrameSelection::ClearTypingStyle | FrameSelection::DoNotUpdateAppea rance);
209 ASSERT_EQ(3, input->selectionStart()); 209 ASSERT_EQ(3, input->selectionStart());
210 210
211 Persistent<SpellChecker> spellChecker(SpellChecker::create(page().frame())); 211 Persistent<SpellChecker> spellChecker(SpellChecker::create(page().frame()));
212 forceLayoutFlag(); 212 forceLayoutFlag();
213 int startCount = layoutCount(); 213 int startCount = layoutCount();
214 spellChecker->respondToChangedSelection(oldSelection, FrameSelection::CloseT yping | FrameSelection::ClearTypingStyle); 214 spellChecker->respondToChangedSelection(oldSelection, FrameSelection::CloseT yping | FrameSelection::ClearTypingStyle);
215 EXPECT_EQ(startCount, layoutCount()); 215 EXPECT_EQ(startCount, layoutCount());
216 } 216 }
217 217
218 TEST_F(HTMLTextFormControlElementTest, IndexForPosition)
219 {
220 HTMLInputElement* input = toHTMLInputElement(document().getElementById("inpu t"));
221 input->setValue("Hello");
222 HTMLElement* innerEditor = input->innerEditorElement();
223 EXPECT_EQ(5, HTMLTextFormControlElement::indexForPosition(innerEditor, Posit ion(innerEditor, PositionAnchorType::AfterAnchor)));
224 }
225
218 } // namespace blink 226 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLTextFormControlElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698