Changeset 42583 in webkit


Ignore:
Timestamp:
Apr 16, 2009 11:11:29 AM (15 years ago)
Author:
justin.garcia@apple.com
Message:

WebCore:

2009-04-16 Justin Garcia <justin.garcia@apple.com>

Reviewed by Simon Fraser.

https://bugs.webkit.org/show_bug.cgi?id=25228
SelectionController::absoluteCaretBounds returns an inflated caret (the caret repaint rect)


Return the bounds of the transformed caret, not the transformed repaint rect for the caret (which is inflated).

  • editing/SelectionController.cpp: (WebCore::SelectionController::localCaretRect): (WebCore::SelectionController::absoluteBoundsForLocalRect): (WebCore::SelectionController::caretRepaintRect): (WebCore::SelectionController::recomputeCaretRect):
  • editing/SelectionController.h:

LayoutTests:

2009-04-16 Justin Garcia <justin.garcia@apple.com>

Reviewed by Simon Fraser.


https://bugs.webkit.org/show_bug.cgi?id=25228
SelectionController::absoluteCaretBounds returns an inflated caret (the caret repaint rect)

  • editing/selection/25228.html: Added.
  • platform/mac/editing/selection/25228-expected.checksum: Added.
  • platform/mac/editing/selection/25228-expected.png: Added.
  • platform/mac/editing/selection/25228-expected.txt: Added.
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r42577 r42583  
     12009-04-16  Justin Garcia  <justin.garcia@apple.com>
     2
     3        Reviewed by Simon Fraser.
     4       
     5        https://bugs.webkit.org/show_bug.cgi?id=25228
     6        SelectionController::absoluteCaretBounds returns an inflated caret (the caret repaint rect)
     7
     8        * editing/selection/25228.html: Added.
     9        * platform/mac/editing/selection/25228-expected.checksum: Added.
     10        * platform/mac/editing/selection/25228-expected.png: Added.
     11        * platform/mac/editing/selection/25228-expected.txt: Added.
     12
    1132009-04-16  Dan Bernstein  <mitz@apple.com>
    214
  • trunk/WebCore/ChangeLog

    r42581 r42583  
     12009-04-16  Justin Garcia  <justin.garcia@apple.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=25228
     6        SelectionController::absoluteCaretBounds returns an inflated caret (the caret repaint rect)
     7       
     8        Return the bounds of the transformed caret, not the transformed repaint rect for the caret (which is inflated).
     9
     10        * editing/SelectionController.cpp:
     11        (WebCore::SelectionController::localCaretRect):
     12        (WebCore::SelectionController::absoluteBoundsForLocalRect):
     13        (WebCore::SelectionController::caretRepaintRect):
     14        (WebCore::SelectionController::recomputeCaretRect):
     15        * editing/SelectionController.h:
     16
    1172009-04-16  Pierre d'Herbemont  <pdherbemont@apple.com>
    218
  • trunk/WebCore/editing/SelectionController.cpp

    r42377 r42583  
    877877{
    878878    if (m_needsLayout)
    879         const_cast<SelectionController *>(this)->layout();
     879        const_cast<SelectionController*>(this)->layout();
    880880   
    881881    return m_caretRect;
     882}
     883
     884IntRect SelectionController::absoluteBoundsForLocalRect(const IntRect& rect) const
     885{
     886    RenderObject* caretPainter = caretRenderer();
     887    if (!caretPainter)
     888        return IntRect();
     889       
     890    return caretPainter->localToAbsoluteQuad(FloatRect(rect)).enclosingBoundingBox();
    882891}
    883892
     
    900909IntRect SelectionController::caretRepaintRect() const
    901910{
    902     IntRect localRect = repaintRectForCaret(localCaretRect());
    903    
    904     RenderObject* caretPainter = caretRenderer();
    905     if (caretPainter)
    906         return caretPainter->localToAbsoluteQuad(FloatRect(localRect)).enclosingBoundingBox();
    907 
    908     return IntRect();
     911    return absoluteBoundsForLocalRect(repaintRectForCaret(localCaretRect()));
    909912}
    910913
     
    922925
    923926    IntRect oldRect = m_caretRect;
    924     m_needsLayout = true;
    925927    IntRect newRect = localCaretRect();
    926928    if (oldRect == newRect && !m_absCaretBoundsDirty)
    927929        return false;
    928930
    929     IntRect oldAbsRepaintRect = m_absCaretBounds;
    930     m_absCaretBounds = caretRepaintRect();
     931    IntRect oldAbsCaretBounds = m_absCaretBounds;
     932    // FIXME: Rename m_caretRect to m_localCaretRect.
     933    m_absCaretBounds = absoluteBoundsForLocalRect(m_caretRect);
    931934    m_absCaretBoundsDirty = false;
    932935   
    933     if (oldAbsRepaintRect == m_absCaretBounds)
    934         return false;
     936    if (oldAbsCaretBounds == m_absCaretBounds)
     937        return false;
     938       
     939    IntRect oldAbsoluteCaretRepaintBounds = m_absoluteCaretRepaintBounds;
     940    // We believe that we need to inflate the local rect before transforming it to obtain the repaint bounds.
     941    m_absoluteCaretRepaintBounds = caretRepaintRect();
    935942   
    936943    if (RenderView* view = toRenderView(m_frame->document()->renderer())) {
    937944        // FIXME: make caret repainting container-aware.
    938         view->repaintRectangleInViewAndCompositedLayers(oldAbsRepaintRect, false);
    939         view->repaintRectangleInViewAndCompositedLayers(m_absCaretBounds, false);
     945        view->repaintRectangleInViewAndCompositedLayers(oldAbsoluteCaretRepaintBounds, false);
     946        view->repaintRectangleInViewAndCompositedLayers(m_absoluteCaretRepaintBounds, false);
    940947    }
    941948
  • trunk/WebCore/editing/SelectionController.h

    r42054 r42583  
    155155    void focusedOrActiveStateChanged();
    156156    bool caretRendersInsideNode(Node*) const;
     157   
     158    IntRect absoluteBoundsForLocalRect(const IntRect&) const;
    157159
    158160    Frame* m_frame;
     
    163165    IntRect m_caretRect;        // caret rect in coords local to the renderer responsible for painting the caret
    164166    IntRect m_absCaretBounds;   // absolute bounding rect for the caret
     167    IntRect m_absoluteCaretRepaintBounds;
    165168   
    166169    bool m_needsLayout : 1;       // true if the caret and expectedVisible rectangles need to be calculated
Note: See TracChangeset for help on using the changeset viewer.