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

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

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