Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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); | |
|
yosin_UTC9
2016/04/29 15:03:12
Should we reset other states of previous cares lik
chrishtr
2016/04/29 20:09:40
I think those other changes will still be handled
| |
| 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 Loading... | |
| 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 |
| OLD | NEW |