Changeset 93435 in webkit


Ignore:
Timestamp:
Aug 19, 2011 1:40:57 PM (13 years ago)
Author:
eae@chromium.org
Message:

Switch RenderBoxModelObject to to new layout types
https://bugs.webkit.org/show_bug.cgi?id=66534

Reviewed by Eric Seidel.

Convert RenderBoxModelObject to new layout abstraction.

No new tests as no new functionality.

  • rendering/RenderBoxModelObject.cpp:

(WebCore::ImageQualityController::set):
(WebCore::ImageQualityController::shouldPaintAtLowQuality):
(WebCore::RenderBoxModelObject::shouldPaintAtLowQuality):
(WebCore::backgroundRectAdjustedForBleedAvoidance):
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
(WebCore::RenderBoxModelObject::calculateFillTileSize):
(WebCore::RenderBoxModelObject::BackgroundImageGeometry::useFixedAttachment):
(WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
(WebCore::RenderBoxModelObject::paintNinePieceImage):
(WebCore::borderWillArcInnerEdge):
(WebCore::RenderBoxModelObject::paintOneBorderSide):
(WebCore::RenderBoxModelObject::paintBorderSides):
(WebCore::RenderBoxModelObject::paintBorder):
(WebCore::RenderBoxModelObject::drawBoxSideFromPath):
(WebCore::RenderBoxModelObject::clipBorderSidePolygon):
(WebCore::areaCastingShadowInHole):
(WebCore::RenderBoxModelObject::paintBoxShadow):
(WebCore::RenderBoxModelObject::containingBlockLogicalWidthForContent):

  • rendering/RenderBoxModelObject.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r93432 r93435  
     12011-08-19  Emil A Eklund  <eae@chromium.org>
     2
     3        Switch RenderBoxModelObject to to new layout types
     4        https://bugs.webkit.org/show_bug.cgi?id=66534
     5
     6        Reviewed by Eric Seidel.
     7
     8        Convert RenderBoxModelObject to new layout abstraction.
     9
     10        No new tests as no new functionality.
     11
     12        * rendering/RenderBoxModelObject.cpp:
     13        (WebCore::ImageQualityController::set):
     14        (WebCore::ImageQualityController::shouldPaintAtLowQuality):
     15        (WebCore::RenderBoxModelObject::shouldPaintAtLowQuality):
     16        (WebCore::backgroundRectAdjustedForBleedAvoidance):
     17        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
     18        (WebCore::RenderBoxModelObject::calculateFillTileSize):
     19        (WebCore::RenderBoxModelObject::BackgroundImageGeometry::useFixedAttachment):
     20        (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
     21        (WebCore::RenderBoxModelObject::paintNinePieceImage):
     22        (WebCore::borderWillArcInnerEdge):
     23        (WebCore::RenderBoxModelObject::paintOneBorderSide):
     24        (WebCore::RenderBoxModelObject::paintBorderSides):
     25        (WebCore::RenderBoxModelObject::paintBorder):
     26        (WebCore::RenderBoxModelObject::drawBoxSideFromPath):
     27        (WebCore::RenderBoxModelObject::clipBorderSidePolygon):
     28        (WebCore::areaCastingShadowInHole):
     29        (WebCore::RenderBoxModelObject::paintBoxShadow):
     30        (WebCore::RenderBoxModelObject::containingBlockLogicalWidthForContent):
     31        * rendering/RenderBoxModelObject.h:
     32
    1332011-08-19  Mihnea Ovidenie  <mihnea@adobe.com>
    234
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r92529 r93435  
    5252static const double cLowQualityTimeThreshold = 0.500; // 500 ms
    5353
    54 typedef HashMap<const void*, IntSize> LayerSizeMap;
     54typedef HashMap<const void*, LayoutSize> LayerSizeMap;
    5555typedef HashMap<RenderBoxModelObject*, LayerSizeMap> ObjectLayerSizeMap;
    5656
     
    6969public:
    7070    ImageQualityController();
    71     bool shouldPaintAtLowQuality(GraphicsContext*, RenderBoxModelObject*, Image*, const void* layer, const IntSize&);
     71    bool shouldPaintAtLowQuality(GraphicsContext*, RenderBoxModelObject*, Image*, const void* layer, const LayoutSize&);
    7272    void removeLayer(RenderBoxModelObject*, LayerSizeMap* innerMap, const void* layer);
    73     void set(RenderBoxModelObject*, LayerSizeMap* innerMap, const void* layer, const IntSize&);
     73    void set(RenderBoxModelObject*, LayerSizeMap* innerMap, const void* layer, const LayoutSize&);
    7474    void objectDestroyed(RenderBoxModelObject*);
    7575    bool isEmpty() { return m_objectLayerSizeMap.isEmpty(); }
     
    9999}
    100100   
    101 void ImageQualityController::set(RenderBoxModelObject* object, LayerSizeMap* innerMap, const void* layer, const IntSize& size)
     101void ImageQualityController::set(RenderBoxModelObject* object, LayerSizeMap* innerMap, const void* layer, const LayoutSize& size)
    102102{
    103103    if (innerMap)
     
    133133}
    134134
    135 bool ImageQualityController::shouldPaintAtLowQuality(GraphicsContext* context, RenderBoxModelObject* object, Image* image, const void *layer, const IntSize& size)
     135bool ImageQualityController::shouldPaintAtLowQuality(GraphicsContext* context, RenderBoxModelObject* object, Image* image, const void *layer, const LayoutSize& size)
    136136{
    137137    // If the image is not a bitmap image, then none of this is relevant and we just paint at high
     
    150150    ObjectLayerSizeMap::iterator i = m_objectLayerSizeMap.find(object);
    151151    LayerSizeMap* innerMap = i != m_objectLayerSizeMap.end() ? &i->second : 0;
    152     IntSize oldSize;
     152    LayoutSize oldSize;
    153153    bool isFirstResize = true;
    154154    if (innerMap) {
     
    162162    const AffineTransform& currentTransform = context->getCTM();
    163163    bool contextIsScaled = !currentTransform.isIdentityOrTranslationOrFlipped();
    164     if (!contextIsScaled && imageSize == size) {
     164    // FIXME: Change to use roughlyEquals when we move to float.
     165    // See https://bugs.webkit.org/show_bug.cgi?id=66148
     166    if (!contextIsScaled && size == imageSize) {
    165167        // There is no scale in effect. If we had a scale in effect before, we can just remove this object from the list.
    166168        removeLayer(object, innerMap, layer);
     
    184186    // same as the last resize, draw at high res, but record the paint
    185187    // size and set the timer.
     188    // FIXME: Change to use roughlyEquals when we move to float.
     189    // See https://bugs.webkit.org/show_bug.cgi?id=66148
    186190    if (isFirstResize || oldSize == size) {
    187191        restartTimer();
     
    236240}
    237241
    238 bool RenderBoxModelObject::shouldPaintAtLowQuality(GraphicsContext* context, Image* image, const void* layer, const IntSize& size)
     242bool RenderBoxModelObject::shouldPaintAtLowQuality(GraphicsContext* context, Image* image, const void* layer, const LayoutSize& size)
    239243{
    240244    return imageQualityController()->shouldPaintAtLowQuality(context, this, image, layer, size);
     
    576580}
    577581
    578 static IntRect backgroundRectAdjustedForBleedAvoidance(GraphicsContext* context, const IntRect& borderRect, BackgroundBleedAvoidance bleedAvoidance)
     582static LayoutRect backgroundRectAdjustedForBleedAvoidance(GraphicsContext* context, const LayoutRect& borderRect, BackgroundBleedAvoidance bleedAvoidance)
    579583{
    580584    if (bleedAvoidance != BackgroundBleedShrinkBackground)
    581585        return borderRect;
    582586
    583     IntRect adjustedRect = borderRect;
     587    LayoutRect adjustedRect = borderRect;
    584588    // We need to shrink the border by one device pixel on each side.
    585589    AffineTransform ctm = context->getCTM();
     
    778782}
    779783
    780 IntSize RenderBoxModelObject::calculateFillTileSize(const FillLayer* fillLayer, IntSize positioningAreaSize) const
     784LayoutSize RenderBoxModelObject::calculateFillTileSize(const FillLayer* fillLayer, LayoutSize positioningAreaSize) const
    781785{
    782786    StyleImage* image = fillLayer->image();
     
    787791    switch (type) {
    788792        case SizeLength: {
    789             int w = positioningAreaSize.width();
    790             int h = positioningAreaSize.height();
     793            LayoutUnit w = positioningAreaSize.width();
     794            LayoutUnit h = positioningAreaSize.height();
    791795
    792796            Length layerWidth = fillLayer->size().size.width();
     
    806810            // scale to maintain our aspect ratio.
    807811            if (layerWidth.isAuto() && !layerHeight.isAuto()) {
    808                 IntSize imageIntrinsicSize = image->imageSize(this, style()->effectiveZoom());
     812                LayoutSize imageIntrinsicSize = image->imageSize(this, style()->effectiveZoom());
    809813                if (imageIntrinsicSize.height())
    810814                    w = imageIntrinsicSize.width() * h / imageIntrinsicSize.height();       
    811815            } else if (!layerWidth.isAuto() && layerHeight.isAuto()) {
    812                 IntSize imageIntrinsicSize = image->imageSize(this, style()->effectiveZoom());
     816                LayoutSize imageIntrinsicSize = image->imageSize(this, style()->effectiveZoom());
    813817                if (imageIntrinsicSize.width())
    814818                    h = imageIntrinsicSize.height() * w / imageIntrinsicSize.width();
    815819            } else if (layerWidth.isAuto() && layerHeight.isAuto()) {
    816820                // If both width and height are auto, use the image's intrinsic size.
    817                 IntSize imageIntrinsicSize = image->imageSize(this, style()->effectiveZoom());
     821                LayoutSize imageIntrinsicSize = image->imageSize(this, style()->effectiveZoom());
    818822                w = imageIntrinsicSize.width();
    819823                h = imageIntrinsicSize.height();
    820824            }
    821825           
    822             return IntSize(max(1, w), max(1, h));
     826            return LayoutSize(max<LayoutUnit>(1, w), max<LayoutUnit>(1, h));
    823827        }
    824828        case Contain:
    825829        case Cover: {
    826             IntSize imageIntrinsicSize = image->imageSize(this, 1);
     830            LayoutSize imageIntrinsicSize = image->imageSize(this, 1);
    827831            float horizontalScaleFactor = imageIntrinsicSize.width()
    828832                ? static_cast<float>(positioningAreaSize.width()) / imageIntrinsicSize.width() : 1;
     
    830834                ? static_cast<float>(positioningAreaSize.height()) / imageIntrinsicSize.height() : 1;
    831835            float scaleFactor = type == Contain ? min(horizontalScaleFactor, verticalScaleFactor) : max(horizontalScaleFactor, verticalScaleFactor);
    832             return IntSize(max<int>(1, imageIntrinsicSize.width() * scaleFactor), max<int>(1, imageIntrinsicSize.height() * scaleFactor));
     836            return LayoutSize(max<LayoutUnit>(1, imageIntrinsicSize.width() * scaleFactor), max<LayoutUnit>(1, imageIntrinsicSize.height() * scaleFactor));
    833837        }
    834838        case SizeNone:
     
    854858void RenderBoxModelObject::BackgroundImageGeometry::useFixedAttachment(const LayoutPoint& attachmentPoint)
    855859{
    856     m_phase.move(max(attachmentPoint.x() - m_destRect.x(), 0), max(attachmentPoint.y() - m_destRect.y(), 0));
     860    m_phase.move(max<LayoutUnit>(attachmentPoint.x() - m_destRect.x(), 0), max<LayoutUnit>(attachmentPoint.y() - m_destRect.y(), 0));
    857861}
    858862
     
    869873}
    870874
    871 void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fillLayer, const IntRect& paintRect,
     875void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fillLayer, const LayoutRect& paintRect,
    872876                                                            BackgroundImageGeometry& geometry)
    873877{
    874     int left = 0;
    875     int top = 0;
    876     IntSize positioningAreaSize;
     878    LayoutUnit left = 0;
     879    LayoutUnit top = 0;
     880    LayoutSize positioningAreaSize;
    877881
    878882    // Determine the background positioning area and set destRect to the background painting area.
     
    893897        geometry.setDestRect(paintRect);
    894898
    895         int right = 0;
    896         int bottom = 0;
     899        LayoutUnit right = 0;
     900        LayoutUnit bottom = 0;
    897901        // Scroll and Local.
    898902        if (fillLayer->origin() != BorderFillBox) {
     
    913917        // the background positioning area.
    914918        if (isRoot()) {
    915             positioningAreaSize = IntSize(toRenderBox(this)->width() - left - right, toRenderBox(this)->height() - top - bottom);
     919            positioningAreaSize = LayoutSize(toRenderBox(this)->width() - left - right, toRenderBox(this)->height() - top - bottom);
    916920            left += marginLeft();
    917921            top += marginTop();
    918922        } else
    919             positioningAreaSize = IntSize(paintRect.width() - left - right, paintRect.height() - top - bottom);
     923            positioningAreaSize = LayoutSize(paintRect.width() - left - right, paintRect.height() - top - bottom);
    920924    } else {
    921925        geometry.setDestRect(viewRect());
     
    928932    EFillRepeat backgroundRepeatY = fillLayer->repeatY();
    929933
    930     int xPosition = fillLayer->xPosition().calcMinValue(positioningAreaSize.width() - geometry.tileSize().width(), true);
     934    LayoutUnit xPosition = fillLayer->xPosition().calcMinValue(positioningAreaSize.width() - geometry.tileSize().width(), true);
    931935    if (backgroundRepeatX == RepeatFill)
    932         geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().width() - (xPosition + left) % geometry.tileSize().width() : 0);
     936        geometry.setPhaseX(geometry.tileSize().width() ? layoutMod(geometry.tileSize().width() - (xPosition + left), geometry.tileSize().width()) : 0);
    933937    else
    934938        geometry.setNoRepeatX(xPosition + left);
    935939
    936     int yPosition = fillLayer->yPosition().calcMinValue(positioningAreaSize.height() - geometry.tileSize().height(), true);
     940    LayoutUnit yPosition = fillLayer->yPosition().calcMinValue(positioningAreaSize.height() - geometry.tileSize().height(), true);
    937941    if (backgroundRepeatY == RepeatFill)
    938         geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().height() - (yPosition + top) % geometry.tileSize().height() : 0);
     942        geometry.setPhaseY(geometry.tileSize().height() ? layoutMod(geometry.tileSize().height() - (yPosition + top), geometry.tileSize().height()) : 0);
    939943    else
    940944        geometry.setNoRepeatY(yPosition + top);
     
    947951}
    948952
    949 bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext, const IntRect& rect, const RenderStyle* style,
     953bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext, const LayoutRect& rect, const RenderStyle* style,
    950954                                               const NinePieceImage& ninePieceImage, CompositeOperator op)
    951955{
     
    963967    // doesn't have any understanding of the zoom that is in effect on the tile.
    964968    styleImage->setImageContainerSize(rect.size());
    965     IntSize imageSize = styleImage->imageSize(this, 1.0f);
    966     int imageWidth = imageSize.width();
    967     int imageHeight = imageSize.height();
    968 
    969     int topSlice = min(imageHeight, ninePieceImage.slices().top().calcValue(imageHeight));
    970     int bottomSlice = min(imageHeight, ninePieceImage.slices().bottom().calcValue(imageHeight));
    971     int leftSlice = min(imageWidth, ninePieceImage.slices().left().calcValue(imageWidth));
    972     int rightSlice = min(imageWidth, ninePieceImage.slices().right().calcValue(imageWidth));
     969    LayoutSize imageSize = styleImage->imageSize(this, 1.0f);
     970    LayoutUnit imageWidth = imageSize.width();
     971    LayoutUnit imageHeight = imageSize.height();
     972
     973    LayoutUnit topSlice = min<LayoutUnit>(imageHeight, ninePieceImage.slices().top().calcValue(imageHeight));
     974    LayoutUnit bottomSlice = min<LayoutUnit>(imageHeight, ninePieceImage.slices().bottom().calcValue(imageHeight));
     975    LayoutUnit leftSlice = min<LayoutUnit>(imageWidth, ninePieceImage.slices().left().calcValue(imageWidth));
     976    LayoutUnit rightSlice = min<LayoutUnit>(imageWidth, ninePieceImage.slices().right().calcValue(imageWidth));
    973977
    974978    ENinePieceImageRule hRule = ninePieceImage.horizontalRule();
     
    977981    bool fitToBorder = style->borderImage() == ninePieceImage;
    978982   
    979     int leftWidth = fitToBorder ? style->borderLeftWidth() : leftSlice;
    980     int topWidth = fitToBorder ? style->borderTopWidth() : topSlice;
    981     int rightWidth = fitToBorder ? style->borderRightWidth() : rightSlice;
    982     int bottomWidth = fitToBorder ? style->borderBottomWidth() : bottomSlice;
     983    LayoutUnit leftWidth = fitToBorder ? style->borderLeftWidth() : leftSlice;
     984    LayoutUnit topWidth = fitToBorder ? style->borderTopWidth() : topSlice;
     985    LayoutUnit rightWidth = fitToBorder ? style->borderRightWidth() : rightSlice;
     986    LayoutUnit bottomWidth = fitToBorder ? style->borderBottomWidth() : bottomSlice;
    983987
    984988    bool drawLeft = leftSlice > 0 && leftWidth > 0;
     
    9981002        // The rect to use from within the image is obtained from our slice, and is (0, 0, leftSlice, topSlice)
    9991003        if (drawTop)
    1000             graphicsContext->drawImage(image.get(), colorSpace, IntRect(rect.location(), IntSize(leftWidth, topWidth)),
    1001                                        IntRect(0, 0, leftSlice, topSlice), op);
     1004            graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(rect.location(), LayoutSize(leftWidth, topWidth)),
     1005                                       LayoutRect(0, 0, leftSlice, topSlice), op);
    10021006
    10031007        // The bottom left corner rect is (tx, ty + h - bottomWidth, leftWidth, bottomWidth)
    10041008        // The rect to use from within the image is (0, imageHeight - bottomSlice, leftSlice, botomSlice)
    10051009        if (drawBottom)
    1006             graphicsContext->drawImage(image.get(), colorSpace, IntRect(rect.x(), rect.y() + rect.height() - bottomWidth, leftWidth, bottomWidth),
    1007                                        IntRect(0, imageHeight - bottomSlice, leftSlice, bottomSlice), op);
     1010            graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(rect.x(), rect.y() + rect.height() - bottomWidth, leftWidth, bottomWidth),
     1011                                       LayoutRect(0, imageHeight - bottomSlice, leftSlice, bottomSlice), op);
    10081012
    10091013        // Paint the left edge.
    10101014        // Have to scale and tile into the border rect.
    1011         graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect(rect.x(), rect.y() + topWidth, leftWidth,
     1015        graphicsContext->drawTiledImage(image.get(), colorSpace, LayoutRect(rect.x(), rect.y() + topWidth, leftWidth,
    10121016                                        rect.height() - topWidth - bottomWidth),
    1013                                         IntRect(0, topSlice, leftSlice, imageHeight - topSlice - bottomSlice),
     1017                                        LayoutRect(0, topSlice, leftSlice, imageHeight - topSlice - bottomSlice),
    10141018                                        Image::StretchTile, (Image::TileRule)vRule, op);
    10151019    }
     
    10201024        // The rect to use from within the image is obtained from our slice, and is (imageWidth - rightSlice, 0, rightSlice, topSlice)
    10211025        if (drawTop)
    1022             graphicsContext->drawImage(image.get(), colorSpace, IntRect(rect.x() + rect.width() - rightWidth, rect.y(), rightWidth, topWidth),
    1023                                        IntRect(imageWidth - rightSlice, 0, rightSlice, topSlice), op);
     1026            graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(rect.x() + rect.width() - rightWidth, rect.y(), rightWidth, topWidth),
     1027                                       LayoutRect(imageWidth - rightSlice, 0, rightSlice, topSlice), op);
    10241028
    10251029        // The bottom right corner rect is (tx + w - rightWidth, ty + h - bottomWidth, rightWidth, bottomWidth)
    10261030        // The rect to use from within the image is (imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice)
    10271031        if (drawBottom)
    1028             graphicsContext->drawImage(image.get(), colorSpace, IntRect(rect.x() + rect.width() - rightWidth, rect.y() + rect.height() - bottomWidth, rightWidth, bottomWidth),
    1029                                        IntRect(imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice), op);
     1032            graphicsContext->drawImage(image.get(), colorSpace, LayoutRect(rect.x() + rect.width() - rightWidth, rect.y() + rect.height() - bottomWidth, rightWidth, bottomWidth),
     1033                                       LayoutRect(imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice), op);
    10301034
    10311035        // Paint the right edge.
    1032         graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect(rect.x() + rect.width() - rightWidth, rect.y() + topWidth, rightWidth,
     1036        graphicsContext->drawTiledImage(image.get(), colorSpace, LayoutRect(rect.x() + rect.width() - rightWidth, rect.y() + topWidth, rightWidth,
    10331037                                        rect.height() - topWidth - bottomWidth),
    1034                                         IntRect(imageWidth - rightSlice, topSlice, rightSlice, imageHeight - topSlice - bottomSlice),
     1038                                        LayoutRect(imageWidth - rightSlice, topSlice, rightSlice, imageHeight - topSlice - bottomSlice),
    10351039                                        Image::StretchTile, (Image::TileRule)vRule, op);
    10361040    }
     
    10381042    // Paint the top edge.
    10391043    if (drawTop)
    1040         graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect(rect.x() + leftWidth, rect.y(), rect.width() - leftWidth - rightWidth, topWidth),
    1041                                         IntRect(leftSlice, 0, imageWidth - rightSlice - leftSlice, topSlice),
     1044        graphicsContext->drawTiledImage(image.get(), colorSpace, LayoutRect(rect.x() + leftWidth, rect.y(), rect.width() - leftWidth - rightWidth, topWidth),
     1045                                        LayoutRect(leftSlice, 0, imageWidth - rightSlice - leftSlice, topSlice),
    10421046                                        (Image::TileRule)hRule, Image::StretchTile, op);
    10431047
    10441048    // Paint the bottom edge.
    10451049    if (drawBottom)
    1046         graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect(rect.x() + leftWidth, rect.y() + rect.height() - bottomWidth,
     1050        graphicsContext->drawTiledImage(image.get(), colorSpace, LayoutRect(rect.x() + leftWidth, rect.y() + rect.height() - bottomWidth,
    10471051                                        rect.width() - leftWidth - rightWidth, bottomWidth),
    1048                                         IntRect(leftSlice, imageHeight - bottomSlice, imageWidth - rightSlice - leftSlice, bottomSlice),
     1052                                        LayoutRect(leftSlice, imageHeight - bottomSlice, imageWidth - rightSlice - leftSlice, bottomSlice),
    10491053                                        (Image::TileRule)hRule, Image::StretchTile, op);
    10501054
    10511055    // Paint the middle.
    10521056    if (drawMiddle)
    1053         graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect(rect.x() + leftWidth, rect.y() + topWidth, rect.width() - leftWidth - rightWidth,
     1057        graphicsContext->drawTiledImage(image.get(), colorSpace, LayoutRect(rect.x() + leftWidth, rect.y() + topWidth, rect.width() - leftWidth - rightWidth,
    10541058                                        rect.height() - topWidth - bottomWidth),
    1055                                         IntRect(leftSlice, topSlice, imageWidth - rightSlice - leftSlice, imageHeight - topSlice - bottomSlice),
     1059                                        LayoutRect(leftSlice, topSlice, imageWidth - rightSlice - leftSlice, imageHeight - topSlice - bottomSlice),
    10561060                                        (Image::TileRule)hRule, (Image::TileRule)vRule, op);
    10571061
     
    11621166
    11631167#if HAVE(PATH_BASED_BORDER_RADIUS_DRAWING)
    1164 static bool borderWillArcInnerEdge(const IntSize& firstRadius, const IntSize& secondRadius)
     1168static bool borderWillArcInnerEdge(const LayoutSize& firstRadius, const FloatSize& secondRadius)
    11651169{
    11661170    return !firstRadius.isZero() || !secondRadius.isZero();
     
    12931297
    12941298void RenderBoxModelObject::paintOneBorderSide(GraphicsContext* graphicsContext, const RenderStyle* style, const RoundedRect& outerBorder, const RoundedRect& innerBorder,
    1295     const IntRect& sideRect, BoxSide side, BoxSide adjacentSide1, BoxSide adjacentSide2, const BorderEdge edges[], const Path* path,
     1299    const LayoutRect& sideRect, BoxSide side, BoxSide adjacentSide1, BoxSide adjacentSide2, const BorderEdge edges[], const Path* path,
    12961300    BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, const Color* overrideColor)
    12971301{
     
    13581362   
    13591363    if (edges[BSTop].shouldRender() && includesEdge(edgeSet, BSTop)) {
    1360         LayoutRect sideRect = calculateSideRect(outerBorder, edges, BSTop);
     1364        LayoutRect sideRect = outerBorder.rect();
     1365        sideRect.setHeight(edges[BSTop].width);
    13611366
    13621367        bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSTop].style) || borderWillArcInnerEdge(innerBorder.radii().topLeft(), innerBorder.radii().topRight()));
     
    13651370
    13661371    if (edges[BSBottom].shouldRender() && includesEdge(edgeSet, BSBottom)) {
    1367         LayoutRect sideRect = calculateSideRect(outerBorder, edges, BSBottom);
     1372        LayoutRect sideRect = outerBorder.rect();
     1373        sideRect.shiftYEdgeTo(sideRect.maxY() - edges[BSBottom].width);
    13681374
    13691375        bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSBottom].style) || borderWillArcInnerEdge(innerBorder.radii().bottomLeft(), innerBorder.radii().bottomRight()));
     
    13721378
    13731379    if (edges[BSLeft].shouldRender() && includesEdge(edgeSet, BSLeft)) {
    1374         LayoutRect sideRect = calculateSideRect(outerBorder, edges, BSLeft);
     1380        LayoutRect sideRect = outerBorder.rect();
     1381        sideRect.setWidth(edges[BSLeft].width);
    13751382
    13761383        bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSLeft].style) || borderWillArcInnerEdge(innerBorder.radii().bottomLeft(), innerBorder.radii().topLeft()));
     
    13791386
    13801387    if (edges[BSRight].shouldRender() && includesEdge(edgeSet, BSRight)) {
    1381         LayoutRect sideRect = calculateSideRect(outerBorder, edges, BSRight);
     1388        LayoutRect sideRect = outerBorder.rect();
     1389        sideRect.shiftXEdgeTo(sideRect.maxX() - edges[BSRight].width);
    13821390
    13831391        bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSRight].style) || borderWillArcInnerEdge(innerBorder.radii().bottomRight(), innerBorder.radii().topRight()));
     
    14261434}
    14271435
    1428 void RenderBoxModelObject::paintBorder(const PaintInfo& info, const IntRect& rect, const RenderStyle* style,
     1436void RenderBoxModelObject::paintBorder(const PaintInfo& info, const LayoutRect& rect, const RenderStyle* style,
    14291437                                       BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
    14301438{
     
    15381546}
    15391547
    1540 void RenderBoxModelObject::drawBoxSideFromPath(GraphicsContext* graphicsContext, const IntRect& borderRect, const Path& borderPath, const BorderEdge edges[],
     1548void RenderBoxModelObject::drawBoxSideFromPath(GraphicsContext* graphicsContext, const LayoutRect& borderRect, const Path& borderPath, const BorderEdge edges[],
    15411549                                    float thickness, float drawThickness, BoxSide side, const RenderStyle* style,
    15421550                                    Color color, EBorderStyle borderStyle, BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
     
    16251633        {
    16261634            GraphicsContextStateSaver stateSaver(*graphicsContext);
    1627             IntRect outerRect = borderRect;
     1635            LayoutRect outerRect = borderRect;
    16281636            if (bleedAvoidance == BackgroundBleedUseTransparencyLayer) {
    16291637                outerRect.inflate(1);
     
    20302038    FloatPoint quad[4];
    20312039
    2032     const IntRect& outerRect = outerBorder.rect();
    2033     const IntRect& innerRect = innerBorder.rect();
     2040    const LayoutRect& outerRect = outerBorder.rect();
     2041    const LayoutRect& innerRect = innerBorder.rect();
    20342042
    20352043    FloatPoint centerPoint(innerRect.location().x() + static_cast<float>(innerRect.width()) / 2, innerRect.location().y() + static_cast<float>(innerRect.height()) / 2);
     
    21962204}
    21972205
    2198 static inline IntRect areaCastingShadowInHole(const IntRect& holeRect, int shadowBlur, int shadowSpread, const IntSize& shadowOffset)
    2199 {
    2200     IntRect bounds(holeRect);
     2206static inline LayoutRect areaCastingShadowInHole(const LayoutRect& holeRect, int shadowBlur, int shadowSpread, const LayoutSize& shadowOffset)
     2207{
     2208    LayoutRect bounds(holeRect);
    22012209   
    22022210    bounds.inflate(shadowBlur);
     
    22052213        bounds.inflate(-shadowSpread);
    22062214   
    2207     IntRect offsetBounds = bounds;
     2215    LayoutRect offsetBounds = bounds;
    22082216    offsetBounds.move(-shadowOffset);
    22092217    return unionRect(bounds, offsetBounds);
     
    22432251                continue;
    22442252
    2245             LayoutRect shadowRect = border.rect();
     2253            LayoutRect shadowRect(border.rect());
    22462254            shadowRect.inflate(shadowBlur + shadowSpread);
    22472255            shadowRect.move(shadowOffset);
     
    23572365}
    23582366
    2359 int RenderBoxModelObject::containingBlockLogicalWidthForContent() const
     2367LayoutUnit RenderBoxModelObject::containingBlockLogicalWidthForContent() const
    23602368{
    23612369    return containingBlock()->availableLogicalWidth();
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.h

    r92340 r93435  
    113113    bool hasInlineDirectionBordersOrPadding() const { return borderStart() || borderEnd() || paddingStart()|| paddingEnd(); }
    114114
    115     virtual int containingBlockLogicalWidthForContent() const;
     115    virtual LayoutUnit containingBlockLogicalWidthForContent() const;
    116116
    117117    virtual void childBecameNonInline(RenderObject* /*child*/) { }
    118118
    119     void paintBorder(const PaintInfo&, const IntRect&, const RenderStyle*, BackgroundBleedAvoidance = BackgroundBleedNone, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
    120     bool paintNinePieceImage(GraphicsContext*, const IntRect&, const RenderStyle*, const NinePieceImage&, CompositeOperator = CompositeSourceOver);
     119    void paintBorder(const PaintInfo&, const LayoutRect&, const RenderStyle*, BackgroundBleedAvoidance = BackgroundBleedNone, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
     120    bool paintNinePieceImage(GraphicsContext*, const LayoutRect&, const RenderStyle*, const NinePieceImage&, CompositeOperator = CompositeSourceOver);
    121121    void paintBoxShadow(const PaintInfo&, const LayoutRect&, const RenderStyle*, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
    122122    void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox* = 0, const LayoutSize& = LayoutSize(), CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0);
    123123   
    124124    // Overridden by subclasses to determine line height and baseline position.
    125     virtual int lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0;
    126     virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0;
     125    virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0;
     126    virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0;
    127127
    128128    // Called by RenderObject::willBeDestroyed() and is the only way layers should ever be destroyed
     
    181181    };
    182182
    183     void calculateBackgroundImageGeometry(const FillLayer*, const IntRect& paintRect, BackgroundImageGeometry&);
     183    void calculateBackgroundImageGeometry(const FillLayer*, const LayoutRect& paintRect, BackgroundImageGeometry&);
    184184    void getBorderEdgeInfo(class BorderEdge[], bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
    185185    bool borderObscuresBackgroundEdge(const FloatSize& contextScale) const;
    186186    bool borderObscuresBackground() const;
    187187
    188     bool shouldPaintAtLowQuality(GraphicsContext*, Image*, const void*, const IntSize&);
     188    bool shouldPaintAtLowQuality(GraphicsContext*, Image*, const void*, const LayoutSize&);
    189189
    190190    RenderBoxModelObject* continuation() const;
     
    194194    virtual bool isBoxModelObject() const { return true; }
    195195
    196     IntSize calculateFillTileSize(const FillLayer*, IntSize scaledSize) const;
     196    LayoutSize calculateFillTileSize(const FillLayer*, LayoutSize scaledSize) const;
    197197
    198198    RoundedRect getBackgroundRoundedRect(const LayoutRect&, InlineFlowBox*, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeight,
     
    202202                               BoxSide, bool firstEdgeMatches, bool secondEdgeMatches);
    203203    void paintOneBorderSide(GraphicsContext*, const RenderStyle*, const RoundedRect& outerBorder, const RoundedRect& innerBorder,
    204                                 const IntRect& sideRect, BoxSide, BoxSide adjacentSide1, BoxSide adjacentSide2, const class BorderEdge[],
     204                                const LayoutRect& sideRect, BoxSide, BoxSide adjacentSide1, BoxSide adjacentSide2, const class BorderEdge[],
    205205                                const Path*, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, const Color* overrideColor = 0);
    206206    void paintTranslucentBorderSides(GraphicsContext*, const RenderStyle*, const RoundedRect& outerBorder, const RoundedRect& innerBorder,
     
    209209                          const class BorderEdge[], BorderEdgeFlags, BackgroundBleedAvoidance,
    210210                          bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias = false, const Color* overrideColor = 0);
    211     void drawBoxSideFromPath(GraphicsContext*, const IntRect&, const Path&, const class BorderEdge[],
     211    void drawBoxSideFromPath(GraphicsContext*, const LayoutRect&, const Path&, const class BorderEdge[],
    212212                            float thickness, float drawThickness, BoxSide, const RenderStyle*,
    213213                            Color, EBorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
Note: See TracChangeset for help on using the changeset viewer.