Changeset 76016 in webkit
- Timestamp:
- Jan 18, 2011 4:26:48 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 deleted
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/Android.mk
r76004 r76016 532 532 platform/graphics/PathTraversalState.cpp \ 533 533 platform/graphics/Pattern.cpp \ 534 platform/graphics/RoundedIntRect.cpp \535 534 platform/graphics/SegmentedFontData.cpp \ 536 535 platform/graphics/SimpleFontData.cpp \ -
trunk/Source/WebCore/CMakeLists.txt
r76004 r76016 1351 1351 platform/graphics/PathTraversalState.cpp 1352 1352 platform/graphics/Pattern.cpp 1353 platform/graphics/RoundedIntRect.cpp1354 1353 platform/graphics/SegmentedFontData.cpp 1355 1354 platform/graphics/SimpleFontData.cpp -
trunk/Source/WebCore/ChangeLog
r76013 r76016 1 2011-01-18 MORITA Hajime <morrita@google.com> 2 3 Unreviewed, rolling out r76004, r76005, r76007, and r76011. 4 http://trac.webkit.org/changeset/76004 5 http://trac.webkit.org/changeset/76005 6 http://trac.webkit.org/changeset/76007 7 http://trac.webkit.org/changeset/76011 8 https://bugs.webkit.org/show_bug.cgi?id=51664 9 10 The r76004 broke pixel tests. 11 (The failure was missed due to the tolerance.) 12 13 * Android.mk: 14 * CMakeLists.txt: 15 * GNUmakefile.am: 16 * WebCore.gypi: 17 * WebCore.pro: 18 * WebCore.vcproj/WebCore.vcproj: 19 * WebCore.xcodeproj/project.pbxproj: 20 * platform/graphics/GraphicsContext.cpp: 21 (WebCore::GraphicsContext::addRoundedRectClip): 22 (WebCore::GraphicsContext::clipOutRoundedRect): 23 * platform/graphics/GraphicsContext.h: 24 * platform/graphics/RoundedIntRect.cpp: Removed. 25 * platform/graphics/RoundedIntRect.h: Removed. 26 * rendering/RenderBox.cpp: 27 (WebCore::RenderBox::pushContentsClip): 28 * rendering/RenderBoxModelObject.cpp: 29 (WebCore::RenderBoxModelObject::paintFillLayerExtended): 30 (WebCore::RenderBoxModelObject::paintBorder): 31 (WebCore::RenderBoxModelObject::clipBorderSidePolygon): 32 (WebCore::uniformlyExpandBorderRadii): 33 (WebCore::RenderBoxModelObject::paintBoxShadow): 34 * rendering/RenderBoxModelObject.h: 35 * rendering/RenderObject.cpp: 36 (WebCore::RenderObject::drawBoxSideFromPath): 37 * rendering/RenderReplaced.cpp: 38 (WebCore::RenderReplaced::paint): 39 * rendering/RenderThemeChromiumWin.cpp: 40 (WebCore::RenderThemeChromiumWin::paintTextFieldInternal): 41 * rendering/RenderThemeMac.mm: 42 (WebCore::RenderThemeMac::paintMenuListButtonGradients): 43 (WebCore::RenderThemeMac::paintSliderTrack): 44 * rendering/RenderThemeSafari.cpp: 45 (WebCore::RenderThemeSafari::paintMenuListButtonGradients): 46 (WebCore::RenderThemeSafari::paintSliderTrack): 47 * rendering/RenderThemeWinCE.cpp: 48 (WebCore::RenderThemeWinCE::paintSearchFieldCancelButton): 49 * rendering/RenderWidget.cpp: 50 (WebCore::RenderWidget::paint): 51 * rendering/style/BorderData.h: 52 * rendering/style/RenderStyle.cpp: 53 (WebCore::constrainCornerRadiiForRect): 54 (WebCore::RenderStyle::getBorderRadiiForRect): 55 (WebCore::RenderStyle::getInnerBorderRadiiForRectWithBorderWidths): 56 * rendering/style/RenderStyle.h: 57 1 58 2011-01-17 Pavel Podivilov <podivilov@chromium.org> 2 59 -
trunk/Source/WebCore/GNUmakefile.am
r76007 r76016 2436 2436 Source/WebCore/platform/graphics/Pattern.cpp \ 2437 2437 Source/WebCore/platform/graphics/Pattern.h \ 2438 Source/WebCore/platform/graphics/RoundedIntRect.h \2439 Source/WebCore/platform/graphics/RoundedIntRect.cpp \2440 2438 Source/WebCore/platform/graphics/SegmentedFontData.cpp \ 2441 2439 Source/WebCore/platform/graphics/SegmentedFontData.h \ -
trunk/Source/WebCore/WebCore.gypi
r76009 r76016 2943 2943 'platform/graphics/Pattern.cpp', 2944 2944 'platform/graphics/Pattern.h', 2945 'platform/graphics/RoundedIntRect.cpp',2946 'platform/graphics/RoundedIntRect.h',2947 2945 'platform/graphics/SegmentedFontData.cpp', 2948 2946 'platform/graphics/SegmentedFontData.h', -
trunk/Source/WebCore/WebCore.pro
r76004 r76016 1211 1211 platform/graphics/PathTraversalState.cpp \ 1212 1212 platform/graphics/Pattern.cpp \ 1213 platform/graphics/RoundedIntRect.cpp \1214 1213 platform/graphics/SegmentedFontData.cpp \ 1215 1214 platform/graphics/SimpleFontData.cpp \ … … 2131 2130 platform/graphics/PathTraversalState.h \ 2132 2131 platform/graphics/Pattern.h \ 2133 platform/graphics/RoundedIntRect.h \2134 2132 platform/graphics/qt/FontCustomPlatformData.h \ 2135 2133 platform/graphics/qt/ImageDecoderQt.h \ -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r76009 r76016 26694 26694 </File> 26695 26695 <File 26696 RelativePath="..\platform\graphics\RoundedIntRect.cpp"26697 >26698 </File>26699 <File26700 RelativePath="..\platform\graphics\RoundedIntRect.h"26701 >26702 </File>26703 <File26704 26696 RelativePath="..\platform\graphics\SegmentedFontData.cpp" 26705 26697 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r76004 r76016 3164 3164 A718760E0B2A120100A16ECE /* DragActions.h in Headers */ = {isa = PBXBuildFile; fileRef = A718760D0B2A120100A16ECE /* DragActions.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3165 3165 A71878900B2D04AC00A16ECE /* DragControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */; }; 3166 A73F95FE12C97BFE0031AAF9 /* RoundedIntRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A73F95FC12C97BFE0031AAF9 /* RoundedIntRect.cpp */; };3167 A73F95FF12C97BFE0031AAF9 /* RoundedIntRect.h in Headers */ = {isa = PBXBuildFile; fileRef = A73F95FD12C97BFE0031AAF9 /* RoundedIntRect.h */; settings = {ATTRIBUTES = (Private, ); }; };3168 3166 A75E497610752ACB00C9B896 /* SerializedScriptValue.h in Headers */ = {isa = PBXBuildFile; fileRef = A75E497410752ACB00C9B896 /* SerializedScriptValue.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3169 3167 A75E497710752ACB00C9B896 /* SerializedScriptValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A75E497510752ACB00C9B896 /* SerializedScriptValue.cpp */; }; … … 9536 9534 A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DragControllerMac.mm; sourceTree = "<group>"; }; 9537 9535 A71A70C911AFB02000989D6D /* HTMLMeterElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLMeterElement.idl; sourceTree = "<group>"; }; 9538 A73F95FC12C97BFE0031AAF9 /* RoundedIntRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RoundedIntRect.cpp; sourceTree = "<group>"; };9539 A73F95FD12C97BFE0031AAF9 /* RoundedIntRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RoundedIntRect.h; sourceTree = "<group>"; };9540 9536 A75E497410752ACB00C9B896 /* SerializedScriptValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SerializedScriptValue.h; sourceTree = "<group>"; }; 9541 9537 A75E497510752ACB00C9B896 /* SerializedScriptValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SerializedScriptValue.cpp; sourceTree = "<group>"; }; … … 17465 17461 A8FA6E5C0E4CFDED00D5CF49 /* Pattern.cpp */, 17466 17462 A8FA6E5B0E4CFDED00D5CF49 /* Pattern.h */, 17467 A73F95FC12C97BFE0031AAF9 /* RoundedIntRect.cpp */,17468 A73F95FD12C97BFE0031AAF9 /* RoundedIntRect.h */,17469 17463 371F4FFB0D25E7F300ECE0D5 /* SegmentedFontData.cpp */, 17470 17464 371F4FFA0D25E7F300ECE0D5 /* SegmentedFontData.h */, … … 21732 21726 BC74DA371013F3F7007987AD /* RGBColor.h in Headers */, 21733 21727 A8CFF5E10A155A05000A4234 /* RootInlineBox.h in Headers */, 21734 A73F95FF12C97BFE0031AAF9 /* RoundedIntRect.h in Headers */,21735 21728 49E911C90EF86D47009D0CAF /* RotateTransformOperation.h in Headers */, 21736 21729 1C63A2480F71646600C09D5A /* RunLoopTimer.h in Headers */, … … 24524 24517 BC74DA381013F3F7007987AD /* RGBColor.cpp in Sources */, 24525 24518 A8CFF5E70A155A05000A4234 /* RootInlineBox.cpp in Sources */, 24526 A73F95FE12C97BFE0031AAF9 /* RoundedIntRect.cpp in Sources */,24527 24519 49E911C80EF86D47009D0CAF /* RotateTransformOperation.cpp in Sources */, 24528 24520 1C63A2490F71646600C09D5A /* RunLoopTimerCF.cpp in Sources */, -
trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp
r76004 r76016 32 32 #include "ImageBuffer.h" 33 33 #include "IntRect.h" 34 #include "RoundedIntRect.h"35 34 36 35 using namespace std; … … 538 537 } 539 538 540 void GraphicsContext::addRoundedRectClip(const RoundedIntRect& rect) 539 void GraphicsContext::addRoundedRectClip(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, 540 const IntSize& bottomLeft, const IntSize& bottomRight) 541 541 { 542 542 if (paintingDisabled()) … … 544 544 545 545 Path path; 546 path.addRoundedRect(rect .rect(), rect.radii().topLeft(), rect.radii().topRight(), rect.radii().bottomLeft(), rect.radii().bottomRight());546 path.addRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight); 547 547 clip(path); 548 548 } 549 549 550 void GraphicsContext::clipOutRoundedRect(const RoundedIntRect& rect) 550 void GraphicsContext::clipOutRoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, 551 const IntSize& bottomLeft, const IntSize& bottomRight) 551 552 { 552 553 if (paintingDisabled()) … … 554 555 555 556 Path path; 556 path.addRoundedRect(rect .rect(), rect.radii().topLeft(), rect.radii().topRight(), rect.radii().bottomLeft(), rect.radii().bottomRight());557 path.addRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight); 557 558 clipOut(path); 558 559 } … … 583 584 return; 584 585 generator.fill(this, rect); 585 }586 587 void GraphicsContext::fillRoundedRect(const RoundedIntRect& rect, const Color& color, ColorSpace colorSpace)588 {589 fillRoundedRect(rect.rect(), rect.radii().topLeft(), rect.radii().topRight(), rect.radii().bottomLeft(), rect.radii().bottomRight(), color, colorSpace);590 586 } 591 587 -
trunk/Source/WebCore/platform/graphics/GraphicsContext.h
r76004 r76016 121 121 class ImageBuffer; 122 122 class IntRect; 123 class RoundedIntRect;124 123 class KURL; 125 124 class SharedGraphicsContext3D; … … 284 283 void fillRect(const FloatRect&, Generator&); 285 284 void fillRoundedRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color&, ColorSpace); 286 void fillRoundedRect(const RoundedIntRect&, const Color&, ColorSpace);287 285 288 286 void clearRect(const FloatRect&); … … 313 311 314 312 void clip(const FloatRect&); 315 void addRoundedRectClip(const RoundedIntRect&);313 void addRoundedRectClip(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight); 316 314 void addInnerRoundedRectClip(const IntRect&, int thickness); 317 315 void clipOut(const IntRect&); 318 void clipOutRoundedRect(const RoundedIntRect&);316 void clipOutRoundedRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight); 319 317 void clipPath(const Path&, WindRule); 320 318 void clipConvexPolygon(size_t numPoints, const FloatPoint*, bool antialias = true); -
trunk/Source/WebCore/rendering/RenderBox.cpp
r76004 r76016 1068 1068 IntRect clipRect(isControlClip ? controlClipRect(tx, ty) : overflowClipRect(tx, ty)); 1069 1069 paintInfo.context->save(); 1070 if (style()->hasBorderRadius()) 1071 paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(IntRect(tx, ty, width(), height()))); 1070 if (style()->hasBorderRadius()) { 1071 IntSize topLeft, topRight, bottomLeft, bottomRight; 1072 IntRect borderRect = IntRect(tx, ty, width(), height()); 1073 style()->getBorderRadiiForRect(borderRect, topLeft, topRight, bottomLeft, bottomRight); 1074 1075 paintInfo.context->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); 1076 } 1077 1072 1078 paintInfo.context->clip(clipRect); 1073 1079 return true; -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r76011 r76016 548 548 context->save(); 549 549 550 RoundedIntRect border = style()->getRoundedBorderFor(borderRect); 551 border.excludeLogicalEdges(box && box->isHorizontal(), !includeLeftEdge, !includeRightEdge); 552 context->addRoundedRectClip(border); 550 IntSize topLeft, topRight, bottomLeft, bottomRight; 551 style()->getBorderRadiiForRect(borderRect, topLeft, topRight, bottomLeft, bottomRight); 552 553 if (!includeLeftEdge) { 554 topLeft = IntSize(); 555 if (box->isHorizontal()) 556 bottomLeft = IntSize(); 557 else 558 topRight = IntSize(); 559 } 560 561 if (!includeRightEdge) { 562 if (box->isHorizontal()) 563 topRight = IntSize(); 564 else 565 bottomLeft = IntSize(); 566 bottomRight = IntSize(); 567 } 568 569 context->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); 553 570 clippedToBorderRadius = true; 554 571 } … … 1008 1025 bool renderBottom = bottomStyle > BHIDDEN && !bottomTransparent && (horizontal || includeLogicalRightEdge); 1009 1026 1027 bool renderRadii = false; 1010 1028 Path roundedPath; 1011 RoundedIntRect border(tx, ty, w, h); 1029 IntSize topLeft, topRight, bottomLeft, bottomRight; 1030 IntRect borderRect(tx, ty, w, h); 1012 1031 1013 1032 if (style->hasBorderRadius()) { 1014 border.includeLogicalEdges(style->getRoundedBorderFor(border.rect()).radii(),1015 horizontal, includeLogicalLeftEdge, includeLogicalRightEdge);1033 IntSize topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius; 1034 style->getBorderRadiiForRect(borderRect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); 1016 1035 1017 1036 int leftWidth = (!horizontal || includeLogicalLeftEdge) ? style->borderLeftWidth() : 0; … … 1020 1039 int bottomWidth = (horizontal || includeLogicalRightEdge) ? style->borderBottomWidth() : 0; 1021 1040 1022 RoundedIntRect inner(borderInnerRect(border.rect(), topWidth, bottomWidth, leftWidth, rightWidth)); 1023 inner.includeLogicalEdges(style->getRoundedInnerBorderWithBorderWidths(inner.rect(), topWidth, bottomWidth, leftWidth, rightWidth).radii(), 1024 horizontal, includeLogicalLeftEdge, includeLogicalRightEdge); 1025 1026 if (border.isRounded()) { 1041 IntRect innerBorderRect = borderInnerRect(borderRect, topWidth, bottomWidth, leftWidth, rightWidth); 1042 IntSize innerTopLeftRadius, innerTopRightRadius, innerBottomLeftRadius, innerBottomRightRadius; 1043 1044 style->getInnerBorderRadiiForRectWithBorderWidths(innerBorderRect, topWidth, bottomWidth, leftWidth, rightWidth, innerTopLeftRadius, innerTopRightRadius, innerBottomLeftRadius, innerBottomRightRadius); 1045 1046 IntSize innerTopLeft, innerTopRight, innerBottomLeft, innerBottomRight; 1047 1048 if (includeLogicalLeftEdge) { 1049 topLeft = topLeftRadius; 1050 innerTopLeft = innerTopLeftRadius; 1051 if (horizontal) { 1052 bottomLeft = bottomLeftRadius; 1053 innerBottomLeft = innerBottomLeftRadius; 1054 } else { 1055 topRight = topRightRadius; 1056 innerTopRight = innerTopRightRadius; 1057 } 1058 } 1059 1060 if (includeLogicalRightEdge) { 1061 if (horizontal) { 1062 topRight = topRightRadius; 1063 innerTopRight = innerTopRightRadius; 1064 } else { 1065 bottomLeft = bottomLeftRadius; 1066 innerBottomLeft = innerBottomLeftRadius; 1067 } 1068 bottomRight = bottomRightRadius; 1069 innerBottomRight = innerBottomRightRadius; 1070 } 1071 1072 renderRadii = !topLeft.isZero() || !topRight.isZero() || !bottomLeft.isZero() || !bottomRight.isZero(); 1073 1074 if (renderRadii) { 1027 1075 // Clip to the inner and outer radii rects. 1028 1076 graphicsContext->save(); 1029 graphicsContext->addRoundedRectClip(border); 1030 graphicsContext->clipOutRoundedRect(inner); 1031 roundedPath.addRoundedRect(border.rect(), border.radii().topLeft(), border.radii().topRight(), border.radii().bottomLeft(), border.radii().bottomRight()); 1032 } 1033 } 1034 1035 bool renderRadii = border.isRounded(); 1077 graphicsContext->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); 1078 graphicsContext->clipOutRoundedRect(innerBorderRect, innerTopLeft, innerTopRight, innerBottomLeft, innerBottomRight); 1079 roundedPath.addRoundedRect(borderRect, topLeft, topRight, bottomLeft, bottomRight); 1080 } 1081 } 1082 1036 1083 bool upperLeftBorderStylesMatch = renderLeft && (topStyle == leftStyle) && (topColor == leftColor); 1037 1084 bool upperRightBorderStylesMatch = renderRight && (topStyle == rightStyle) && (topColor == rightColor) && (topStyle != OUTSET) && (topStyle != RIDGE) && (topStyle != INSET) && (topStyle != GROOVE); … … 1043 1090 int x2 = tx + w; 1044 1091 1045 if (renderRadii && borderWillArcInnerEdge( border.radii().topLeft(), border.radii().topRight(), style->borderLeftWidth(), style->borderRightWidth(), style->borderTopWidth())) {1092 if (renderRadii && borderWillArcInnerEdge(topLeft, topRight, style->borderLeftWidth(), style->borderRightWidth(), style->borderTopWidth())) { 1046 1093 graphicsContext->save(); 1047 clipBorderSidePolygon(graphicsContext, border , BSTop, upperLeftBorderStylesMatch, upperRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge);1094 clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSTop, upperLeftBorderStylesMatch, upperRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); 1048 1095 float thickness = max(max(style->borderTopWidth(), style->borderLeftWidth()), style->borderRightWidth()); 1049 drawBoxSideFromPath(graphicsContext, border .rect(), roundedPath, style->borderTopWidth(), thickness, BSTop, style, topColor, topStyle);1096 drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderTopWidth(), thickness, BSTop, style, topColor, topStyle); 1050 1097 graphicsContext->restore(); 1051 1098 } else { … … 1064 1111 int x2 = tx + w; 1065 1112 1066 if (renderRadii && borderWillArcInnerEdge(bo rder.radii().bottomLeft(), border.radii().bottomRight(), style->borderLeftWidth(), style->borderRightWidth(), style->borderBottomWidth())) {1113 if (renderRadii && borderWillArcInnerEdge(bottomLeft, bottomRight, style->borderLeftWidth(), style->borderRightWidth(), style->borderBottomWidth())) { 1067 1114 graphicsContext->save(); 1068 clipBorderSidePolygon(graphicsContext, border , BSBottom, lowerLeftBorderStylesMatch, lowerRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge);1115 clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSBottom, lowerLeftBorderStylesMatch, lowerRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); 1069 1116 float thickness = max(max(style->borderBottomWidth(), style->borderLeftWidth()), style->borderRightWidth()); 1070 drawBoxSideFromPath(graphicsContext, border .rect(), roundedPath, style->borderBottomWidth(), thickness, BSBottom, style, bottomColor, bottomStyle);1117 drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderBottomWidth(), thickness, BSBottom, style, bottomColor, bottomStyle); 1071 1118 graphicsContext->restore(); 1072 1119 } else { … … 1087 1134 int y2 = ty + h; 1088 1135 1089 if (renderRadii && borderWillArcInnerEdge(bo rder.radii().bottomLeft(), border.radii().topLeft(), style->borderBottomWidth(), style->borderTopWidth(), style->borderLeftWidth())) {1136 if (renderRadii && borderWillArcInnerEdge(bottomLeft, topLeft, style->borderBottomWidth(), style->borderTopWidth(), style->borderLeftWidth())) { 1090 1137 graphicsContext->save(); 1091 clipBorderSidePolygon(graphicsContext, border , BSLeft, upperLeftBorderStylesMatch, lowerLeftBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge);1138 clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSLeft, upperLeftBorderStylesMatch, lowerLeftBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); 1092 1139 float thickness = max(max(style->borderLeftWidth(), style->borderTopWidth()), style->borderBottomWidth()); 1093 drawBoxSideFromPath(graphicsContext, border .rect(), roundedPath, style->borderLeftWidth(), thickness, BSLeft, style, leftColor, leftStyle);1140 drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderLeftWidth(), thickness, BSLeft, style, leftColor, leftStyle); 1094 1141 graphicsContext->restore(); 1095 1142 } else { … … 1106 1153 1107 1154 if (renderRight) { 1108 if (renderRadii && borderWillArcInnerEdge(bo rder.radii().bottomRight(), border.radii().topRight(), style->borderBottomWidth(), style->borderTopWidth(), style->borderRightWidth())) {1155 if (renderRadii && borderWillArcInnerEdge(bottomRight, topRight, style->borderBottomWidth(), style->borderTopWidth(), style->borderRightWidth())) { 1109 1156 graphicsContext->save(); 1110 clipBorderSidePolygon(graphicsContext, border , BSRight, upperRightBorderStylesMatch, lowerRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge);1157 clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSRight, upperRightBorderStylesMatch, lowerRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); 1111 1158 float thickness = max(max(style->borderRightWidth(), style->borderTopWidth()), style->borderBottomWidth()); 1112 drawBoxSideFromPath(graphicsContext, border .rect(), roundedPath, style->borderRightWidth(), thickness, BSRight, style, rightColor, rightStyle);1159 drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderRightWidth(), thickness, BSRight, style, rightColor, rightStyle); 1113 1160 graphicsContext->restore(); 1114 1161 } else { … … 1163 1210 bool renderBottom = bottomStyle > BHIDDEN && !bottomTransparent && (horizontal || includeLogicalRightEdge); 1164 1211 1165 1166 RoundedIntRect border(tx, ty, w, h); 1212 bool renderRadii = false; 1213 IntSize topLeft, topRight, bottomLeft, bottomRight; 1214 1167 1215 if (style->hasBorderRadius()) { 1168 border.includeLogicalEdges(style->getRoundedBorderFor(border.rect()).radii(), 1169 horizontal, includeLogicalLeftEdge, includeLogicalRightEdge); 1170 if (border.isRounded()) { 1216 IntRect borderRect = IntRect(tx, ty, w, h); 1217 1218 IntSize topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius; 1219 style->getBorderRadiiForRect(borderRect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); 1220 1221 if (includeLogicalLeftEdge) { 1222 topLeft = topLeftRadius; 1223 if (horizontal) 1224 bottomLeft = bottomLeftRadius; 1225 else 1226 topRight = topRightRadius; 1227 } 1228 1229 if (includeLogicalRightEdge) { 1230 if (horizontal) 1231 topRight = topRightRadius; 1232 else 1233 bottomLeft = bottomLeftRadius; 1234 bottomRight = bottomRightRadius; 1235 } 1236 1237 renderRadii = !topLeft.isZero() || !topRight.isZero() || !bottomLeft.isZero() || !bottomRight.isZero(); 1238 1239 if (renderRadii) { 1240 // Clip to the rounded rectangle. 1171 1241 graphicsContext->save(); 1172 graphicsContext->addRoundedRectClip(border );1242 graphicsContext->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); 1173 1243 } 1174 1244 } … … 1176 1246 int firstAngleStart, secondAngleStart, firstAngleSpan, secondAngleSpan; 1177 1247 float thickness; 1178 bool renderRadii = border.isRounded();1179 1248 bool upperLeftBorderStylesMatch = renderLeft && (topStyle == leftStyle) && (topColor == leftColor); 1180 1249 bool upperRightBorderStylesMatch = renderRight && (topStyle == rightStyle) && (topColor == rightColor) && (topStyle != OUTSET) && (topStyle != RIDGE) && (topStyle != INSET) && (topStyle != GROOVE); … … 1183 1252 1184 1253 if (renderTop) { 1185 bool ignore Left = (renderRadii && border.radii().topLeft().width() > 0)1186 || (topColor == leftColor && topTransparent == leftTransparent && topStyle >= OUTSET1187 &&(leftStyle == DOTTED || leftStyle == DASHED || leftStyle == SOLID || leftStyle == OUTSET));1188 1189 bool ignore Right = (renderRadii && border.radii().topRight().width() > 0)1190 || (topColor == rightColor && topTransparent == rightTransparent && topStyle >= OUTSET1191 &&(rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET));1254 bool ignore_left = (renderRadii && topLeft.width() > 0) || 1255 (topColor == leftColor && topTransparent == leftTransparent && topStyle >= OUTSET && 1256 (leftStyle == DOTTED || leftStyle == DASHED || leftStyle == SOLID || leftStyle == OUTSET)); 1257 1258 bool ignore_right = (renderRadii && topRight.width() > 0) || 1259 (topColor == rightColor && topTransparent == rightTransparent && topStyle >= OUTSET && 1260 (rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET)); 1192 1261 1193 1262 int x = tx; 1194 1263 int x2 = tx + w; 1195 1264 if (renderRadii) { 1196 x += border.radii().topLeft().width();1197 x2 -= border.radii().topRight().width();1265 x += topLeft.width(); 1266 x2 -= topRight.width(); 1198 1267 } 1199 1268 1200 1269 drawLineForBoxSide(graphicsContext, x, ty, x2, ty + style->borderTopWidth(), BSTop, topColor, topStyle, 1201 ignore Left ? 0 : style->borderLeftWidth(), ignoreRight ? 0 : style->borderRightWidth());1270 ignore_left ? 0 : style->borderLeftWidth(), ignore_right ? 0 : style->borderRightWidth()); 1202 1271 1203 1272 if (renderRadii) { … … 1209 1278 thickness = style->borderTopWidth() * 2; 1210 1279 1211 if ( border.radii().topLeft().width()) {1280 if (topLeft.width()) { 1212 1281 int leftX = tx; 1213 1282 // The inner clip clips inside the arc. This is especially important for 1px borders. 1214 bool applyLeftInnerClip = (style->borderLeftWidth() < border.radii().topLeft().width())1215 && (style->borderTopWidth() < border.radii().topLeft().height())1283 bool applyLeftInnerClip = (style->borderLeftWidth() < topLeft.width()) 1284 && (style->borderTopWidth() < topLeft.height()) 1216 1285 && (topStyle != DOUBLE || style->borderTopWidth() > 6); 1217 1286 if (applyLeftInnerClip) { 1218 1287 graphicsContext->save(); 1219 graphicsContext->addInnerRoundedRectClip(IntRect(leftX, leftY, border.radii().topLeft().width() * 2, border.radii().topLeft().height() * 2),1288 graphicsContext->addInnerRoundedRectClip(IntRect(leftX, leftY, topLeft.width() * 2, topLeft.height() * 2), 1220 1289 style->borderTopWidth()); 1221 1290 } … … 1225 1294 1226 1295 // Draw upper left arc 1227 drawArcForBoxSide(graphicsContext, leftX, leftY, thickness, border.radii().topLeft(), firstAngleStart, firstAngleSpan,1296 drawArcForBoxSide(graphicsContext, leftX, leftY, thickness, topLeft, firstAngleStart, firstAngleSpan, 1228 1297 BSTop, topColor, topStyle, true); 1229 1298 if (applyLeftInnerClip) … … 1231 1300 } 1232 1301 1233 if ( border.radii().topRight().width()) {1234 int rightX = tx + w - border.radii().topRight().width() * 2;1235 bool applyRightInnerClip = (style->borderRightWidth() < border.radii().topRight().width())1236 && (style->borderTopWidth() < border.radii().topRight().height())1302 if (topRight.width()) { 1303 int rightX = tx + w - topRight.width() * 2; 1304 bool applyRightInnerClip = (style->borderRightWidth() < topRight.width()) 1305 && (style->borderTopWidth() < topRight.height()) 1237 1306 && (topStyle != DOUBLE || style->borderTopWidth() > 6); 1238 1307 if (applyRightInnerClip) { 1239 1308 graphicsContext->save(); 1240 graphicsContext->addInnerRoundedRectClip(IntRect(rightX, leftY, border.radii().topRight().width() * 2, border.radii().topRight().height() * 2),1309 graphicsContext->addInnerRoundedRectClip(IntRect(rightX, leftY, topRight.width() * 2, topRight.height() * 2), 1241 1310 style->borderTopWidth()); 1242 1311 } … … 1251 1320 1252 1321 // Draw upper right arc 1253 drawArcForBoxSide(graphicsContext, rightX, leftY, thickness, border.radii().topRight(), secondAngleStart, secondAngleSpan,1322 drawArcForBoxSide(graphicsContext, rightX, leftY, thickness, topRight, secondAngleStart, secondAngleSpan, 1254 1323 BSTop, topColor, topStyle, false); 1255 1324 if (applyRightInnerClip) … … 1260 1329 1261 1330 if (renderBottom) { 1262 bool ignore Left = (renderRadii && border.radii().bottomLeft().width() > 0)1263 || (bottomColor == leftColor && bottomTransparent == leftTransparent && bottomStyle >= OUTSET1264 &&(leftStyle == DOTTED || leftStyle == DASHED || leftStyle == SOLID || leftStyle == OUTSET));1265 1266 bool ignore Right = (renderRadii && border.radii().bottomRight().width() > 0)1267 || (bottomColor == rightColor && bottomTransparent == rightTransparent && bottomStyle >= OUTSET1268 &&(rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET));1331 bool ignore_left = (renderRadii && bottomLeft.width() > 0) || 1332 (bottomColor == leftColor && bottomTransparent == leftTransparent && bottomStyle >= OUTSET && 1333 (leftStyle == DOTTED || leftStyle == DASHED || leftStyle == SOLID || leftStyle == OUTSET)); 1334 1335 bool ignore_right = (renderRadii && bottomRight.width() > 0) || 1336 (bottomColor == rightColor && bottomTransparent == rightTransparent && bottomStyle >= OUTSET && 1337 (rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET)); 1269 1338 1270 1339 int x = tx; 1271 1340 int x2 = tx + w; 1272 1341 if (renderRadii) { 1273 x += bo rder.radii().bottomLeft().width();1274 x2 -= bo rder.radii().bottomRight().width();1342 x += bottomLeft.width(); 1343 x2 -= bottomRight.width(); 1275 1344 } 1276 1345 1277 1346 drawLineForBoxSide(graphicsContext, x, ty + h - style->borderBottomWidth(), x2, ty + h, BSBottom, bottomColor, bottomStyle, 1278 ignore Left ? 0 : style->borderLeftWidth(), ignoreRight ? 0 : style->borderRightWidth());1347 ignore_left ? 0 : style->borderLeftWidth(), ignore_right ? 0 : style->borderRightWidth()); 1279 1348 1280 1349 if (renderRadii) { 1281 1350 thickness = style->borderBottomWidth() * 2; 1282 1351 1283 if (bo rder.radii().bottomLeft().width()) {1352 if (bottomLeft.width()) { 1284 1353 int leftX = tx; 1285 int leftY = ty + h - bo rder.radii().bottomLeft().height() * 2;1286 bool applyLeftInnerClip = (style->borderLeftWidth() < bo rder.radii().bottomLeft().width())1287 && (style->borderBottomWidth() < bo rder.radii().bottomLeft().height())1354 int leftY = ty + h - bottomLeft.height() * 2; 1355 bool applyLeftInnerClip = (style->borderLeftWidth() < bottomLeft.width()) 1356 && (style->borderBottomWidth() < bottomLeft.height()) 1288 1357 && (bottomStyle != DOUBLE || style->borderBottomWidth() > 6); 1289 1358 if (applyLeftInnerClip) { 1290 1359 graphicsContext->save(); 1291 graphicsContext->addInnerRoundedRectClip(IntRect(leftX, leftY, bo rder.radii().bottomLeft().width() * 2, border.radii().bottomLeft().height() * 2),1360 graphicsContext->addInnerRoundedRectClip(IntRect(leftX, leftY, bottomLeft.width() * 2, bottomLeft.height() * 2), 1292 1361 style->borderBottomWidth()); 1293 1362 } … … 1302 1371 1303 1372 // Draw lower left arc 1304 drawArcForBoxSide(graphicsContext, leftX, leftY, thickness, bo rder.radii().bottomLeft(), firstAngleStart, firstAngleSpan,1373 drawArcForBoxSide(graphicsContext, leftX, leftY, thickness, bottomLeft, firstAngleStart, firstAngleSpan, 1305 1374 BSBottom, bottomColor, bottomStyle, true); 1306 1375 if (applyLeftInnerClip) … … 1308 1377 } 1309 1378 1310 if (bo rder.radii().bottomRight().width()) {1311 int rightY = ty + h - bo rder.radii().bottomRight().height() * 2;1312 int rightX = tx + w - bo rder.radii().bottomRight().width() * 2;1313 bool applyRightInnerClip = (style->borderRightWidth() < bo rder.radii().bottomRight().width())1314 && (style->borderBottomWidth() < bo rder.radii().bottomRight().height())1379 if (bottomRight.width()) { 1380 int rightY = ty + h - bottomRight.height() * 2; 1381 int rightX = tx + w - bottomRight.width() * 2; 1382 bool applyRightInnerClip = (style->borderRightWidth() < bottomRight.width()) 1383 && (style->borderBottomWidth() < bottomRight.height()) 1315 1384 && (bottomStyle != DOUBLE || style->borderBottomWidth() > 6); 1316 1385 if (applyRightInnerClip) { 1317 1386 graphicsContext->save(); 1318 graphicsContext->addInnerRoundedRectClip(IntRect(rightX, rightY, bo rder.radii().bottomRight().width() * 2, border.radii().bottomRight().height() * 2),1387 graphicsContext->addInnerRoundedRectClip(IntRect(rightX, rightY, bottomRight.width() * 2, bottomRight.height() * 2), 1319 1388 style->borderBottomWidth()); 1320 1389 } … … 1324 1393 1325 1394 // Draw lower right arc 1326 drawArcForBoxSide(graphicsContext, rightX, rightY, thickness, bo rder.radii().bottomRight(), secondAngleStart, secondAngleSpan,1395 drawArcForBoxSide(graphicsContext, rightX, rightY, thickness, bottomRight, secondAngleStart, secondAngleSpan, 1327 1396 BSBottom, bottomColor, bottomStyle, false); 1328 1397 if (applyRightInnerClip) … … 1333 1402 1334 1403 if (renderLeft) { 1335 bool ignore Top = (renderRadii && border.radii().topLeft().height() > 0)1336 || (topColor == leftColor && topTransparent == leftTransparent && leftStyle >= OUTSET1337 &&(topStyle == DOTTED || topStyle == DASHED || topStyle == SOLID || topStyle == OUTSET));1338 1339 bool ignore Bottom = (renderRadii && border.radii().bottomLeft().height() > 0)1340 || (bottomColor == leftColor && bottomTransparent == leftTransparent && leftStyle >= OUTSET1341 &&(bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET));1404 bool ignore_top = (renderRadii && topLeft.height() > 0) || 1405 (topColor == leftColor && topTransparent == leftTransparent && leftStyle >= OUTSET && 1406 (topStyle == DOTTED || topStyle == DASHED || topStyle == SOLID || topStyle == OUTSET)); 1407 1408 bool ignore_bottom = (renderRadii && bottomLeft.height() > 0) || 1409 (bottomColor == leftColor && bottomTransparent == leftTransparent && leftStyle >= OUTSET && 1410 (bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET)); 1342 1411 1343 1412 int y = ty; 1344 1413 int y2 = ty + h; 1345 1414 if (renderRadii) { 1346 y += border.radii().topLeft().height();1347 y2 -= bo rder.radii().bottomLeft().height();1415 y += topLeft.height(); 1416 y2 -= bottomLeft.height(); 1348 1417 } 1349 1418 1350 1419 drawLineForBoxSide(graphicsContext, tx, y, tx + style->borderLeftWidth(), y2, BSLeft, leftColor, leftStyle, 1351 ignore Top ? 0 : style->borderTopWidth(), ignoreBottom ? 0 : style->borderBottomWidth());1420 ignore_top ? 0 : style->borderTopWidth(), ignore_bottom ? 0 : style->borderBottomWidth()); 1352 1421 1353 1422 if (renderRadii && (!upperLeftBorderStylesMatch || !lowerLeftBorderStylesMatch)) { … … 1355 1424 thickness = style->borderLeftWidth() * 2; 1356 1425 1357 if (!upperLeftBorderStylesMatch && border.radii().topLeft().width()) {1426 if (!upperLeftBorderStylesMatch && topLeft.width()) { 1358 1427 int topY = ty; 1359 bool applyTopInnerClip = (style->borderLeftWidth() < border.radii().topLeft().width())1360 && (style->borderTopWidth() < border.radii().topLeft().height())1428 bool applyTopInnerClip = (style->borderLeftWidth() < topLeft.width()) 1429 && (style->borderTopWidth() < topLeft.height()) 1361 1430 && (leftStyle != DOUBLE || style->borderLeftWidth() > 6); 1362 1431 if (applyTopInnerClip) { 1363 1432 graphicsContext->save(); 1364 graphicsContext->addInnerRoundedRectClip(IntRect(topX, topY, border.radii().topLeft().width() * 2, border.radii().topLeft().height() * 2),1433 graphicsContext->addInnerRoundedRectClip(IntRect(topX, topY, topLeft.width() * 2, topLeft.height() * 2), 1365 1434 style->borderLeftWidth()); 1366 1435 } … … 1370 1439 1371 1440 // Draw top left arc 1372 drawArcForBoxSide(graphicsContext, topX, topY, thickness, border.radii().topLeft(), firstAngleStart, firstAngleSpan,1441 drawArcForBoxSide(graphicsContext, topX, topY, thickness, topLeft, firstAngleStart, firstAngleSpan, 1373 1442 BSLeft, leftColor, leftStyle, true); 1374 1443 if (applyTopInnerClip) … … 1376 1445 } 1377 1446 1378 if (!lowerLeftBorderStylesMatch && bo rder.radii().bottomLeft().width()) {1379 int bottomY = ty + h - bo rder.radii().bottomLeft().height() * 2;1380 bool applyBottomInnerClip = (style->borderLeftWidth() < bo rder.radii().bottomLeft().width())1381 && (style->borderBottomWidth() < bo rder.radii().bottomLeft().height())1447 if (!lowerLeftBorderStylesMatch && bottomLeft.width()) { 1448 int bottomY = ty + h - bottomLeft.height() * 2; 1449 bool applyBottomInnerClip = (style->borderLeftWidth() < bottomLeft.width()) 1450 && (style->borderBottomWidth() < bottomLeft.height()) 1382 1451 && (leftStyle != DOUBLE || style->borderLeftWidth() > 6); 1383 1452 if (applyBottomInnerClip) { 1384 1453 graphicsContext->save(); 1385 graphicsContext->addInnerRoundedRectClip(IntRect(topX, bottomY, bo rder.radii().bottomLeft().width() * 2, border.radii().bottomLeft().height() * 2),1454 graphicsContext->addInnerRoundedRectClip(IntRect(topX, bottomY, bottomLeft.width() * 2, bottomLeft.height() * 2), 1386 1455 style->borderLeftWidth()); 1387 1456 } … … 1391 1460 1392 1461 // Draw bottom left arc 1393 drawArcForBoxSide(graphicsContext, topX, bottomY, thickness, bo rder.radii().bottomLeft(), secondAngleStart, secondAngleSpan,1462 drawArcForBoxSide(graphicsContext, topX, bottomY, thickness, bottomLeft, secondAngleStart, secondAngleSpan, 1394 1463 BSLeft, leftColor, leftStyle, false); 1395 1464 if (applyBottomInnerClip) … … 1400 1469 1401 1470 if (renderRight) { 1402 bool ignore Top = (renderRadii && border.radii().topRight().height() > 0)1403 || ((topColor == rightColor) && (topTransparent == rightTransparent)1404 && (rightStyle >= DOTTED || rightStyle == INSET)1405 &&(topStyle == DOTTED || topStyle == DASHED || topStyle == SOLID || topStyle == OUTSET));1406 1407 bool ignore Bottom = (renderRadii && border.radii().bottomRight().height() > 0)1408 || ((bottomColor == rightColor) && (bottomTransparent == rightTransparent)1409 && (rightStyle >= DOTTED || rightStyle == INSET)1410 &&(bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET));1471 bool ignore_top = (renderRadii && topRight.height() > 0) || 1472 ((topColor == rightColor) && (topTransparent == rightTransparent) && 1473 (rightStyle >= DOTTED || rightStyle == INSET) && 1474 (topStyle == DOTTED || topStyle == DASHED || topStyle == SOLID || topStyle == OUTSET)); 1475 1476 bool ignore_bottom = (renderRadii && bottomRight.height() > 0) || 1477 ((bottomColor == rightColor) && (bottomTransparent == rightTransparent) && 1478 (rightStyle >= DOTTED || rightStyle == INSET) && 1479 (bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET)); 1411 1480 1412 1481 int y = ty; 1413 1482 int y2 = ty + h; 1414 1483 if (renderRadii) { 1415 y += border.radii().topRight().height();1416 y2 -= bo rder.radii().bottomRight().height();1484 y += topRight.height(); 1485 y2 -= bottomRight.height(); 1417 1486 } 1418 1487 1419 1488 drawLineForBoxSide(graphicsContext, tx + w - style->borderRightWidth(), y, tx + w, y2, BSRight, rightColor, rightStyle, 1420 ignore Top ? 0 : style->borderTopWidth(), ignoreBottom ? 0 : style->borderBottomWidth());1489 ignore_top ? 0 : style->borderTopWidth(), ignore_bottom ? 0 : style->borderBottomWidth()); 1421 1490 1422 1491 if (renderRadii && (!upperRightBorderStylesMatch || !lowerRightBorderStylesMatch)) { 1423 1492 thickness = style->borderRightWidth() * 2; 1424 1493 1425 if (!upperRightBorderStylesMatch && border.radii().topRight().width()) {1426 int topX = tx + w - border.radii().topRight().width() * 2;1494 if (!upperRightBorderStylesMatch && topRight.width()) { 1495 int topX = tx + w - topRight.width() * 2; 1427 1496 int topY = ty; 1428 bool applyTopInnerClip = (style->borderRightWidth() < border.radii().topRight().width())1429 && (style->borderTopWidth() < border.radii().topRight().height())1497 bool applyTopInnerClip = (style->borderRightWidth() < topRight.width()) 1498 && (style->borderTopWidth() < topRight.height()) 1430 1499 && (rightStyle != DOUBLE || style->borderRightWidth() > 6); 1431 1500 if (applyTopInnerClip) { 1432 1501 graphicsContext->save(); 1433 graphicsContext->addInnerRoundedRectClip(IntRect(topX, topY, border.radii().topRight().width() * 2, border.radii().topRight().height() * 2),1502 graphicsContext->addInnerRoundedRectClip(IntRect(topX, topY, topRight.width() * 2, topRight.height() * 2), 1434 1503 style->borderRightWidth()); 1435 1504 } … … 1439 1508 1440 1509 // Draw top right arc 1441 drawArcForBoxSide(graphicsContext, topX, topY, thickness, border.radii().topRight(), firstAngleStart, firstAngleSpan,1510 drawArcForBoxSide(graphicsContext, topX, topY, thickness, topRight, firstAngleStart, firstAngleSpan, 1442 1511 BSRight, rightColor, rightStyle, true); 1443 1512 if (applyTopInnerClip) … … 1445 1514 } 1446 1515 1447 if (!lowerRightBorderStylesMatch && bo rder.radii().bottomRight().width()) {1448 int bottomX = tx + w - bo rder.radii().bottomRight().width() * 2;1449 int bottomY = ty + h - bo rder.radii().bottomRight().height() * 2;1450 bool applyBottomInnerClip = (style->borderRightWidth() < bo rder.radii().bottomRight().width())1451 && (style->borderBottomWidth() < bo rder.radii().bottomRight().height())1516 if (!lowerRightBorderStylesMatch && bottomRight.width()) { 1517 int bottomX = tx + w - bottomRight.width() * 2; 1518 int bottomY = ty + h - bottomRight.height() * 2; 1519 bool applyBottomInnerClip = (style->borderRightWidth() < bottomRight.width()) 1520 && (style->borderBottomWidth() < bottomRight.height()) 1452 1521 && (rightStyle != DOUBLE || style->borderRightWidth() > 6); 1453 1522 if (applyBottomInnerClip) { 1454 1523 graphicsContext->save(); 1455 graphicsContext->addInnerRoundedRectClip(IntRect(bottomX, bottomY, bo rder.radii().bottomRight().width() * 2, border.radii().bottomRight().height() * 2),1524 graphicsContext->addInnerRoundedRectClip(IntRect(bottomX, bottomY, bottomRight.width() * 2, bottomRight.height() * 2), 1456 1525 style->borderRightWidth()); 1457 1526 } … … 1461 1530 1462 1531 // Draw bottom right arc 1463 drawArcForBoxSide(graphicsContext, bottomX, bottomY, thickness, bo rder.radii().bottomRight(), secondAngleStart, secondAngleSpan,1532 drawArcForBoxSide(graphicsContext, bottomX, bottomY, thickness, bottomRight, secondAngleStart, secondAngleSpan, 1464 1533 BSRight, rightColor, rightStyle, false); 1465 1534 if (applyBottomInnerClip) … … 1474 1543 #endif 1475 1544 1476 void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContext, const RoundedIntRect& border,1545 void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContext, const IntRect& box, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, 1477 1546 const BoxSide side, bool firstEdgeMatches, bool secondEdgeMatches, const RenderStyle* style, 1478 1547 bool includeLogicalLeftEdge, bool includeLogicalRightEdge) 1479 1548 { 1480 1549 FloatPoint quad[4]; 1481 int tx = bo rder.rect().x();1482 int ty = bo rder.rect().y();1483 int w = bo rder.rect().width();1484 int h = bo rder.rect().height();1550 int tx = box.x(); 1551 int ty = box.y(); 1552 int w = box.width(); 1553 int h = box.height(); 1485 1554 1486 1555 bool horizontal = style->isHorizontalWritingMode(); … … 1495 1564 case BSTop: 1496 1565 quad[0] = FloatPoint(tx, ty); 1497 quad[1] = FloatPoint(tx + max( border.radii().topLeft().width(), leftWidth), ty + max(border.radii().topLeft().height(), topWidth));1498 quad[2] = FloatPoint(tx + w - max( border.radii().topRight().width(), rightWidth), ty + max(border.radii().topRight().height(), topWidth));1566 quad[1] = FloatPoint(tx + max(topLeft.width(), leftWidth), ty + max(topLeft.height(), topWidth)); 1567 quad[2] = FloatPoint(tx + w - max(topRight.width(), rightWidth), ty + max(topRight.height(), topWidth)); 1499 1568 quad[3] = FloatPoint(tx + w, ty); 1500 1569 break; 1501 1570 case BSLeft: 1502 1571 quad[0] = FloatPoint(tx, ty); 1503 quad[1] = FloatPoint(tx + max( border.radii().topLeft().width(), leftWidth), ty + max(border.radii().topLeft().height(), topWidth));1504 quad[2] = FloatPoint(tx + max(bo rder.radii().bottomLeft().width(), leftWidth), ty + h - max(border.radii().bottomLeft().height(), bottomWidth));1572 quad[1] = FloatPoint(tx + max(topLeft.width(), leftWidth), ty + max(topLeft.height(), topWidth)); 1573 quad[2] = FloatPoint(tx + max(bottomLeft.width(), leftWidth), ty + h - max(bottomLeft.height(), bottomWidth)); 1505 1574 quad[3] = FloatPoint(tx, ty + h); 1506 1575 break; 1507 1576 case BSBottom: 1508 1577 quad[0] = FloatPoint(tx, ty + h); 1509 quad[1] = FloatPoint(tx + max(bo rder.radii().bottomLeft().width(), leftWidth), ty + h - max(border.radii().bottomLeft().height(), bottomWidth));1510 quad[2] = FloatPoint(tx + w - max(bo rder.radii().bottomRight().width(), rightWidth), ty + h - max(border.radii().bottomRight().height(), bottomWidth));1578 quad[1] = FloatPoint(tx + max(bottomLeft.width(), leftWidth), ty + h - max(bottomLeft.height(), bottomWidth)); 1579 quad[2] = FloatPoint(tx + w - max(bottomRight.width(), rightWidth), ty + h - max(bottomRight.height(), bottomWidth)); 1511 1580 quad[3] = FloatPoint(tx + w, ty + h); 1512 1581 break; 1513 1582 case BSRight: 1514 1583 quad[0] = FloatPoint(tx + w, ty); 1515 quad[1] = FloatPoint(tx + w - max( border.radii().topRight().width(), rightWidth), ty + max(border.radii().topRight().height(), topWidth));1516 quad[2] = FloatPoint(tx + w - max(bo rder.radii().bottomRight().width(), rightWidth), ty + h - max(border.radii().bottomRight().height(), bottomWidth));1584 quad[1] = FloatPoint(tx + w - max(topRight.width(), rightWidth), ty + max(topRight.height(), topWidth)); 1585 quad[2] = FloatPoint(tx + w - max(bottomRight.width(), rightWidth), ty + h - max(bottomRight.height(), bottomWidth)); 1517 1586 quad[3] = FloatPoint(tx + w, ty + h); 1518 1587 break; … … 1545 1614 } 1546 1615 1616 static inline void uniformlyExpandBorderRadii(int delta, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) 1617 { 1618 topLeft.expand(delta, delta); 1619 topLeft.clampNegativeToZero(); 1620 topRight.expand(delta, delta); 1621 topRight.clampNegativeToZero(); 1622 bottomLeft.expand(delta, delta); 1623 bottomLeft.clampNegativeToZero(); 1624 bottomRight.expand(delta, delta); 1625 bottomRight.clampNegativeToZero(); 1626 } 1627 1547 1628 void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int ty, int w, int h, const RenderStyle* s, ShadowStyle shadowStyle, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) 1548 1629 { … … 1552 1633 return; 1553 1634 1554 RoundedIntRect border(tx, ty, w, h); 1635 IntRect rect(tx, ty, w, h); 1636 IntSize topLeft; 1637 IntSize topRight; 1638 IntSize bottomLeft; 1639 IntSize bottomRight; 1640 1555 1641 bool hasBorderRadius = s->hasBorderRadius(); 1556 1642 bool isHorizontal = s->isHorizontalWritingMode(); 1557 1643 if (hasBorderRadius && (includeLogicalLeftEdge || includeLogicalRightEdge)) { 1558 border = (shadowStyle == Inset) ? s->getRoundedInnerBorderWithBorderWidths(border.rect(), borderTop(), borderBottom(), borderLeft(), borderRight()) : s->getRoundedBorderFor(border.rect()); 1559 border.includeLogicalEdges(border.radii(), isHorizontal, includeLogicalLeftEdge, includeLogicalRightEdge); 1560 } 1561 1562 if (shadowStyle == Inset) 1563 border.setRect(IntRect(border.rect().x() + (includeLogicalLeftEdge || !isHorizontal ? borderLeft() : 0), 1564 border.rect().y() + (includeLogicalLeftEdge || isHorizontal ? borderTop() : 0), 1565 border.rect().width() - ((includeLogicalLeftEdge || !isHorizontal) ? borderLeft() : 0) - ((includeLogicalRightEdge || !isHorizontal) ? borderRight() : 0), 1566 border.rect().height() - ((includeLogicalLeftEdge || isHorizontal) ? borderTop() : 0) - ((includeLogicalRightEdge || isHorizontal) ? borderBottom() : 0))); 1644 IntSize topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius; 1645 s->getBorderRadiiForRect(rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); 1646 1647 if (includeLogicalLeftEdge) { 1648 if (shadowStyle == Inset) { 1649 topLeftRadius.expand(-borderLeft(), -borderTop()); 1650 topLeftRadius.clampNegativeToZero(); 1651 if (isHorizontal) { 1652 bottomLeftRadius.expand(-borderLeft(), -borderBottom()); 1653 bottomLeftRadius.clampNegativeToZero(); 1654 } else { 1655 topRightRadius.expand(-borderRight(), -borderTop()); 1656 topRightRadius.clampNegativeToZero(); 1657 } 1658 } 1659 topLeft = topLeftRadius; 1660 if (isHorizontal) 1661 bottomLeft = bottomLeftRadius; 1662 else 1663 topRight = topRightRadius; 1664 } 1665 if (includeLogicalRightEdge) { 1666 if (shadowStyle == Inset) { 1667 if (isHorizontal) { 1668 topRightRadius.expand(-borderRight(), -borderTop()); 1669 topRightRadius.clampNegativeToZero(); 1670 } else { 1671 bottomLeftRadius.expand(-borderLeft(), -borderBottom()); 1672 bottomLeftRadius.clampNegativeToZero(); 1673 } 1674 bottomRightRadius.expand(-borderRight(), -borderBottom()); 1675 bottomRightRadius.clampNegativeToZero(); 1676 } 1677 if (isHorizontal) 1678 topRight = topRightRadius; 1679 else 1680 bottomLeft = bottomLeftRadius; 1681 bottomRight = bottomRightRadius; 1682 } 1683 } 1684 1685 if (shadowStyle == Inset) { 1686 rect.move(includeLogicalLeftEdge || !isHorizontal ? borderLeft() : 0, includeLogicalLeftEdge || isHorizontal ? borderTop() : 0); 1687 rect.setWidth(rect.width() - ((includeLogicalLeftEdge || !isHorizontal) ? borderLeft() : 0) - ((includeLogicalRightEdge || !isHorizontal) ? borderRight() : 0)); 1688 rect.setHeight(rect.height() - ((includeLogicalLeftEdge || isHorizontal) ? borderTop() : 0) - ((includeLogicalRightEdge || isHorizontal) ? borderBottom() : 0)); 1689 } 1567 1690 1568 1691 bool hasOpaqueBackground = s->visitedDependentColor(CSSPropertyBackgroundColor).isValid() && s->visitedDependentColor(CSSPropertyBackgroundColor).alpha() == 255; … … 1577 1700 1578 1701 if (shadow->style() == Normal) { 1579 RoundedIntRect fillRect = border;1702 IntRect fillRect(rect); 1580 1703 fillRect.inflate(shadowSpread); 1581 1704 if (fillRect.isEmpty()) 1582 1705 continue; 1583 1706 1584 IntRect shadowRect( border.rect());1707 IntRect shadowRect(rect); 1585 1708 shadowRect.inflate(shadowBlur + shadowSpread); 1586 1709 shadowRect.move(shadowOffset); … … 1597 1720 context->setShadow(shadowOffset, shadowBlur, shadowColor, s->colorSpace()); 1598 1721 if (hasBorderRadius) { 1599 RoundedIntRect rectToClipOut = border; 1722 IntRect rectToClipOut = rect; 1723 IntSize topLeftToClipOut = topLeft; 1724 IntSize topRightToClipOut = topRight; 1725 IntSize bottomLeftToClipOut = bottomLeft; 1726 IntSize bottomRightToClipOut = bottomRight; 1727 1728 IntSize topLeftToFill = topLeft; 1729 IntSize topRightToFill = topRight; 1730 IntSize bottomLeftToFill = bottomLeft; 1731 IntSize bottomRightToFill = bottomRight; 1732 if (shadowSpread < 0) 1733 uniformlyExpandBorderRadii(shadowSpread, topLeftToFill, topRightToFill, bottomLeftToFill, bottomRightToFill); 1600 1734 1601 1735 // If the box is opaque, it is unnecessary to clip it out. However, doing so saves time … … 1603 1737 // corners. Those are avoided by insetting the clipping path by one pixel. 1604 1738 if (hasOpaqueBackground) { 1605 rectToClipOut.inflateWithRadii(-1); 1739 rectToClipOut.inflate(-1); 1740 uniformlyExpandBorderRadii(-1, topLeftToClipOut, topRightToClipOut, bottomLeftToClipOut, bottomRightToClipOut); 1606 1741 } 1607 1742 1608 1743 if (!rectToClipOut.isEmpty()) 1609 context->clipOutRoundedRect(rectToClipOut); 1610 1611 if (shadowSpread < 0) 1612 fillRect.expandRadii(shadowSpread); 1613 context->fillRoundedRect(fillRect, Color::black, s->colorSpace()); 1744 context->clipOutRoundedRect(rectToClipOut, topLeftToClipOut, topRightToClipOut, bottomLeftToClipOut, bottomRightToClipOut); 1745 context->fillRoundedRect(fillRect, topLeftToFill, topRightToFill, bottomLeftToFill, bottomRightToFill, Color::black, s->colorSpace()); 1614 1746 } else { 1615 IntRect rectToClipOut = border.rect();1747 IntRect rectToClipOut = rect; 1616 1748 1617 1749 // If the box is opaque, it is unnecessary to clip it out. However, doing so saves time … … 1628 1760 if (!rectToClipOut.isEmpty()) 1629 1761 context->clipOut(rectToClipOut); 1630 context->fillRect(fillRect .rect(), Color::black, s->colorSpace());1762 context->fillRect(fillRect, Color::black, s->colorSpace()); 1631 1763 } 1632 1764 … … 1634 1766 } else { 1635 1767 // Inset shadow. 1636 IntRect holeRect( border.rect());1768 IntRect holeRect(rect); 1637 1769 holeRect.inflate(-shadowSpread); 1638 1770 1639 1771 if (holeRect.isEmpty()) { 1640 1772 if (hasBorderRadius) 1641 context->fillRoundedRect( border, shadowColor, s->colorSpace());1773 context->fillRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight, shadowColor, s->colorSpace()); 1642 1774 else 1643 context->fillRect( border.rect(), shadowColor, s->colorSpace());1775 context->fillRect(rect, shadowColor, s->colorSpace()); 1644 1776 continue; 1645 1777 } … … 1663 1795 Color fillColor(shadowColor.red(), shadowColor.green(), shadowColor.blue(), 255); 1664 1796 1665 IntRect outerRect( border.rect());1797 IntRect outerRect(rect); 1666 1798 outerRect.inflateX(w - 2 * shadowSpread); 1667 1799 outerRect.inflateY(h - 2 * shadowSpread); … … 1671 1803 Path path; 1672 1804 if (hasBorderRadius) { 1673 path.addRoundedRect( border.rect(), border.radii().topLeft(), border.radii().topRight(), border.radii().bottomLeft(), border.radii().bottomRight());1805 path.addRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight); 1674 1806 context->clip(path); 1675 1807 path.clear(); 1676 1808 } else 1677 context->clip( border.rect());1809 context->clip(rect); 1678 1810 1679 1811 IntSize extraOffset(2 * w + max(0, shadowOffset.width()) + shadowBlur - 2 * shadowSpread + 1, 0); … … 1685 1817 if (hasBorderRadius) { 1686 1818 if (shadowSpread > 0) 1687 border.shrinkRadii(shadowSpread);1688 path.addRoundedRect(holeRect, border.radii().topLeft(), border.radii().topRight(), border.radii().bottomLeft(), border.radii().bottomRight());1819 uniformlyExpandBorderRadii(-shadowSpread, topLeft, topRight, bottomLeft, bottomRight); 1820 path.addRoundedRect(holeRect, topLeft, topRight, bottomLeft, bottomRight); 1689 1821 } else 1690 1822 path.addRect(holeRect); -
trunk/Source/WebCore/rendering/RenderBoxModelObject.h
r76004 r76016 135 135 IntSize calculateFillTileSize(const FillLayer*, IntSize scaledSize) const; 136 136 137 void clipBorderSidePolygon(GraphicsContext*, const RoundedIntRect& border,138 const BoxSide, bool firstEdgeMatches, bool secondEdgeMatches, const RenderStyle*,137 void clipBorderSidePolygon(GraphicsContext*, const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, 138 const IntSize& bottomRight, const BoxSide side, bool firstEdgeMatches, bool secondEdgeMatches, const RenderStyle* style, 139 139 bool includeLogicalLeftEdge, bool includeLogicalRightEdge); 140 140 -
trunk/Source/WebCore/rendering/RenderObject.cpp
r76004 r76016 980 980 981 981 // Get the inner border rects for both the outer border line and the inner border line 982 IntRect outerBorderInnerRect = borderInnerRect(borderRect, outerBorderTopWidth, outerBorderBottomWidth, 983 outerBorderLeftWidth, outerBorderRightWidth); 984 IntRect innerBorderInnerRect = borderInnerRect(borderRect, innerBorderTopWidth, innerBorderBottomWidth, 985 innerBorderLeftWidth, innerBorderRightWidth); 986 987 // Get the inner radii for the outer border line 988 IntSize outerBorderTopLeftInnerRadius, outerBorderTopRightInnerRadius, outerBorderBottomLeftInnerRadius, 989 outerBorderBottomRightInnerRadius; 990 style->getInnerBorderRadiiForRectWithBorderWidths(outerBorderInnerRect, outerBorderTopWidth, outerBorderBottomWidth, 991 outerBorderLeftWidth, outerBorderRightWidth, outerBorderTopLeftInnerRadius, outerBorderTopRightInnerRadius, 992 outerBorderBottomLeftInnerRadius, outerBorderBottomRightInnerRadius); 993 994 // Get the inner radii for the inner border line 995 IntSize innerBorderTopLeftInnerRadius, innerBorderTopRightInnerRadius, innerBorderBottomLeftInnerRadius, 996 innerBorderBottomRightInnerRadius; 997 style->getInnerBorderRadiiForRectWithBorderWidths(innerBorderInnerRect, innerBorderTopWidth, innerBorderBottomWidth, 998 innerBorderLeftWidth, innerBorderRightWidth, innerBorderTopLeftInnerRadius, innerBorderTopRightInnerRadius, 999 innerBorderBottomLeftInnerRadius, innerBorderBottomRightInnerRadius); 982 1000 983 1001 // Draw inner border line 984 1002 graphicsContext->save(); 985 IntRect innerBorderInnerRect = borderInnerRect(borderRect, innerBorderTopWidth, innerBorderBottomWidth, 986 innerBorderLeftWidth, innerBorderRightWidth); 987 RoundedIntRect innerClip = style->getRoundedInnerBorderWithBorderWidths(innerBorderInnerRect, innerBorderTopWidth, innerBorderBottomWidth, 988 innerBorderLeftWidth, innerBorderRightWidth); 989 graphicsContext->addRoundedRectClip(innerClip); 1003 graphicsContext->addRoundedRectClip(innerBorderInnerRect, innerBorderTopLeftInnerRadius, 1004 innerBorderTopRightInnerRadius, innerBorderBottomLeftInnerRadius, innerBorderBottomRightInnerRadius); 990 1005 drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, SOLID); 991 1006 graphicsContext->restore(); … … 993 1008 // Draw outer border line 994 1009 graphicsContext->save(); 995 IntRect outerBorderInnerRect = borderInnerRect(borderRect, outerBorderTopWidth, outerBorderBottomWidth, 996 outerBorderLeftWidth, outerBorderRightWidth); 997 RoundedIntRect outerClip = style->getRoundedInnerBorderWithBorderWidths(outerBorderInnerRect, outerBorderTopWidth, outerBorderBottomWidth, 998 outerBorderLeftWidth, outerBorderRightWidth); 999 graphicsContext->clipOutRoundedRect(outerClip); 1010 graphicsContext->clipOutRoundedRect(outerBorderInnerRect, outerBorderTopLeftInnerRadius, 1011 outerBorderTopRightInnerRadius, outerBorderBottomLeftInnerRadius, outerBorderBottomRightInnerRadius); 1000 1012 drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, SOLID); 1001 1013 graphicsContext->restore(); … … 1019 1031 style->borderLeftWidth() / 2, style->borderRightWidth() / 2); 1020 1032 1033 IntSize topLeftHalfRadius, topRightHalfRadius, bottomLeftHalfRadius, bottomRightHalfRadius; 1034 style->getInnerBorderRadiiForRectWithBorderWidths(halfBorderRect, style->borderLeftWidth() / 2, 1035 style->borderBottomWidth() / 2, style->borderLeftWidth() / 2, style->borderRightWidth() / 2, 1036 topLeftHalfRadius, topRightHalfRadius, bottomLeftHalfRadius, bottomRightHalfRadius); 1037 1021 1038 // Paint full border 1022 1039 drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, s1); … … 1024 1041 // Paint inner only 1025 1042 graphicsContext->save(); 1026 RoundedIntRect clipRect = style->getRoundedInnerBorderWithBorderWidths(halfBorderRect, style->borderLeftWidth() / 2, style->borderBottomWidth() / 2, 1027 style->borderLeftWidth() / 2, style->borderRightWidth() / 2); 1028 graphicsContext->addRoundedRectClip(clipRect); 1043 graphicsContext->addRoundedRectClip(halfBorderRect, topLeftHalfRadius, topRightHalfRadius, 1044 bottomLeftHalfRadius, bottomRightHalfRadius); 1029 1045 drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, s2); 1030 1046 graphicsContext->restore(); -
trunk/Source/WebCore/rendering/RenderReplaced.cpp
r76004 r76016 136 136 // Push a clip if we have a border radius, since we want to round the foreground content that gets painted. 137 137 paintInfo.context->save(); 138 paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(borderRect)); 138 139 IntSize topLeft, topRight, bottomLeft, bottomRight; 140 style()->getBorderRadiiForRect(borderRect, topLeft, topRight, bottomLeft, bottomRight); 141 142 paintInfo.context->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); 139 143 } 140 144 } -
trunk/Source/WebCore/rendering/RenderThemeChromiumWin.cpp
r76004 r76016 677 677 // FIXME: make sure we do the right thing if css background-clip is set. 678 678 i.context->save(); 679 i.context->addRoundedRectClip(o->style()->getRoundedBorderFor(r)); 679 IntSize topLeft, topRight, bottomLeft, bottomRight; 680 o->style()->getBorderRadiiForRect(r, topLeft, topRight, bottomLeft, bottomRight); 681 i.context->addRoundedRectClip(r, topLeft, topRight, bottomLeft, bottomRight); 680 682 } 681 683 { -
trunk/Source/WebCore/rendering/RenderThemeMac.mm
r76004 r76016 1034 1034 paintInfo.context->save(); 1035 1035 1036 RoundedIntRect border = o->style()->getRoundedBorderFor(r); 1037 int radius = border.radii().topLeft().width(); 1036 IntSize topLeftRadius; 1037 IntSize topRightRadius; 1038 IntSize bottomLeftRadius; 1039 IntSize bottomRightRadius; 1040 1041 o->style()->getBorderRadiiForRect(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); 1042 1043 int radius = topLeftRadius.width(); 1038 1044 1039 1045 CGColorSpaceRef cspace = deviceRGBColorSpaceRef(); … … 1058 1064 paintInfo.context->save(); 1059 1065 CGContextClipToRect(context, r); 1060 paintInfo.context->addRoundedRectClip( border);1066 paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); 1061 1067 CGContextDrawShading(context, mainShading.get()); 1062 1068 paintInfo.context->restore(); … … 1064 1070 paintInfo.context->save(); 1065 1071 CGContextClipToRect(context, topGradient); 1066 paintInfo.context->addRoundedRectClip( RoundedIntRect(enclosingIntRect(topGradient), border.radii().topLeft(), border.radii().topRight(), IntSize(), IntSize()));1072 paintInfo.context->addRoundedRectClip(enclosingIntRect(topGradient), topLeftRadius, topRightRadius, IntSize(), IntSize()); 1067 1073 CGContextDrawShading(context, topShading.get()); 1068 1074 paintInfo.context->restore(); … … 1071 1077 paintInfo.context->save(); 1072 1078 CGContextClipToRect(context, bottomGradient); 1073 paintInfo.context->addRoundedRectClip( RoundedIntRect(enclosingIntRect(bottomGradient), IntSize(), IntSize(), border.radii().bottomLeft(), border.radii().bottomRight()));1079 paintInfo.context->addRoundedRectClip(enclosingIntRect(bottomGradient), IntSize(), IntSize(), bottomLeftRadius, bottomRightRadius); 1074 1080 CGContextDrawShading(context, bottomShading.get()); 1075 1081 paintInfo.context->restore(); … … 1078 1084 paintInfo.context->save(); 1079 1085 CGContextClipToRect(context, r); 1080 paintInfo.context->addRoundedRectClip( border);1086 paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); 1081 1087 CGContextDrawShading(context, leftShading.get()); 1082 1088 CGContextDrawShading(context, rightShading.get()); … … 1299 1305 1300 1306 IntSize radius(trackRadius, trackRadius); 1301 paintInfo.context->addRoundedRectClip(RoundedIntRect(bounds, radius, radius, radius, radius)); 1307 paintInfo.context->addRoundedRectClip(bounds, 1308 radius, radius, 1309 radius, radius); 1302 1310 CGContextDrawShading(context, mainShading.get()); 1303 1311 paintInfo.context->restore(); -
trunk/Source/WebCore/rendering/RenderThemeSafari.cpp
r76004 r76016 753 753 paintInfo.context->save(); 754 754 755 RoundedIntRect bound = o->style()->getRoundedBorderFor(r); 756 int radius = bound.radii().topLeft().width(); 755 IntSize topLeftRadius; 756 IntSize topRightRadius; 757 IntSize bottomLeftRadius; 758 IntSize bottomRightRadius; 759 760 o->style()->getBorderRadiiForRect(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); 761 762 int radius = topLeftRadius.width(); 757 763 758 764 CGColorSpaceRef cspace = deviceRGBColorSpaceRef(); … … 776 782 RetainPtr<CGShadingRef> rightShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(r.right(), r.y()), CGPointMake(r.right() - radius, r.y()), mainFunction.get(), false, false)); 777 783 paintInfo.context->save(); 778 CGContextClipToRect(context, bound.rect());779 paintInfo.context->addRoundedRectClip( bound);784 CGContextClipToRect(context, r); 785 paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); 780 786 CGContextDrawShading(context, mainShading.get()); 781 787 paintInfo.context->restore(); … … 783 789 paintInfo.context->save(); 784 790 CGContextClipToRect(context, topGradient); 785 paintInfo.context->addRoundedRectClip( RoundedIntRect(enclosingIntRect(topGradient), bound.radii().topLeft(), bound.radii().topRight(), IntSize(), IntSize()));791 paintInfo.context->addRoundedRectClip(enclosingIntRect(topGradient), topLeftRadius, topRightRadius, IntSize(), IntSize()); 786 792 CGContextDrawShading(context, topShading.get()); 787 793 paintInfo.context->restore(); … … 790 796 paintInfo.context->save(); 791 797 CGContextClipToRect(context, bottomGradient); 792 paintInfo.context->addRoundedRectClip( RoundedIntRect(enclosingIntRect(bottomGradient), IntSize(), IntSize(), bound.radii().bottomLeft(), bound.radii().bottomRight()));798 paintInfo.context->addRoundedRectClip(enclosingIntRect(bottomGradient), IntSize(), IntSize(), bottomLeftRadius, bottomRightRadius); 793 799 CGContextDrawShading(context, bottomShading.get()); 794 800 paintInfo.context->restore(); … … 796 802 797 803 paintInfo.context->save(); 798 CGContextClipToRect(context, bound.rect());799 paintInfo.context->addRoundedRectClip( bound);804 CGContextClipToRect(context, r); 805 paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); 800 806 CGContextDrawShading(context, leftShading.get()); 801 807 CGContextDrawShading(context, rightShading.get()); … … 953 959 bool RenderThemeSafari::paintSliderTrack(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) 954 960 { 955 IntSize radius(trackRadius, trackRadius); 956 RoundedIntRect bounds(r, radius, radius, radius, radius); 957 958 if (o->style()->appearance() == SliderHorizontalPart) 959 bounds.setRect(IntRect(r.x(), 960 r.y() + r.height() / 2 - trackWidth / 2, 961 r.width(), 962 trackWidth)); 963 else if (o->style()->appearance() == SliderVerticalPart) 964 bounds.setRect(IntRect(r.x() + r.width() / 2 - trackWidth / 2, 965 r.y(), 966 trackWidth, 967 r.height())); 961 IntRect bounds = r; 962 963 if (o->style()->appearance() == SliderHorizontalPart) { 964 bounds.setHeight(trackWidth); 965 bounds.setY(r.y() + r.height() / 2 - trackWidth / 2); 966 } else if (o->style()->appearance() == SliderVerticalPart) { 967 bounds.setWidth(trackWidth); 968 bounds.setX(r.x() + r.width() / 2 - trackWidth / 2); 969 } 968 970 969 971 CGContextRef context = paintInfo.context->platformContext(); … … 971 973 972 974 paintInfo.context->save(); 973 CGContextClipToRect(context, bounds .rect());975 CGContextClipToRect(context, bounds); 974 976 975 977 struct CGFunctionCallbacks mainCallbacks = { 0, TrackGradientInterpolate, NULL }; … … 977 979 RetainPtr<CGShadingRef> mainShading; 978 980 if (o->style()->appearance() == SliderVerticalPart) 979 mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds. rect().x(), bounds.rect().bottom()), CGPointMake(bounds.rect().right(), bounds.rect().bottom()), mainFunction.get(), false, false));981 mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.x(), bounds.bottom()), CGPointMake(bounds.right(), bounds.bottom()), mainFunction.get(), false, false)); 980 982 else 981 mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.rect().x(), bounds.rect().y()), CGPointMake(bounds.rect().x(), bounds.rect().bottom()), mainFunction.get(), false, false)); 982 983 paintInfo.context->addRoundedRectClip(bounds); 983 mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.x(), bounds.y()), CGPointMake(bounds.x(), bounds.bottom()), mainFunction.get(), false, false)); 984 985 IntSize radius(trackRadius, trackRadius); 986 paintInfo.context->addRoundedRectClip(bounds, 987 radius, radius, 988 radius, radius); 984 989 CGContextDrawShading(context, mainShading.get()); 985 990 paintInfo.context->restore(); -
trunk/Source/WebCore/rendering/RenderThemeWinCE.cpp
r76004 r76016 379 379 IntRect cancelBounds(IntPoint(x, y), cancelSize); 380 380 paintInfo.context->save(); 381 paintInfo.context->addRoundedRectClip( RoundedIntRect(cancelBounds, cancelRadius, cancelRadius, cancelRadius, cancelRadius));381 paintInfo.context->addRoundedRectClip(cancelBounds, cancelRadius, cancelRadius, cancelRadius, cancelRadius); 382 382 paintInfo.context->fillRect(cancelBounds, buttonColor, ColorSpaceDeviceRGB); 383 383 -
trunk/Source/WebCore/rendering/RenderWidget.cpp
r76004 r76016 276 276 // Push a clip if we have a border radius, since we want to round the foreground content that gets painted. 277 277 paintInfo.context->save(); 278 paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(borderRect)); 278 279 IntSize topLeft, topRight, bottomLeft, bottomRight; 280 style()->getBorderRadiiForRect(borderRect, topLeft, topRight, bottomLeft, bottomRight); 281 282 paintInfo.context->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); 279 283 } 280 284 -
trunk/Source/WebCore/rendering/style/BorderData.h
r76004 r76016 27 27 28 28 #include "BorderValue.h" 29 #include "IntRect.h"30 29 #include "LengthSize.h" 31 30 #include "NinePieceImage.h" … … 111 110 const LengthSize& bottomLeft() const { return m_bottomLeft; } 112 111 const LengthSize& bottomRight() const { return m_bottomRight; } 113 112 114 113 private: 115 114 BorderValue m_left; -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r76004 r76016 745 745 } 746 746 747 static RoundedIntRect::Radii calcRadiiFor(const BorderData& border, int width, int height) 748 { 749 return RoundedIntRect::Radii(IntSize(border.topLeft().width().calcValue(width), 750 border.topLeft().height().calcValue(height)), 751 IntSize(border.topRight().width().calcValue(width), 752 border.topRight().height().calcValue(height)), 753 IntSize(border.bottomLeft().width().calcValue(width), 754 border.bottomLeft().height().calcValue(height)), 755 IntSize(border.bottomRight().width().calcValue(width), 756 border.bottomRight().height().calcValue(height))); 757 } 758 759 static float calcConstraintScaleFor(const IntRect& rect, const RoundedIntRect::Radii& radii) 747 static void constrainCornerRadiiForRect(const IntRect& r, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) 760 748 { 761 749 // Constrain corner radii using CSS3 rules: … … 766 754 767 755 // top 768 radiiSum = static_cast<unsigned>( radii.topLeft().width()) + static_cast<unsigned>(radii.topRight().width()); // Casts to avoid integer overflow.769 if (radiiSum > static_cast<unsigned>(r ect.width()))770 factor = std::min(static_cast<float>(rect.width()) / radiiSum, factor);756 radiiSum = static_cast<unsigned>(topLeft.width()) + static_cast<unsigned>(topRight.width()); // Casts to avoid integer overflow. 757 if (radiiSum > static_cast<unsigned>(r.width())) 758 factor = min(static_cast<float>(r.width()) / radiiSum, factor); 771 759 772 760 // bottom 773 radiiSum = static_cast<unsigned>( radii.bottomLeft().width()) + static_cast<unsigned>(radii.bottomRight().width());774 if (radiiSum > static_cast<unsigned>(r ect.width()))775 factor = std::min(static_cast<float>(rect.width()) / radiiSum, factor);761 radiiSum = static_cast<unsigned>(bottomLeft.width()) + static_cast<unsigned>(bottomRight.width()); 762 if (radiiSum > static_cast<unsigned>(r.width())) 763 factor = min(static_cast<float>(r.width()) / radiiSum, factor); 776 764 777 765 // left 778 radiiSum = static_cast<unsigned>( radii.topLeft().height()) + static_cast<unsigned>(radii.bottomLeft().height());779 if (radiiSum > static_cast<unsigned>(r ect.height()))780 factor = std::min(static_cast<float>(rect.height()) / radiiSum, factor);766 radiiSum = static_cast<unsigned>(topLeft.height()) + static_cast<unsigned>(bottomLeft.height()); 767 if (radiiSum > static_cast<unsigned>(r.height())) 768 factor = min(static_cast<float>(r.height()) / radiiSum, factor); 781 769 782 770 // right 783 radiiSum = static_cast<unsigned>( radii.topRight().height()) + static_cast<unsigned>(radii.bottomRight().height());784 if (radiiSum > static_cast<unsigned>(r ect.height()))785 factor = std::min(static_cast<float>(rect.height()) / radiiSum, factor);771 radiiSum = static_cast<unsigned>(topRight.height()) + static_cast<unsigned>(bottomRight.height()); 772 if (radiiSum > static_cast<unsigned>(r.height())) 773 factor = min(static_cast<float>(r.height()) / radiiSum, factor); 786 774 787 ASSERT(factor <= 1); 788 return factor; 789 } 790 791 RoundedIntRect RenderStyle::getRoundedBorderFor(const IntRect& rect) const 792 { 793 RoundedIntRect::Radii radii = calcRadiiFor(surround->border, rect.width(), rect.height()); 794 radii.scale(calcConstraintScaleFor(rect, radii)); 795 return RoundedIntRect(rect, radii); 796 } 797 798 RoundedIntRect RenderStyle::getRoundedInnerBorderWithBorderWidths(const IntRect& innerRect, unsigned short topWidth, 799 unsigned short bottomWidth, unsigned short leftWidth, unsigned short rightWidth) const 800 { 801 RoundedIntRect::Radii radii = calcRadiiFor(surround->border, innerRect.width(), innerRect.height()); 802 radii.shrink(topWidth, bottomWidth, leftWidth, rightWidth); 803 radii.scale(calcConstraintScaleFor(innerRect, radii)); 804 return RoundedIntRect(innerRect, radii); 775 // Scale all radii by f if necessary. 776 if (factor < 1) { 777 // If either radius on a corner becomes zero, reset both radii on that corner. 778 topLeft.scale(factor); 779 if (!topLeft.width() || !topLeft.height()) 780 topLeft = IntSize(); 781 topRight.scale(factor); 782 if (!topRight.width() || !topRight.height()) 783 topRight = IntSize(); 784 bottomLeft.scale(factor); 785 if (!bottomLeft.width() || !bottomLeft.height()) 786 bottomLeft = IntSize(); 787 bottomRight.scale(factor); 788 if (!bottomRight.width() || !bottomRight.height()) 789 bottomRight = IntSize(); 790 } 791 } 792 793 void RenderStyle::getBorderRadiiForRect(const IntRect& r, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) const 794 { 795 topLeft = IntSize(surround->border.topLeft().width().calcValue(r.width()), surround->border.topLeft().height().calcValue(r.height())); 796 topRight = IntSize(surround->border.topRight().width().calcValue(r.width()), surround->border.topRight().height().calcValue(r.height())); 797 798 bottomLeft = IntSize(surround->border.bottomLeft().width().calcValue(r.width()), surround->border.bottomLeft().height().calcValue(r.height())); 799 bottomRight = IntSize(surround->border.bottomRight().width().calcValue(r.width()), surround->border.bottomRight().height().calcValue(r.height())); 800 801 constrainCornerRadiiForRect(r, topLeft, topRight, bottomLeft, bottomRight); 802 } 803 804 void RenderStyle::getInnerBorderRadiiForRectWithBorderWidths(const IntRect& innerRect, unsigned short topWidth, unsigned short bottomWidth, unsigned short leftWidth, unsigned short rightWidth, IntSize& innerTopLeft, IntSize& innerTopRight, IntSize& innerBottomLeft, IntSize& innerBottomRight) const 805 { 806 innerTopLeft = IntSize(surround->border.topLeft().width().calcValue(innerRect.width()), surround->border.topLeft().height().calcValue(innerRect.height())); 807 innerTopRight = IntSize(surround->border.topRight().width().calcValue(innerRect.width()), surround->border.topRight().height().calcValue(innerRect.height())); 808 innerBottomLeft = IntSize(surround->border.bottomLeft().width().calcValue(innerRect.width()), surround->border.bottomLeft().height().calcValue(innerRect.height())); 809 innerBottomRight = IntSize(surround->border.bottomRight().width().calcValue(innerRect.width()), surround->border.bottomRight().height().calcValue(innerRect.height())); 810 811 812 innerTopLeft.setWidth(max(0, innerTopLeft.width() - leftWidth)); 813 innerTopLeft.setHeight(max(0, innerTopLeft.height() - topWidth)); 814 815 innerTopRight.setWidth(max(0, innerTopRight.width() - rightWidth)); 816 innerTopRight.setHeight(max(0, innerTopRight.height() - topWidth)); 817 818 innerBottomLeft.setWidth(max(0, innerBottomLeft.width() - leftWidth)); 819 innerBottomLeft.setHeight(max(0, innerBottomLeft.height() - bottomWidth)); 820 821 innerBottomRight.setWidth(max(0, innerBottomRight.width() - rightWidth)); 822 innerBottomRight.setHeight(max(0, innerBottomRight.height() - bottomWidth)); 823 824 constrainCornerRadiiForRect(innerRect, innerTopLeft, innerTopRight, innerBottomLeft, innerBottomRight); 805 825 } 806 826 -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r76012 r76016 44 44 #include "OutlineValue.h" 45 45 #include "RenderStyleConstants.h" 46 #include "RoundedIntRect.h"47 #include "ShadowData.h"48 46 #include "StyleBackgroundData.h" 49 47 #include "StyleBoxData.h" … … 849 847 setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed))); 850 848 } 849 851 850 852 RoundedIntRect getRoundedBorderFor(const IntRect&) const; 853 RoundedIntRect getRoundedInnerBorderWithBorderWidths(const IntRect&, unsigned short topWidth, 854 unsigned short bottomWidth, unsigned short leftWidth, unsigned short rightWidth) const; 851 void getBorderRadiiForRect(const IntRect&, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) const; 852 void getInnerBorderRadiiForRectWithBorderWidths(const IntRect&, unsigned short topWidth, 853 unsigned short bottomWidth, unsigned short leftWidth, unsigned short rightWidth, 854 IntSize& innerTopLeft, IntSize& innerTopRight, IntSize& innerBottomLeft, 855 IntSize& innerBottomRight) const; 855 856 856 857 void setBorderLeftWidth(unsigned short v) { SET_VAR(surround, border.m_left.m_width, v) }
Note: See TracChangeset
for help on using the changeset viewer.