Changeset 70692 in webkit
- Timestamp:
- Oct 27, 2010 12:48:16 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r70691 r70692 1 2010-10-27 David Hyatt <hyatt@apple.com> 2 3 Reviewed by Beth Dakin. 4 5 https://bugs.webkit.org/show_bug.cgi?id=48449 6 7 Make border drawing work correctly with vertical inline flows. The top and bottom edge have to be omitted 8 rather than the left and right edges. 9 10 Also discovered that border-radius is broken with the new path-based-drawing code for all inline flows. This 11 is a regression from the old drawing code. I patched the code to be correct rather than clipping out stuff 12 that it shouldn't and applying border-radii on lines that don't even have them. 13 14 Added fast/blockflow/border-vertical-lr.html and fast/borders/border-radius-inline-flow.html 15 16 * fast/blockflow/border-vertical-lr.html: Added. 17 * fast/borders/border-radius-inline-flow.html: Added. 18 * platform/mac/fast/blockflow/border-vertical-lr-expected.checksum: Added. 19 * platform/mac/fast/blockflow/border-vertical-lr-expected.png: Added. 20 * platform/mac/fast/blockflow/border-vertical-lr-expected.txt: Added. 21 * platform/mac/fast/borders/border-radius-inline-flow-expected.checksum: Added. 22 * platform/mac/fast/borders/border-radius-inline-flow-expected.png: Added. 23 * platform/mac/fast/borders/border-radius-inline-flow-expected.txt: Added. 24 1 25 2010-10-27 Adam Roben <aroben@apple.com> 2 26 -
trunk/WebCore/ChangeLog
r70688 r70692 1 2010-10-27 David Hyatt <hyatt@apple.com> 2 3 Reviewed by Beth Dakin. 4 5 https://bugs.webkit.org/show_bug.cgi?id=48449 6 7 Make border drawing work correctly with vertical inline flows. The top and bottom edge have to be omitted 8 rather than the left and right edges. 9 10 Also discovered that border-radius is broken with the new path-based-drawing code for all inline flows. This 11 is a regression from the old drawing code. I patched the code to be correct rather than clipping out stuff 12 that it shouldn't and applying border-radii on lines that don't even have them. 13 14 Added fast/blockflow/border-vertical-lr.html and fast/borders/border-radius-inline-flow.html 15 16 * rendering/RenderBoxModelObject.cpp: 17 (WebCore::RenderBoxModelObject::paintBorder): 18 (WebCore::RenderBoxModelObject::clipBorderSidePolygon): 19 * rendering/RenderBoxModelObject.h: 20 1 21 2010-10-27 Martin Robinson <mrobinson@igalia.com> 2 22 -
trunk/WebCore/rendering/RenderBoxModelObject.cpp
r70072 r70692 1003 1003 1004 1004 void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, int ty, int w, int h, 1005 const RenderStyle* style, bool begin, bool end)1005 const RenderStyle* style, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) 1006 1006 { 1007 1007 if (paintNinePieceImage(graphicsContext, tx, ty, w, h, style, style->borderImage())) … … 1026 1026 EBorderStyle rightStyle = style->borderRightStyle(); 1027 1027 1028 bool renderTop = topStyle > BHIDDEN && !topTransparent; 1029 bool renderLeft = leftStyle > BHIDDEN && begin && !leftTransparent; 1030 bool renderRight = rightStyle > BHIDDEN && end && !rightTransparent; 1031 bool renderBottom = bottomStyle > BHIDDEN && !bottomTransparent; 1028 bool horizontal = style->isHorizontalWritingMode(); 1029 1030 bool renderTop = topStyle > BHIDDEN && !topTransparent && (horizontal || includeLogicalLeftEdge); 1031 bool renderLeft = leftStyle > BHIDDEN && !leftTransparent && (!horizontal || includeLogicalLeftEdge); 1032 bool renderRight = rightStyle > BHIDDEN && !rightTransparent && (!horizontal || includeLogicalRightEdge); 1033 bool renderBottom = bottomStyle > BHIDDEN && !bottomTransparent && (horizontal || includeLogicalRightEdge); 1032 1034 1033 1035 bool renderRadii = false; … … 1040 1042 style->getBorderRadiiForRect(borderRect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); 1041 1043 1042 IntRect innerBorderRect = borderInnerRect(borderRect, style->borderTopWidth(), style->borderBottomWidth(), 1043 style->borderLeftWidth(), style->borderRightWidth()); 1044 1044 int leftWidth = (!horizontal || includeLogicalLeftEdge) ? style->borderLeftWidth() : 0; 1045 int rightWidth = (!horizontal || includeLogicalRightEdge) ? style->borderRightWidth() : 0; 1046 int topWidth = (horizontal || includeLogicalLeftEdge) ? style->borderTopWidth() : 0; 1047 int bottomWidth = (horizontal || includeLogicalRightEdge) ? style->borderBottomWidth() : 0; 1048 1049 IntRect innerBorderRect = borderInnerRect(borderRect, topWidth, bottomWidth, leftWidth, rightWidth); 1045 1050 IntSize innerTopLeftRadius, innerTopRightRadius, innerBottomLeftRadius, innerBottomRightRadius; 1046 style->getInnerBorderRadiiForRectWithBorderWidths(innerBorderRect, style->borderTopWidth(), style->borderBottomWidth(), 1047 style->borderLeftWidth(), style->borderRightWidth(), innerTopLeftRadius, innerTopRightRadius, 1048 innerBottomLeftRadius, innerBottomRightRadius); 1049 1050 if (begin) { 1051 1052 style->getInnerBorderRadiiForRectWithBorderWidths(innerBorderRect, topWidth, bottomWidth, leftWidth, rightWidth, innerTopLeftRadius, innerTopRightRadius, innerBottomLeftRadius, innerBottomRightRadius); 1053 1054 IntSize innerTopLeft, innerTopRight, innerBottomLeft, innerBottomRight; 1055 1056 if (includeLogicalLeftEdge) { 1051 1057 topLeft = topLeftRadius; 1052 bottomLeft = bottomLeftRadius; 1053 } 1054 if (end) { 1055 topRight = topRightRadius; 1058 innerTopLeft = innerTopLeftRadius; 1059 if (horizontal) { 1060 bottomLeft = bottomLeftRadius; 1061 innerBottomLeft = innerBottomLeftRadius; 1062 } else { 1063 topRight = topRightRadius; 1064 innerTopRight = innerTopRightRadius; 1065 } 1066 } 1067 1068 if (includeLogicalRightEdge) { 1069 if (horizontal) { 1070 topRight = topRightRadius; 1071 innerTopRight = innerTopRightRadius; 1072 } else { 1073 bottomLeft = bottomLeftRadius; 1074 innerBottomLeft = innerBottomLeftRadius; 1075 } 1056 1076 bottomRight = bottomRightRadius; 1057 } 1058 1059 renderRadii = true; 1060 1061 // Clip to the inner and outer radii rects. 1062 graphicsContext->save(); 1063 graphicsContext->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); 1064 graphicsContext->clipOutRoundedRect(innerBorderRect, innerTopLeftRadius, innerTopRightRadius, innerBottomLeftRadius, innerBottomRightRadius); 1065 1066 roundedPath.addRoundedRect(borderRect, topLeft, topRight, bottomLeft, bottomRight); 1067 graphicsContext->addPath(roundedPath); 1077 innerBottomRight = innerBottomRightRadius; 1078 } 1079 1080 renderRadii = !topLeft.isZero() || !topRight.isZero() || !bottomLeft.isZero() || !bottomRight.isZero(); 1081 1082 if (renderRadii) { 1083 // Clip to the inner and outer radii rects. 1084 graphicsContext->save(); 1085 graphicsContext->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); 1086 graphicsContext->clipOutRoundedRect(innerBorderRect, innerTopLeft, innerTopRight, innerBottomLeft, innerBottomRight); 1087 roundedPath.addRoundedRect(borderRect, topLeft, topRight, bottomLeft, bottomRight); 1088 graphicsContext->addPath(roundedPath); 1089 } 1068 1090 } 1069 1091 … … 1079 1101 if (renderRadii && borderWillArcInnerEdge(topLeft, topRight, style->borderLeftWidth(), style->borderRightWidth(), style->borderTopWidth())) { 1080 1102 graphicsContext->save(); 1081 clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSTop, upperLeftBorderStylesMatch, upperRightBorderStylesMatch, style );1103 clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSTop, upperLeftBorderStylesMatch, upperRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); 1082 1104 float thickness = max(max(style->borderTopWidth(), style->borderLeftWidth()), style->borderRightWidth()); 1083 1105 drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderTopWidth(), thickness, BSTop, style, topColor, topStyle); … … 1100 1122 if (renderRadii && borderWillArcInnerEdge(bottomLeft, bottomRight, style->borderLeftWidth(), style->borderRightWidth(), style->borderBottomWidth())) { 1101 1123 graphicsContext->save(); 1102 clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSBottom, lowerLeftBorderStylesMatch, lowerRightBorderStylesMatch, style );1124 clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSBottom, lowerLeftBorderStylesMatch, lowerRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); 1103 1125 float thickness = max(max(style->borderBottomWidth(), style->borderLeftWidth()), style->borderRightWidth()); 1104 1126 drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderBottomWidth(), thickness, BSBottom, style, bottomColor, bottomStyle); … … 1123 1145 if (renderRadii && borderWillArcInnerEdge(bottomLeft, topLeft, style->borderBottomWidth(), style->borderTopWidth(), style->borderLeftWidth())) { 1124 1146 graphicsContext->save(); 1125 clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSLeft, upperLeftBorderStylesMatch, lowerLeftBorderStylesMatch, style );1147 clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSLeft, upperLeftBorderStylesMatch, lowerLeftBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); 1126 1148 float thickness = max(max(style->borderLeftWidth(), style->borderTopWidth()), style->borderBottomWidth()); 1127 1149 drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderLeftWidth(), thickness, BSLeft, style, leftColor, leftStyle); … … 1142 1164 if (renderRadii && borderWillArcInnerEdge(bottomRight, topRight, style->borderBottomWidth(), style->borderTopWidth(), style->borderRightWidth())) { 1143 1165 graphicsContext->save(); 1144 clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSRight, upperRightBorderStylesMatch, lowerRightBorderStylesMatch, style );1166 clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSRight, upperRightBorderStylesMatch, lowerRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); 1145 1167 float thickness = max(max(style->borderRightWidth(), style->borderTopWidth()), style->borderBottomWidth()); 1146 1168 drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderRightWidth(), thickness, BSRight, style, rightColor, rightStyle); … … 1169 1191 #else 1170 1192 void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, int ty, int w, int h, 1171 const RenderStyle* style, bool begin, bool end)1193 const RenderStyle* style, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) 1172 1194 { 1173 1195 // FIXME: This old version of paintBorder should be removed when all ports implement … … 1191 1213 EBorderStyle rightStyle = style->borderRightStyle(); 1192 1214 1193 bool renderTop = topStyle > BHIDDEN && !topTransparent ;1194 bool renderLeft = leftStyle > BHIDDEN && begin && !leftTransparent;1195 bool renderRight = rightStyle > BHIDDEN && end && !rightTransparent;1196 bool renderBottom = bottomStyle > BHIDDEN && !bottomTransparent ;1215 bool renderTop = topStyle > BHIDDEN && !topTransparent && (horizontal || includeLogicalLeftEdge); 1216 bool renderLeft = leftStyle > BHIDDEN && !leftTransparent && (!horizontal || includeLogicalLeftEdge); 1217 bool renderRight = rightStyle > BHIDDEN && !rightTransparent && (!horizontal || includeLogicalRightEdge); 1218 bool renderBottom = bottomStyle > BHIDDEN && !bottomTransparent && (horizontal || includeLogicalRightEdge); 1197 1219 1198 1220 bool renderRadii = false; … … 1205 1227 style->getBorderRadiiForRect(borderRect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); 1206 1228 1207 if ( begin) {1229 if (includeLogicalLeftEdge) { 1208 1230 topLeft = topLeftRadius; 1209 bottomLeft = bottomLeftRadius; 1210 } 1211 if (end) { 1212 topRight = topRightRadius; 1231 if (horizontal) 1232 bottomLeft = bottomLeftRadius; 1233 else 1234 topRight = topRightRadius; 1235 } 1236 1237 if (includeLogicalRightEdge) { 1238 if (horizontal) 1239 topRight = topRightRadius; 1240 else 1241 bottomLeft = bottomLeftRadius; 1213 1242 bottomRight = bottomRightRadius; 1214 1243 } 1215 1244 1216 renderRadii = true; 1217 1218 // Clip to the rounded rectangle. 1219 graphicsContext->save(); 1220 graphicsContext->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); 1245 renderRadii = !topLeft.isZero() || !topRight.isZero() || !bottomLeft.isZero() || !bottomRight.isZero(); 1246 1247 if (renderRadii) { 1248 // Clip to the rounded rectangle. 1249 graphicsContext->save(); 1250 graphicsContext->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); 1251 } 1221 1252 } 1222 1253 … … 1520 1551 #endif 1521 1552 1522 void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContext, const IntRect& box, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const BoxSide side, bool firstEdgeMatches, bool secondEdgeMatches, const RenderStyle* style) 1553 void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContext, const IntRect& box, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, 1554 const BoxSide side, bool firstEdgeMatches, bool secondEdgeMatches, const RenderStyle* style, 1555 bool includeLogicalLeftEdge, bool includeLogicalRightEdge) 1523 1556 { 1524 1557 FloatPoint quad[4]; … … 1528 1561 int h = box.height(); 1529 1562 1563 bool horizontal = style->isHorizontalWritingMode(); 1564 int leftWidth = (!horizontal || includeLogicalLeftEdge) ? style->borderLeftWidth() : 0; 1565 int rightWidth = (!horizontal || includeLogicalRightEdge) ? style->borderRightWidth() : 0; 1566 int topWidth = (horizontal || includeLogicalLeftEdge) ? style->borderTopWidth() : 0; 1567 int bottomWidth = (horizontal || includeLogicalRightEdge) ? style->borderBottomWidth() : 0; 1568 1530 1569 // For each side, create an array of FloatPoints where each point is based on whichever value in each corner 1531 1570 // is larger -- the radius width/height or the border width/height -- as appropriate. … … 1533 1572 case BSTop: 1534 1573 quad[0] = FloatPoint(tx, ty); 1535 quad[1] = FloatPoint( 1536 tx + max(topLeft.width(), (int) style->borderLeftWidth()), 1537 ty + max(topLeft.height(), (int) style->borderTopWidth())); 1538 quad[2] = FloatPoint( 1539 tx + w - max(topRight.width(), (int) style->borderRightWidth()), 1540 ty + max(topRight.height(), (int)style->borderTopWidth())); 1574 quad[1] = FloatPoint(tx + max(topLeft.width(), leftWidth), ty + max(topLeft.height(), topWidth)); 1575 quad[2] = FloatPoint(tx + w - max(topRight.width(), rightWidth), ty + max(topRight.height(), topWidth)); 1541 1576 quad[3] = FloatPoint(tx + w, ty); 1542 1577 break; 1543 1578 case BSLeft: 1544 1579 quad[0] = FloatPoint(tx, ty); 1545 quad[1] = FloatPoint( 1546 tx + max(topLeft.width(), (int) style->borderLeftWidth()), 1547 ty + max(topLeft.height(), (int) style->borderTopWidth())); 1548 quad[2] = FloatPoint( 1549 tx + max(bottomLeft.width(), (int) style->borderLeftWidth()), 1550 ty + h - max(bottomLeft.height(), (int)style->borderBottomWidth())); 1580 quad[1] = FloatPoint(tx + max(topLeft.width(), leftWidth), ty + max(topLeft.height(), topWidth)); 1581 quad[2] = FloatPoint(tx + max(bottomLeft.width(), leftWidth), ty + h - max(bottomLeft.height(), bottomWidth)); 1551 1582 quad[3] = FloatPoint(tx, ty + h); 1552 1583 break; 1553 1584 case BSBottom: 1554 1585 quad[0] = FloatPoint(tx, ty + h); 1555 quad[1] = FloatPoint( 1556 tx + max(bottomLeft.width(), (int) style->borderLeftWidth()), 1557 ty + h - max(bottomLeft.height(), (int)style->borderBottomWidth())); 1558 quad[2] = FloatPoint( 1559 tx + w - max(bottomRight.width(), (int) style->borderRightWidth()), 1560 ty + h - max(bottomRight.height(), (int)style->borderBottomWidth())); 1586 quad[1] = FloatPoint(tx + max(bottomLeft.width(), leftWidth), ty + h - max(bottomLeft.height(), bottomWidth)); 1587 quad[2] = FloatPoint(tx + w - max(bottomRight.width(), rightWidth), ty + h - max(bottomRight.height(), bottomWidth)); 1561 1588 quad[3] = FloatPoint(tx + w, ty + h); 1562 1589 break; 1563 1590 case BSRight: 1564 1591 quad[0] = FloatPoint(tx + w, ty); 1565 quad[1] = FloatPoint( 1566 tx + w - max(topRight.width(), (int) style->borderRightWidth()), 1567 ty + max(topRight.height(), (int) style->borderTopWidth())); 1568 quad[2] = FloatPoint( 1569 tx + w - max(bottomRight.width(), (int) style->borderRightWidth()), 1570 ty + h - max(bottomRight.height(), (int)style->borderBottomWidth())); 1592 quad[1] = FloatPoint(tx + w - max(topRight.width(), rightWidth), ty + max(topRight.height(), topWidth)); 1593 quad[2] = FloatPoint(tx + w - max(bottomRight.width(), rightWidth), ty + h - max(bottomRight.height(), bottomWidth)); 1571 1594 quad[3] = FloatPoint(tx + w, ty + h); 1572 1595 break; -
trunk/WebCore/rendering/RenderBoxModelObject.h
r70072 r70692 110 110 virtual void childBecameNonInline(RenderObject* /*child*/) { } 111 111 112 void paintBorder(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, bool begin = true, bool end= true);112 void paintBorder(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true); 113 113 bool paintNinePieceImage(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, const NinePieceImage&, CompositeOperator = CompositeSourceOver); 114 114 void paintBoxShadow(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, ShadowStyle, bool begin = true, bool end = true); … … 138 138 IntSize calculateFillTileSize(const FillLayer*, IntSize scaledSize) const; 139 139 140 void clipBorderSidePolygon(GraphicsContext*, const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const BoxSide side, bool firstEdgeMatches, bool secondEdgeMatches, const RenderStyle* style); 140 void clipBorderSidePolygon(GraphicsContext*, const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, 141 const IntSize& bottomRight, const BoxSide side, bool firstEdgeMatches, bool secondEdgeMatches, const RenderStyle* style, 142 bool includeLogicalLeftEdge, bool includeLogicalRightEdge); 141 143 142 144 friend class RenderView;
Note: See TracChangeset
for help on using the changeset viewer.