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

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

Issue 2457613004: Utilize FrameSelection::setSelection() taking SelectionInDOMTree/SelectionInFlatTree (Closed)
Patch Set: 2016-11-24T13:04:01 Rebase 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
« 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());
56 document().frame()->selection().setSelection( 54 document().frame()->selection().setSelection(
57 newSelection, FrameSelection::CloseTyping | 55 SelectionInDOMTree::Builder().collapse(newPosition).build(),
58 FrameSelection::ClearTypingStyle | 56 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle |
59 FrameSelection::DoNotUpdateAppearance); 57 FrameSelection::DoNotUpdateAppearance);
60 ASSERT_EQ(3, input->selectionStart()); 58 ASSERT_EQ(3, input->selectionStart());
61 59
62 Persistent<SpellChecker> spellChecker(SpellChecker::create(page().frame())); 60 Persistent<SpellChecker> spellChecker(SpellChecker::create(page().frame()));
63 forceLayout(); 61 forceLayout();
64 int startCount = layoutCount(); 62 int startCount = layoutCount();
65 spellChecker->respondToChangedSelection( 63 spellChecker->respondToChangedSelection(
66 oldSelection.start(), 64 oldSelection.start(),
67 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle); 65 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle);
68 EXPECT_EQ(startCount, layoutCount()); 66 EXPECT_EQ(startCount, layoutCount());
69 } 67 }
70 68
71 } // namespace blink 69 } // 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