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

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

Issue 2491763004: Revert of Utilize FrameSelection::setSelection() taking SelectionInDOMTree/SelectionInFlatTree (Closed)
Patch Set: 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
« no previous file with comments | « third_party/WebKit/Source/core/editing/SelectionController.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 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 = createVisibleSelection(
55 SelectionInDOMTree::Builder().collapse(newPosition).build());
54 document().frame()->selection().setSelection( 56 document().frame()->selection().setSelection(
55 SelectionInDOMTree::Builder().collapse(newPosition).build(), 57 newSelection, FrameSelection::CloseTyping |
56 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle | 58 FrameSelection::ClearTypingStyle |
57 FrameSelection::DoNotUpdateAppearance); 59 FrameSelection::DoNotUpdateAppearance);
58 ASSERT_EQ(3, input->selectionStart()); 60 ASSERT_EQ(3, input->selectionStart());
59 61
60 Persistent<SpellChecker> spellChecker(SpellChecker::create(page().frame())); 62 Persistent<SpellChecker> spellChecker(SpellChecker::create(page().frame()));
61 forceLayout(); 63 forceLayout();
62 int startCount = layoutCount(); 64 int startCount = layoutCount();
63 spellChecker->respondToChangedSelection( 65 spellChecker->respondToChangedSelection(
64 oldSelection.start(), 66 oldSelection.start(),
65 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle); 67 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle);
66 EXPECT_EQ(startCount, layoutCount()); 68 EXPECT_EQ(startCount, layoutCount());
67 } 69 }
68 70
69 } // namespace blink 71 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/SelectionController.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698