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

Side by Side 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: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 && newNode == m_previousCaretNode 698 && newNode == m_previousCaretNode
699 && newRect == m_previousCaretRect 699 && newRect == m_previousCaretRect
700 && caretVisibility() == m_previousCaretVisibility) 700 && caretVisibility() == m_previousCaretVisibility)
701 return; 701 return;
702 702
703 LayoutView* view = m_frame->document()->layoutView(); 703 LayoutView* view = m_frame->document()->layoutView();
704 if (m_previousCaretNode && (shouldRepaintCaret(*m_previousCaretNode) || shou ldRepaintCaret(view))) 704 if (m_previousCaretNode && (shouldRepaintCaret(*m_previousCaretNode) || shou ldRepaintCaret(view)))
705 invalidateLocalCaretRect(m_previousCaretNode.get(), m_previousCaretRect) ; 705 invalidateLocalCaretRect(m_previousCaretNode.get(), m_previousCaretRect) ;
706 if (newNode && (shouldRepaintCaret(*newNode) || shouldRepaintCaret(view))) 706 if (newNode && (shouldRepaintCaret(*newNode) || shouldRepaintCaret(view)))
707 invalidateLocalCaretRect(newNode, newRect); 707 invalidateLocalCaretRect(newNode, newRect);
708 // Must invalidate |m_previousCaretNode| even if it's detached from its pare nt. crbug.com/528922
709 if (m_previousCaretNode && newNode && !m_previousCaretNode->parentNode())
yosin_UTC9 2016/02/02 01:56:56 nit: s/!m_previousCaretNode->parentNode()/!m_previ
dshwang 2016/02/02 14:58:45 Done.
710 invalidateLocalCaretRect(newNode, m_previousCaretRect);
yosin_UTC9 2016/02/02 01:56:56 This call seems to be wrong, since |m_previousCare
dshwang 2016/02/02 14:58:45 True. this code expects |newNode| is formatted at
708 m_previousCaretNode = newNode; 711 m_previousCaretNode = newNode;
709 m_previousCaretRect = newRect; 712 m_previousCaretRect = newRect;
710 m_previousCaretVisibility = caretVisibility(); 713 m_previousCaretVisibility = caretVisibility();
711 } 714 }
712 715
713 void FrameSelection::paintCaret(GraphicsContext& context, const LayoutPoint& pai ntOffset) 716 void FrameSelection::paintCaret(GraphicsContext& context, const LayoutPoint& pai ntOffset)
714 { 717 {
715 if (selection().isCaret() && m_shouldPaintCaret) { 718 if (selection().isCaret() && m_shouldPaintCaret) {
716 updateCaretRect(PositionWithAffinity(selection().start(), selection().af finity())); 719 updateCaretRect(PositionWithAffinity(selection().start(), selection().af finity()));
717 CaretBase::paintCaret(selection().start().anchorNode(), context, paintOf fset); 720 CaretBase::paintCaret(selection().start().anchorNode(), context, paintOf fset);
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 1414
1412 void showTree(const blink::FrameSelection* sel) 1415 void showTree(const blink::FrameSelection* sel)
1413 { 1416 {
1414 if (sel) 1417 if (sel)
1415 sel->showTreeForThis(); 1418 sel->showTreeForThis();
1416 else 1419 else
1417 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); 1420 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n");
1418 } 1421 }
1419 1422
1420 #endif 1423 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698