Changeset 88176 in webkit


Ignore:
Timestamp:
Jun 6, 2011 11:43:40 AM (13 years ago)
Author:
leviw@chromium.org
Message:

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

Reviewed by Eric Seidel.

Switch paintContents, paintColumnContents, paintColumnRules, and paintSelection to use IntPoint
https://bugs.webkit.org/show_bug.cgi?id=62134

Switching paintContents, paintColumnContents, paintColumnRules, and paintSelection to take an
IntPoint representing the paint offset instead of a pair of ints.

No new tests as this simple refactoring.

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

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r88175 r88176  
     12011-06-06  Levi Weintraub  <leviw@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Switch paintContents, paintColumnContents, paintColumnRules, and paintSelection to use IntPoint
     6        https://bugs.webkit.org/show_bug.cgi?id=62134
     7
     8        Switching paintContents, paintColumnContents, paintColumnRules, and paintSelection to take an
     9        IntPoint representing the paint offset instead of a pair of ints.
     10
     11        No new tests as this simple refactoring.
     12
     13        * rendering/RenderBlock.cpp:
     14        (WebCore::RenderBlock::paintColumnRules):
     15        (WebCore::RenderBlock::paintColumnContents):
     16        (WebCore::RenderBlock::paintContents):
     17        (WebCore::RenderBlock::paintObject):
     18        (WebCore::RenderBlock::paintSelection):
     19        * rendering/RenderBlock.h:
     20
    1212011-06-06  Yael Aharon  <yael.aharon@nokia.com>
    222
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r88172 r88176  
    22702270}
    22712271
    2272 void RenderBlock::paintColumnRules(PaintInfo& paintInfo, int tx, int ty)
     2272void RenderBlock::paintColumnRules(PaintInfo& paintInfo, const IntPoint& paintOffset)
    22732273{
    22742274    if (paintInfo.context->paintingDisabled())
     
    23102310        // Now paint the column rule.
    23112311        if (i < colCount - 1) {
    2312             int ruleLeft = isHorizontalWritingMode() ? tx + ruleLogicalLeft - ruleWidth / 2 + ruleAdd : tx + borderBefore() + paddingBefore();
     2312            int ruleLeft = isHorizontalWritingMode() ? paintOffset.x() + ruleLogicalLeft - ruleWidth / 2 + ruleAdd : paintOffset.x() + borderBefore() + paddingBefore();
    23132313            int ruleRight = isHorizontalWritingMode() ? ruleLeft + ruleWidth : ruleLeft + contentWidth();
    2314             int ruleTop = isHorizontalWritingMode() ? ty + borderTop() + paddingTop() : ty + ruleLogicalLeft - ruleWidth / 2 + ruleAdd;
     2314            int ruleTop = isHorizontalWritingMode() ? paintOffset.y() + borderTop() + paddingTop() : paintOffset.y() + ruleLogicalLeft - ruleWidth / 2 + ruleAdd;
    23152315            int ruleBottom = isHorizontalWritingMode() ? ruleTop + contentHeight() : ruleTop + ruleWidth;
    23162316            drawLineForBoxSide(paintInfo.context, ruleLeft, ruleTop, ruleRight, ruleBottom,
     
    23222322}
    23232323
    2324 void RenderBlock::paintColumnContents(PaintInfo& paintInfo, int tx, int ty, bool paintingFloats)
     2324void RenderBlock::paintColumnContents(PaintInfo& paintInfo, const IntPoint& paintOffset, bool paintingFloats)
    23252325{
    23262326    // We need to do multiple passes, breaking up our child painting into strips.
     
    23372337        int logicalLeftOffset = (isHorizontalWritingMode() ? colRect.x() : colRect.y()) - logicalLeftOffsetForContent();
    23382338        IntSize offset = isHorizontalWritingMode() ? IntSize(logicalLeftOffset, currLogicalTopOffset) : IntSize(currLogicalTopOffset, logicalLeftOffset);
    2339         colRect.move(tx, ty);
     2339        colRect.moveBy(paintOffset);
    23402340        PaintInfo info(paintInfo);
    23412341        info.rect.intersect(colRect);
     
    23492349
    23502350            // Adjust our x and y when painting.
    2351             int finalX = tx + offset.width();
    2352             int finalY = ty + offset.height();
     2351            IntPoint adjustedPaintOffset = paintOffset + offset;
    23532352            if (paintingFloats)
    2354                 paintFloats(info, IntPoint(finalX, finalY), paintInfo.phase == PaintPhaseSelection || paintInfo.phase == PaintPhaseTextClip);
     2353                paintFloats(info, adjustedPaintOffset, paintInfo.phase == PaintPhaseSelection || paintInfo.phase == PaintPhaseTextClip);
    23552354            else
    2356                 paintContents(info, finalX, finalY);
     2355                paintContents(info, adjustedPaintOffset);
    23572356        }
    23582357
     
    23652364}
    23662365
    2367 void RenderBlock::paintContents(PaintInfo& paintInfo, int tx, int ty)
     2366void RenderBlock::paintContents(PaintInfo& paintInfo, const IntPoint& paintOffset)
    23682367{
    23692368    // Avoid painting descendants of the root element when stylesheets haven't loaded.  This eliminates FOUC.
     
    23742373
    23752374    if (childrenInline())
    2376         m_lineBoxes.paint(this, paintInfo, tx, ty);
     2375        m_lineBoxes.paint(this, paintInfo, paintOffset.x(), paintOffset.y());
    23772376    else
    2378         paintChildren(paintInfo, IntPoint(tx, ty));
     2377        paintChildren(paintInfo, paintOffset);
    23792378}
    23802379
     
    24672466            paintBoxDecorations(paintInfo, paintOffset);
    24682467        if (hasColumns())
    2469             paintColumnRules(paintInfo, paintOffset.x(), paintOffset.y());
     2468            paintColumnRules(paintInfo, paintOffset);
    24702469    }
    24712470
     
    24872486    if (paintPhase != PaintPhaseSelfOutline) {
    24882487        if (hasColumns())
    2489             paintColumnContents(paintInfo, scrolledOffset.x(), scrolledOffset.y());
     2488            paintColumnContents(paintInfo, scrolledOffset);
    24902489        else
    2491             paintContents(paintInfo, scrolledOffset.x(), scrolledOffset.y());
     2490            paintContents(paintInfo, scrolledOffset);
    24922491    }
    24932492
     
    24962495    bool isPrinting = document()->printing();
    24972496    if (!isPrinting && !hasColumns())
    2498         paintSelection(paintInfo, scrolledOffset.x(), scrolledOffset.y()); // Fill in gaps in selection on lines and between blocks.
     2497        paintSelection(paintInfo, scrolledOffset); // Fill in gaps in selection on lines and between blocks.
    24992498
    25002499    // 4. paint floats.
    25012500    if (paintPhase == PaintPhaseFloat || paintPhase == PaintPhaseSelection || paintPhase == PaintPhaseTextClip) {
    25022501        if (hasColumns())
    2503             paintColumnContents(paintInfo, scrolledOffset.x(), scrolledOffset.y(), true);
     2502            paintColumnContents(paintInfo, scrolledOffset, true);
    25042503        else
    25052504            paintFloats(paintInfo, scrolledOffset, paintPhase == PaintPhaseSelection || paintPhase == PaintPhaseTextClip);
     
    27412740}
    27422741
    2743 void RenderBlock::paintSelection(PaintInfo& paintInfo, int tx, int ty)
     2742void RenderBlock::paintSelection(PaintInfo& paintInfo, const IntPoint& paintOffset)
    27442743{
    27452744    if (shouldPaintSelectionGaps() && paintInfo.phase == PaintPhaseForeground) {
     
    27492748        GraphicsContextStateSaver stateSaver(*paintInfo.context);
    27502749
    2751         IntRect gapRectsBounds = selectionGaps(this, IntPoint(tx, ty), IntSize(), lastTop, lastLeft, lastRight, &paintInfo);
     2750        IntRect gapRectsBounds = selectionGaps(this, paintOffset, IntSize(), lastTop, lastLeft, lastRight, &paintInfo);
    27522751        if (!gapRectsBounds.isEmpty()) {
    27532752            if (RenderLayer* layer = enclosingLayer()) {
    2754                 gapRectsBounds.move(IntSize(-tx, -ty));
     2753                gapRectsBounds.moveBy(-paintOffset);
    27552754                if (!hasLayer()) {
    27562755                    IntRect localBounds(gapRectsBounds);
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r88172 r88176  
    561561
    562562    void paintFloats(PaintInfo&, const IntPoint&, bool preservePhase = false);
    563     void paintContents(PaintInfo&, int tx, int ty);
    564     void paintColumnContents(PaintInfo&, int tx, int ty, bool paintFloats = false);
    565     void paintColumnRules(PaintInfo&, int tx, int ty);
     563    void paintContents(PaintInfo&, const IntPoint&);
     564    void paintColumnContents(PaintInfo&, const IntPoint&, bool paintFloats = false);
     565    void paintColumnRules(PaintInfo&, const IntPoint&);
    566566    void paintChildren(PaintInfo&, const IntPoint&);
    567567    void paintEllipsisBoxes(PaintInfo&, const IntPoint&);
    568     void paintSelection(PaintInfo&, int tx, int ty);
     568    void paintSelection(PaintInfo&, const IntPoint&);
    569569    void paintCaret(PaintInfo&, const IntPoint&, CaretType);
    570570
Note: See TracChangeset for help on using the changeset viewer.