Changeset 88200 in webkit


Ignore:
Timestamp:
Jun 6, 2011 4:21:20 PM (13 years ago)
Author:
leviw@chromium.org
Message:

2011-06-06 Levi Weintraub <leviw@chromium.org>

Reviewed by Eric Seidel.

Switch shouldPaint to use IntPoint
https://bugs.webkit.org/show_bug.cgi?id=62158

Switching shouldPaint to take an IntPoint representing the paint offset instead
of a pair of ints.

No new tests as this is simple refactoring.

  • rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::paint): (WebCore::RenderReplaced::shouldPaint):
  • rendering/RenderReplaced.h:
  • rendering/RenderWidget.cpp: (WebCore::RenderWidget::paint):
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r88199 r88200  
     12011-06-06  Levi Weintraub  <leviw@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Switch shouldPaint to use IntPoint
     6        https://bugs.webkit.org/show_bug.cgi?id=62158
     7
     8        Switching shouldPaint to take an IntPoint representing the paint offset instead
     9        of a pair of ints.
     10
     11        No new tests as this is simple refactoring.
     12
     13        * rendering/RenderReplaced.cpp:
     14        (WebCore::RenderReplaced::paint):
     15        (WebCore::RenderReplaced::shouldPaint):
     16        * rendering/RenderReplaced.h:
     17        * rendering/RenderWidget.cpp:
     18        (WebCore::RenderWidget::paint):
     19
    1202011-06-06  James Simonsen  <simonjam@chromium.org>
    221
  • trunk/Source/WebCore/rendering/RenderReplaced.cpp

    r88087 r88200  
    9797void RenderReplaced::paint(PaintInfo& paintInfo, int tx, int ty)
    9898{
    99     if (!shouldPaint(paintInfo, tx, ty))
     99    if (!shouldPaint(paintInfo, IntPoint(tx, ty)))
    100100        return;
    101101   
     
    157157}
    158158
    159 bool RenderReplaced::shouldPaint(PaintInfo& paintInfo, int& tx, int& ty)
     159bool RenderReplaced::shouldPaint(PaintInfo& paintInfo, const IntPoint& paintOffset)
    160160{
    161161    if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseOutline && paintInfo.phase != PaintPhaseSelfOutline
     
    170170        return false;
    171171
    172     int currentTX = tx + x();
    173     int currentTY = ty + y();
     172    IntPoint adjustedPaintOffset = paintOffset + location();
    174173
    175174    // Early exit if the element touches the edges.
    176     int top = currentTY + minYVisualOverflow();
    177     int bottom = currentTY + maxYVisualOverflow();
     175    int top = adjustedPaintOffset.y() + minYVisualOverflow();
     176    int bottom = adjustedPaintOffset.y() + maxYVisualOverflow();
    178177    if (isSelected() && m_inlineBoxWrapper) {
    179         int selTop = ty + m_inlineBoxWrapper->root()->selectionTop();
    180         int selBottom = ty + selTop + m_inlineBoxWrapper->root()->selectionHeight();
     178        int selTop = paintOffset.y() + m_inlineBoxWrapper->root()->selectionTop();
     179        int selBottom = paintOffset.y() + selTop + m_inlineBoxWrapper->root()->selectionHeight();
    181180        top = min(selTop, top);
    182181        bottom = max(selBottom, bottom);
     
    184183   
    185184    int os = 2 * maximalOutlineSize(paintInfo.phase);
    186     if (currentTX + minXVisualOverflow() >= paintInfo.rect.maxX() + os || currentTX + maxXVisualOverflow() <= paintInfo.rect.x() - os)
     185    if (adjustedPaintOffset.x() + minXVisualOverflow() >= paintInfo.rect.maxX() + os || adjustedPaintOffset.x() + maxXVisualOverflow() <= paintInfo.rect.x() - os)
    187186        return false;
    188187    if (top >= paintInfo.rect.maxY() + os || bottom <= paintInfo.rect.y() - os)
  • trunk/Source/WebCore/rendering/RenderReplaced.h

    r87989 r88200  
    5353
    5454    virtual void paint(PaintInfo&, int tx, int ty);
    55     bool shouldPaint(PaintInfo&, int& tx, int& ty);
     55    bool shouldPaint(PaintInfo&, const IntPoint&);
    5656    IntRect localSelectionRect(bool checkWhetherSelected = true) const; // This is in local coordinates, but it's a physical rect (so the top left corner is physical top left).
    5757
  • trunk/Source/WebCore/rendering/RenderWidget.cpp

    r88087 r88200  
    250250void RenderWidget::paint(PaintInfo& paintInfo, int tx, int ty)
    251251{
    252     if (!shouldPaint(paintInfo, tx, ty))
     252    if (!shouldPaint(paintInfo, IntPoint(tx, ty)))
    253253        return;
    254254
Note: See TracChangeset for help on using the changeset viewer.