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

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

Issue 2876923002: Track client debug names for raster invalidation tracking (Closed)
Patch Set: Rebaseline virtual/spv2/paint/invalidation/margin.html 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/CaretDisplayItemClient.h" 5 #include "core/editing/CaretDisplayItemClient.h"
6 6
7 #include "core/HTMLNames.h" 7 #include "core/HTMLNames.h"
8 #include "core/editing/FrameSelection.h" 8 #include "core/editing/FrameSelection.h"
9 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/layout/LayoutTestHelper.h" 10 #include "core/layout/LayoutTestHelper.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 305
306 Text* text = AppendTextNode("Hello, World!"); 306 Text* text = AppendTextNode("Hello, World!");
307 GetDocument().body()->focus(); 307 GetDocument().body()->focus();
308 UpdateAllLifecyclePhases(); 308 UpdateAllLifecyclePhases();
309 const auto* block = ToLayoutBlock(GetDocument().body()->GetLayoutObject()); 309 const auto* block = ToLayoutBlock(GetDocument().body()->GetLayoutObject());
310 310
311 LayoutRect caret_visual_rect = GetCaretDisplayItemClient().VisualRect(); 311 LayoutRect caret_visual_rect = GetCaretDisplayItemClient().VisualRect();
312 EXPECT_EQ(1, caret_visual_rect.Width()); 312 EXPECT_EQ(1, caret_visual_rect.Width());
313 EXPECT_EQ(block->Location(), caret_visual_rect.Location()); 313 EXPECT_EQ(block->Location(), caret_visual_rect.Location());
314 314
315 GetDocument().View()->SetTracksPaintInvalidations(true);
315 // Simulate that the blinking cursor becomes invisible. 316 // Simulate that the blinking cursor becomes invisible.
316 Selection().SetCaretVisible(false); 317 Selection().SetCaretVisible(false);
317 // Move the caret to the end of the text. 318 // Move the caret to the end of the text.
318 GetDocument().View()->SetTracksPaintInvalidations(true);
319 Selection().SetSelection( 319 Selection().SetSelection(
320 SelectionInDOMTree::Builder().Collapse(Position(text, 5)).Build()); 320 SelectionInDOMTree::Builder().Collapse(Position(text, 5)).Build());
321 // Simulate that the cursor blinking is restarted. 321 // Simulate that the cursor blinking is restarted.
322 Selection().SetCaretVisible(true); 322 Selection().SetCaretVisible(true);
323 UpdateAllLifecyclePhases(); 323 UpdateAllLifecyclePhases();
324 324
325 LayoutRect new_caret_visual_rect = GetCaretDisplayItemClient().VisualRect(); 325 LayoutRect new_caret_visual_rect = GetCaretDisplayItemClient().VisualRect();
326 EXPECT_EQ(caret_visual_rect.Size(), new_caret_visual_rect.Size()); 326 EXPECT_EQ(caret_visual_rect.Size(), new_caret_visual_rect.Size());
327 EXPECT_EQ(caret_visual_rect.Y(), new_caret_visual_rect.Y()); 327 EXPECT_EQ(caret_visual_rect.Y(), new_caret_visual_rect.Y());
328 EXPECT_LT(caret_visual_rect.X(), new_caret_visual_rect.X()); 328 EXPECT_LT(caret_visual_rect.X(), new_caret_visual_rect.X());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 EXPECT_EQ(LayoutRect(50, 50, 1, 1), GetCaretDisplayItemClient().VisualRect()); 378 EXPECT_EQ(LayoutRect(50, 50, 1, 1), GetCaretDisplayItemClient().VisualRect());
379 379
380 // Uncomposite container. 380 // Uncomposite container.
381 container->setAttribute(HTMLNames::styleAttr, ""); 381 container->setAttribute(HTMLNames::styleAttr, "");
382 UpdateAllLifecyclePhases(); 382 UpdateAllLifecyclePhases();
383 EXPECT_EQ(LayoutRect(116, 105, 1, 1), 383 EXPECT_EQ(LayoutRect(116, 105, 1, 1),
384 GetCaretDisplayItemClient().VisualRect()); 384 GetCaretDisplayItemClient().VisualRect());
385 } 385 }
386 386
387 } // namespace blink 387 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698