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

Unified Diff: third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp

Issue 2229303002: Revert "Remove extraneous frameView->setNeedsLayout() in LayoutPart" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: windows too. :( Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | third_party/WebKit/Source/core/frame/FrameView.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
diff --git a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
index 1659362fa901a5366159e58a869e5b1d9e984f8b..f4575f00f292ad2f1701aa7cf5cbaaf0ed3222b0 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp
@@ -94,6 +94,40 @@ TEST_F(FrameSelectionTest, InvalidateCaretRect)
EXPECT_FALSE(selection().isCaretBoundsDirty());
}
+TEST_F(FrameSelectionTest, PaintCaretShouldNotLayout)
+{
+ Text* text = appendTextNode("Hello, World!");
+ document().view()->updateAllLifecyclePhases();
+
+ document().body()->setContentEditable("true", ASSERT_NO_EXCEPTION);
+ document().body()->focus();
+ EXPECT_TRUE(document().body()->focused());
+
+ VisibleSelection validSelection(Position(text, 0), Position(text, 0));
+ selection().setCaretVisible(true);
+ setSelection(validSelection);
+ EXPECT_TRUE(selection().isCaret());
+ EXPECT_TRUE(shouldPaintCaretForTesting());
+
+ int startCount = layoutCount();
+ {
+ // To force layout in next updateLayout calling, widen view.
+ FrameView& frameView = dummyPageHolder().frameView();
+ IntRect frameRect = frameView.frameRect();
+ frameRect.setWidth(frameRect.width() + 1);
+ frameRect.setHeight(frameRect.height() + 1);
+ dummyPageHolder().frameView().setFrameRect(frameRect);
+ }
+ std::unique_ptr<PaintController> paintController = PaintController::create();
+ {
+ GraphicsContext context(*paintController);
+ DrawingRecorder drawingRecorder(context, *dummyPageHolder().frameView().layoutView(), DisplayItem::Caret, LayoutRect::infiniteIntRect());
+ selection().paintCaret(context, LayoutPoint());
+ }
+ paintController->commitNewDisplayItems();
+ EXPECT_EQ(startCount, layoutCount());
+}
+
TEST_F(FrameSelectionTest, InvalidatePreviousCaretAfterRemovingLastCharacter)
{
Text* text = appendTextNode("Hello, World!");
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | third_party/WebKit/Source/core/frame/FrameView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698