Changeset 88172 in webkit


Ignore:
Timestamp:
Jun 6, 2011 10:50:03 AM (13 years ago)
Author:
leviw@chromium.org
Message:

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

Reviewed by Eric Seidel.

Switch paintFloats, paintChildren, and paintEllipsisBoxes to use IntPoint
https://bugs.webkit.org/show_bug.cgi?id=62058

Switching paintFloats, paintChildren, and paintEllipsisBoxes to take IntPoints representing
their paint offsets instead of pairs of ints.

No new tests since this is simple refactoring.

  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::paintColumnContents): (WebCore::RenderBlock::paintContents): (WebCore::RenderBlock::paintChildren): (WebCore::RenderBlock::paintObject): (WebCore::RenderBlock::paintFloats): (WebCore::RenderBlock::paintEllipsisBoxes):
  • rendering/RenderBlock.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r88166 r88172  
     12011-06-03  Levi Weintraub  <leviw@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Switch paintFloats, paintChildren, and paintEllipsisBoxes to use IntPoint
     6        https://bugs.webkit.org/show_bug.cgi?id=62058
     7
     8        Switching paintFloats, paintChildren, and paintEllipsisBoxes to take IntPoints representing
     9        their paint offsets instead of pairs of ints.
     10
     11        No new tests since this is simple refactoring.
     12
     13        * rendering/RenderBlock.cpp:
     14        (WebCore::RenderBlock::paintColumnContents):
     15        (WebCore::RenderBlock::paintContents):
     16        (WebCore::RenderBlock::paintChildren):
     17        (WebCore::RenderBlock::paintObject):
     18        (WebCore::RenderBlock::paintFloats):
     19        (WebCore::RenderBlock::paintEllipsisBoxes):
     20        * rendering/RenderBlock.h:
     21
    1222011-06-06  Steve Block  <steveblock@google.com>
    223
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r88122 r88172  
    23522352            int finalY = ty + offset.height();
    23532353            if (paintingFloats)
    2354                 paintFloats(info, finalX, finalY, paintInfo.phase == PaintPhaseSelection || paintInfo.phase == PaintPhaseTextClip);
     2354                paintFloats(info, IntPoint(finalX, finalY), paintInfo.phase == PaintPhaseSelection || paintInfo.phase == PaintPhaseTextClip);
    23552355            else
    23562356                paintContents(info, finalX, finalY);
     
    23762376        m_lineBoxes.paint(this, paintInfo, tx, ty);
    23772377    else
    2378         paintChildren(paintInfo, tx, ty);
    2379 }
    2380 
    2381 void RenderBlock::paintChildren(PaintInfo& paintInfo, int tx, int ty)
     2378        paintChildren(paintInfo, IntPoint(tx, ty));
     2379}
     2380
     2381void RenderBlock::paintChildren(PaintInfo& paintInfo, const IntPoint& paintOffset)
    23822382{
    23832383    PaintPhase newPhase = (paintInfo.phase == PaintPhaseChildOutlines) ? PaintPhaseOutline : paintInfo.phase;
     
    23972397        // Check for page-break-before: always, and if it's set, break and bail.
    23982398        bool checkBeforeAlways = !childrenInline() && (usePrintRect && child->style()->pageBreakBefore() == PBALWAYS);
     2399        int absoluteChildY = paintOffset.y() + child->y();
    23992400        if (checkBeforeAlways
    2400             && (ty + child->y()) > paintInfo.rect.y()
    2401             && (ty + child->y()) < paintInfo.rect.maxY()) {
    2402             view()->setBestTruncatedAt(ty + child->y(), this, true);
     2401            && absoluteChildY > paintInfo.rect.y()
     2402            && absoluteChildY < paintInfo.rect.maxY()) {
     2403            view()->setBestTruncatedAt(absoluteChildY, this, true);
    24032404            return;
    24042405        }
     
    24062407        if (!child->isFloating() && child->isReplaced() && usePrintRect && child->height() <= renderView->printRect().height()) {
    24072408            // Paginate block-level replaced elements.
    2408             if (ty + child->y() + child->height() > renderView->printRect().maxY()) {
    2409                 if (ty + child->y() < renderView->truncatedAt())
    2410                     renderView->setBestTruncatedAt(ty + child->y(), child);
     2409            if (absoluteChildY + child->height() > renderView->printRect().maxY()) {
     2410                if (absoluteChildY < renderView->truncatedAt())
     2411                    renderView->setBestTruncatedAt(absoluteChildY, child);
    24112412                // If we were able to truncate, don't paint.
    2412                 if (ty + child->y() >= renderView->truncatedAt())
     2413                if (absoluteChildY >= renderView->truncatedAt())
    24132414                    break;
    24142415            }
    24152416        }
    24162417
    2417         IntPoint childPoint = flipForWritingMode(child, IntPoint(tx, ty), ParentToChildFlippingAdjustment);
     2418        IntPoint childPoint = flipForWritingMode(child, paintOffset, ParentToChildFlippingAdjustment);
    24182419        if (!child->hasSelfPaintingLayer() && !child->isFloating())
    24192420            child->paint(info, childPoint.x(), childPoint.y());
     
    24222423        bool checkAfterAlways = !childrenInline() && (usePrintRect && child->style()->pageBreakAfter() == PBALWAYS);
    24232424        if (checkAfterAlways
    2424             && (ty + child->y() + child->height()) > paintInfo.rect.y()
    2425             && (ty + child->y() + child->height()) < paintInfo.rect.maxY()) {
    2426             view()->setBestTruncatedAt(ty + child->y() + child->height() + max(0, child->collapsedMarginAfter()), this, true);
     2425            && (absoluteChildY + child->height()) > paintInfo.rect.y()
     2426            && (absoluteChildY + child->height()) < paintInfo.rect.maxY()) {
     2427            view()->setBestTruncatedAt(absoluteChildY + child->height() + max(0, child->collapsedMarginAfter()), this, true);
    24272428            return;
    24282429        }
     
    25022503            paintColumnContents(paintInfo, scrolledOffset.x(), scrolledOffset.y(), true);
    25032504        else
    2504             paintFloats(paintInfo, scrolledOffset.x(), scrolledOffset.y(), paintPhase == PaintPhaseSelection || paintPhase == PaintPhaseTextClip);
     2505            paintFloats(paintInfo, scrolledOffset, paintPhase == PaintPhaseSelection || paintPhase == PaintPhaseTextClip);
    25052506    }
    25062507
     
    25552556}
    25562557
    2557 void RenderBlock::paintFloats(PaintInfo& paintInfo, int tx, int ty, bool preservePhase)
     2558void RenderBlock::paintFloats(PaintInfo& paintInfo, const IntPoint& paintOffset, bool preservePhase)
    25582559{
    25592560    if (!m_floatingObjects)
     
    25682569            PaintInfo currentPaintInfo(paintInfo);
    25692570            currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground;
    2570             IntPoint childPoint = flipFloatForWritingMode(r, IntPoint(tx + xPositionForFloatIncludingMargin(r) - r->m_renderer->x(), ty + yPositionForFloatIncludingMargin(r) - r->m_renderer->y()));
     2571            IntPoint childPoint = flipFloatForWritingMode(r, IntPoint(paintOffset.x() + xPositionForFloatIncludingMargin(r) - r->m_renderer->x(), paintOffset.y() + yPositionForFloatIncludingMargin(r) - r->m_renderer->y()));
    25712572            r->m_renderer->paint(currentPaintInfo, childPoint.x(), childPoint.y());
    25722573            if (!preservePhase) {
     
    25842585}
    25852586
    2586 void RenderBlock::paintEllipsisBoxes(PaintInfo& paintInfo, int tx, int ty)
     2587void RenderBlock::paintEllipsisBoxes(PaintInfo& paintInfo, const IntPoint& paintOffset)
    25872588{
    25882589    if (!paintInfo.shouldPaintWithinRoot(this) || !firstLineBox())
     
    25922593        // We can check the first box and last box and avoid painting if we don't
    25932594        // intersect.
    2594         int yPos = ty + firstLineBox()->y();
     2595        int yPos = paintOffset.y() + firstLineBox()->y();
    25952596        int h = lastLineBox()->y() + lastLineBox()->logicalHeight() - firstLineBox()->y();
    25962597        if (yPos >= paintInfo.rect.maxY() || yPos + h <= paintInfo.rect.y())
     
    26012602        // based off positions of our first line box or our last line box.
    26022603        for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) {
    2603             yPos = ty + curr->y();
     2604            yPos = paintOffset.y() + curr->y();
    26042605            h = curr->logicalHeight();
    26052606            if (curr->ellipsisBox() && yPos < paintInfo.rect.maxY() && yPos + h > paintInfo.rect.y())
    2606                 curr->paintEllipsisBox(paintInfo, IntPoint(tx, ty), curr->lineTop(), curr->lineBottom());
     2607                curr->paintEllipsisBox(paintInfo, paintOffset, curr->lineTop(), curr->lineBottom());
    26072608        }
    26082609    }
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r88087 r88172  
    560560    // End of functions defined in RenderBlockLineLayout.cpp.
    561561
    562     void paintFloats(PaintInfo&, int tx, int ty, bool preservePhase = false);
     562    void paintFloats(PaintInfo&, const IntPoint&, bool preservePhase = false);
    563563    void paintContents(PaintInfo&, int tx, int ty);
    564564    void paintColumnContents(PaintInfo&, int tx, int ty, bool paintFloats = false);
    565565    void paintColumnRules(PaintInfo&, int tx, int ty);
    566     void paintChildren(PaintInfo&, int tx, int ty);
    567     void paintEllipsisBoxes(PaintInfo&, int tx, int ty);
     566    void paintChildren(PaintInfo&, const IntPoint&);
     567    void paintEllipsisBoxes(PaintInfo&, const IntPoint&);
    568568    void paintSelection(PaintInfo&, int tx, int ty);
    569569    void paintCaret(PaintInfo&, const IntPoint&, CaretType);
Note: See TracChangeset for help on using the changeset viewer.