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

Side by Side Diff: third_party/WebKit/Source/core/editing/spellcheck/SpellCheckerTest.cpp

Issue 2442673002: Get rid of createVisibleSelection() taking one Position (Closed)
Patch Set: 2016-10-24T17:42:38 Created 4 years, 1 month 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/editing/spellcheck/SpellChecker.h" 5 #include "core/editing/spellcheck/SpellChecker.h"
6 6
7 #include "core/editing/EditingTestBase.h" 7 #include "core/editing/EditingTestBase.h"
8 #include "core/editing/Editor.h" 8 #include "core/editing/Editor.h"
9 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 TEST_F(SpellCheckerTest, SpellCheckDoesNotCauseUpdateLayout) { 44 TEST_F(SpellCheckerTest, SpellCheckDoesNotCauseUpdateLayout) {
45 setBodyContent("<input>"); 45 setBodyContent("<input>");
46 HTMLInputElement* input = 46 HTMLInputElement* input =
47 toHTMLInputElement(document().querySelector("input")); 47 toHTMLInputElement(document().querySelector("input"));
48 input->focus(); 48 input->focus();
49 input->setValue("Hello, input field"); 49 input->setValue("Hello, input field");
50 document().updateStyleAndLayout(); 50 document().updateStyleAndLayout();
51 VisibleSelection oldSelection = document().frame()->selection().selection(); 51 VisibleSelection oldSelection = document().frame()->selection().selection();
52 52
53 Position newPosition(input->innerEditorElement()->firstChild(), 3); 53 Position newPosition(input->innerEditorElement()->firstChild(), 3);
54 VisibleSelection newSelection = 54 VisibleSelection newSelection = createVisibleSelection(
55 createVisibleSelection(newPosition, TextAffinity::Downstream); 55 SelectionInDOMTree::Builder().collapse(newPosition).build());
56 document().frame()->selection().setSelection( 56 document().frame()->selection().setSelection(
57 newSelection, FrameSelection::CloseTyping | 57 newSelection, FrameSelection::CloseTyping |
58 FrameSelection::ClearTypingStyle | 58 FrameSelection::ClearTypingStyle |
59 FrameSelection::DoNotUpdateAppearance); 59 FrameSelection::DoNotUpdateAppearance);
60 ASSERT_EQ(3, input->selectionStart()); 60 ASSERT_EQ(3, input->selectionStart());
61 61
62 Persistent<SpellChecker> spellChecker(SpellChecker::create(page().frame())); 62 Persistent<SpellChecker> spellChecker(SpellChecker::create(page().frame()));
63 forceLayout(); 63 forceLayout();
64 int startCount = layoutCount(); 64 int startCount = layoutCount();
65 spellChecker->respondToChangedSelection( 65 spellChecker->respondToChangedSelection(
66 oldSelection.start(), 66 oldSelection.start(),
67 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle); 67 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle);
68 EXPECT_EQ(startCount, layoutCount()); 68 EXPECT_EQ(startCount, layoutCount());
69 } 69 }
70 70
71 } // namespace blink 71 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698