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

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: Created 6 years, 5 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 55db7b776bc49c8f96fb84cccf87fef731630808..70aa830f9e7ccc79cc7a5fd07a965a5745198d40 100644
--- a/Source/core/editing/FrameSelection.cpp
+++ b/Source/core/editing/FrameSelection.cpp
@@ -1534,14 +1534,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(endForPlatform());
leviw_travelin_and_unemployed 2014/08/07 18:39:16 Since we're only using it if it's a caret, endForP
svillar 2014/08/08 09:01:25 Indeed, you're totally right.
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.
@@ -1571,7 +1567,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