Chromium Code Reviews| 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..cc2c54f34ed175fcc29b0dcd9799c7753d5c105c 100644 |
| --- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp |
| +++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp |
| @@ -634,6 +634,7 @@ void FrameSelection::prepareForDestruction() |
| setSelection(VisibleSelection(), CloseTyping | ClearTypingStyle | DoNotUpdateAppearance); |
| m_selectionEditor->dispose(); |
| m_previousCaretNode.clear(); |
| + m_parentOfPreviousCaretNode.clear(); |
| } |
| void FrameSelection::setStart(const VisiblePosition &pos, EUserTriggered trigger) |
| @@ -713,11 +714,20 @@ void FrameSelection::invalidateCaretRect() |
| return; |
| LayoutView* view = m_frame->document()->layoutView(); |
| - if (m_previousCaretNode && (shouldRepaintCaret(*m_previousCaretNode) || shouldRepaintCaret(view))) |
| + if (m_previousCaretNode && (shouldRepaintCaret(*m_previousCaretNode) || shouldRepaintCaret(view))) { |
| invalidateLocalCaretRect(m_previousCaretNode.get(), m_previousCaretRect); |
| - if (newNode && (shouldRepaintCaret(*newNode) || shouldRepaintCaret(view))) |
| + m_previousCaretRect = LayoutRect(); |
| + } |
| + if (newNode && (shouldRepaintCaret(*newNode) || shouldRepaintCaret(view))) { |
| invalidateLocalCaretRect(newNode, newRect); |
| + if (!m_previousCaretRect.isEmpty() && m_previousCaretNode && !m_previousCaretNode->parentNode() |
| + && newNode == m_parentOfPreviousCaretNode.get()) { |
|
dshwang
2016/02/05 10:25:47
It means |newNode| is also detached from document.
yosin_UTC9
2016/02/12 03:53:13
I would like to have radical change. Current imple
|
| + // Must invalidate #text even if it's detached. crbug.com/528922 |
| + invalidateLocalCaretRect(newNode, m_previousCaretRect); |
| + } |
| + } |
| m_previousCaretNode = newNode; |
| + m_parentOfPreviousCaretNode = newNode ? newNode->parentNode() : nullptr; |
| m_previousCaretRect = newRect; |
| m_previousCaretVisibility = caretVisibility(); |
| } |
| @@ -1328,6 +1338,7 @@ DEFINE_TRACE(FrameSelection) |
| visitor->trace(m_originalBase); |
| visitor->trace(m_originalBaseInComposedTree); |
| visitor->trace(m_previousCaretNode); |
| + visitor->trace(m_parentOfPreviousCaretNode); |
| visitor->trace(m_typingStyle); |
| } |