Changeset 91090 in webkit
- Timestamp:
- Jul 15, 2011 12:27:30 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r91088 r91090 1 2011-07-15 Ian Henderson <ianh@apple.com> 2 3 Avoid rounded rect corner-drawing overhead if no corners are visible 4 https://bugs.webkit.org/show_bug.cgi?id=64584 5 6 Reviewed by Simon Fraser. 7 8 No new tests, rendering is visually identical. 9 10 * rendering/InlineFlowBox.cpp: 11 (WebCore::InlineFlowBox::paintBoxDecorations): Pass PaintInfo into 12 paintBorder. 13 * rendering/RenderBox.cpp: 14 (WebCore::RenderBox::paintBoxDecorations): Ditto. 15 * rendering/RenderBoxModelObject.cpp: 16 (WebCore::unroundClippedCorners): 17 (WebCore::RenderBoxModelObject::paintBorder): 18 Any invisible corner may be replaced with a corner of radius zero, as 19 long as the stroke style is solid. Change the GraphicsContext 20 parameter into a PaintInfo parameter so we can get the rect to be 21 drawn. 22 * rendering/RenderBoxModelObject.h: 23 * rendering/RenderFieldset.cpp: 24 (WebCore::RenderFieldset::paintBoxDecorations): Pass PaintInfo into 25 paintBorder. 26 * rendering/RenderTable.cpp: 27 (WebCore::RenderTable::paintBoxDecorations): Ditto. 28 * rendering/RenderTableCell.cpp: 29 (WebCore::RenderTableCell::paintBoxDecorations): Ditto. 30 1 31 2011-07-15 Jeff Miller <jeffm@apple.com> 2 32 -
trunk/Source/WebCore/rendering/InlineFlowBox.cpp
r90869 r91090 1135 1135 // cases only a single call to draw is required. 1136 1136 if (!hasBorderImage || (!prevLineBox() && !nextLineBox())) 1137 boxModelObject()->paintBorder( context, paintRect, renderer()->style(), BackgroundBleedNone, includeLogicalLeftEdge(), includeLogicalRightEdge());1137 boxModelObject()->paintBorder(paintInfo, paintRect, renderer()->style(), BackgroundBleedNone, includeLogicalLeftEdge(), includeLogicalRightEdge()); 1138 1138 else { 1139 1139 // We have a border image that spans multiple lines. … … 1158 1158 GraphicsContextStateSaver stateSaver(*context); 1159 1159 context->clip(paintRect); 1160 boxModelObject()->paintBorder( context, LayoutRect(stripX, stripY, stripWidth, stripHeight), renderer()->style());1160 boxModelObject()->paintBorder(paintInfo, LayoutRect(stripX, stripY, stripWidth, stripHeight), renderer()->style()); 1161 1161 } 1162 1162 } -
trunk/Source/WebCore/rendering/RenderBox.cpp
r90912 r91090 875 875 // The theme will tell us whether or not we should also paint the CSS border. 876 876 if ((!style()->hasAppearance() || (!themePainted && theme()->paintBorderOnly(this, paintInfo, paintRect))) && style()->hasBorder()) 877 paintBorder(paintInfo .context, paintRect, style(), bleedAvoidance);877 paintBorder(paintInfo, paintRect, style(), bleedAvoidance); 878 878 879 879 if (bleedAvoidance == BackgroundBleedUseTransparencyLayer) -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r90955 r91090 1372 1372 } 1373 1373 1374 void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, const IntRect& rect, const RenderStyle* style, 1374 static void unroundClippedCorners(RoundedRect& border, const LayoutRect& clipRect) 1375 { 1376 LayoutRect boundingRect = border.rect(); 1377 if (!border.isRounded() || clipRect.contains(boundingRect)) 1378 return; 1379 1380 RoundedRect::Radii adjustedRadii = border.radii(); 1381 bool didAdjustRadii = false; 1382 1383 LayoutRect topLeftRect(boundingRect.location(), adjustedRadii.topLeft()); 1384 if (!clipRect.intersects(topLeftRect)) { 1385 adjustedRadii.setTopLeft(IntSize()); 1386 didAdjustRadii = true; 1387 } 1388 1389 LayoutRect topRightRect(boundingRect.location(), adjustedRadii.topRight()); 1390 topRightRect.setX(boundingRect.maxX() - topRightRect.width()); 1391 if (!clipRect.intersects(topRightRect)) { 1392 adjustedRadii.setTopRight(IntSize()); 1393 didAdjustRadii = true; 1394 } 1395 1396 LayoutRect bottomLeftRect(boundingRect.location(), adjustedRadii.bottomLeft()); 1397 bottomLeftRect.setY(boundingRect.maxY() - bottomLeftRect.height()); 1398 if (!clipRect.intersects(bottomLeftRect)) { 1399 adjustedRadii.setBottomLeft(IntSize()); 1400 didAdjustRadii = true; 1401 } 1402 1403 LayoutRect bottomRightRect(boundingRect.location(), adjustedRadii.bottomRight()); 1404 bottomRightRect.setX(boundingRect.maxX() - bottomRightRect.width()); 1405 bottomRightRect.setY(boundingRect.maxY() - bottomRightRect.height()); 1406 if (!clipRect.intersects(bottomRightRect)) { 1407 adjustedRadii.setBottomRight(IntSize()); 1408 didAdjustRadii = true; 1409 } 1410 1411 if (didAdjustRadii) 1412 border.setRadii(adjustedRadii); 1413 } 1414 1415 void RenderBoxModelObject::paintBorder(const PaintInfo& info, const IntRect& rect, const RenderStyle* style, 1375 1416 BackgroundBleedAvoidance bleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) 1376 1417 { 1418 GraphicsContext* graphicsContext = info.context; 1377 1419 // border-image is not affected by border-radius. 1378 1420 if (paintNinePieceImage(graphicsContext, rect, style, style->borderImage())) … … 1421 1463 haveAllSolidEdges = false; 1422 1464 } 1423 1465 1466 // If one of the corners falls outside the clip region, pretend it has no 1467 // radius to improve performance. 1468 if (haveAllSolidEdges) 1469 unroundClippedCorners(outerBorder, info.rect); 1470 1424 1471 // isRenderable() check avoids issue described in https://bugs.webkit.org/show_bug.cgi?id=38787 1425 1472 if (haveAllSolidEdges && allEdgesVisible && allEdgesShareColor && innerBorder.isRenderable()) { … … 1614 1661 } 1615 1662 #else 1616 void RenderBoxModelObject::paintBorder( GraphicsContext* graphicsContext, const IntRect& rect, const RenderStyle* style,1663 void RenderBoxModelObject::paintBorder(const PaintInfo& info, const IntRect& rect, const RenderStyle* style, 1617 1664 BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) 1618 1665 { 1666 GraphicsContext* graphicsContext = info.context; 1619 1667 // FIXME: This old version of paintBorder should be removed when all ports implement 1620 1668 // GraphicsContext::clipConvexPolygon()!! This should happen soon. -
trunk/Source/WebCore/rendering/RenderBoxModelObject.h
r90955 r91090 117 117 virtual void childBecameNonInline(RenderObject* /*child*/) { } 118 118 119 void paintBorder( GraphicsContext*, const IntRect&, const RenderStyle*, BackgroundBleedAvoidance = BackgroundBleedNone, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);119 void paintBorder(const PaintInfo&, const IntRect&, const RenderStyle*, BackgroundBleedAvoidance = BackgroundBleedNone, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true); 120 120 bool paintNinePieceImage(GraphicsContext*, const IntRect&, const RenderStyle*, const NinePieceImage&, CompositeOperator = CompositeSourceOver); 121 121 void paintBoxShadow(GraphicsContext*, const LayoutRect&, const RenderStyle*, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true); -
trunk/Source/WebCore/rendering/RenderFieldset.cpp
r89979 r91090 166 166 } 167 167 168 paintBorder(paintInfo .context, paintRect, style());168 paintBorder(paintInfo, paintRect, style()); 169 169 } 170 170 -
trunk/Source/WebCore/rendering/RenderTable.cpp
r90955 r91090 570 570 571 571 if (style()->hasBorder() && !collapseBorders()) 572 paintBorder(paintInfo .context, rect, style());572 paintBorder(paintInfo, rect, style()); 573 573 } 574 574 -
trunk/Source/WebCore/rendering/RenderTableCell.cpp
r90955 r91090 1018 1018 return; 1019 1019 1020 paintBorder(paintInfo .context, paintRect, style());1020 paintBorder(paintInfo, paintRect, style()); 1021 1021 } 1022 1022
Note: See TracChangeset
for help on using the changeset viewer.