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

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: handle layouttests failure 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 | « third_party/WebKit/ManualTests/caret-paint-after-last-text-is-removed.html ('k') | 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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 398
399 void FrameSelection::nodeWillBeRemoved(Node& node) 399 void FrameSelection::nodeWillBeRemoved(Node& node)
400 { 400 {
401 // There can't be a selection inside a fragment, so if a fragment's node is being removed, 401 // There can't be a selection inside a fragment, so if a fragment's node is being removed,
402 // the selection in the document that created the fragment needs no adjustme nt. 402 // the selection in the document that created the fragment needs no adjustme nt.
403 if (isNone() || !node.inActiveDocument()) 403 if (isNone() || !node.inActiveDocument())
404 return; 404 return;
405 405
406 respondToNodeModification(node, removingNodeRemovesPosition(node, selection( ).base()), removingNodeRemovesPosition(node, selection().extent()), 406 respondToNodeModification(node, removingNodeRemovesPosition(node, selection( ).base()), removingNodeRemovesPosition(node, selection().extent()),
407 removingNodeRemovesPosition(node, selection().start()), removingNodeRemo vesPosition(node, selection().end())); 407 removingNodeRemovesPosition(node, selection().start()), removingNodeRemo vesPosition(node, selection().end()));
408
409 if (m_previousCaretNode && node.isSameNode(m_previousCaretNode.get())) {
yosin_UTC9 2016/02/24 03:55:25 |node == m_previousCaretNode| Node::isSmaeNode()
dshwang 2016/02/24 13:12:18 Done.
410 // Hits in ManualTests/caret-paint-after-last-text-is-removed.html
411 DisableCompositingQueryAsserts disabler;
412 invalidateLocalCaretRect(m_previousCaretNode.get(), m_previousCaretRect) ;
413 m_previousCaretNode = nullptr;
414 m_previousCaretRect = LayoutRect();
415 m_previousCaretVisibility = Hidden;
416 }
408 } 417 }
409 418
410 static bool intersectsNode(const VisibleSelection& selection, Node* node) 419 static bool intersectsNode(const VisibleSelection& selection, Node* node)
411 { 420 {
412 if (selection.isNone()) 421 if (selection.isNone())
413 return false; 422 return false;
414 Position start = selection.start().parentAnchoredEquivalent(); 423 Position start = selection.start().parentAnchoredEquivalent();
415 Position end = selection.end().parentAnchoredEquivalent(); 424 Position end = selection.end().parentAnchoredEquivalent();
416 TrackExceptionState exceptionState; 425 TrackExceptionState exceptionState;
417 // TODO(yosin) We should avoid to use |Range::intersectsNode()|. 426 // TODO(yosin) We should avoid to use |Range::intersectsNode()|.
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 1410
1402 void showTree(const blink::FrameSelection* sel) 1411 void showTree(const blink::FrameSelection* sel)
1403 { 1412 {
1404 if (sel) 1413 if (sel)
1405 sel->showTreeForThis(); 1414 sel->showTreeForThis();
1406 else 1415 else
1407 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); 1416 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n");
1408 } 1417 }
1409 1418
1410 #endif 1419 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/ManualTests/caret-paint-after-last-text-is-removed.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698