Changeset 76016 in webkit


Ignore:
Timestamp:
Jan 18, 2011 4:26:48 AM (13 years ago)
Author:
morrita@google.com
Message:

2011-01-18 MORITA Hajime <morrita@google.com>

Unreviewed, rolling out r76004, r76005, r76007, and r76011.
http://trac.webkit.org/changeset/76004
http://trac.webkit.org/changeset/76005
http://trac.webkit.org/changeset/76007
http://trac.webkit.org/changeset/76011
https://bugs.webkit.org/show_bug.cgi?id=51664

The r76004 broke pixel tests.
(The failure was missed due to the tolerance.)

  • Android.mk:
  • CMakeLists.txt:
  • GNUmakefile.am:
  • WebCore.gypi:
  • WebCore.pro:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContext::addRoundedRectClip): (WebCore::GraphicsContext::clipOutRoundedRect):
  • platform/graphics/GraphicsContext.h:
  • platform/graphics/RoundedIntRect.cpp: Removed.
  • platform/graphics/RoundedIntRect.h: Removed.
  • rendering/RenderBox.cpp: (WebCore::RenderBox::pushContentsClip):
  • rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintFillLayerExtended): (WebCore::RenderBoxModelObject::paintBorder): (WebCore::RenderBoxModelObject::clipBorderSidePolygon): (WebCore::uniformlyExpandBorderRadii): (WebCore::RenderBoxModelObject::paintBoxShadow):
  • rendering/RenderBoxModelObject.h:
  • rendering/RenderObject.cpp: (WebCore::RenderObject::drawBoxSideFromPath):
  • rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::paint):
  • rendering/RenderThemeChromiumWin.cpp: (WebCore::RenderThemeChromiumWin::paintTextFieldInternal):
  • rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::paintMenuListButtonGradients): (WebCore::RenderThemeMac::paintSliderTrack):
  • rendering/RenderThemeSafari.cpp: (WebCore::RenderThemeSafari::paintMenuListButtonGradients): (WebCore::RenderThemeSafari::paintSliderTrack):
  • rendering/RenderThemeWinCE.cpp: (WebCore::RenderThemeWinCE::paintSearchFieldCancelButton):
  • rendering/RenderWidget.cpp: (WebCore::RenderWidget::paint):
  • rendering/style/BorderData.h:
  • rendering/style/RenderStyle.cpp: (WebCore::constrainCornerRadiiForRect): (WebCore::RenderStyle::getBorderRadiiForRect): (WebCore::RenderStyle::getInnerBorderRadiiForRectWithBorderWidths):
  • rendering/style/RenderStyle.h:
