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

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

Issue 2293293003: Make CaretBase a DisplayItemClient. (Closed)
Patch Set: Fix unit test and disable failing test on SPv2. Created 4 years, 3 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
Index: third_party/WebKit/Source/core/editing/FrameCaret.cpp
diff --git a/third_party/WebKit/Source/core/editing/FrameCaret.cpp b/third_party/WebKit/Source/core/editing/FrameCaret.cpp
index 53eddb304f09ba4922444c7d3433650eb54f6d77..17f0bb83538fe57d380a6648d31a97fe4b3b21ad 100644
--- a/third_party/WebKit/Source/core/editing/FrameCaret.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameCaret.cpp
@@ -115,7 +115,6 @@ void FrameCaret::startBlinkCaret()
m_shouldPaintCaret = true;
setCaretRectNeedsUpdate();
-
}
void FrameCaret::setCaretVisibility(CaretVisibility visibility)
@@ -147,7 +146,7 @@ bool FrameCaret::caretPositionIsValidForDocument(const Document& document) const
&& !caretPosition().position().isOrphan();
}
-void FrameCaret::invalidateCaretRect()
+void FrameCaret::invalidateCaretRect(bool forceInvalidation)
{
if (!m_caretRectDirty)
return;
@@ -160,7 +159,14 @@ void FrameCaret::invalidateCaretRect()
newRect = localCaretRectOfPosition(caretPosition(), layoutObject);
Node* newNode = layoutObject ? layoutObject->node() : nullptr;
- if (!m_caretBlinkTimer.isActive()
+ // It's possible for the timer to be inactive even though we want to
+ // invalidate the caret. For example, when running as a layout test the
+ // caret blink interval could be zero and thus |m_caretBlinkTimer| will
+ // never be started. We provide |forceInvalidation| for use by paint
+ // invalidation internals where we need to invalidate the caret regardless
+ // of timer state.
+ if (!forceInvalidation
+ && !m_caretBlinkTimer.isActive()
&& newNode == m_previousCaretNode
&& newRect == m_previousCaretRect
&& getCaretVisibility() == m_previousCaretVisibility)
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameCaret.h ('k') | third_party/WebKit/Source/core/editing/FrameSelection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698