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

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

Issue 2748563002: Fix another caret paint invalidation issue (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 | « no previous file | third_party/WebKit/Source/core/editing/CaretDisplayItemClientTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/CaretDisplayItemClient.cpp
diff --git a/third_party/WebKit/Source/core/editing/CaretDisplayItemClient.cpp b/third_party/WebKit/Source/core/editing/CaretDisplayItemClient.cpp
index 0990fdef8cabca9e3bf7024048e5965ca2a6dc46..5ad7545aacdc5e40134ea7e5d061d97a20c9218e 100644
--- a/third_party/WebKit/Source/core/editing/CaretDisplayItemClient.cpp
+++ b/third_party/WebKit/Source/core/editing/CaretDisplayItemClient.cpp
@@ -133,9 +133,17 @@ void CaretDisplayItemClient::updateStyleAndLayoutIfNeeded(
if (m_layoutBlock)
m_layoutBlock->setMayNeedPaintInvalidation();
m_layoutBlock = newLayoutBlock;
- if (newLayoutBlock)
- m_needsPaintInvalidation = true;
m_visualRect = LayoutRect();
+ if (newLayoutBlock) {
+ m_needsPaintInvalidation = true;
+ if (newLayoutBlock == m_previousLayoutBlock) {
+ // The caret has disappeared and is reappearing in the same block,
+ // since the last paint invalidation. Set m_visualRect as if the caret
+ // has always been there as paint invalidation doesn't care about the
+ // intermediate changes.
+ m_visualRect = m_visualRectInPreviousLayoutBlock;
+ }
+ }
}
if (!newLayoutBlock) {
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/CaretDisplayItemClientTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698