Changeset 86272 in webkit


Ignore:
Timestamp:
May 11, 2011 2:33:01 PM (13 years ago)
Author:
leviw@chromium.org
Message:

2011-05-11 Levi Weintraub <leviw@chromium.org>

Reviewed by Eric Seidel.

Switch RenderBoxModelObject::paintBorder to use IntRect instead of four ints
https://bugs.webkit.org/show_bug.cgi?id=60591

Switching RenderBoxModelObject::paintBorder to use IntRect instead of four ints representing a rect.

No new tests since there is no functionality change.

  • rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::paintBoxDecorations):
  • rendering/RenderBox.cpp: (WebCore::RenderBox::paintBoxDecorationsWithSize):
  • rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintBorder):
  • rendering/RenderBoxModelObject.h:
  • rendering/RenderFieldset.cpp: (WebCore::RenderFieldset::paintBoxDecorations):
  • rendering/RenderTable.cpp: (WebCore::RenderTable::paintBoxDecorations):
  • rendering/RenderTableCell.cpp: (WebCore::RenderTableCell::paintBoxDecorations):
Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r86271 r86272  
     12011-05-11  Levi Weintraub  <leviw@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Switch RenderBoxModelObject::paintBorder to use IntRect instead of four ints
     6        https://bugs.webkit.org/show_bug.cgi?id=60591
     7
     8        Switching RenderBoxModelObject::paintBorder to use IntRect instead of four ints representing a rect.
     9
     10        No new tests since there is no functionality change.
     11
     12        * rendering/InlineFlowBox.cpp:
     13        (WebCore::InlineFlowBox::paintBoxDecorations):
     14        * rendering/RenderBox.cpp:
     15        (WebCore::RenderBox::paintBoxDecorationsWithSize):
     16        * rendering/RenderBoxModelObject.cpp:
     17        (WebCore::RenderBoxModelObject::paintBorder):
     18        * rendering/RenderBoxModelObject.h:
     19        * rendering/RenderFieldset.cpp:
     20        (WebCore::RenderFieldset::paintBoxDecorations):
     21        * rendering/RenderTable.cpp:
     22        (WebCore::RenderTable::paintBoxDecorations):
     23        * rendering/RenderTableCell.cpp:
     24        (WebCore::RenderTableCell::paintBoxDecorations):
     25
    1262011-05-11  Sheriff Bot  <webkit.review.bot@gmail.com>
    227
  • trunk/Source/WebCore/rendering/InlineFlowBox.cpp

    r86188 r86272  
    11281128            // cases only a single call to draw is required.
    11291129            if (!hasBorderImage || (!prevLineBox() && !nextLineBox()))
    1130                 boxModelObject()->paintBorder(context, tx, ty, w, h, renderer()->style(), BackgroundBleedNone, includeLogicalLeftEdge(), includeLogicalRightEdge());
     1130                boxModelObject()->paintBorder(context, IntRect(tx, ty, w, h), renderer()->style(), BackgroundBleedNone, includeLogicalLeftEdge(), includeLogicalRightEdge());
    11311131            else {
    11321132                // We have a border image that spans multiple lines.
     
    11511151                GraphicsContextStateSaver stateSaver(*context);
    11521152                context->clip(IntRect(tx, ty, w, h));
    1153                 boxModelObject()->paintBorder(context, stripX, stripY, stripWidth, stripHeight, renderer()->style());
     1153                boxModelObject()->paintBorder(context, IntRect(stripX, stripY, stripWidth, stripHeight), renderer()->style());
    11541154            }
    11551155        }
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r86197 r86272  
    874874    // The theme will tell us whether or not we should also paint the CSS border.
    875875    if ((!style()->hasAppearance() || (!themePainted && theme()->paintBorderOnly(this, paintInfo, IntRect(tx, ty, width, height)))) && style()->hasBorder())
    876         paintBorder(paintInfo.context, tx, ty, width, height, style(), bleedAvoidance);
     876        paintBorder(paintInfo.context, IntRect(tx, ty, width, height), style(), bleedAvoidance);
    877877
    878878    if (bleedAvoidance == BackgroundBleedUseTransparencyLayer)
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r86188 r86272  
    13471347}
    13481348
    1349 void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, int ty, int w, int h,
    1350                                        const RenderStyle* style, BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
     1349void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, const IntRect& rect, const RenderStyle* style,
     1350                                       BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
    13511351{
    13521352    // border-image is not affected by border-radius.
    1353     if (paintNinePieceImage(graphicsContext, IntRect(tx, ty, w, h), style, style->borderImage()))
     1353    if (paintNinePieceImage(graphicsContext, rect, style, style->borderImage()))
    13541354        return;
    13551355
     
    13601360    getBorderEdgeInfo(edges, includeLogicalLeftEdge, includeLogicalRightEdge);
    13611361
    1362     IntRect borderRect(tx, ty, w, h);
    1363     RoundedIntRect outerBorder = style->getRoundedBorderFor(borderRect, includeLogicalLeftEdge, includeLogicalRightEdge);
    1364     RoundedIntRect innerBorder = style->getRoundedInnerBorderFor(borderRect, includeLogicalLeftEdge, includeLogicalRightEdge);
     1362    RoundedIntRect outerBorder = style->getRoundedBorderFor(rect, includeLogicalLeftEdge, includeLogicalRightEdge);
     1363    RoundedIntRect innerBorder = style->getRoundedInnerBorderFor(rect, includeLogicalLeftEdge, includeLogicalRightEdge);
    13651364
    13661365    const AffineTransform& currentCTM = graphicsContext->getCTM();
     
    15881587}
    15891588#else
    1590 void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, int ty, int w, int h,
    1591                                        const RenderStyle* style, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
     1589void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, const IntRect& rect, const RenderStyle* style,
     1590                                       BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
    15921591{
    15931592    // FIXME: This old version of paintBorder should be removed when all ports implement
    15941593    // GraphicsContext::clipConvexPolygon()!! This should happen soon.
    1595     if (paintNinePieceImage(graphicsContext, IntRect(tx, ty, w, h), style, style->borderImage()))
     1594    if (paintNinePieceImage(graphicsContext, rect, style, style->borderImage()))
    15961595        return;
    15971596
     
    16181617
    16191618
    1620     RoundedIntRect border(tx, ty, w, h);
     1619    RoundedIntRect border(rect);
    16211620   
    16221621    GraphicsContextStateSaver stateSaver(*graphicsContext, false);
     
    16471646                && (rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET));
    16481647
    1649         int x = tx;
    1650         int x2 = tx + w;
     1648        int x = rect.x();
     1649        int x2 = rect.maxX();
    16511650        if (renderRadii) {
    16521651            x += border.radii().topLeft().width();
     
    16541653        }
    16551654
    1656         drawLineForBoxSide(graphicsContext, x, ty, x2, ty + style->borderTopWidth(), BSTop, topColor, topStyle,
     1655        drawLineForBoxSide(graphicsContext, x, rect.y(), x2, rect.y() + style->borderTopWidth(), BSTop, topColor, topStyle,
    16571656                   ignoreLeft ? 0 : style->borderLeftWidth(), ignoreRight ? 0 : style->borderRightWidth());
    16581657
    16591658        if (renderRadii) {
    1660             int leftY = ty;
     1659            int leftY = rect.y();
    16611660
    16621661            // We make the arc double thick and let the clip rect take care of clipping the extra off.
     
    16661665
    16671666            if (border.radii().topLeft().width()) {
    1668                 int leftX = tx;
     1667                int leftX = rect.x();
    16691668                // The inner clip clips inside the arc. This is especially important for 1px borders.
    16701669                bool applyLeftInnerClip = (style->borderLeftWidth() < border.radii().topLeft().width())
     
    16861685
    16871686            if (border.radii().topRight().width()) {
    1688                 int rightX = tx + w - border.radii().topRight().width() * 2;
     1687                int rightX = rect.maxX() - border.radii().topRight().width() * 2;
    16891688                bool applyRightInnerClip = (style->borderRightWidth() < border.radii().topRight().width())
    16901689                    && (style->borderTopWidth() < border.radii().topRight().height())
     
    17201719                && (rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET));
    17211720
    1722         int x = tx;
    1723         int x2 = tx + w;
     1721        int x = rect.x();
     1722        int x2 = rect.maxX();
    17241723        if (renderRadii) {
    17251724            x += border.radii().bottomLeft().width();
     
    17271726        }
    17281727
    1729         drawLineForBoxSide(graphicsContext, x, ty + h - style->borderBottomWidth(), x2, ty + h, BSBottom, bottomColor, bottomStyle,
     1728        drawLineForBoxSide(graphicsContext, x, rect.maxY() - style->borderBottomWidth(), x2, rect.maxY(), BSBottom, bottomColor, bottomStyle,
    17301729                   ignoreLeft ? 0 : style->borderLeftWidth(), ignoreRight ? 0 : style->borderRightWidth());
    17311730
     
    17341733
    17351734            if (border.radii().bottomLeft().width()) {
    1736                 int leftX = tx;
    1737                 int leftY = ty + h - border.radii().bottomLeft().height() * 2;
     1735                int leftX = rect.x();
     1736                int leftY = rect.maxY() - border.radii().bottomLeft().height() * 2;
    17381737                bool applyLeftInnerClip = (style->borderLeftWidth() < border.radii().bottomLeft().width())
    17391738                    && (style->borderBottomWidth() < border.radii().bottomLeft().height())
     
    17591758
    17601759            if (border.radii().bottomRight().width()) {
    1761                 int rightY = ty + h - border.radii().bottomRight().height() * 2;
    1762                 int rightX = tx + w - border.radii().bottomRight().width() * 2;
     1760                int rightY = rect.maxY() - border.radii().bottomRight().height() * 2;
     1761                int rightX = rect.maxX() - border.radii().bottomRight().width() * 2;
    17631762                bool applyRightInnerClip = (style->borderRightWidth() < border.radii().bottomRight().width())
    17641763                    && (style->borderBottomWidth() < border.radii().bottomRight().height())
     
    17891788                && (bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET));
    17901789
    1791         int y = ty;
    1792         int y2 = ty + h;
     1790        int y = rect.y();
     1791        int y2 = rect.maxY();
    17931792        if (renderRadii) {
    17941793            y += border.radii().topLeft().height();
     
    17961795        }
    17971796
    1798         drawLineForBoxSide(graphicsContext, tx, y, tx + style->borderLeftWidth(), y2, BSLeft, leftColor, leftStyle,
     1797        drawLineForBoxSide(graphicsContext, rect.x(), y, rect.x() + style->borderLeftWidth(), y2, BSLeft, leftColor, leftStyle,
    17991798                   ignoreTop ? 0 : style->borderTopWidth(), ignoreBottom ? 0 : style->borderBottomWidth());
    18001799
    18011800        if (renderRadii && (!upperLeftBorderStylesMatch || !lowerLeftBorderStylesMatch)) {
    1802             int topX = tx;
     1801            int topX = rect.x();
    18031802            thickness = style->borderLeftWidth() * 2;
    18041803
    18051804            if (!upperLeftBorderStylesMatch && border.radii().topLeft().width()) {
    1806                 int topY = ty;
     1805                int topY = rect.y();
    18071806                bool applyTopInnerClip = (style->borderLeftWidth() < border.radii().topLeft().width())
    18081807                    && (style->borderTopWidth() < border.radii().topLeft().height())
     
    18231822
    18241823            if (!lowerLeftBorderStylesMatch && border.radii().bottomLeft().width()) {
    1825                 int bottomY = ty + h - border.radii().bottomLeft().height() * 2;
     1824                int bottomY = rect.maxY() - border.radii().bottomLeft().height() * 2;
    18261825                bool applyBottomInnerClip = (style->borderLeftWidth() < border.radii().bottomLeft().width())
    18271826                    && (style->borderBottomWidth() < border.radii().bottomLeft().height())
     
    18541853                && (bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET));
    18551854
    1856         int y = ty;
    1857         int y2 = ty + h;
     1855        int y = rect.y();
     1856        int y2 = rect.maxY();
    18581857        if (renderRadii) {
    18591858            y += border.radii().topRight().height();
     
    18611860        }
    18621861
    1863         drawLineForBoxSide(graphicsContext, tx + w - style->borderRightWidth(), y, tx + w, y2, BSRight, rightColor, rightStyle,
     1862        drawLineForBoxSide(graphicsContext, rect.maxX() - style->borderRightWidth(), y, rect.maxX(), y2, BSRight, rightColor, rightStyle,
    18641863                   ignoreTop ? 0 : style->borderTopWidth(), ignoreBottom ? 0 : style->borderBottomWidth());
    18651864
     
    18681867
    18691868            if (!upperRightBorderStylesMatch && border.radii().topRight().width()) {
    1870                 int topX = tx + w - border.radii().topRight().width() * 2;
    1871                 int topY = ty;
     1869                int topX = rect.maxX() - border.radii().topRight().width() * 2;
     1870                int topY = rect.y();
    18721871                bool applyTopInnerClip = (style->borderRightWidth() < border.radii().topRight().width())
    18731872                    && (style->borderTopWidth() < border.radii().topRight().height())
     
    18881887
    18891888            if (!lowerRightBorderStylesMatch && border.radii().bottomRight().width()) {
    1890                 int bottomX = tx + w - border.radii().bottomRight().width() * 2;
    1891                 int bottomY = ty + h - border.radii().bottomRight().height() * 2;
     1889                int bottomX = rect.maxX() - border.radii().bottomRight().width() * 2;
     1890                int bottomY = rect.maxY() - border.radii().bottomRight().height() * 2;
    18921891                bool applyBottomInnerClip = (style->borderRightWidth() < border.radii().bottomRight().width())
    18931892                    && (style->borderBottomWidth() < border.radii().bottomRight().height())
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.h

    r86188 r86272  
    119119    virtual void childBecameNonInline(RenderObject* /*child*/) { }
    120120
    121     void paintBorder(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, BackgroundBleedAvoidance = BackgroundBleedNone, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
     121    void paintBorder(GraphicsContext*, const IntRect&, const RenderStyle*, BackgroundBleedAvoidance = BackgroundBleedNone, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
    122122    bool paintNinePieceImage(GraphicsContext*, const IntRect&, const RenderStyle*, const NinePieceImage&, CompositeOperator = CompositeSourceOver);
    123123    void paintBoxShadow(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
  • trunk/Source/WebCore/rendering/RenderFieldset.cpp

    r85256 r86272  
    168168    }
    169169
    170     paintBorder(paintInfo.context, tx, ty, w, h, style());
     170    paintBorder(paintInfo.context, IntRect(tx, ty, w, h), style());
    171171}
    172172
  • trunk/Source/WebCore/rendering/RenderTable.cpp

    r86197 r86272  
    571571
    572572    if (style()->hasBorder() && !collapseBorders())
    573         paintBorder(paintInfo.context, rect.x(), rect.y(), rect.width(), rect.height(), style());
     573        paintBorder(paintInfo.context, rect, style());
    574574}
    575575
  • trunk/Source/WebCore/rendering/RenderTableCell.cpp

    r84504 r86272  
    10211021        return;
    10221022
    1023     paintBorder(paintInfo.context, tx, ty, w, h, style());
     1023    paintBorder(paintInfo.context, IntRect(tx, ty, w, h), style());
    10241024}
    10251025
Note: See TracChangeset for help on using the changeset viewer.