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

Side by Side Diff: third_party/WebKit/Source/core/editing/FrameSelection.cpp

Issue 1931513003: Invalidate the previous caret location when editing text nodes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/Source/core/editing/FrameSelection.h ('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 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 LayoutViewItem view = m_frame->document()->layoutViewItem(); 724 LayoutViewItem view = m_frame->document()->layoutViewItem();
725 if (m_previousCaretNode && (m_caretBase->shouldRepaintCaret(*m_previousCaret Node) || m_caretBase->shouldRepaintCaret(view))) 725 if (m_previousCaretNode && (m_caretBase->shouldRepaintCaret(*m_previousCaret Node) || m_caretBase->shouldRepaintCaret(view)))
726 m_caretBase->invalidateLocalCaretRect(m_previousCaretNode.get(), m_previ ousCaretRect); 726 m_caretBase->invalidateLocalCaretRect(m_previousCaretNode.get(), m_previ ousCaretRect);
727 if (newNode && (m_caretBase->shouldRepaintCaret(*newNode) || m_caretBase->sh ouldRepaintCaret(view))) 727 if (newNode && (m_caretBase->shouldRepaintCaret(*newNode) || m_caretBase->sh ouldRepaintCaret(view)))
728 m_caretBase->invalidateLocalCaretRect(newNode, newRect); 728 m_caretBase->invalidateLocalCaretRect(newNode, newRect);
729 m_previousCaretNode = newNode; 729 m_previousCaretNode = newNode;
730 m_previousCaretRect = newRect; 730 m_previousCaretRect = newRect;
731 m_previousCaretVisibility = m_caretBase->getCaretVisibility(); 731 m_previousCaretVisibility = m_caretBase->getCaretVisibility();
732 } 732 }
733 733
734 void FrameSelection::dataWillChange(const CharacterData& node)
735 {
736 if (node == m_previousCaretNode) {
737 // This invalidation is eager, and intentionally uses stale state.
738 DisableCompositingQueryAsserts disabler;
739 m_caretBase->invalidateLocalCaretRect(m_previousCaretNode.get(), m_previ ousCaretRect);
740 }
741 }
742
734 void FrameSelection::paintCaret(GraphicsContext& context, const LayoutPoint& pai ntOffset) 743 void FrameSelection::paintCaret(GraphicsContext& context, const LayoutPoint& pai ntOffset)
735 { 744 {
736 if (selection().isCaret() && m_shouldPaintCaret) { 745 if (selection().isCaret() && m_shouldPaintCaret) {
737 m_caretBase->updateCaretRect(PositionWithAffinity(selection().start(), s election().affinity())); 746 m_caretBase->updateCaretRect(PositionWithAffinity(selection().start(), s election().affinity()));
738 m_caretBase->paintCaret(selection().start().anchorNode(), context, paint Offset); 747 m_caretBase->paintCaret(selection().start().anchorNode(), context, paint Offset);
739 } 748 }
740 } 749 }
741 750
742 bool FrameSelection::contains(const LayoutPoint& point) 751 bool FrameSelection::contains(const LayoutPoint& point)
743 { 752 {
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
1420 1429
1421 void showTree(const blink::FrameSelection* sel) 1430 void showTree(const blink::FrameSelection* sel)
1422 { 1431 {
1423 if (sel) 1432 if (sel)
1424 sel->showTreeForThis(); 1433 sel->showTreeForThis();
1425 else 1434 else
1426 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); 1435 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n");
1427 } 1436 }
1428 1437
1429 #endif 1438 #endif
OLDNEW
« 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