Changeset 86188 in webkit
- Timestamp:
- May 10, 2011 3:45:29 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r86185 r86188 1 2011-05-10 Levi Weintraub <leviw@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 Switch RenderBoxModelObject::paintNinePieceImage to use IntRect instead of four ints 6 https://bugs.webkit.org/show_bug.cgi?id=60586 7 8 Switch paintNinePieceImage to take an IntRect instead of four ints representing an IntRect! 9 10 No new tests as this is simply refactoring. 11 12 * rendering/InlineFlowBox.cpp: 13 (WebCore::InlineFlowBox::paintMask): 14 * rendering/RenderBox.cpp: 15 (WebCore::RenderBox::paintMaskImages): 16 * rendering/RenderBoxModelObject.cpp: 17 (WebCore::RenderBoxModelObject::paintNinePieceImage): 18 (WebCore::RenderBoxModelObject::paintBorder): 19 * rendering/RenderBoxModelObject.h: 20 1 21 2011-05-05 Jer Noble <jer.noble@apple.com> 2 22 -
trunk/Source/WebCore/rendering/InlineFlowBox.cpp
r85971 r86188 1214 1214 // cases only a single call to draw is required. 1215 1215 if (!prevLineBox() && !nextLineBox()) { 1216 boxModelObject()->paintNinePieceImage(paintInfo.context, tx, ty, w, h, renderer()->style(), maskNinePieceImage, compositeOp);1216 boxModelObject()->paintNinePieceImage(paintInfo.context, IntRect(tx, ty, w, h), renderer()->style(), maskNinePieceImage, compositeOp); 1217 1217 } else { 1218 1218 // We have a mask image that spans multiple lines. … … 1231 1231 GraphicsContextStateSaver stateSaver(*paintInfo.context); 1232 1232 paintInfo.context->clip(IntRect(tx, ty, w, h)); 1233 boxModelObject()->paintNinePieceImage(paintInfo.context, stripX, stripY, stripWidth, stripHeight, renderer()->style(), maskNinePieceImage, compositeOp);1233 boxModelObject()->paintNinePieceImage(paintInfo.context, IntRect(stripX, stripY, stripWidth, stripHeight), renderer()->style(), maskNinePieceImage, compositeOp); 1234 1234 } 1235 1235 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r86024 r86188 954 954 if (allMaskImagesLoaded) { 955 955 paintFillLayers(paintInfo, Color(), style()->maskLayers(), tx, ty, w, h, BackgroundBleedNone, compositeOp); 956 paintNinePieceImage(paintInfo.context, tx, ty, w, h, style(), style()->maskBoxImage(), compositeOp);956 paintNinePieceImage(paintInfo.context, IntRect(tx, ty, w, h), style(), style()->maskBoxImage(), compositeOp); 957 957 } 958 958 -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r84664 r86188 922 922 } 923 923 924 bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext, int tx, int ty, int w, int h, const RenderStyle* style,924 bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext, const IntRect& rect, const RenderStyle* style, 925 925 const NinePieceImage& ninePieceImage, CompositeOperator op) 926 926 { … … 937 937 // FIXME: border-image is broken with full page zooming when tiling has to happen, since the tiling function 938 938 // doesn't have any understanding of the zoom that is in effect on the tile. 939 styleImage->setImageContainerSize( IntSize(w, h));939 styleImage->setImageContainerSize(rect.size()); 940 940 IntSize imageSize = styleImage->imageSize(this, 1.0f); 941 941 int imageWidth = imageSize.width(); … … 961 961 bool drawRight = rightSlice > 0 && rightWidth > 0; 962 962 bool drawBottom = bottomSlice > 0 && bottomWidth > 0; 963 bool drawMiddle = (imageWidth - leftSlice - rightSlice) > 0 && ( w - leftWidth - rightWidth) > 0 &&964 (imageHeight - topSlice - bottomSlice) > 0 && (h- topWidth - bottomWidth) > 0;963 bool drawMiddle = (imageWidth - leftSlice - rightSlice) > 0 && (rect.width() - leftWidth - rightWidth) > 0 964 && (imageHeight - topSlice - bottomSlice) > 0 && (rect.height() - topWidth - bottomWidth) > 0; 965 965 966 966 RefPtr<Image> image = styleImage->image(this, imageSize); … … 973 973 // The rect to use from within the image is obtained from our slice, and is (0, 0, leftSlice, topSlice) 974 974 if (drawTop) 975 graphicsContext->drawImage(image.get(), colorSpace, IntRect( tx, ty, leftWidth, topWidth),975 graphicsContext->drawImage(image.get(), colorSpace, IntRect(rect.location(), IntSize(leftWidth, topWidth)), 976 976 IntRect(0, 0, leftSlice, topSlice), op); 977 977 … … 979 979 // The rect to use from within the image is (0, imageHeight - bottomSlice, leftSlice, botomSlice) 980 980 if (drawBottom) 981 graphicsContext->drawImage(image.get(), colorSpace, IntRect( tx, ty + h- bottomWidth, leftWidth, bottomWidth),981 graphicsContext->drawImage(image.get(), colorSpace, IntRect(rect.x(), rect.y() + rect.height() - bottomWidth, leftWidth, bottomWidth), 982 982 IntRect(0, imageHeight - bottomSlice, leftSlice, bottomSlice), op); 983 983 984 984 // Paint the left edge. 985 985 // Have to scale and tile into the border rect. 986 graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect( tx, ty+ topWidth, leftWidth,987 h- topWidth - bottomWidth),986 graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect(rect.x(), rect.y() + topWidth, leftWidth, 987 rect.height() - topWidth - bottomWidth), 988 988 IntRect(0, topSlice, leftSlice, imageHeight - topSlice - bottomSlice), 989 989 Image::StretchTile, (Image::TileRule)vRule, op); … … 995 995 // The rect to use from within the image is obtained from our slice, and is (imageWidth - rightSlice, 0, rightSlice, topSlice) 996 996 if (drawTop) 997 graphicsContext->drawImage(image.get(), colorSpace, IntRect( tx + w - rightWidth, ty, rightWidth, topWidth),997 graphicsContext->drawImage(image.get(), colorSpace, IntRect(rect.x() + rect.width() - rightWidth, rect.y(), rightWidth, topWidth), 998 998 IntRect(imageWidth - rightSlice, 0, rightSlice, topSlice), op); 999 999 … … 1001 1001 // The rect to use from within the image is (imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice) 1002 1002 if (drawBottom) 1003 graphicsContext->drawImage(image.get(), colorSpace, IntRect( tx + w - rightWidth, ty + h- bottomWidth, rightWidth, bottomWidth),1003 graphicsContext->drawImage(image.get(), colorSpace, IntRect(rect.x() + rect.width() - rightWidth, rect.y() + rect.height() - bottomWidth, rightWidth, bottomWidth), 1004 1004 IntRect(imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice), op); 1005 1005 1006 1006 // Paint the right edge. 1007 graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect( tx + w - rightWidth, ty+ topWidth, rightWidth,1008 h- topWidth - bottomWidth),1007 graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect(rect.x() + rect.width() - rightWidth, rect.y() + topWidth, rightWidth, 1008 rect.height() - topWidth - bottomWidth), 1009 1009 IntRect(imageWidth - rightSlice, topSlice, rightSlice, imageHeight - topSlice - bottomSlice), 1010 1010 Image::StretchTile, (Image::TileRule)vRule, op); … … 1013 1013 // Paint the top edge. 1014 1014 if (drawTop) 1015 graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect( tx + leftWidth, ty, w- leftWidth - rightWidth, topWidth),1015 graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect(rect.x() + leftWidth, rect.y(), rect.width() - leftWidth - rightWidth, topWidth), 1016 1016 IntRect(leftSlice, 0, imageWidth - rightSlice - leftSlice, topSlice), 1017 1017 (Image::TileRule)hRule, Image::StretchTile, op); … … 1019 1019 // Paint the bottom edge. 1020 1020 if (drawBottom) 1021 graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect( tx + leftWidth, ty + h- bottomWidth,1022 w- leftWidth - rightWidth, bottomWidth),1021 graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect(rect.x() + leftWidth, rect.y() + rect.height() - bottomWidth, 1022 rect.width() - leftWidth - rightWidth, bottomWidth), 1023 1023 IntRect(leftSlice, imageHeight - bottomSlice, imageWidth - rightSlice - leftSlice, bottomSlice), 1024 1024 (Image::TileRule)hRule, Image::StretchTile, op); … … 1026 1026 // Paint the middle. 1027 1027 if (drawMiddle) 1028 graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect( tx + leftWidth, ty + topWidth, w- leftWidth - rightWidth,1029 h- topWidth - bottomWidth),1028 graphicsContext->drawTiledImage(image.get(), colorSpace, IntRect(rect.x() + leftWidth, rect.y() + topWidth, rect.width() - leftWidth - rightWidth, 1029 rect.height() - topWidth - bottomWidth), 1030 1030 IntRect(leftSlice, topSlice, imageWidth - rightSlice - leftSlice, imageHeight - topSlice - bottomSlice), 1031 1031 (Image::TileRule)hRule, (Image::TileRule)vRule, op); … … 1351 1351 { 1352 1352 // border-image is not affected by border-radius. 1353 if (paintNinePieceImage(graphicsContext, tx, ty, w, h, style, style->borderImage()))1353 if (paintNinePieceImage(graphicsContext, IntRect(tx, ty, w, h), style, style->borderImage())) 1354 1354 return; 1355 1355 … … 1593 1593 // FIXME: This old version of paintBorder should be removed when all ports implement 1594 1594 // GraphicsContext::clipConvexPolygon()!! This should happen soon. 1595 if (paintNinePieceImage(graphicsContext, tx, ty, w, h, style, style->borderImage()))1595 if (paintNinePieceImage(graphicsContext, IntRect(tx, ty, w, h), style, style->borderImage())) 1596 1596 return; 1597 1597 -
trunk/Source/WebCore/rendering/RenderBoxModelObject.h
r84341 r86188 120 120 121 121 void paintBorder(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, BackgroundBleedAvoidance = BackgroundBleedNone, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true); 122 bool paintNinePieceImage(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, const NinePieceImage&, CompositeOperator = CompositeSourceOver);122 bool paintNinePieceImage(GraphicsContext*, const IntRect&, const RenderStyle*, const NinePieceImage&, CompositeOperator = CompositeSourceOver); 123 123 void paintBoxShadow(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true); 124 124 void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer*, int tx, int ty, int width, int height, BackgroundBleedAvoidance, InlineFlowBox* = 0, int inlineBoxWidth = 0, int inlineBoxHeight = 0, CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0);
Note: See TracChangeset
for help on using the changeset viewer.