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

Unified Diff: Source/core/editing/FrameSelection.cpp

Issue 437843002: Invalid caret at the end of line in overtype mode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed comments Created 6 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
Index: Source/core/editing/FrameSelection.cpp
diff --git a/Source/core/editing/FrameSelection.cpp b/Source/core/editing/FrameSelection.cpp
index 126cf31b027d91093ffe0a4c0c60c848d0ee21ed..677676fb2b75bde4fd555d637189b49b96fa3b15 100644
--- a/Source/core/editing/FrameSelection.cpp
+++ b/Source/core/editing/FrameSelection.cpp
@@ -1544,14 +1544,10 @@ void FrameSelection::updateAppearance()
{
// Paint a block cursor instead of a caret in overtype mode unless the caret is at the end of a line (in this case
// the FrameSelection will paint a blinking caret as usual).
- VisiblePosition forwardPosition;
- if (m_shouldShowBlockCursor && m_selection.isCaret()) {
- forwardPosition = modifyExtendingForward(CharacterGranularity);
- m_caretPaint = forwardPosition.isNull();
- }
+ bool paintBlockCursor = m_shouldShowBlockCursor && m_selection.isCaret() && !isLogicalEndOfLine(m_selection.visibleEnd());
bool caretRectChangedOrCleared = recomputeCaretRect();
- bool shouldBlink = shouldBlinkCaret() && forwardPosition.isNull();
+ bool shouldBlink = !paintBlockCursor && shouldBlinkCaret();
// If the caret moved, stop the blink timer so we can restart with a
// black caret in the new location.
@@ -1581,7 +1577,8 @@ void FrameSelection::updateAppearance()
// Construct a new VisibleSolution, since m_selection is not necessarily valid, and the following steps
// assume a valid selection. See <https://bugs.webkit.org/show_bug.cgi?id=69563> and <rdar://problem/10232866>.
- VisibleSelection selection(m_selection.visibleStart(), forwardPosition.isNotNull() ? forwardPosition : m_selection.visibleEnd());
+ VisiblePosition endVisiblePosition = paintBlockCursor ? modifyExtendingForward(CharacterGranularity) : m_selection.visibleEnd();
+ VisibleSelection selection(m_selection.visibleStart(), endVisiblePosition);
if (!selection.isRange()) {
view->clearSelection();

Powered by Google App Engine
This is Rietveld 408576698