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

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

Issue 2694823002: Revert of Make FrameSelection to hold non-canonicalized positions (Closed)
Patch Set: Merge branch 'master' of https://chromium.googlesource.com/chromium/src into patch_revert Created 3 years, 10 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
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/editing/FrameSelection.h" 5 #include "core/editing/FrameSelection.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/dom/Element.h" 10 #include "core/dom/Element.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 TEST_F(FrameSelectionTest, updateIfNeededAndFrameCaret) { 259 TEST_F(FrameSelectionTest, updateIfNeededAndFrameCaret) {
260 setBodyContent("<style id=sample></style>"); 260 setBodyContent("<style id=sample></style>");
261 document().setDesignMode("on"); 261 document().setDesignMode("on");
262 updateAllLifecyclePhases(); 262 updateAllLifecyclePhases();
263 Element* sample = document().getElementById("sample"); 263 Element* sample = document().getElementById("sample");
264 selection().setSelection( 264 selection().setSelection(
265 SelectionInDOMTree::Builder().collapse(Position(sample, 0)).build()); 265 SelectionInDOMTree::Builder().collapse(Position(sample, 0)).build());
266 EXPECT_EQ(Position(document().body(), 0), selection().start()); 266 EXPECT_EQ(Position(document().body(), 0), selection().start());
267 EXPECT_EQ(selection().start(), caretPosition().position()); 267 EXPECT_EQ(selection().start(), caretPosition().position());
268 document().body()->remove(); 268 document().body()->remove();
269 EXPECT_EQ(Position(), selection().start()) 269 // TODO(yosin): Once lazy canonicalization implemented, selection.start
270 << "Selection has been removed by BODY.remove()."; 270 // should be Position(HTML, 0).
271 EXPECT_EQ(Position(document().documentElement(), 1), selection().start());
271 EXPECT_EQ(selection().start(), caretPosition().position()); 272 EXPECT_EQ(selection().start(), caretPosition().position());
272 document().updateStyleAndLayout(); 273 document().updateStyleAndLayout();
273 selection().updateIfNeeded(); 274 selection().updateIfNeeded();
274 275
276 // TODO(yosin): Once lazy canonicalization implemented, selection.start
277 // should be Position(HTML, 0).
275 EXPECT_EQ(Position(), selection().start()) 278 EXPECT_EQ(Position(), selection().start())
276 << "selection().updateIfNeeded() does nothing."; 279 << "updateIfNeeded() makes selection to null.";
277 EXPECT_EQ(selection().start(), caretPosition().position()); 280 EXPECT_EQ(selection().start(), caretPosition().position());
278 } 281 }
279 282
280 } // namespace blink 283 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelection.cpp ('k') | third_party/WebKit/Source/core/editing/SelectionEditor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698