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

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

Issue 2857173003: Remove DocumentMarkerController::MarkersInRange() (Closed)
Patch Set: Fix WebFrameTest.cpp Created 3 years, 7 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/InputMethodController.h" 5 #include "core/editing/InputMethodController.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/Element.h" 9 #include "core/dom/Element.h"
10 #include "core/dom/Range.h" 10 #include "core/dom/Range.h"
(...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 Controller().FinishComposingText(InputMethodController::kKeepSelection); 1401 Controller().FinishComposingText(InputMethodController::kKeepSelection);
1402 GetFrame().GetEditor().InsertLineBreak(); 1402 GetFrame().GetEditor().InsertLineBreak();
1403 1403
1404 Controller().SetCompositionFromExistingText(underlines, 8, 8); 1404 Controller().SetCompositionFromExistingText(underlines, 8, 8);
1405 1405
1406 underlines.push_back(CompositionUnderline(0, 5, Color(255, 0, 0), false, 0)); 1406 underlines.push_back(CompositionUnderline(0, 5, Color(255, 0, 0), false, 0));
1407 Controller().SetComposition(String("world"), underlines, 0, 0); 1407 Controller().SetComposition(String("world"), underlines, 0, 0);
1408 ASSERT_EQ(1u, GetDocument().Markers().Markers().size()); 1408 ASSERT_EQ(1u, GetDocument().Markers().Markers().size());
1409 1409
1410 // Verify composition underline shows up on the second line, not the first 1410 // Verify composition underline shows up on the second line, not the first
1411 ASSERT_EQ(0u, GetDocument() 1411 ASSERT_FALSE(
1412 .Markers() 1412 GetDocument()
1413 .MarkersInRange(PlainTextRange(0, 5).CreateRange(*div), 1413 .Markers()
1414 DocumentMarker::AllMarkers()) 1414 .MarkerAtPosition(PlainTextRange(2).CreateRange(*div).StartPosition(),
1415 .size()); 1415 DocumentMarker::AllMarkers())
1416 ASSERT_EQ(1u, GetDocument() 1416 .has_value());
1417 .Markers() 1417 ASSERT_TRUE(
1418 .MarkersInRange(PlainTextRange(6, 11).CreateRange(*div), 1418 GetDocument()
1419 DocumentMarker::AllMarkers()) 1419 .Markers()
1420 .size()); 1420 .MarkerAtPosition(PlainTextRange(8).CreateRange(*div).StartPosition(),
1421 DocumentMarker::AllMarkers())
1422 .has_value());
1421 1423
1422 // Verify marker has correct start/end offsets (measured from the beginning 1424 // Verify marker has correct start/end offsets (measured from the beginning
1423 // of the node, which is the beginning of the line) 1425 // of the node, which is the beginning of the line)
1424 EXPECT_EQ(0u, GetDocument().Markers().Markers()[0]->StartOffset()); 1426 EXPECT_EQ(0u, GetDocument().Markers().Markers()[0]->StartOffset());
1425 EXPECT_EQ(5u, GetDocument().Markers().Markers()[0]->EndOffset()); 1427 EXPECT_EQ(5u, GetDocument().Markers().Markers()[0]->EndOffset());
1426 } 1428 }
1427 1429
1428 TEST_F(InputMethodControllerTest, SelectionWhenFocusChangeFinishesComposition) { 1430 TEST_F(InputMethodControllerTest, SelectionWhenFocusChangeFinishesComposition) {
1429 GetDocument().GetSettings()->SetScriptEnabled(true); 1431 GetDocument().GetSettings()->SetScriptEnabled(true);
1430 Element* editable = 1432 Element* editable =
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
1972 // Set selection before BODY(editable). 1974 // Set selection before BODY(editable).
1973 GetFrame().Selection().SetSelection( 1975 GetFrame().Selection().SetSelection(
1974 SelectionInDOMTree::Builder() 1976 SelectionInDOMTree::Builder()
1975 .Collapse(Position(GetDocument().documentElement(), 0)) 1977 .Collapse(Position(GetDocument().documentElement(), 0))
1976 .Build()); 1978 .Build());
1977 1979
1978 EXPECT_EQ(kWebTextInputTypeContentEditable, Controller().TextInputType()); 1980 EXPECT_EQ(kWebTextInputTypeContentEditable, Controller().TextInputType());
1979 } 1981 }
1980 1982
1981 } // namespace blink 1983 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698