Changeset 153815 in webkit


Ignore:
Timestamp:
Aug 8, 2013 12:16:51 AM (11 years ago)
Author:
akling@apple.com
Message:

REGRESSION(r139282): Old caret sometimes gets "stuck" (not repainted) in contenteditable elements.
<http://webkit.org/b/119520>
<rdar://problem/14658929>

Reviewed by Simon Fraser.

Source/WebCore:

When computing a new caret rect, don't forget to repaint the old rect if the caret jumped
from one node to another.
We were being a little too clever, assuming that oldRect==newRect meant that no repaint was
necessary, but moving from (0,0) in one node to (0,0) in another would cause a ghost caret
in the old node.

Test: fast/repaint/caret-jump-between-nodes.html

  • editing/FrameSelection.cpp:

(WebCore::FrameSelection::recomputeCaretRect):

Fall through all the way down to caret repaints if the selection's new anchor node is not
the same as m_previousCaretNode.

LayoutTests:

  • fast/repaint/caret-jump-between-nodes-expected.txt: Added.
  • fast/repaint/caret-jump-between-nodes.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r153814 r153815  
     12013-08-08  Andreas Kling  <akling@apple.com>
     2
     3        REGRESSION(r139282): Old caret sometimes gets "stuck" (not repainted) in contenteditable elements.
     4        <http://webkit.org/b/119520>
     5        <rdar://problem/14658929>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * fast/repaint/caret-jump-between-nodes-expected.txt: Added.
     10        * fast/repaint/caret-jump-between-nodes.html: Added.
     11
    1122013-08-07  Andrei Bucur  <abucur@adobe.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r153814 r153815  
     12013-08-08  Andreas Kling  <akling@apple.com>
     2
     3        REGRESSION(r139282): Old caret sometimes gets "stuck" (not repainted) in contenteditable elements.
     4        <http://webkit.org/b/119520>
     5        <rdar://problem/14658929>
     6
     7        Reviewed by Simon Fraser.
     8
     9        When computing a new caret rect, don't forget to repaint the old rect if the caret jumped
     10        from one node to another.
     11        We were being a little too clever, assuming that oldRect==newRect meant that no repaint was
     12        necessary, but moving from (0,0) in one node to (0,0) in another would cause a ghost caret
     13        in the old node.
     14
     15        Test: fast/repaint/caret-jump-between-nodes.html
     16
     17        * editing/FrameSelection.cpp:
     18        (WebCore::FrameSelection::recomputeCaretRect):
     19
     20            Fall through all the way down to caret repaints if the selection's new anchor node is not
     21            the same as m_previousCaretNode.
     22
    1232013-08-07  Andrei Bucur  <abucur@adobe.com>
    224
  • trunk/Source/WebCore/editing/FrameSelection.cpp

    r153366 r153815  
    13811381        return false;
    13821382
     1383    Node* caretNode = m_selection.start().deprecatedNode();
     1384
    13831385    LayoutRect oldRect = localCaretRectWithoutUpdate();
    13841386    LayoutRect newRect = localCaretRect();
    1385     if (oldRect == newRect && !m_absCaretBoundsDirty)
     1387
     1388    if (caretNode == m_previousCaretNode && oldRect == newRect && !m_absCaretBoundsDirty)
    13861389        return false;
    13871390
    13881391    IntRect oldAbsCaretBounds = m_absCaretBounds;
    1389     m_absCaretBounds = absoluteBoundsForLocalRect(m_selection.start().deprecatedNode(), localCaretRectWithoutUpdate());
     1392    m_absCaretBounds = absoluteBoundsForLocalRect(caretNode, localCaretRectWithoutUpdate());
    13901393    m_absCaretBoundsDirty = false;
    1391    
    1392     if (oldAbsCaretBounds == m_absCaretBounds)
     1394
     1395    if (caretNode == m_previousCaretNode && oldAbsCaretBounds == m_absCaretBounds)
    13931396        return false;
    13941397
     
    13971400        bool previousOrNewCaretNodeIsContentEditable = isContentEditable() || (m_previousCaretNode && m_previousCaretNode->isContentEditable());
    13981401        if (shouldRepaintCaret(view, previousOrNewCaretNodeIsContentEditable)) {
    1399             Node* node = m_selection.start().deprecatedNode();
    14001402            if (m_previousCaretNode)
    14011403                repaintCaretForLocalRect(m_previousCaretNode.get(), oldRect);
    1402             m_previousCaretNode = node;
    1403             repaintCaretForLocalRect(node, newRect);
     1404            m_previousCaretNode = caretNode;
     1405            repaintCaretForLocalRect(caretNode, newRect);
    14041406        }
    14051407    }
Note: See TracChangeset for help on using the changeset viewer.