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

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

Issue 1654123002: Invalidate the previous caret even if the parent text node is removed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more clear code Created 4 years, 10 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/FrameSelection.h ('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/FrameSelection.cpp
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.cpp b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
index b51173b7bff61bb2ec2393b037a0360637a3abdf..d88af3460da90d27f4777cf8b147f16a956a6a6e 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
@@ -95,6 +95,7 @@ FrameSelection::FrameSelection(LocalFrame* frame)
, m_pendingSelection(PendingSelection::create(*this))
, m_selectionEditor(SelectionEditor::create(*this))
, m_granularity(CharacterGranularity)
+ , m_parentOfPreviousCaretNode(nullptr)
, m_previousCaretVisibility(Hidden)
, m_caretBlinkTimer(this, &FrameSelection::caretBlinkTimerFired)
, m_caretRectDirty(true)
@@ -634,6 +635,7 @@ void FrameSelection::prepareForDestruction()
setSelection(VisibleSelection(), CloseTyping | ClearTypingStyle | DoNotUpdateAppearance);
m_selectionEditor->dispose();
m_previousCaretNode.clear();
+ m_parentOfPreviousCaretNode = nullptr;
}
void FrameSelection::setStart(const VisiblePosition &pos, EUserTriggered trigger)
@@ -717,7 +719,12 @@ void FrameSelection::invalidateCaretRect()
invalidateLocalCaretRect(m_previousCaretNode.get(), m_previousCaretRect);
if (newNode && (shouldRepaintCaret(*newNode) || shouldRepaintCaret(view)))
invalidateLocalCaretRect(newNode, newRect);
+ // Must invalidate #text even if it's detached. crbug.com/528922
+ if (m_previousCaretNode && newNode == m_parentOfPreviousCaretNode && !m_previousCaretNode->inDocument())
yosin_UTC9 2016/02/05 04:04:48 This condition isn't enough, e.g. - ancestor of
+ invalidateLocalCaretRect(newNode, m_previousCaretRect);
m_previousCaretNode = newNode;
+ if (newNode)
+ m_parentOfPreviousCaretNode = newNode->parentNode();
m_previousCaretRect = newRect;
m_previousCaretVisibility = caretVisibility();
}
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698