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

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

Issue 2886893008: [DMC #8] Rename DocumentMarkerController::RenderedRectsForMarkers() (Closed)
Patch Set: Reformat FrameView 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 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 // No more reference to marked node. 198 // No more reference to marked node.
199 ThreadState::Current()->CollectAllGarbage(); 199 ThreadState::Current()->CollectAllGarbage();
200 EXPECT_EQ(0u, MarkerController().Markers().size()); 200 EXPECT_EQ(0u, MarkerController().Markers().size());
201 } 201 }
202 202
203 TEST_F(DocumentMarkerControllerTest, UpdateRenderedRects) { 203 TEST_F(DocumentMarkerControllerTest, UpdateRenderedRects) {
204 SetBodyInnerHTML("<div style='margin: 100px'>foo</div>"); 204 SetBodyInnerHTML("<div style='margin: 100px'>foo</div>");
205 Element* div = ToElement(GetDocument().body()->firstChild()); 205 Element* div = ToElement(GetDocument().body()->firstChild());
206 MarkNodeContentsTextMatch(div); 206 MarkNodeContentsTextMatch(div);
207 Vector<IntRect> rendered_rects = 207 Vector<IntRect> rendered_rects =
208 MarkerController().RenderedRectsForMarkers(DocumentMarker::kTextMatch); 208 MarkerController().RenderedRectsForTextMatchMarkers();
209 EXPECT_EQ(1u, rendered_rects.size()); 209 EXPECT_EQ(1u, rendered_rects.size());
210 210
211 div->setAttribute(HTMLNames::styleAttr, "margin: 200px"); 211 div->setAttribute(HTMLNames::styleAttr, "margin: 200px");
212 GetDocument().UpdateStyleAndLayout(); 212 GetDocument().UpdateStyleAndLayout();
213 Vector<IntRect> new_rendered_rects = 213 Vector<IntRect> new_rendered_rects =
214 MarkerController().RenderedRectsForMarkers(DocumentMarker::kTextMatch); 214 MarkerController().RenderedRectsForTextMatchMarkers();
215 EXPECT_EQ(1u, new_rendered_rects.size()); 215 EXPECT_EQ(1u, new_rendered_rects.size());
216 EXPECT_NE(rendered_rects[0], new_rendered_rects[0]); 216 EXPECT_NE(rendered_rects[0], new_rendered_rects[0]);
217 } 217 }
218 218
219 TEST_F(DocumentMarkerControllerTest, CompositionMarkersNotMerged) { 219 TEST_F(DocumentMarkerControllerTest, CompositionMarkersNotMerged) {
220 SetBodyInnerHTML("<div style='margin: 100px'>foo</div>"); 220 SetBodyInnerHTML("<div style='margin: 100px'>foo</div>");
221 Node* text = GetDocument().body()->firstChild()->firstChild(); 221 Node* text = GetDocument().body()->firstChild()->firstChild();
222 GetDocument().UpdateStyleAndLayout(); 222 GetDocument().UpdateStyleAndLayout();
223 MarkerController().AddCompositionMarker(Position(text, 0), Position(text, 1), 223 MarkerController().AddCompositionMarker(Position(text, 0), Position(text, 1),
224 Color::kBlack, false, Color::kBlack); 224 Color::kBlack, false, Color::kBlack);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 325
326 // RemoveSpellingMarkersUnderWords does not remove text match marker. 326 // RemoveSpellingMarkersUnderWords does not remove text match marker.
327 ASSERT_EQ(1u, MarkerController().Markers().size()); 327 ASSERT_EQ(1u, MarkerController().Markers().size());
328 const DocumentMarker& marker = *MarkerController().Markers()[0]; 328 const DocumentMarker& marker = *MarkerController().Markers()[0];
329 EXPECT_EQ(0u, marker.StartOffset()); 329 EXPECT_EQ(0u, marker.StartOffset());
330 EXPECT_EQ(3u, marker.EndOffset()); 330 EXPECT_EQ(3u, marker.EndOffset());
331 EXPECT_EQ(DocumentMarker::kTextMatch, marker.GetType()); 331 EXPECT_EQ(DocumentMarker::kTextMatch, marker.GetType());
332 } 332 }
333 333
334 } // namespace blink 334 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698