Changeset 55669 in webkit


Ignore:
Timestamp:
Mar 8, 2010 9:54:36 AM (14 years ago)
Author:
dbates@webkit.org
Message:

2010-03-08 Daniel Bates <dbates@rim.com>

Reviewed by Simon Fraser.

https://bugs.webkit.org/show_bug.cgi?id=34819

Fixes an issue where we repaint the caret rectangle even if the associated
selection is not in a content editable element. This is extraneous since the
caret is only visible when the selection is in a content editable element.
Hence, we should only repaint the caret rectangle when the associated selection
is in a content editable element.

Note, we always paint the caret when caret browsing is enabled.

Test: fast/repaint/no-caret-repaint-in-non-content-editable-element.html

  • editing/SelectionController.cpp: (WebCore::SelectionController::recomputeCaretRect): Modified to call method SelectionController::shouldRepaintCaret. (WebCore::SelectionController::shouldRepaintCaret): Added. (WebCore::SelectionController::invalidateCaretRect): Modified to call method SelectionController::shouldRepaintCaret.
  • editing/SelectionController.h:

2010-03-08 Daniel Bates <dbates@rim.com>

Reviewed by Simon Fraser.

https://bugs.webkit.org/show_bug.cgi?id=34819

Tests that we do not repaint the caret rectangle when the associated selection is
not in a content editable element.

  • fast/repaint/no-caret-repaint-in-non-content-editable-element.html: Added.
  • platform/mac/fast/repaint/no-caret-repaint-in-non-content-editable-element-expected.checksum: Added.
  • platform/mac/fast/repaint/no-caret-repaint-in-non-content-editable-element-expected.png: Added.
  • platform/mac/fast/repaint/no-caret-repaint-in-non-content-editable-element-expected.txt: Added.
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r55664 r55669  
     12010-03-08  Daniel Bates  <dbates@rim.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=34819
     6
     7        Tests that we do not repaint the caret rectangle when the associated selection is
     8        not in a content editable element.
     9
     10        * fast/repaint/no-caret-repaint-in-non-content-editable-element.html: Added.
     11        * platform/mac/fast/repaint/no-caret-repaint-in-non-content-editable-element-expected.checksum: Added.
     12        * platform/mac/fast/repaint/no-caret-repaint-in-non-content-editable-element-expected.png: Added.
     13        * platform/mac/fast/repaint/no-caret-repaint-in-non-content-editable-element-expected.txt: Added.
     14
    1152010-03-08  Shu Chang  <Chang.Shu@nokia.com>
    216
  • trunk/WebCore/ChangeLog

    r55668 r55669  
     12010-03-08  Daniel Bates  <dbates@rim.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=34819
     6
     7        Fixes an issue where we repaint the caret rectangle even if the associated
     8        selection is not in a content editable element. This is extraneous since the
     9        caret is only visible when the selection is in a content editable element.
     10        Hence, we should only repaint the caret rectangle when the associated selection
     11        is in a content editable element.
     12
     13        Note, we always paint the caret when caret browsing is enabled.
     14
     15        Test: fast/repaint/no-caret-repaint-in-non-content-editable-element.html
     16
     17        * editing/SelectionController.cpp:
     18        (WebCore::SelectionController::recomputeCaretRect): Modified to call method
     19        SelectionController::shouldRepaintCaret.
     20        (WebCore::SelectionController::shouldRepaintCaret): Added.
     21        (WebCore::SelectionController::invalidateCaretRect): Modified to call method
     22        SelectionController::shouldRepaintCaret.
     23        * editing/SelectionController.h:
     24
    1252010-03-08  Eric Carlson  <eric.carlson@apple.com>
    226
  • trunk/WebCore/editing/SelectionController.cpp

    r54980 r55669  
    974974        // FIXME: make caret repainting container-aware.
    975975        view->repaintRectangleInViewAndCompositedLayers(oldAbsoluteCaretRepaintBounds, false);
    976         view->repaintRectangleInViewAndCompositedLayers(m_absoluteCaretRepaintBounds, false);
     976        if (shouldRepaintCaret(view))
     977            view->repaintRectangleInViewAndCompositedLayers(m_absoluteCaretRepaintBounds, false);
    977978    }
    978979
    979980    return true;
     981}
     982
     983bool SelectionController::shouldRepaintCaret(const RenderView* view) const
     984{
     985    ASSERT(view);
     986    Frame* frame = view->frameView() ? view->frameView()->frame() : 0; // The frame where the selection started.
     987    bool caretBrowsing = frame && frame->settings() && frame->settings()->caretBrowsingEnabled();
     988    return (caretBrowsing || isContentEditable());
    980989}
    981990
     
    10051014
    10061015    if (!caretRectChanged) {
    1007         if (RenderView* view = toRenderView(d->renderer()))
     1016        RenderView* view = toRenderView(d->renderer());
     1017        if (view && shouldRepaintCaret(view))
    10081018            view->repaintRectangleInViewAndCompositedLayers(caretRepaintRect(), false);
    10091019    }
  • trunk/WebCore/editing/SelectionController.h

    r54980 r55669  
    3838class GraphicsContext;
    3939class RenderObject;
     40class RenderView;
    4041class VisiblePosition;
    4142
     
    156157    void layout();
    157158    IntRect caretRepaintRect() const;
     159    bool shouldRepaintCaret(const RenderView* view) const;
    158160
    159161    int xPosForVerticalArrowNavigation(EPositionType);
Note: See TracChangeset for help on using the changeset viewer.