Changeset 88190 in webkit


Ignore:
Timestamp:
Jun 6, 2011 2:35:56 PM (13 years ago)
Author:
leviw@chromium.org
Message:

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

Reviewed by Eric Seidel.

Switch paintOutline, paintContinuationOutlines, and paintOutlineForLine to use IntPoint
https://bugs.webkit.org/show_bug.cgi?id=62137

Switching paintOutline, paintContinuationOutlines, and paintOutlineForLine to take an IntPoint
representing the paint offset instead of a pair of ints.

No new tests as this is simple refactoring.

  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::paintObject): (WebCore::RenderBlock::paintContinuationOutlines):
  • rendering/RenderBlock.h:
  • rendering/RenderInline.cpp: (WebCore::RenderInline::paintOutline): (WebCore::RenderInline::paintOutlineForLine):
  • rendering/RenderInline.h:
  • rendering/RenderLineBoxList.cpp: (WebCore::RenderLineBoxList::paint):
Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r88189 r88190  
     12011-06-06  Levi Weintraub  <leviw@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Switch paintOutline, paintContinuationOutlines, and paintOutlineForLine to use IntPoint
     6        https://bugs.webkit.org/show_bug.cgi?id=62137
     7
     8        Switching paintOutline, paintContinuationOutlines, and paintOutlineForLine to take an IntPoint
     9        representing the paint offset instead of a pair of ints.
     10
     11        No new tests as this is simple refactoring.
     12
     13        * rendering/RenderBlock.cpp:
     14        (WebCore::RenderBlock::paintObject):
     15        (WebCore::RenderBlock::paintContinuationOutlines):
     16        * rendering/RenderBlock.h:
     17        * rendering/RenderInline.cpp:
     18        (WebCore::RenderInline::paintOutline):
     19        (WebCore::RenderInline::paintOutlineForLine):
     20        * rendering/RenderInline.h:
     21        * rendering/RenderLineBoxList.cpp:
     22        (WebCore::RenderLineBoxList::paint):
     23
    1242011-06-06  Emil A Eklund  <eae@chromium.org>
    225
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r88189 r88190  
    25272527                cb->addContinuationWithOutline(inlineRenderer);
    25282528            else if (!inlineRenderer->firstLineBox())
    2529                 inlineRenderer->paintOutline(paintInfo.context, paintOffset.x() - x() + inlineRenderer->containingBlock()->x(),
    2530                                              paintOffset.y() - y() + inlineRenderer->containingBlock()->y());
    2531         }
    2532         paintContinuationOutlines(paintInfo, paintOffset.x(), paintOffset.y());
     2529                inlineRenderer->paintOutline(paintInfo.context, paintOffset - locationOffset() + inlineRenderer->containingBlock()->location());
     2530        }
     2531        paintContinuationOutlines(paintInfo, paintOffset);
    25332532    }
    25342533
     
    26612660}
    26622661
    2663 void RenderBlock::paintContinuationOutlines(PaintInfo& info, int tx, int ty)
     2662void RenderBlock::paintContinuationOutlines(PaintInfo& info, const IntPoint& paintOffset)
    26642663{
    26652664    ContinuationOutlineTableMap* table = continuationOutlineTable();
     
    26702669    if (!continuations)
    26712670        return;
    2672        
     2671
     2672    IntPoint accumulatedPaintOffset = paintOffset;
    26732673    // Paint each continuation outline.
    26742674    ListHashSet<RenderInline*>::iterator end = continuations->end();
     
    26772677        RenderInline* flow = *it;
    26782678        RenderBlock* block = flow->containingBlock();
    2679         for ( ; block && block != this; block = block->containingBlock()) {
    2680             tx += block->x();
    2681             ty += block->y();
    2682         }
     2679        for ( ; block && block != this; block = block->containingBlock())
     2680            accumulatedPaintOffset.move(block->location());
    26832681        ASSERT(block);   
    2684         flow->paintOutline(info.context, tx, ty);
     2682        flow->paintOutline(info.context, accumulatedPaintOffset);
    26852683    }
    26862684   
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r88176 r88190  
    633633    void setDesiredColumnCountAndWidth(int count, int width);
    634634
    635     void paintContinuationOutlines(PaintInfo&, int tx, int ty);
     635    void paintContinuationOutlines(PaintInfo&, const IntPoint&);
    636636
    637637    virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);
  • trunk/Source/WebCore/rendering/RenderInline.cpp

    r87989 r88190  
    13671367}
    13681368
    1369 void RenderInline::paintOutline(GraphicsContext* graphicsContext, int tx, int ty)
     1369void RenderInline::paintOutline(GraphicsContext* graphicsContext, const IntPoint& paintOffset)
    13701370{
    13711371    if (!hasOutline())
     
    13761376        if (!theme()->supportsFocusRing(styleToUse)) {
    13771377            // Only paint the focus ring by hand if the theme isn't able to draw the focus ring.
    1378             paintFocusRing(graphicsContext, IntPoint(tx, ty), styleToUse);
     1378            paintFocusRing(graphicsContext, paintOffset, styleToUse);
    13791379        }
    13801380    }
     
    14091409
    14101410    for (unsigned i = 1; i < rects.size() - 1; i++)
    1411         paintOutlineForLine(graphicsContext, tx, ty, rects.at(i - 1), rects.at(i), rects.at(i + 1), outlineColor);
     1411        paintOutlineForLine(graphicsContext, paintOffset, rects.at(i - 1), rects.at(i), rects.at(i + 1), outlineColor);
    14121412
    14131413// FIXME: Using a transparency layer for rgba outlines exacerbates an existing SKIA bug. The #if
     
    14191419}
    14201420
    1421 void RenderInline::paintOutlineForLine(GraphicsContext* graphicsContext, int tx, int ty,
     1421void RenderInline::paintOutlineForLine(GraphicsContext* graphicsContext, const IntPoint& paintOffset,
    14221422                                       const IntRect& lastline, const IntRect& thisline, const IntRect& nextline,
    14231423                                       const Color outlineColor)
     
    14321432    int offset = style()->outlineOffset();
    14331433
    1434     int t = ty + thisline.y() - offset;
    1435     int l = tx + thisline.x() - offset;
    1436     int b = ty + thisline.maxY() + offset;
    1437     int r = tx + thisline.maxX() + offset;
     1434    int t = paintOffset.y() + thisline.y() - offset;
     1435    int l = paintOffset.x() + thisline.x() - offset;
     1436    int b = paintOffset.y() + thisline.maxY() + offset;
     1437    int r = paintOffset.x() + thisline.maxX() + offset;
    14381438   
    14391439    // left edge
     
    14651465                   l - ow,
    14661466                   t - ow,
    1467                    min(r+ow, (lastline.isEmpty() ? 1000000 : tx + lastline.x())),
     1467                   min(r+ow, (lastline.isEmpty() ? 1000000 : paintOffset.x() + lastline.x())),
    14681468                   t,
    14691469                   BSTop, outlineColor, os,
    14701470                   ow,
    1471                    (!lastline.isEmpty() && tx + lastline.x() + 1 < r + ow) ? -ow : ow,
     1471                   (!lastline.isEmpty() && paintOffset.x() + lastline.x() + 1 < r + ow) ? -ow : ow,
    14721472                   antialias);
    14731473   
    14741474    if (lastline.maxX() < thisline.maxX())
    14751475        drawLineForBoxSide(graphicsContext,
    1476                    max(lastline.isEmpty() ? -1000000 : tx + lastline.maxX(), l - ow),
     1476                   max(lastline.isEmpty() ? -1000000 : paintOffset.x() + lastline.maxX(), l - ow),
    14771477                   t - ow,
    14781478                   r + ow,
    14791479                   t,
    14801480                   BSTop, outlineColor, os,
    1481                    (!lastline.isEmpty() && l - ow < tx + lastline.maxX()) ? -ow : ow,
     1481                   (!lastline.isEmpty() && l - ow < paintOffset.x() + lastline.maxX()) ? -ow : ow,
    14821482                   ow, antialias);
    14831483   
     
    14871487                   l - ow,
    14881488                   b,
    1489                    min(r + ow, !nextline.isEmpty() ? tx + nextline.x() + 1 : 1000000),
     1489                   min(r + ow, !nextline.isEmpty() ? paintOffset.x() + nextline.x() + 1 : 1000000),
    14901490                   b + ow,
    14911491                   BSBottom, outlineColor, os,
    14921492                   ow,
    1493                    (!nextline.isEmpty() && tx + nextline.x() + 1 < r + ow) ? -ow : ow,
     1493                   (!nextline.isEmpty() && paintOffset.x() + nextline.x() + 1 < r + ow) ? -ow : ow,
    14941494                   antialias);
    14951495   
    14961496    if (nextline.maxX() < thisline.maxX())
    14971497        drawLineForBoxSide(graphicsContext,
    1498                    max(!nextline.isEmpty() ? tx + nextline.maxX() : -1000000, l - ow),
     1498                   max(!nextline.isEmpty() ? paintOffset.x() + nextline.maxX() : -1000000, l - ow),
    14991499                   b,
    15001500                   r + ow,
    15011501                   b + ow,
    15021502                   BSBottom, outlineColor, os,
    1503                    (!nextline.isEmpty() && l - ow < tx + nextline.maxX()) ? -ow : ow,
     1503                   (!nextline.isEmpty() && l - ow < paintOffset.x() + nextline.maxX()) ? -ow : ow,
    15041504                   ow, antialias);
    15051505}
  • trunk/Source/WebCore/rendering/RenderInline.h

    r87302 r88190  
    7777
    7878    virtual void addFocusRingRects(Vector<IntRect>&, const IntPoint&);
    79     void paintOutline(GraphicsContext*, int tx, int ty);
     79    void paintOutline(GraphicsContext*, const IntPoint&);
    8080
    8181    using RenderBoxModelObject::continuation;
     
    163163    static RenderInline* cloneInline(RenderInline* src);
    164164
    165     void paintOutlineForLine(GraphicsContext*, int tx, int ty, const IntRect& prevLine, const IntRect& thisLine,
     165    void paintOutlineForLine(GraphicsContext*, const IntPoint&, const IntRect& prevLine, const IntRect& thisLine,
    166166                             const IntRect& nextLine, const Color);
    167167    RenderBoxModelObject* continuationBefore(RenderObject* beforeChild);
  • trunk/Source/WebCore/rendering/RenderLineBoxList.cpp

    r87825 r88190  
    268268        for (ListHashSet<RenderInline*>::iterator it = info.outlineObjects->begin(); it != end; ++it) {
    269269            RenderInline* flow = *it;
    270             flow->paintOutline(info.context, tx, ty);
     270            flow->paintOutline(info.context, IntPoint(tx, ty));
    271271        }
    272272        info.outlineObjects->clear();
Note: See TracChangeset for help on using the changeset viewer.