Location:
trunk/Source/WebCore
Files:
2 deleted
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/Android.mk

    r76004 r76016  
    532532        platform/graphics/PathTraversalState.cpp \
    533533        platform/graphics/Pattern.cpp \
    534         platform/graphics/RoundedIntRect.cpp \
    535534        platform/graphics/SegmentedFontData.cpp \
    536535        platform/graphics/SimpleFontData.cpp \
  • trunk/Source/WebCore/CMakeLists.txt

    r76004 r76016  
    13511351    platform/graphics/PathTraversalState.cpp
    13521352    platform/graphics/Pattern.cpp
    1353     platform/graphics/RoundedIntRect.cpp
    13541353    platform/graphics/SegmentedFontData.cpp
    13551354    platform/graphics/SimpleFontData.cpp
  • trunk/Source/WebCore/ChangeLog

    r76013 r76016  
     12011-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
    1582011-01-17  Pavel Podivilov  <podivilov@chromium.org>
    259
  • trunk/Source/WebCore/GNUmakefile.am

    r76007 r76016  
    24362436        Source/WebCore/platform/graphics/Pattern.cpp \
    24372437        Source/WebCore/platform/graphics/Pattern.h \
    2438         Source/WebCore/platform/graphics/RoundedIntRect.h \
    2439         Source/WebCore/platform/graphics/RoundedIntRect.cpp \
    24402438        Source/WebCore/platform/graphics/SegmentedFontData.cpp \
    24412439        Source/WebCore/platform/graphics/SegmentedFontData.h \
  • trunk/Source/WebCore/WebCore.gypi

    r76009 r76016  
    29432943            'platform/graphics/Pattern.cpp',
    29442944            'platform/graphics/Pattern.h',
    2945             'platform/graphics/RoundedIntRect.cpp',
    2946             'platform/graphics/RoundedIntRect.h',
    29472945            'platform/graphics/SegmentedFontData.cpp',
    29482946            'platform/graphics/SegmentedFontData.h',
  • trunk/Source/WebCore/WebCore.pro

    r76004 r76016  
    12111211    platform/graphics/PathTraversalState.cpp \
    12121212    platform/graphics/Pattern.cpp \
    1213     platform/graphics/RoundedIntRect.cpp \
    12141213    platform/graphics/SegmentedFontData.cpp \
    12151214    platform/graphics/SimpleFontData.cpp \
     
    21312130    platform/graphics/PathTraversalState.h \
    21322131    platform/graphics/Pattern.h \
    2133     platform/graphics/RoundedIntRect.h \
    21342132    platform/graphics/qt/FontCustomPlatformData.h \
    21352133    platform/graphics/qt/ImageDecoderQt.h \
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r76009 r76016  
    2669426694                                </File>
    2669526695                                <File
    26696                                         RelativePath="..\platform\graphics\RoundedIntRect.cpp"
    26697                                         >
    26698                                 </File>
    26699                                 <File
    26700                                         RelativePath="..\platform\graphics\RoundedIntRect.h"
    26701                                         >
    26702                                 </File>
    26703                                 <File
    2670426696                                        RelativePath="..\platform\graphics\SegmentedFontData.cpp"
    2670526697                                        >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r76004 r76016  
    31643164                A718760E0B2A120100A16ECE /* DragActions.h in Headers */ = {isa = PBXBuildFile; fileRef = A718760D0B2A120100A16ECE /* DragActions.h */; settings = {ATTRIBUTES = (Private, ); }; };
    31653165                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, ); }; };
    31683166                A75E497610752ACB00C9B896 /* SerializedScriptValue.h in Headers */ = {isa = PBXBuildFile; fileRef = A75E497410752ACB00C9B896 /* SerializedScriptValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
    31693167                A75E497710752ACB00C9B896 /* SerializedScriptValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A75E497510752ACB00C9B896 /* SerializedScriptValue.cpp */; };
     
    95369534                A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DragControllerMac.mm; sourceTree = "<group>"; };
    95379535                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>"; };
    95409536                A75E497410752ACB00C9B896 /* SerializedScriptValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SerializedScriptValue.h; sourceTree = "<group>"; };
    95419537                A75E497510752ACB00C9B896 /* SerializedScriptValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SerializedScriptValue.cpp; sourceTree = "<group>"; };
     
    1746517461                                A8FA6E5C0E4CFDED00D5CF49 /* Pattern.cpp */,
    1746617462                                A8FA6E5B0E4CFDED00D5CF49 /* Pattern.h */,
    17467                                 A73F95FC12C97BFE0031AAF9 /* RoundedIntRect.cpp */,
    17468                                 A73F95FD12C97BFE0031AAF9 /* RoundedIntRect.h */,
    1746917463                                371F4FFB0D25E7F300ECE0D5 /* SegmentedFontData.cpp */,
    1747017464                                371F4FFA0D25E7F300ECE0D5 /* SegmentedFontData.h */,
     
    2173221726                                BC74DA371013F3F7007987AD /* RGBColor.h in Headers */,
    2173321727                                A8CFF5E10A155A05000A4234 /* RootInlineBox.h in Headers */,
    21734                                 A73F95FF12C97BFE0031AAF9 /* RoundedIntRect.h in Headers */,
    2173521728                                49E911C90EF86D47009D0CAF /* RotateTransformOperation.h in Headers */,
    2173621729                                1C63A2480F71646600C09D5A /* RunLoopTimer.h in Headers */,
     
    2452424517                                BC74DA381013F3F7007987AD /* RGBColor.cpp in Sources */,
    2452524518                                A8CFF5E70A155A05000A4234 /* RootInlineBox.cpp in Sources */,
    24526                                 A73F95FE12C97BFE0031AAF9 /* RoundedIntRect.cpp in Sources */,
    2452724519                                49E911C80EF86D47009D0CAF /* RotateTransformOperation.cpp in Sources */,
    2452824520                                1C63A2490F71646600C09D5A /* RunLoopTimerCF.cpp in Sources */,
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp

    r76004 r76016  
    3232#include "ImageBuffer.h"
    3333#include "IntRect.h"
    34 #include "RoundedIntRect.h"
    3534
    3635using namespace std;
     
    538537}
    539538
    540 void GraphicsContext::addRoundedRectClip(const RoundedIntRect& rect)
     539void GraphicsContext::addRoundedRectClip(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight,
     540    const IntSize& bottomLeft, const IntSize& bottomRight)
    541541{
    542542    if (paintingDisabled())
     
    544544
    545545    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);
    547547    clip(path);
    548548}
    549549
    550 void GraphicsContext::clipOutRoundedRect(const RoundedIntRect& rect)
     550void GraphicsContext::clipOutRoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight,
     551                                         const IntSize& bottomLeft, const IntSize& bottomRight)
    551552{
    552553    if (paintingDisabled())
     
    554555
    555556    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);
    557558    clipOut(path);
    558559}
     
    583584        return;
    584585    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);
    590586}
    591587
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.h

    r76004 r76016  
    121121    class ImageBuffer;
    122122    class IntRect;
    123     class RoundedIntRect;
    124123    class KURL;
    125124    class SharedGraphicsContext3D;
     
    284283        void fillRect(const FloatRect&, Generator&);
    285284        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);
    287285
    288286        void clearRect(const FloatRect&);
     
    313311
    314312        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);
    316314        void addInnerRoundedRectClip(const IntRect&, int thickness);
    317315        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);
    319317        void clipPath(const Path&, WindRule);
    320318        void clipConvexPolygon(size_t numPoints, const FloatPoint*, bool antialias = true);
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r76004 r76016  
    10681068    IntRect clipRect(isControlClip ? controlClipRect(tx, ty) : overflowClipRect(tx, ty));
    10691069    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   
    10721078    paintInfo.context->clip(clipRect);
    10731079    return true;
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r76011 r76016  
    548548        context->save();
    549549
    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);
    553570        clippedToBorderRadius = true;
    554571    }
     
    10081025    bool renderBottom = bottomStyle > BHIDDEN && !bottomTransparent && (horizontal || includeLogicalRightEdge);
    10091026
     1027    bool renderRadii = false;
    10101028    Path roundedPath;
    1011     RoundedIntRect border(tx, ty, w, h);
     1029    IntSize topLeft, topRight, bottomLeft, bottomRight;
     1030    IntRect borderRect(tx, ty, w, h);
    10121031
    10131032    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);
    10161035
    10171036        int leftWidth = (!horizontal || includeLogicalLeftEdge) ? style->borderLeftWidth() : 0;
     
    10201039        int bottomWidth = (horizontal || includeLogicalRightEdge) ? style->borderBottomWidth() : 0;
    10211040
    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) {
    10271075            // Clip to the inner and outer radii rects.
    10281076            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
    10361083    bool upperLeftBorderStylesMatch = renderLeft && (topStyle == leftStyle) && (topColor == leftColor);
    10371084    bool upperRightBorderStylesMatch = renderRight && (topStyle == rightStyle) && (topColor == rightColor) && (topStyle != OUTSET) && (topStyle != RIDGE) && (topStyle != INSET) && (topStyle != GROOVE);
     
    10431090        int x2 = tx + w;
    10441091
    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())) {
    10461093            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);
    10481095            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);
    10501097            graphicsContext->restore();
    10511098        } else {
     
    10641111        int x2 = tx + w;
    10651112
    1066         if (renderRadii && borderWillArcInnerEdge(border.radii().bottomLeft(), border.radii().bottomRight(), style->borderLeftWidth(), style->borderRightWidth(), style->borderBottomWidth())) {
     1113        if (renderRadii && borderWillArcInnerEdge(bottomLeft, bottomRight, style->borderLeftWidth(), style->borderRightWidth(), style->borderBottomWidth())) {
    10671114            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);
    10691116            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);
    10711118            graphicsContext->restore();
    10721119        } else {
     
    10871134        int y2 = ty + h;
    10881135
    1089         if (renderRadii && borderWillArcInnerEdge(border.radii().bottomLeft(), border.radii().topLeft(), style->borderBottomWidth(), style->borderTopWidth(), style->borderLeftWidth())) {
     1136        if (renderRadii && borderWillArcInnerEdge(bottomLeft, topLeft, style->borderBottomWidth(), style->borderTopWidth(), style->borderLeftWidth())) {
    10901137            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);
    10921139            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);
    10941141            graphicsContext->restore();
    10951142        } else {
     
    11061153
    11071154    if (renderRight) {
    1108         if (renderRadii && borderWillArcInnerEdge(border.radii().bottomRight(), border.radii().topRight(), style->borderBottomWidth(), style->borderTopWidth(), style->borderRightWidth())) {
     1155        if (renderRadii && borderWillArcInnerEdge(bottomRight, topRight, style->borderBottomWidth(), style->borderTopWidth(), style->borderRightWidth())) {
    11091156            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);
    11111158            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);
    11131160            graphicsContext->restore();
    11141161        } else {
     
    11631210    bool renderBottom = bottomStyle > BHIDDEN && !bottomTransparent && (horizontal || includeLogicalRightEdge);
    11641211
    1165 
    1166     RoundedIntRect border(tx, ty, w, h);
     1212    bool renderRadii = false;
     1213    IntSize topLeft, topRight, bottomLeft, bottomRight;
     1214
    11671215    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.
    11711241            graphicsContext->save();
    1172             graphicsContext->addRoundedRectClip(border);
     1242            graphicsContext->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight);
    11731243        }
    11741244    }
     
    11761246    int firstAngleStart, secondAngleStart, firstAngleSpan, secondAngleSpan;
    11771247    float thickness;
    1178     bool renderRadii = border.isRounded();
    11791248    bool upperLeftBorderStylesMatch = renderLeft && (topStyle == leftStyle) && (topColor == leftColor);
    11801249    bool upperRightBorderStylesMatch = renderRight && (topStyle == rightStyle) && (topColor == rightColor) && (topStyle != OUTSET) && (topStyle != RIDGE) && (topStyle != INSET) && (topStyle != GROOVE);
     
    11831252
    11841253    if (renderTop) {
    1185         bool ignoreLeft = (renderRadii && border.radii().topLeft().width() > 0)
    1186             || (topColor == leftColor && topTransparent == leftTransparent && topStyle >= OUTSET
    1187                 && (leftStyle == DOTTED || leftStyle == DASHED || leftStyle == SOLID || leftStyle == OUTSET));
    1188        
    1189         bool ignoreRight = (renderRadii && border.radii().topRight().width() > 0)
    1190             || (topColor == rightColor && topTransparent == rightTransparent && topStyle >= OUTSET
    1191                 && (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));
    11921261
    11931262        int x = tx;
    11941263        int x2 = tx + w;
    11951264        if (renderRadii) {
    1196             x += border.radii().topLeft().width();
    1197             x2 -= border.radii().topRight().width();
     1265            x += topLeft.width();
     1266            x2 -= topRight.width();
    11981267        }
    11991268
    12001269        drawLineForBoxSide(graphicsContext, x, ty, x2, ty + style->borderTopWidth(), BSTop, topColor, topStyle,
    1201                    ignoreLeft ? 0 : style->borderLeftWidth(), ignoreRight ? 0 : style->borderRightWidth());
     1270                   ignore_left ? 0 : style->borderLeftWidth(), ignore_right ? 0 : style->borderRightWidth());
    12021271
    12031272        if (renderRadii) {
     
    12091278            thickness = style->borderTopWidth() * 2;
    12101279
    1211             if (border.radii().topLeft().width()) {
     1280            if (topLeft.width()) {
    12121281                int leftX = tx;
    12131282                // 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())
    12161285                    && (topStyle != DOUBLE || style->borderTopWidth() > 6);
    12171286                if (applyLeftInnerClip) {
    12181287                    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),
    12201289                                                             style->borderTopWidth());
    12211290                }
     
    12251294
    12261295                // Draw upper left arc
    1227                 drawArcForBoxSide(graphicsContext, leftX, leftY, thickness, border.radii().topLeft(), firstAngleStart, firstAngleSpan,
     1296                drawArcForBoxSide(graphicsContext, leftX, leftY, thickness, topLeft, firstAngleStart, firstAngleSpan,
    12281297                              BSTop, topColor, topStyle, true);
    12291298                if (applyLeftInnerClip)
     
    12311300            }
    12321301
    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())
    12371306                    && (topStyle != DOUBLE || style->borderTopWidth() > 6);
    12381307                if (applyRightInnerClip) {
    12391308                    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),
    12411310                                                             style->borderTopWidth());
    12421311                }
     
    12511320
    12521321                // Draw upper right arc
    1253                 drawArcForBoxSide(graphicsContext, rightX, leftY, thickness, border.radii().topRight(), secondAngleStart, secondAngleSpan,
     1322                drawArcForBoxSide(graphicsContext, rightX, leftY, thickness, topRight, secondAngleStart, secondAngleSpan,
    12541323                              BSTop, topColor, topStyle, false);
    12551324                if (applyRightInnerClip)
     
    12601329
    12611330    if (renderBottom) {
    1262         bool ignoreLeft = (renderRadii && border.radii().bottomLeft().width() > 0)
    1263             || (bottomColor == leftColor && bottomTransparent == leftTransparent && bottomStyle >= OUTSET
    1264                 && (leftStyle == DOTTED || leftStyle == DASHED || leftStyle == SOLID || leftStyle == OUTSET));
    1265 
    1266         bool ignoreRight = (renderRadii && border.radii().bottomRight().width() > 0)
    1267             || (bottomColor == rightColor && bottomTransparent == rightTransparent && bottomStyle >= OUTSET
    1268                 && (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));
    12691338
    12701339        int x = tx;
    12711340        int x2 = tx + w;
    12721341        if (renderRadii) {
    1273             x += border.radii().bottomLeft().width();
    1274             x2 -= border.radii().bottomRight().width();
     1342            x += bottomLeft.width();
     1343            x2 -= bottomRight.width();
    12751344        }
    12761345
    12771346        drawLineForBoxSide(graphicsContext, x, ty + h - style->borderBottomWidth(), x2, ty + h, BSBottom, bottomColor, bottomStyle,
    1278                    ignoreLeft ? 0 : style->borderLeftWidth(), ignoreRight ? 0 : style->borderRightWidth());
     1347                   ignore_left ? 0 : style->borderLeftWidth(), ignore_right ? 0 : style->borderRightWidth());
    12791348
    12801349        if (renderRadii) {
    12811350            thickness = style->borderBottomWidth() * 2;
    12821351
    1283             if (border.radii().bottomLeft().width()) {
     1352            if (bottomLeft.width()) {
    12841353                int leftX = tx;
    1285                 int leftY = ty + h - border.radii().bottomLeft().height() * 2;
    1286                 bool applyLeftInnerClip = (style->borderLeftWidth() < border.radii().bottomLeft().width())
    1287                     && (style->borderBottomWidth() < border.radii().bottomLeft().height())
     1354                int leftY = ty + h - bottomLeft.height() * 2;
     1355                bool applyLeftInnerClip = (style->borderLeftWidth() < bottomLeft.width())
     1356                    && (style->borderBottomWidth() < bottomLeft.height())
    12881357                    && (bottomStyle != DOUBLE || style->borderBottomWidth() > 6);
    12891358                if (applyLeftInnerClip) {
    12901359                    graphicsContext->save();
    1291                     graphicsContext->addInnerRoundedRectClip(IntRect(leftX, leftY, border.radii().bottomLeft().width() * 2, border.radii().bottomLeft().height() * 2),
     1360                    graphicsContext->addInnerRoundedRectClip(IntRect(leftX, leftY, bottomLeft.width() * 2, bottomLeft.height() * 2),
    12921361                                                             style->borderBottomWidth());
    12931362                }
     
    13021371
    13031372                // Draw lower left arc
    1304                 drawArcForBoxSide(graphicsContext, leftX, leftY, thickness, border.radii().bottomLeft(), firstAngleStart, firstAngleSpan,
     1373                drawArcForBoxSide(graphicsContext, leftX, leftY, thickness, bottomLeft, firstAngleStart, firstAngleSpan,
    13051374                              BSBottom, bottomColor, bottomStyle, true);
    13061375                if (applyLeftInnerClip)
     
    13081377            }
    13091378
    1310             if (border.radii().bottomRight().width()) {
    1311                 int rightY = ty + h - border.radii().bottomRight().height() * 2;
    1312                 int rightX = tx + w - border.radii().bottomRight().width() * 2;
    1313                 bool applyRightInnerClip = (style->borderRightWidth() < border.radii().bottomRight().width())
    1314                     && (style->borderBottomWidth() < border.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())
    13151384                    && (bottomStyle != DOUBLE || style->borderBottomWidth() > 6);
    13161385                if (applyRightInnerClip) {
    13171386                    graphicsContext->save();
    1318                     graphicsContext->addInnerRoundedRectClip(IntRect(rightX, rightY, border.radii().bottomRight().width() * 2, border.radii().bottomRight().height() * 2),
     1387                    graphicsContext->addInnerRoundedRectClip(IntRect(rightX, rightY, bottomRight.width() * 2, bottomRight.height() * 2),
    13191388                                                             style->borderBottomWidth());
    13201389                }
     
    13241393
    13251394                // Draw lower right arc
    1326                 drawArcForBoxSide(graphicsContext, rightX, rightY, thickness, border.radii().bottomRight(), secondAngleStart, secondAngleSpan,
     1395                drawArcForBoxSide(graphicsContext, rightX, rightY, thickness, bottomRight, secondAngleStart, secondAngleSpan,
    13271396                              BSBottom, bottomColor, bottomStyle, false);
    13281397                if (applyRightInnerClip)
     
    13331402
    13341403    if (renderLeft) {
    1335         bool ignoreTop = (renderRadii && border.radii().topLeft().height() > 0)
    1336             || (topColor == leftColor && topTransparent == leftTransparent && leftStyle >= OUTSET
    1337                 && (topStyle == DOTTED || topStyle == DASHED || topStyle == SOLID || topStyle == OUTSET));
    1338 
    1339         bool ignoreBottom = (renderRadii && border.radii().bottomLeft().height() > 0)
    1340             || (bottomColor == leftColor && bottomTransparent == leftTransparent && leftStyle >= OUTSET
    1341                 && (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));
    13421411
    13431412        int y = ty;
    13441413        int y2 = ty + h;
    13451414        if (renderRadii) {
    1346             y += border.radii().topLeft().height();
    1347             y2 -= border.radii().bottomLeft().height();
     1415            y += topLeft.height();
     1416            y2 -= bottomLeft.height();
    13481417        }
    13491418
    13501419        drawLineForBoxSide(graphicsContext, tx, y, tx + style->borderLeftWidth(), y2, BSLeft, leftColor, leftStyle,
    1351                    ignoreTop ? 0 : style->borderTopWidth(), ignoreBottom ? 0 : style->borderBottomWidth());
     1420                   ignore_top ? 0 : style->borderTopWidth(), ignore_bottom ? 0 : style->borderBottomWidth());
    13521421
    13531422        if (renderRadii && (!upperLeftBorderStylesMatch || !lowerLeftBorderStylesMatch)) {
     
    13551424            thickness = style->borderLeftWidth() * 2;
    13561425
    1357             if (!upperLeftBorderStylesMatch && border.radii().topLeft().width()) {
     1426            if (!upperLeftBorderStylesMatch && topLeft.width()) {
    13581427                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())
    13611430                    && (leftStyle != DOUBLE || style->borderLeftWidth() > 6);
    13621431                if (applyTopInnerClip) {
    13631432                    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),
    13651434                                                             style->borderLeftWidth());
    13661435                }
     
    13701439
    13711440                // Draw top left arc
    1372                 drawArcForBoxSide(graphicsContext, topX, topY, thickness, border.radii().topLeft(), firstAngleStart, firstAngleSpan,
     1441                drawArcForBoxSide(graphicsContext, topX, topY, thickness, topLeft, firstAngleStart, firstAngleSpan,
    13731442                              BSLeft, leftColor, leftStyle, true);
    13741443                if (applyTopInnerClip)
     
    13761445            }
    13771446
    1378             if (!lowerLeftBorderStylesMatch && border.radii().bottomLeft().width()) {
    1379                 int bottomY = ty + h - border.radii().bottomLeft().height() * 2;
    1380                 bool applyBottomInnerClip = (style->borderLeftWidth() < border.radii().bottomLeft().width())
    1381                     && (style->borderBottomWidth() < border.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())
    13821451                    && (leftStyle != DOUBLE || style->borderLeftWidth() > 6);
    13831452                if (applyBottomInnerClip) {
    13841453                    graphicsContext->save();
    1385                     graphicsContext->addInnerRoundedRectClip(IntRect(topX, bottomY, border.radii().bottomLeft().width() * 2, border.radii().bottomLeft().height() * 2),
     1454                    graphicsContext->addInnerRoundedRectClip(IntRect(topX, bottomY, bottomLeft.width() * 2, bottomLeft.height() * 2),
    13861455                                                             style->borderLeftWidth());
    13871456                }
     
    13911460
    13921461                // Draw bottom left arc
    1393                 drawArcForBoxSide(graphicsContext, topX, bottomY, thickness, border.radii().bottomLeft(), secondAngleStart, secondAngleSpan,
     1462                drawArcForBoxSide(graphicsContext, topX, bottomY, thickness, bottomLeft, secondAngleStart, secondAngleSpan,
    13941463                              BSLeft, leftColor, leftStyle, false);
    13951464                if (applyBottomInnerClip)
     
    14001469
    14011470    if (renderRight) {
    1402         bool ignoreTop = (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 ignoreBottom = (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));
    14111480
    14121481        int y = ty;
    14131482        int y2 = ty + h;
    14141483        if (renderRadii) {
    1415             y += border.radii().topRight().height();
    1416             y2 -= border.radii().bottomRight().height();
     1484            y += topRight.height();
     1485            y2 -= bottomRight.height();
    14171486        }
    14181487
    14191488        drawLineForBoxSide(graphicsContext, tx + w - style->borderRightWidth(), y, tx + w, y2, BSRight, rightColor, rightStyle,
    1420                    ignoreTop ? 0 : style->borderTopWidth(), ignoreBottom ? 0 : style->borderBottomWidth());
     1489                   ignore_top ? 0 : style->borderTopWidth(), ignore_bottom ? 0 : style->borderBottomWidth());
    14211490
    14221491        if (renderRadii && (!upperRightBorderStylesMatch || !lowerRightBorderStylesMatch)) {
    14231492            thickness = style->borderRightWidth() * 2;
    14241493
    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;
    14271496                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())
    14301499                    && (rightStyle != DOUBLE || style->borderRightWidth() > 6);
    14311500                if (applyTopInnerClip) {
    14321501                    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),
    14341503                                                             style->borderRightWidth());
    14351504                }
     
    14391508
    14401509                // Draw top right arc
    1441                 drawArcForBoxSide(graphicsContext, topX, topY, thickness, border.radii().topRight(), firstAngleStart, firstAngleSpan,
     1510                drawArcForBoxSide(graphicsContext, topX, topY, thickness, topRight, firstAngleStart, firstAngleSpan,
    14421511                              BSRight, rightColor, rightStyle, true);
    14431512                if (applyTopInnerClip)
     
    14451514            }
    14461515
    1447             if (!lowerRightBorderStylesMatch && border.radii().bottomRight().width()) {
    1448                 int bottomX = tx + w - border.radii().bottomRight().width() * 2;
    1449                 int bottomY = ty + h - border.radii().bottomRight().height() * 2;
    1450                 bool applyBottomInnerClip = (style->borderRightWidth() < border.radii().bottomRight().width())
    1451                     && (style->borderBottomWidth() < border.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())
    14521521                    && (rightStyle != DOUBLE || style->borderRightWidth() > 6);
    14531522                if (applyBottomInnerClip) {
    14541523                    graphicsContext->save();
    1455                     graphicsContext->addInnerRoundedRectClip(IntRect(bottomX, bottomY, border.radii().bottomRight().width() * 2, border.radii().bottomRight().height() * 2),
     1524                    graphicsContext->addInnerRoundedRectClip(IntRect(bottomX, bottomY, bottomRight.width() * 2, bottomRight.height() * 2),
    14561525                                                             style->borderRightWidth());
    14571526                }
     
    14611530
    14621531                // Draw bottom right arc
    1463                 drawArcForBoxSide(graphicsContext, bottomX, bottomY, thickness, border.radii().bottomRight(), secondAngleStart, secondAngleSpan,
     1532                drawArcForBoxSide(graphicsContext, bottomX, bottomY, thickness, bottomRight, secondAngleStart, secondAngleSpan,
    14641533                              BSRight, rightColor, rightStyle, false);
    14651534                if (applyBottomInnerClip)
     
    14741543#endif
    14751544
    1476 void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContext, const RoundedIntRect& border,
     1545void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContext, const IntRect& box, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight,
    14771546                                                 const BoxSide side, bool firstEdgeMatches, bool secondEdgeMatches, const RenderStyle* style,
    14781547                                                 bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
    14791548{
    14801549    FloatPoint quad[4];
    1481     int tx = border.rect().x();
    1482     int ty = border.rect().y();
    1483     int w = border.rect().width();
    1484     int h = border.rect().height();
     1550    int tx = box.x();
     1551    int ty = box.y();
     1552    int w = box.width();
     1553    int h = box.height();
    14851554
    14861555    bool horizontal = style->isHorizontalWritingMode();
     
    14951564    case BSTop:
    14961565        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));
    14991568        quad[3] = FloatPoint(tx + w, ty);
    15001569        break;
    15011570    case BSLeft:
    15021571        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(border.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));
    15051574        quad[3] = FloatPoint(tx, ty + h);
    15061575        break;
    15071576    case BSBottom:
    15081577        quad[0] = FloatPoint(tx, ty + h);
    1509         quad[1] = FloatPoint(tx + max(border.radii().bottomLeft().width(), leftWidth), ty + h - max(border.radii().bottomLeft().height(), bottomWidth));
    1510         quad[2] = FloatPoint(tx + w - max(border.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));
    15111580        quad[3] = FloatPoint(tx + w, ty + h);
    15121581        break;
    15131582    case BSRight:
    15141583        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(border.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));
    15171586        quad[3] = FloatPoint(tx + w, ty + h);
    15181587        break;
     
    15451614}
    15461615
     1616static 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
    15471628void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int ty, int w, int h, const RenderStyle* s, ShadowStyle shadowStyle, bool includeLogicalLeftEdge, bool includeLogicalRightEdge)
    15481629{
     
    15521633        return;
    15531634
    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
    15551641    bool hasBorderRadius = s->hasBorderRadius();
    15561642    bool isHorizontal = s->isHorizontalWritingMode();
    15571643    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    }
    15671690
    15681691    bool hasOpaqueBackground = s->visitedDependentColor(CSSPropertyBackgroundColor).isValid() && s->visitedDependentColor(CSSPropertyBackgroundColor).alpha() == 255;
     
    15771700
    15781701        if (shadow->style() == Normal) {
    1579             RoundedIntRect fillRect = border;
     1702            IntRect fillRect(rect);
    15801703            fillRect.inflate(shadowSpread);
    15811704            if (fillRect.isEmpty())
    15821705                continue;
    15831706
    1584             IntRect shadowRect(border.rect());
     1707            IntRect shadowRect(rect);
    15851708            shadowRect.inflate(shadowBlur + shadowSpread);
    15861709            shadowRect.move(shadowOffset);
     
    15971720            context->setShadow(shadowOffset, shadowBlur, shadowColor, s->colorSpace());
    15981721            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);
    16001734
    16011735                // If the box is opaque, it is unnecessary to clip it out. However, doing so saves time
     
    16031737                // corners. Those are avoided by insetting the clipping path by one pixel.
    16041738                if (hasOpaqueBackground) {
    1605                     rectToClipOut.inflateWithRadii(-1);
     1739                    rectToClipOut.inflate(-1);
     1740                    uniformlyExpandBorderRadii(-1, topLeftToClipOut, topRightToClipOut, bottomLeftToClipOut, bottomRightToClipOut);
    16061741                }
    16071742
    16081743                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());
    16141746            } else {
    1615                 IntRect rectToClipOut = border.rect();
     1747                IntRect rectToClipOut = rect;
    16161748
    16171749                // If the box is opaque, it is unnecessary to clip it out. However, doing so saves time
     
    16281760                if (!rectToClipOut.isEmpty())
    16291761                    context->clipOut(rectToClipOut);
    1630                 context->fillRect(fillRect.rect(), Color::black, s->colorSpace());
     1762                context->fillRect(fillRect, Color::black, s->colorSpace());
    16311763            }
    16321764
     
    16341766        } else {
    16351767            // Inset shadow.
    1636             IntRect holeRect(border.rect());
     1768            IntRect holeRect(rect);
    16371769            holeRect.inflate(-shadowSpread);
    16381770
    16391771            if (holeRect.isEmpty()) {
    16401772                if (hasBorderRadius)
    1641                     context->fillRoundedRect(border, shadowColor, s->colorSpace());
     1773                    context->fillRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight, shadowColor, s->colorSpace());
    16421774                else
    1643                     context->fillRect(border.rect(), shadowColor, s->colorSpace());
     1775                    context->fillRect(rect, shadowColor, s->colorSpace());
    16441776                continue;
    16451777            }
     
    16631795            Color fillColor(shadowColor.red(), shadowColor.green(), shadowColor.blue(), 255);
    16641796
    1665             IntRect outerRect(border.rect());
     1797            IntRect outerRect(rect);
    16661798            outerRect.inflateX(w - 2 * shadowSpread);
    16671799            outerRect.inflateY(h - 2 * shadowSpread);
     
    16711803            Path path;
    16721804            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);
    16741806                context->clip(path);
    16751807                path.clear();
    16761808            } else
    1677                 context->clip(border.rect());
     1809                context->clip(rect);
    16781810
    16791811            IntSize extraOffset(2 * w + max(0, shadowOffset.width()) + shadowBlur - 2 * shadowSpread + 1, 0);
     
    16851817            if (hasBorderRadius) {
    16861818                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);
    16891821            } else
    16901822                path.addRect(holeRect);
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.h

    r76004 r76016  
    135135    IntSize calculateFillTileSize(const FillLayer*, IntSize scaledSize) const;
    136136
    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,
    139139                               bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
    140140
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r76004 r76016  
    980980
    981981        // 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);
    9821000
    9831001        // Draw inner border line
    9841002        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);
    9901005        drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, SOLID);
    9911006        graphicsContext->restore();
     
    9931008        // Draw outer border line
    9941009        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);
    10001012        drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, SOLID);
    10011013        graphicsContext->restore();
     
    10191031            style->borderLeftWidth() / 2, style->borderRightWidth() / 2);
    10201032
     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
    10211038        // Paint full border
    10221039        drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, s1);
     
    10241041        // Paint inner only
    10251042        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);
    10291045        drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, s2);
    10301046        graphicsContext->restore();
  • trunk/Source/WebCore/rendering/RenderReplaced.cpp

    r76004 r76016  
    136136            // Push a clip if we have a border radius, since we want to round the foreground content that gets painted.
    137137            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);
    139143        }
    140144    }
  • trunk/Source/WebCore/rendering/RenderThemeChromiumWin.cpp

    r76004 r76016  
    677677        // FIXME: make sure we do the right thing if css background-clip is set.
    678678        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);
    680682    }
    681683    {
  • trunk/Source/WebCore/rendering/RenderThemeMac.mm

    r76004 r76016  
    10341034    paintInfo.context->save();
    10351035
    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();
    10381044
    10391045    CGColorSpaceRef cspace = deviceRGBColorSpaceRef();
     
    10581064    paintInfo.context->save();
    10591065    CGContextClipToRect(context, r);
    1060     paintInfo.context->addRoundedRectClip(border);
     1066    paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
    10611067    CGContextDrawShading(context, mainShading.get());
    10621068    paintInfo.context->restore();
     
    10641070    paintInfo.context->save();
    10651071    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());
    10671073    CGContextDrawShading(context, topShading.get());
    10681074    paintInfo.context->restore();
     
    10711077        paintInfo.context->save();
    10721078        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);
    10741080        CGContextDrawShading(context, bottomShading.get());
    10751081        paintInfo.context->restore();
     
    10781084    paintInfo.context->save();
    10791085    CGContextClipToRect(context, r);
    1080     paintInfo.context->addRoundedRectClip(border);
     1086    paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
    10811087    CGContextDrawShading(context, leftShading.get());
    10821088    CGContextDrawShading(context, rightShading.get());
     
    12991305
    13001306    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);
    13021310    CGContextDrawShading(context, mainShading.get());
    13031311    paintInfo.context->restore();
  • trunk/Source/WebCore/rendering/RenderThemeSafari.cpp

    r76004 r76016  
    753753    paintInfo.context->save();
    754754
    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();
    757763
    758764    CGColorSpaceRef cspace = deviceRGBColorSpaceRef();
     
    776782    RetainPtr<CGShadingRef> rightShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(r.right(),  r.y()), CGPointMake(r.right() - radius, r.y()), mainFunction.get(), false, false));
    777783    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);
    780786    CGContextDrawShading(context, mainShading.get());
    781787    paintInfo.context->restore();
     
    783789    paintInfo.context->save();
    784790    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());
    786792    CGContextDrawShading(context, topShading.get());
    787793    paintInfo.context->restore();
     
    790796        paintInfo.context->save();
    791797        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);
    793799        CGContextDrawShading(context, bottomShading.get());
    794800        paintInfo.context->restore();
     
    796802
    797803    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);
    800806    CGContextDrawShading(context, leftShading.get());
    801807    CGContextDrawShading(context, rightShading.get());
     
    953959bool RenderThemeSafari::paintSliderTrack(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
    954960{
    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    }
    968970
    969971    CGContextRef context = paintInfo.context->platformContext();
     
    971973
    972974    paintInfo.context->save();
    973     CGContextClipToRect(context, bounds.rect());
     975    CGContextClipToRect(context, bounds);
    974976
    975977    struct CGFunctionCallbacks mainCallbacks = { 0, TrackGradientInterpolate, NULL };
     
    977979    RetainPtr<CGShadingRef> mainShading;
    978980    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));
    980982    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);
    984989    CGContextDrawShading(context, mainShading.get());
    985990    paintInfo.context->restore();
  • trunk/Source/WebCore/rendering/RenderThemeWinCE.cpp

    r76004 r76016  
    379379    IntRect cancelBounds(IntPoint(x, y), cancelSize);
    380380    paintInfo.context->save();
    381     paintInfo.context->addRoundedRectClip(RoundedIntRect(cancelBounds, cancelRadius, cancelRadius, cancelRadius, cancelRadius));
     381    paintInfo.context->addRoundedRectClip(cancelBounds, cancelRadius, cancelRadius, cancelRadius, cancelRadius);
    382382    paintInfo.context->fillRect(cancelBounds, buttonColor, ColorSpaceDeviceRGB);
    383383
  • trunk/Source/WebCore/rendering/RenderWidget.cpp

    r76004 r76016  
    276276        // Push a clip if we have a border radius, since we want to round the foreground content that gets painted.
    277277        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);
    279283    }
    280284
  • trunk/Source/WebCore/rendering/style/BorderData.h

    r76004 r76016  
    2727
    2828#include "BorderValue.h"
    29 #include "IntRect.h"
    3029#include "LengthSize.h"
    3130#include "NinePieceImage.h"
     
    111110    const LengthSize& bottomLeft() const { return m_bottomLeft; }
    112111    const LengthSize& bottomRight() const { return m_bottomRight; }
    113 
     112   
    114113private:
    115114    BorderValue m_left;
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r76004 r76016  
    745745}
    746746
    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)
     747static void constrainCornerRadiiForRect(const IntRect& r, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight)
    760748{
    761749    // Constrain corner radii using CSS3 rules:
     
    766754
    767755    // 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>(rect.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);
    771759
    772760    // bottom
    773     radiiSum = static_cast<unsigned>(radii.bottomLeft().width()) + static_cast<unsigned>(radii.bottomRight().width());
    774     if (radiiSum > static_cast<unsigned>(rect.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);
    776764   
    777765    // left
    778     radiiSum = static_cast<unsigned>(radii.topLeft().height()) + static_cast<unsigned>(radii.bottomLeft().height());
    779     if (radiiSum > static_cast<unsigned>(rect.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);
    781769   
    782770    // right
    783     radiiSum = static_cast<unsigned>(radii.topRight().height()) + static_cast<unsigned>(radii.bottomRight().height());
    784     if (radiiSum > static_cast<unsigned>(rect.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);
    786774   
    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
     793void 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
     804void 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);
    805825}
    806826
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r76012 r76016  
    4444#include "OutlineValue.h"
    4545#include "RenderStyleConstants.h"
    46 #include "RoundedIntRect.h"
    47 #include "ShadowData.h"
    4846#include "StyleBackgroundData.h"
    4947#include "StyleBoxData.h"
     
    849847        setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed)));
    850848    }
     849
    851850   
    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;
    855856
    856857    void setBorderLeftWidth(unsigned short v) { SET_VAR(surround, border.m_left.m_width, v) }
Note: See TracChangeset for help on using the changeset viewer.