Changeset 17089 in webkit


Ignore:
Timestamp:
Oct 17, 2006 12:47:55 PM (18 years ago)
Author:
justing
Message:

LayoutTests:

Reviewed by sullivan


<rdar://problem/4776765>
REGRESSION: Caret's ghost left behind after inserting a paragraph separator (11237)

  • fast/repaint/4776765-expected.checksum: Added.
  • fast/repaint/4776765-expected.png: Added.
  • fast/repaint/4776765-expected.txt: Added.
  • fast/repaint/4776765.html: Added.

WebCore:

Reviewed by sullivan


<rdar://problem/4776765>
REGRESSION: Caret's ghost left behind after inserting a paragraph separator (11237)

We set m_needsLayout to false and call caretRect() in the hopes that it will give us
the old caret rect. It in fact corrects the caret rect for an offset that it
believes is due to scrolling but which is actually due to a change in selection
without an accompanying layout. So it returns the new caret rect regardless of
what m_needsLayout is set to.


  • editing/SelectionController.cpp: (WebCore::repaintRectForCaret): Moved the code from caretRepaintRect that adds a one pixel slop to this new function. (WebCore::SelectionController::caretRepaintRect): Moved this code to repaintRectForCaret. (WebCore::SelectionController::recomputeCaretRect): Compare the old caret rect to the new one that's computed with a fresh layout. If they are different, invalidate both repaint rects.
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r17084 r17089  
     12006-10-17  Justin Garcia  <justin.garcia@apple.com>
     2
     3        Reviewed by sullivan
     4       
     5        <rdar://problem/4776765>
     6        REGRESSION: Caret's ghost left behind after inserting a paragraph separator (11237)
     7
     8        * fast/repaint/4776765-expected.checksum: Added.
     9        * fast/repaint/4776765-expected.png: Added.
     10        * fast/repaint/4776765-expected.txt: Added.
     11        * fast/repaint/4776765.html: Added.
     12
    1132006-10-17  Alice Liu  <alice.liu@apple.com>
    214
    315        Reviewed by Tim Hatcher.
    416
    5         When nodes are removed, selections are cleared, and when http://bugs.webkit.org/show_bug.cgi?id=6498 was fixed, we started sending didChangeSelection notifications.  Updating the test results fixes some of the tests mentioned in http://bugs.webkit.org/show_bug.cgi?id=10924
     17        When nodes are removed, selections are cleared, and when
     18        http://bugs.webkit.org/show_bug.cgi?id=6498 was fixed, we started
     19        sending didChangeSelection notifications.  Updating the test results
     20        fixes some of the tests mentioned in http://bugs.webkit.org/show_bug.cgi?id=10924
    621
    722        * fast/dynamic/move-node-with-selection-expected.txt:
  • trunk/WebCore/ChangeLog

    r17083 r17089  
     12006-10-16  Justin Garcia  <justin.garcia@apple.com>
     2
     3        Reviewed by sullivan
     4       
     5        <rdar://problem/4776765>
     6        REGRESSION: Caret's ghost left behind after inserting a paragraph separator (11237)
     7
     8        We set m_needsLayout to false and call caretRect() in the hopes that it will give us
     9        the old caret rect.  It in fact corrects the caret rect for an offset that it
     10        believes is due to scrolling but which is actually due to a change in selection
     11        without an accompanying layout.  So it returns the new caret rect regardless of
     12        what m_needsLayout is set to.
     13       
     14        * editing/SelectionController.cpp:
     15        (WebCore::repaintRectForCaret): Moved the code from caretRepaintRect that
     16        adds a one pixel slop to this new function.
     17        (WebCore::SelectionController::caretRepaintRect): Moved this code to
     18        repaintRectForCaret.
     19        (WebCore::SelectionController::recomputeCaretRect): Compare the old
     20        caret rect to the new one that's computed with a fresh layout.  If
     21        they are different, invalidate both repaint rects.
     22
    1232006-10-17  David Harrison  <harrison@apple.com>
    224
  • trunk/WebCore/editing/SelectionController.cpp

    r16738 r17089  
    777777}
    778778
     779static IntRect repaintRectForCaret(IntRect caret)
     780{
     781    if (caret.isEmpty())
     782        return IntRect();
     783    caret.inflate(1);
     784    return caret;
     785}
     786
    779787IntRect SelectionController::caretRepaintRect() const
    780788{
    781     // FIXME: Add one pixel of slop on each side to make sure we don't leave behind artifacts.
    782     IntRect r = caretRect();
    783     if (r.isEmpty())
    784         return IntRect();
    785     return IntRect(r.x() - 1, r.y() - 1, r.width() + 2, r.height() + 2);
     789    return repaintRectForCaret(caretRect());
    786790}
    787791
     
    798802        return false;
    799803
    800     // Set m_needsLayout to false to get the "old" repaint rect,
    801     // since caretRepaintRect currently recomputes the rect if
    802     // m_needsLayout is true. It's a problem if that ever happens
    803     // outside this function, so we need to change that design in
    804     // the future.
    805     m_needsLayout = false;
    806     IntRect oldRect = caretRepaintRect();
     804    IntRect oldRect = m_caretRect;
    807805    m_needsLayout = true;
    808     IntRect newRect = caretRepaintRect();
     806    IntRect newRect = caretRect();
    809807    if (oldRect == newRect)
    810808        return false;
    811809
    812     v->updateContents(oldRect, false);
    813     v->updateContents(newRect, false);
     810    v->updateContents(repaintRectForCaret(oldRect), false);
     811    v->updateContents(repaintRectForCaret(newRect), false);
    814812    return true;
    815813}
Note: See TracChangeset for help on using the changeset viewer.