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

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

Issue 2533213003: [Editing] Use VisiblePosition stardOfWord for textarea in spell checker. (Closed)
Patch Set: Created 4 years 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
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/TextControlElement.h" 5 #include "core/html/TextControlElement.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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 TEST_F(TextControlElementTest, IndexForPosition) { 203 TEST_F(TextControlElementTest, IndexForPosition) {
204 HTMLInputElement* input = 204 HTMLInputElement* input =
205 toHTMLInputElement(document().getElementById("input")); 205 toHTMLInputElement(document().getElementById("input"));
206 input->setValue("Hello"); 206 input->setValue("Hello");
207 HTMLElement* innerEditor = input->innerEditorElement(); 207 HTMLElement* innerEditor = input->innerEditorElement();
208 EXPECT_EQ(5, TextControlElement::indexForPosition( 208 EXPECT_EQ(5, TextControlElement::indexForPosition(
209 innerEditor, 209 innerEditor,
210 Position(innerEditor, PositionAnchorType::AfterAnchor))); 210 Position(innerEditor, PositionAnchorType::AfterAnchor)));
211 } 211 }
212 212
213 TEST_F(TextControlElementTest, EnclosingTextControl) {
214 textControl().setValue("foobar");
215 EXPECT_EQ(nullptr, enclosingTextControl(Position(&document(), 0)));
216 EXPECT_EQ(nullptr, enclosingTextControl(Position(&textControl(), 0)));
217 EXPECT_EQ(&textControl(), enclosingTextControl(Position(
218 textControl().innerEditorElement(), 0)));
219 EXPECT_EQ(&textControl(),
220 enclosingTextControl(
221 Position(textControl().innerEditorElement()->firstChild(), 0)));
222 EXPECT_EQ(nullptr,
223 enclosingTextControl(Position(textControl().innerEditorElement(),
224 PositionAnchorType::BeforeAnchor)));
225 }
226
213 } // namespace blink 227 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698