Changeset 89970 in webkit


Ignore:
Timestamp:
Jun 28, 2011 3:41:36 PM (13 years ago)
Author:
leviw@chromium.org
Message:

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

Reviewed by Eric Seidel.

Switch paintFillLayer* to new layout types
https://bugs.webkit.org/show_bug.cgi?id=63570

Switching painFillLayer* to layout type abstraction from more integral types.

No new tests as this is just moving to an abstraction.

  • rendering/InlineFlowBox.cpp: (WebCore::InlineFlowBox::paintFillLayers): (WebCore::InlineFlowBox::paintFillLayer):
  • rendering/InlineFlowBox.h:
  • rendering/RenderBox.cpp: (WebCore::RenderBox::paintFillLayers): (WebCore::RenderBox::paintFillLayer):
  • rendering/RenderBox.h:
  • rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintFillLayerExtended):
  • rendering/RenderBoxModelObject.h:
  • rendering/RenderObject.h:
Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r89969 r89970  
     12011-06-28  Levi Weintraub  <leviw@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Switch paintFillLayer* to new layout types
     6        https://bugs.webkit.org/show_bug.cgi?id=63570
     7
     8        Switching painFillLayer* to layout type abstraction from more integral types.
     9
     10        No new tests as this is just moving to an abstraction.
     11
     12        * rendering/InlineFlowBox.cpp:
     13        (WebCore::InlineFlowBox::paintFillLayers):
     14        (WebCore::InlineFlowBox::paintFillLayer):
     15        * rendering/InlineFlowBox.h:
     16        * rendering/RenderBox.cpp:
     17        (WebCore::RenderBox::paintFillLayers):
     18        (WebCore::RenderBox::paintFillLayer):
     19        * rendering/RenderBox.h:
     20        * rendering/RenderBoxModelObject.cpp:
     21        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
     22        * rendering/RenderBoxModelObject.h:
     23        * rendering/RenderObject.h:
     24
    1252011-06-28  Luke Macpherson   <macpherson@chromium.org>
    226
  • trunk/Source/WebCore/rendering/InlineFlowBox.cpp

    r89704 r89970  
    10171017}
    10181018
    1019 void InlineFlowBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const IntRect& rect, CompositeOperator op)
     1019void InlineFlowBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const LayoutRect& rect, CompositeOperator op)
    10201020{
    10211021    if (!fillLayer)
     
    10251025}
    10261026
    1027 void InlineFlowBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const IntRect& rect, CompositeOperator op)
     1027void InlineFlowBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const LayoutRect& rect, CompositeOperator op)
    10281028{
    10291029    StyleImage* img = fillLayer->image();
     
    10381038        // as though you had one single line.  This means each line has to pick up the background where
    10391039        // the previous line left off.
    1040         int logicalOffsetOnLine = 0;
    1041         int totalLogicalWidth;
     1040        LayoutUnit logicalOffsetOnLine = 0;
     1041        LayoutUnit totalLogicalWidth;
    10421042        if (renderer()->style()->direction() == LTR) {
    10431043            for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLineBox())
     
    10531053                totalLogicalWidth += curr->logicalWidth();
    10541054        }
    1055         int stripX = rect.x() - (isHorizontal() ? logicalOffsetOnLine : 0);
    1056         int stripY = rect.y() - (isHorizontal() ? 0 : logicalOffsetOnLine);
    1057         int stripWidth = isHorizontal() ? totalLogicalWidth : width();
    1058         int stripHeight = isHorizontal() ? height() : totalLogicalWidth;
     1055        LayoutUnit stripX = rect.x() - (isHorizontal() ? logicalOffsetOnLine : 0);
     1056        LayoutUnit stripY = rect.y() - (isHorizontal() ? 0 : logicalOffsetOnLine);
     1057        LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : width();
     1058        LayoutUnit stripHeight = isHorizontal() ? height() : totalLogicalWidth;
    10591059
    10601060        GraphicsContextStateSaver stateSaver(*paintInfo.context);
    1061         paintInfo.context->clip(IntRect(rect.x(), rect.y(), width(), height()));
    1062         boxModelObject()->paintFillLayerExtended(paintInfo, c, fillLayer, IntRect(stripX, stripY, stripWidth, stripHeight), BackgroundBleedNone, this, rect.size(), op);
     1061        paintInfo.context->clip(LayoutRect(rect.x(), rect.y(), width(), height()));
     1062        boxModelObject()->paintFillLayerExtended(paintInfo, c, fillLayer, LayoutRect(stripX, stripY, stripWidth, stripHeight), BackgroundBleedNone, this, rect.size(), op);
    10631063    }
    10641064}
  • trunk/Source/WebCore/rendering/InlineFlowBox.h

    r89704 r89970  
    106106    virtual void paintBoxDecorations(PaintInfo&, const IntPoint&);
    107107    virtual void paintMask(PaintInfo&, const IntPoint&);
    108     void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, const IntRect&, CompositeOperator = CompositeSourceOver);
    109     void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, const IntRect&, CompositeOperator = CompositeSourceOver);
     108    void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, CompositeOperator = CompositeSourceOver);
     109    void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, CompositeOperator = CompositeSourceOver);
    110110    void paintBoxShadow(GraphicsContext*, RenderStyle*, ShadowStyle, const IntRect&);
    111111    virtual void paint(PaintInfo&, const IntPoint&, int lineTop, int lineBottom);
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r89754 r89970  
    978978}
    979979
    980 void RenderBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const IntRect& rect,
     980void RenderBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const LayoutRect& rect,
    981981    BackgroundBleedAvoidance bleedAvoidance, CompositeOperator op, RenderObject* backgroundObject)
    982982{
     
    988988}
    989989
    990 void RenderBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const IntRect& rect,
     990void RenderBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const LayoutRect& rect,
    991991    BackgroundBleedAvoidance bleedAvoidance, CompositeOperator op, RenderObject* backgroundObject)
    992992{
  • trunk/Source/WebCore/rendering/RenderBox.h

    r89754 r89970  
    418418    virtual void updateBoxModelInfoFromStyle();
    419419
    420     void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, const IntRect&, BackgroundBleedAvoidance, CompositeOperator, RenderObject* backgroundObject);
    421     void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, const IntRect&, BackgroundBleedAvoidance = BackgroundBleedNone, CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0);
     420    void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance, CompositeOperator, RenderObject* backgroundObject);
     421    void paintFillLayers(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance = BackgroundBleedNone, CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0);
    422422
    423423    void paintMaskImages(const PaintInfo&, const IntRect&);
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r89475 r89970  
    590590}
    591591
    592 void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, const Color& color, const FillLayer* bgLayer, const IntRect& rect,
    593     BackgroundBleedAvoidance bleedAvoidance, InlineFlowBox* box, const IntSize& boxSize, CompositeOperator op, RenderObject* backgroundObject)
     592void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, const Color& color, const FillLayer* bgLayer, const LayoutRect& rect,
     593    BackgroundBleedAvoidance bleedAvoidance, InlineFlowBox* box, const LayoutSize& boxSize, CompositeOperator op, RenderObject* backgroundObject)
    594594{
    595595    GraphicsContext* context = paintInfo.context;
     
    647647    }
    648648   
    649     int bLeft = includeLeftEdge ? borderLeft() : 0;
    650     int bRight = includeRightEdge ? borderRight() : 0;
    651     int pLeft = includeLeftEdge ? paddingLeft() : 0;
    652     int pRight = includeRightEdge ? paddingRight() : 0;
     649    LayoutUnit bLeft = includeLeftEdge ? borderLeft() : 0;
     650    LayoutUnit bRight = includeRightEdge ? borderRight() : 0;
     651    LayoutUnit pLeft = includeLeftEdge ? paddingLeft() : 0;
     652    LayoutUnit pRight = includeRightEdge ? paddingRight() : 0;
    653653
    654654    GraphicsContextStateSaver clipWithScrollingStateSaver(*context, clippedWithLocalScrolling);
    655     IntRect scrolledPaintRect = rect;
     655    LayoutRect scrolledPaintRect = rect;
    656656    if (clippedWithLocalScrolling) {
    657657        // Clip to the overflow area.
     
    659659       
    660660        // Adjust the paint rect to reflect a scrolled content box with borders at the ends.
    661         IntSize offset = layer()->scrolledContentOffset();
     661        LayoutSize offset = layer()->scrolledContentOffset();
    662662        scrolledPaintRect.move(-offset);
    663663        scrolledPaintRect.setWidth(bLeft + layer()->scrollWidth() + bRight);
     
    669669        // Clip to the padding or content boxes as necessary.
    670670        bool includePadding = bgLayer->clip() == ContentFillBox;
    671         IntRect clipRect = IntRect(scrolledPaintRect.x() + bLeft + (includePadding ? pLeft : 0),
     671        LayoutRect clipRect = LayoutRect(scrolledPaintRect.x() + bLeft + (includePadding ? pLeft : 0),
    672672                                   scrolledPaintRect.y() + borderTop() + (includePadding ? paddingTop() : 0),
    673673                                   scrolledPaintRect.width() - bLeft - bRight - (includePadding ? pLeft + pRight : 0),
     
    679679        // First figure out how big the mask has to be.  It should be no bigger than what we need
    680680        // to actually render, so we should intersect the dirty rect with the border box of the background.
    681         IntRect maskRect = rect;
     681        LayoutRect maskRect = rect;
    682682        maskRect.intersect(paintInfo.rect);
    683683       
     
    695695        if (box) {
    696696            RootInlineBox* root = box->root();
    697             box->paint(info, IntPoint(scrolledPaintRect.x() - box->x(), scrolledPaintRect.y() - box->y()), root->lineTop(), root->lineBottom());
     697            box->paint(info, LayoutPoint(scrolledPaintRect.x() - box->x(), scrolledPaintRect.y() - box->y()), root->lineTop(), root->lineBottom());
    698698        } else {
    699             IntSize localOffset = isBox() ? toRenderBox(this)->locationOffset() : IntSize();
     699            LayoutSize localOffset = isBox() ? toRenderBox(this)->locationOffset() : LayoutSize();
    700700            paint(info, scrolledPaintRect.location() - localOffset);
    701701        }
     
    739739    // Paint the color first underneath all images.
    740740    if (!bgLayer->next()) {
    741         IntRect backgroundRect(scrolledPaintRect);
     741        LayoutRect backgroundRect(scrolledPaintRect);
    742742        backgroundRect.intersect(paintInfo.rect);
    743743        // If we have an alpha and we are painting the root element, go ahead and blend with the base background color.
     
    764764    // no progressive loading of the background image
    765765    if (shouldPaintBackgroundImage) {
    766         IntRect destRect;
    767         IntPoint phase;
    768         IntSize tileSize;
     766        LayoutRect destRect;
     767        LayoutPoint phase;
     768        LayoutSize tileSize;
    769769
    770770        calculateBackgroundImageGeometry(bgLayer, scrolledPaintRect, destRect, phase, tileSize);
    771         IntPoint destOrigin = destRect.location();
     771        LayoutPoint destOrigin = destRect.location();
    772772        destRect.intersect(paintInfo.rect);
    773773        if (!destRect.isEmpty()) {
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.h

    r86384 r89970  
    122122    bool paintNinePieceImage(GraphicsContext*, const IntRect&, const RenderStyle*, const NinePieceImage&, CompositeOperator = CompositeSourceOver);
    123123    void paintBoxShadow(GraphicsContext*, const IntRect&, const RenderStyle*, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
    124     void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer*, const IntRect&, BackgroundBleedAvoidance, InlineFlowBox* = 0, const IntSize& = IntSize(), CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0);
     124    void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox* = 0, const LayoutSize& = LayoutSize(), CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0);
    125125   
    126126    // Overridden by subclasses to determine line height and baseline position.
  • trunk/Source/WebCore/rendering/RenderObject.h

    r89754 r89970  
    3131#include "Element.h"
    3232#include "FloatQuad.h"
     33#include "LayoutTypes.h"
    3334#include "PaintPhase.h"
    3435#include "RenderObjectChildList.h"
Note: See TracChangeset for help on using the changeset viewer.