Changeset 93435 in webkit
- Timestamp:
- Aug 19, 2011 1:40:57 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r93432 r93435 1 2011-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 1 33 2011-08-19 Mihnea Ovidenie <mihnea@adobe.com> 2 34 -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r92529 r93435 52 52 static const double cLowQualityTimeThreshold = 0.500; // 500 ms 53 53 54 typedef HashMap<const void*, IntSize> LayerSizeMap;54 typedef HashMap<const void*, LayoutSize> LayerSizeMap; 55 55 typedef HashMap<RenderBoxModelObject*, LayerSizeMap> ObjectLayerSizeMap; 56 56 … … 69 69 public: 70 70 ImageQualityController(); 71 bool shouldPaintAtLowQuality(GraphicsContext*, RenderBoxModelObject*, Image*, const void* layer, const IntSize&);71 bool shouldPaintAtLowQuality(GraphicsContext*, RenderBoxModelObject*, Image*, const void* layer, const LayoutSize&); 72 72 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&); 74 74 void objectDestroyed(RenderBoxModelObject*); 75 75 bool isEmpty() { return m_objectLayerSizeMap.isEmpty(); } … … 99 99 } 100 100 101 void ImageQualityController::set(RenderBoxModelObject* object, LayerSizeMap* innerMap, const void* layer, const IntSize& size)101 void ImageQualityController::set(RenderBoxModelObject* object, LayerSizeMap* innerMap, const void* layer, const LayoutSize& size) 102 102 { 103 103 if (innerMap) … … 133 133 } 134 134 135 bool ImageQualityController::shouldPaintAtLowQuality(GraphicsContext* context, RenderBoxModelObject* object, Image* image, const void *layer, const IntSize& size)135 bool ImageQualityController::shouldPaintAtLowQuality(GraphicsContext* context, RenderBoxModelObject* object, Image* image, const void *layer, const LayoutSize& size) 136 136 { 137 137 // If the image is not a bitmap image, then none of this is relevant and we just paint at high … … 150 150 ObjectLayerSizeMap::iterator i = m_objectLayerSizeMap.find(object); 151 151 LayerSizeMap* innerMap = i != m_objectLayerSizeMap.end() ? &i->second : 0; 152 IntSize oldSize;152 LayoutSize oldSize; 153 153 bool isFirstResize = true; 154 154 if (innerMap) { … … 162 162 const AffineTransform& currentTransform = context->getCTM(); 163 163 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) { 165 167 // There is no scale in effect. If we had a scale in effect before, we can just remove this object from the list. 166 168 removeLayer(object, innerMap, layer); … … 184 186 // same as the last resize, draw at high res, but record the paint 185 187 // 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 186 190 if (isFirstResize || oldSize == size) { 187 191 restartTimer(); … … 236 240 } 237 241 238 bool RenderBoxModelObject::shouldPaintAtLowQuality(GraphicsContext* context, Image* image, const void* layer, const IntSize& size)242 bool RenderBoxModelObject::shouldPaintAtLowQuality(GraphicsContext* context, Image* image, const void* layer, const LayoutSize& size) 239 243 { 240 244 return imageQualityController()->shouldPaintAtLowQuality(context, this, image, layer, size); … … 576 580 } 577 581 578 static IntRect backgroundRectAdjustedForBleedAvoidance(GraphicsContext* context, const IntRect& borderRect, BackgroundBleedAvoidance bleedAvoidance)582 static LayoutRect backgroundRectAdjustedForBleedAvoidance(GraphicsContext* context, const LayoutRect& borderRect, BackgroundBleedAvoidance bleedAvoidance) 579 583 { 580 584 if (bleedAvoidance != BackgroundBleedShrinkBackground) 581 585 return borderRect; 582 586 583 IntRect adjustedRect = borderRect;587 LayoutRect adjustedRect = borderRect; 584 588 // We need to shrink the border by one device pixel on each side. 585 589 AffineTransform ctm = context->getCTM(); … … 778 782 } 779 783 780 IntSize RenderBoxModelObject::calculateFillTileSize(const FillLayer* fillLayer, IntSize positioningAreaSize) const784 LayoutSize RenderBoxModelObject::calculateFillTileSize(const FillLayer* fillLayer, LayoutSize positioningAreaSize) const 781 785 { 782 786 StyleImage* image = fillLayer->image(); … … 787 791 switch (type) { 788 792 case SizeLength: { 789 int w = positioningAreaSize.width();790 int h = positioningAreaSize.height();793 LayoutUnit w = positioningAreaSize.width(); 794 LayoutUnit h = positioningAreaSize.height(); 791 795 792 796 Length layerWidth = fillLayer->size().size.width(); … … 806 810 // scale to maintain our aspect ratio. 807 811 if (layerWidth.isAuto() && !layerHeight.isAuto()) { 808 IntSize imageIntrinsicSize = image->imageSize(this, style()->effectiveZoom());812 LayoutSize imageIntrinsicSize = image->imageSize(this, style()->effectiveZoom()); 809 813 if (imageIntrinsicSize.height()) 810 814 w = imageIntrinsicSize.width() * h / imageIntrinsicSize.height(); 811 815 } else if (!layerWidth.isAuto() && layerHeight.isAuto()) { 812 IntSize imageIntrinsicSize = image->imageSize(this, style()->effectiveZoom());816 LayoutSize imageIntrinsicSize = image->imageSize(this, style()->effectiveZoom()); 813 817 if (imageIntrinsicSize.width()) 814 818 h = imageIntrinsicSize.height() * w / imageIntrinsicSize.width(); 815 819 } else if (layerWidth.isAuto() && layerHeight.isAuto()) { 816 820 // 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()); 818 822 w = imageIntrinsicSize.width(); 819 823 h = imageIntrinsicSize.height(); 820 824 } 821 825 822 return IntSize(max(1, w), max(1, h));826 return LayoutSize(max<LayoutUnit>(1, w), max<LayoutUnit>(1, h)); 823 827 } 824 828 case Contain: 825 829 case Cover: { 826 IntSize imageIntrinsicSize = image->imageSize(this, 1);830 LayoutSize imageIntrinsicSize = image->imageSize(this, 1); 827 831 float horizontalScaleFactor = imageIntrinsicSize.width() 828 832 ? static_cast<float>(positioningAreaSize.width()) / imageIntrinsicSize.width() : 1; … … 830 834 ? static_cast<float>(positioningAreaSize.height()) / imageIntrinsicSize.height() : 1; 831 835 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)); 833 837 } 834 838 case SizeNone: … … 854 858 void RenderBoxModelObject::BackgroundImageGeometry::useFixedAttachment(const LayoutPoint& attachmentPoint) 855 859 { 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)); 857 861 } 858 862 … … 869 873 } 870 874 871 void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fillLayer, const IntRect& paintRect,875 void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fillLayer, const LayoutRect& paintRect, 872 876 BackgroundImageGeometry& geometry) 873 877 { 874 int left = 0;875 int top = 0;876 IntSize positioningAreaSize;878 LayoutUnit left = 0; 879 LayoutUnit top = 0; 880 LayoutSize positioningAreaSize; 877 881 878 882 // Determine the background positioning area and set destRect to the background painting area. … … 893 897 geometry.setDestRect(paintRect); 894 898 895 int right = 0;896 int bottom = 0;899 LayoutUnit right = 0; 900 LayoutUnit bottom = 0; 897 901 // Scroll and Local. 898 902 if (fillLayer->origin() != BorderFillBox) { … … 913 917 // the background positioning area. 914 918 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); 916 920 left += marginLeft(); 917 921 top += marginTop(); 918 922 } else 919 positioningAreaSize = IntSize(paintRect.width() - left - right, paintRect.height() - top - bottom);923 positioningAreaSize = LayoutSize(paintRect.width() - left - right, paintRect.height() - top - bottom); 920 924 } else { 921 925 geometry.setDestRect(viewRect()); … … 928 932 EFillRepeat backgroundRepeatY = fillLayer->repeatY(); 929 933 930 int xPosition = fillLayer->xPosition().calcMinValue(positioningAreaSize.width() - geometry.tileSize().width(), true);934 LayoutUnit xPosition = fillLayer->xPosition().calcMinValue(positioningAreaSize.width() - geometry.tileSize().width(), true); 931 935 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); 933 937 else 934 938 geometry.setNoRepeatX(xPosition + left); 935 939 936 int yPosition = fillLayer->yPosition().calcMinValue(positioningAreaSize.height() - geometry.tileSize().height(), true);940 LayoutUnit yPosition = fillLayer->yPosition().calcMinValue(positioningAreaSize.height() - geometry.tileSize().height(), true); 937 941 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); 939 943 else 940 944 geometry.setNoRepeatY(yPosition + top); … … 947 951 } 948 952 949 bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext, const IntRect& rect, const RenderStyle* style,953 bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext, const LayoutRect& rect, const RenderStyle* style, 950 954 const NinePieceImage& ninePieceImage, CompositeOperator op) 951 955 { … … 963 967 // doesn't have any understanding of the zoom that is in effect on the tile. 964 968 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)); 973 977 974 978 ENinePieceImageRule hRule = ninePieceImage.horizontalRule(); … … 977 981 bool fitToBorder = style->borderImage() == ninePieceImage; 978 982 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; 983 987 984 988 bool drawLeft = leftSlice > 0 && leftWidth > 0; … … 998 1002 // The rect to use from within the image is obtained from our slice, and is (0, 0, leftSlice, topSlice) 999 1003 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); 1002 1006 1003 1007 // The bottom left corner rect is (tx, ty + h - bottomWidth, leftWidth, bottomWidth) 1004 1008 // The rect to use from within the image is (0, imageHeight - bottomSlice, leftSlice, botomSlice) 1005 1009 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); 1008 1012 1009 1013 // Paint the left edge. 1010 1014 // 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, 1012 1016 rect.height() - topWidth - bottomWidth), 1013 IntRect(0, topSlice, leftSlice, imageHeight - topSlice - bottomSlice),1017 LayoutRect(0, topSlice, leftSlice, imageHeight - topSlice - bottomSlice), 1014 1018 Image::StretchTile, (Image::TileRule)vRule, op); 1015 1019 } … … 1020 1024 // The rect to use from within the image is obtained from our slice, and is (imageWidth - rightSlice, 0, rightSlice, topSlice) 1021 1025 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); 1024 1028 1025 1029 // The bottom right corner rect is (tx + w - rightWidth, ty + h - bottomWidth, rightWidth, bottomWidth) 1026 1030 // The rect to use from within the image is (imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice) 1027 1031 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); 1030 1034 1031 1035 // 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, 1033 1037 rect.height() - topWidth - bottomWidth), 1034 IntRect(imageWidth - rightSlice, topSlice, rightSlice, imageHeight - topSlice - bottomSlice),1038 LayoutRect(imageWidth - rightSlice, topSlice, rightSlice, imageHeight - topSlice - bottomSlice), 1035 1039 Image::StretchTile, (Image::TileRule)vRule, op); 1036 1040 } … … 1038 1042 // Paint the top edge. 1039 1043 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), 1042 1046 (Image::TileRule)hRule, Image::StretchTile, op); 1043 1047 1044 1048 // Paint the bottom edge. 1045 1049 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, 1047 1051 rect.width() - leftWidth - rightWidth, bottomWidth), 1048 IntRect(leftSlice, imageHeight - bottomSlice, imageWidth - rightSlice - leftSlice, bottomSlice),1052 LayoutRect(leftSlice, imageHeight - bottomSlice, imageWidth - rightSlice - leftSlice, bottomSlice), 1049 1053 (Image::TileRule)hRule, Image::StretchTile, op); 1050 1054 1051 1055 // Paint the middle. 1052 1056 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, 1054 1058 rect.height() - topWidth - bottomWidth), 1055 IntRect(leftSlice, topSlice, imageWidth - rightSlice - leftSlice, imageHeight - topSlice - bottomSlice),1059 LayoutRect(leftSlice, topSlice, imageWidth - rightSlice - leftSlice, imageHeight - topSlice - bottomSlice), 1056 1060 (Image::TileRule)hRule, (Image::TileRule)vRule, op); 1057 1061 … … 1162 1166 1163 1167 #if HAVE(PATH_BASED_BORDER_RADIUS_DRAWING) 1164 static bool borderWillArcInnerEdge(const IntSize& firstRadius, const IntSize& secondRadius)1168 static bool borderWillArcInnerEdge(const LayoutSize& firstRadius, const FloatSize& secondRadius) 1165 1169 { 1166 1170 return !firstRadius.isZero() || !secondRadius.isZero(); … … 1293 1297 1294 1298 void 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, 1296 1300 BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, const Color* overrideColor) 1297 1301 { … … 1358 1362 1359 1363 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); 1361 1366 1362 1367 bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSTop].style) || borderWillArcInnerEdge(innerBorder.radii().topLeft(), innerBorder.radii().topRight())); … … 1365 1370 1366 1371 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); 1368 1374 1369 1375 bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSBottom].style) || borderWillArcInnerEdge(innerBorder.radii().bottomLeft(), innerBorder.radii().bottomRight())); … … 1372 1378 1373 1379 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); 1375 1382 1376 1383 bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSLeft].style) || borderWillArcInnerEdge(innerBorder.radii().bottomLeft(), innerBorder.radii().topLeft())); … … 1379 1386 1380 1387 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); 1382 1390 1383 1391 bool usePath = renderRadii && (borderStyleHasInnerDetail(edges[BSRight].style) || borderWillArcInnerEdge(innerBorder.radii().bottomRight(), innerBorder.radii().topRight())); … … 1426 1434 } 1427 1435 1428 void RenderBoxModelObject::paintBorder(const PaintInfo& info, const IntRect& rect, const RenderStyle* style,1436 void RenderBoxModelObject::paintBorder(const PaintInfo& info, const LayoutRect& rect, const RenderStyle* style, 1429 1437 BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) 1430 1438 { … … 1538 1546 } 1539 1547 1540 void RenderBoxModelObject::drawBoxSideFromPath(GraphicsContext* graphicsContext, const IntRect& borderRect, const Path& borderPath, const BorderEdge edges[],1548 void RenderBoxModelObject::drawBoxSideFromPath(GraphicsContext* graphicsContext, const LayoutRect& borderRect, const Path& borderPath, const BorderEdge edges[], 1541 1549 float thickness, float drawThickness, BoxSide side, const RenderStyle* style, 1542 1550 Color color, EBorderStyle borderStyle, BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) … … 1625 1633 { 1626 1634 GraphicsContextStateSaver stateSaver(*graphicsContext); 1627 IntRect outerRect = borderRect;1635 LayoutRect outerRect = borderRect; 1628 1636 if (bleedAvoidance == BackgroundBleedUseTransparencyLayer) { 1629 1637 outerRect.inflate(1); … … 2030 2038 FloatPoint quad[4]; 2031 2039 2032 const IntRect& outerRect = outerBorder.rect();2033 const IntRect& innerRect = innerBorder.rect();2040 const LayoutRect& outerRect = outerBorder.rect(); 2041 const LayoutRect& innerRect = innerBorder.rect(); 2034 2042 2035 2043 FloatPoint centerPoint(innerRect.location().x() + static_cast<float>(innerRect.width()) / 2, innerRect.location().y() + static_cast<float>(innerRect.height()) / 2); … … 2196 2204 } 2197 2205 2198 static inline IntRect areaCastingShadowInHole(const IntRect& holeRect, int shadowBlur, int shadowSpread, const IntSize& shadowOffset)2199 { 2200 IntRect bounds(holeRect);2206 static inline LayoutRect areaCastingShadowInHole(const LayoutRect& holeRect, int shadowBlur, int shadowSpread, const LayoutSize& shadowOffset) 2207 { 2208 LayoutRect bounds(holeRect); 2201 2209 2202 2210 bounds.inflate(shadowBlur); … … 2205 2213 bounds.inflate(-shadowSpread); 2206 2214 2207 IntRect offsetBounds = bounds;2215 LayoutRect offsetBounds = bounds; 2208 2216 offsetBounds.move(-shadowOffset); 2209 2217 return unionRect(bounds, offsetBounds); … … 2243 2251 continue; 2244 2252 2245 LayoutRect shadowRect = border.rect();2253 LayoutRect shadowRect(border.rect()); 2246 2254 shadowRect.inflate(shadowBlur + shadowSpread); 2247 2255 shadowRect.move(shadowOffset); … … 2357 2365 } 2358 2366 2359 int RenderBoxModelObject::containingBlockLogicalWidthForContent() const2367 LayoutUnit RenderBoxModelObject::containingBlockLogicalWidthForContent() const 2360 2368 { 2361 2369 return containingBlock()->availableLogicalWidth(); -
trunk/Source/WebCore/rendering/RenderBoxModelObject.h
r92340 r93435 113 113 bool hasInlineDirectionBordersOrPadding() const { return borderStart() || borderEnd() || paddingStart()|| paddingEnd(); } 114 114 115 virtual int containingBlockLogicalWidthForContent() const;115 virtual LayoutUnit containingBlockLogicalWidthForContent() const; 116 116 117 117 virtual void childBecameNonInline(RenderObject* /*child*/) { } 118 118 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); 121 121 void paintBoxShadow(const PaintInfo&, const LayoutRect&, const RenderStyle*, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true); 122 122 void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox* = 0, const LayoutSize& = LayoutSize(), CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0); 123 123 124 124 // 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; 127 127 128 128 // Called by RenderObject::willBeDestroyed() and is the only way layers should ever be destroyed … … 181 181 }; 182 182 183 void calculateBackgroundImageGeometry(const FillLayer*, const IntRect& paintRect, BackgroundImageGeometry&);183 void calculateBackgroundImageGeometry(const FillLayer*, const LayoutRect& paintRect, BackgroundImageGeometry&); 184 184 void getBorderEdgeInfo(class BorderEdge[], bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const; 185 185 bool borderObscuresBackgroundEdge(const FloatSize& contextScale) const; 186 186 bool borderObscuresBackground() const; 187 187 188 bool shouldPaintAtLowQuality(GraphicsContext*, Image*, const void*, const IntSize&);188 bool shouldPaintAtLowQuality(GraphicsContext*, Image*, const void*, const LayoutSize&); 189 189 190 190 RenderBoxModelObject* continuation() const; … … 194 194 virtual bool isBoxModelObject() const { return true; } 195 195 196 IntSize calculateFillTileSize(const FillLayer*, IntSize scaledSize) const;196 LayoutSize calculateFillTileSize(const FillLayer*, LayoutSize scaledSize) const; 197 197 198 198 RoundedRect getBackgroundRoundedRect(const LayoutRect&, InlineFlowBox*, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeight, … … 202 202 BoxSide, bool firstEdgeMatches, bool secondEdgeMatches); 203 203 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[], 205 205 const Path*, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, const Color* overrideColor = 0); 206 206 void paintTranslucentBorderSides(GraphicsContext*, const RenderStyle*, const RoundedRect& outerBorder, const RoundedRect& innerBorder, … … 209 209 const class BorderEdge[], BorderEdgeFlags, BackgroundBleedAvoidance, 210 210 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[], 212 212 float thickness, float drawThickness, BoxSide, const RenderStyle*, 213 213 Color, EBorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
Note: See TracChangeset
for help on using the changeset viewer.