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

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

Issue 2777183003: Fix caret visual rect on compositing change (Closed)
Patch Set: Created 3 years, 9 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/Source/core/editing/CaretDisplayItemClient.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/CaretDisplayItemClientTest.cpp
diff --git a/third_party/WebKit/Source/core/editing/CaretDisplayItemClientTest.cpp b/third_party/WebKit/Source/core/editing/CaretDisplayItemClientTest.cpp
index 4c2344e9b3971bc9f0198a21c51591ff3a89e34c..2887d04581855b2ae531047a50b8939c0b20d322 100644
--- a/third_party/WebKit/Source/core/editing/CaretDisplayItemClientTest.cpp
+++ b/third_party/WebKit/Source/core/editing/CaretDisplayItemClientTest.cpp
@@ -341,4 +341,39 @@ TEST_F(CaretDisplayItemClientTest, CaretHideMoveAndShow) {
document().view()->setTracksPaintInvalidations(false);
}
+TEST_F(CaretDisplayItemClientTest, CompositingChange) {
+ enableCompositing();
+ setBodyInnerHTML(
+ "<style>"
+ " body { margin: 0 }"
+ " #container { position: absolute; top: 55px; left: 66px; }"
+ "</style>"
+ "<div id='container'>"
+ " <div id='editor' contenteditable style='padding: 50px'>ABCDE</div>"
+ "</div>");
+
+ document().page()->focusController().setActive(true);
+ document().page()->focusController().setFocused(true);
+ auto* container = document().getElementById("container");
+ auto* editor = document().getElementById("editor");
+ auto* editorBlock = toLayoutBlock(editor->layoutObject());
+ selection().setSelection(
+ SelectionInDOMTree::Builder().collapse(Position(editor, 0)).build());
+ updateAllLifecyclePhases();
+
+ EXPECT_TRUE(editorBlock->shouldPaintCursorCaret());
+ EXPECT_EQ(editorBlock, caretLayoutBlock());
+ EXPECT_EQ(LayoutRect(116, 105, 1, 1), caretDisplayItemClient().visualRect());
+
+ // Composite container.
+ container->setAttribute(HTMLNames::styleAttr, "will-change: transform");
+ updateAllLifecyclePhases();
+ EXPECT_EQ(LayoutRect(50, 50, 1, 1), caretDisplayItemClient().visualRect());
+
+ // Uncomposite container.
+ container->setAttribute(HTMLNames::styleAttr, "");
+ updateAllLifecyclePhases();
+ EXPECT_EQ(LayoutRect(116, 105, 1, 1), caretDisplayItemClient().visualRect());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/editing/CaretDisplayItemClient.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698