2010-09-01 Rob Buis <rwlbuis@gmail.com>
authorrwlbuis@webkit.org <rwlbuis@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Sep 2010 19:51:32 +0000 (19:51 +0000)
committerrwlbuis@webkit.org <rwlbuis@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Sep 2010 19:51:32 +0000 (19:51 +0000)
        Reviewed by Darin Adler.

        Support for Percentage Values in border-radius
        https://bugs.webkit.org/show_bug.cgi?id=38354

        Support percentage values on the border-radius family
        of CSS properties.

        * css/CSSComputedStyleDeclaration.cpp:
        (WebCore::getBorderRadiusCornerValue):
        * css/CSSParser.cpp:
        (WebCore::CSSParser::parseValue):
        (WebCore::CSSParser::parseBorderRadius):
        * css/CSSPrimitiveValue.cpp:
        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::applyProperty):
        * page/animation/AnimationBase.cpp:
        (WebCore::AnimationBase::ensurePropertyMap):
        * platform/Length.h:
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::repaintAfterLayoutIfNeeded):
        * rendering/style/BorderData.h:
        (WebCore::BorderData::BorderData):
        (WebCore::BorderData::hasBorderRadius):
        (WebCore::BorderData::topLeft):
        (WebCore::BorderData::topRight):
        (WebCore::BorderData::bottomLeft):
        (WebCore::BorderData::bottomRight):
        * rendering/style/RenderStyle.cpp:
        (WebCore::RenderStyle::getBorderRadiiForRect):
        (WebCore::RenderStyle::getInnerBorderRadiiForRectWithBorderWidths):
        * rendering/style/RenderStyle.h:
        (WebCore::InheritedFlags::borderTopLeftRadius):
        (WebCore::InheritedFlags::borderTopRightRadius):
        (WebCore::InheritedFlags::borderBottomLeftRadius):
        (WebCore::InheritedFlags::borderBottomRightRadius):
        (WebCore::InheritedFlags::setBorderTopLeftRadius):
        (WebCore::InheritedFlags::setBorderTopRightRadius):
        (WebCore::InheritedFlags::setBorderBottomLeftRadius):
        (WebCore::InheritedFlags::setBorderBottomRightRadius):
        (WebCore::InheritedFlags::setBorderRadius):
        (WebCore::InheritedFlags::initialBorderRadius):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@66615 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/borders/border-radius-parsing-expected.txt
LayoutTests/fast/borders/border-radius-parsing.html
WebCore/ChangeLog
WebCore/css/CSSComputedStyleDeclaration.cpp
WebCore/css/CSSParser.cpp
WebCore/css/CSSPrimitiveValue.cpp
WebCore/css/CSSStyleSelector.cpp
WebCore/page/animation/AnimationBase.cpp
WebCore/platform/Length.h
WebCore/rendering/RenderObject.cpp
WebCore/rendering/style/BorderData.h
WebCore/rendering/style/RenderStyle.cpp
WebCore/rendering/style/RenderStyle.h

index dbb3db4..a19b062 100644 (file)
@@ -1,3 +1,16 @@
+2010-09-01  Rob Buis  <rwlbuis@gmail.com>
+
+        Reviewed by Darin Adler.
+
+        Support for Percentage Values in border-radius
+        https://bugs.webkit.org/show_bug.cgi?id=38354
+
+        Adjust existing test to test percentages as well as
+        mixing fixed values with percentages.
+
+        * fast/borders/border-radius-parsing-expected.txt:
+        * fast/borders/border-radius-parsing.html:
+
 2010-09-01  Tony Chang  <tony@chromium.org>
 
         Unreviewed, add chromium win/linux baselines for fast/multicol/float-paginate.html.
index 6dbef2c..e4618b0 100644 (file)
@@ -28,4 +28,36 @@ Testing border-radius: / 10px 20px 30px 40px;
 SUCCESS
 Testing border-radius: 10px / 20px 30px 40px;
 SUCCESS
+Testing border-radius: 10%;
+SUCCESS
+Testing border-radius: 10% 20%;
+SUCCESS
+Testing -webkit-border-radius: 10% 20%;
+SUCCESS
+Testing border-radius: 10% 20% 30%;
+SUCCESS
+Testing border-radius: 10% 20% 30% 40%;
+SUCCESS
+Testing border-radius: 10% 20% 30% 40% 50%;
+SUCCESS
+Testing border-radius: 10% 20% 30% 40% / 15%;
+SUCCESS
+Testing border-radius: 10% 20% 30% 40% / 15% 25%;
+SUCCESS
+Testing border-radius: 10% 20% 30% 40% / 15% 25% 35%;
+SUCCESS
+Testing border-radius: 10% 20% 30% 40% / 15% 25% 35% 45%;
+SUCCESS
+Testing border-radius: 10% 20% 30% 40% / 15% 25% 35% 45% 55%;
+SUCCESS
+Testing border-radius: 10% 20% 30% 40% / 15% 25% 35% 45% /;
+SUCCESS
+Testing border-radius: 10% 20% 30% 40% / / 25% 35% 45%;
+SUCCESS
+Testing border-radius: / 10% 20% 30% 40%;
+SUCCESS
+Testing border-radius: 10% / 20% 30% 40%;
+SUCCESS
+Testing border-radius: 10% 20px;
+SUCCESS
 
index 9874590..772a021 100644 (file)
     testBorderRadiusValue("border-radius", "10px 20px 30px 40px / / 25px 35px 45px", ["0px", "0px", "0px", "0px"]);
     testBorderRadiusValue("border-radius", "/ 10px 20px 30px 40px", ["0px", "0px", "0px", "0px"]);
     testBorderRadiusValue("border-radius", "10px / 20px 30px 40px", ["10px 20px", "10px 30px", "10px 40px", "10px 30px"]);
+    testBorderRadiusValue("border-radius", "10%", ["10%", "10%", "10%", "10%"]);
+    testBorderRadiusValue("border-radius", "10% 20%", ["10%", "20%", "10%", "20%"]);
+    testBorderRadiusValue("-webkit-border-radius", "10% 20%", ["10% 20%", "10% 20%", "10% 20%", "10% 20%"]);
+    testBorderRadiusValue("border-radius", "10% 20% 30%", ["10%", "20%", "30%", "20%"]);
+    testBorderRadiusValue("border-radius", "10% 20% 30% 40%", ["10%", "20%", "30%", "40%"]);
+    testBorderRadiusValue("border-radius", "10% 20% 30% 40% 50%", ["0px", "0px", "0px", "0px"]);
+    testBorderRadiusValue("border-radius", "10% 20% 30% 40% / 15%", ["10% 15%", "20% 15%", "30% 15%", "40% 15%"]);
+    testBorderRadiusValue("border-radius", "10% 20% 30% 40% / 15% 25%", ["10% 15%", "20% 25%", "30% 15%", "40% 25%"]);
+    testBorderRadiusValue("border-radius", "10% 20% 30% 40% / 15% 25% 35%", ["10% 15%", "20% 25%", "30% 35%", "40% 25%"]);
+    testBorderRadiusValue("border-radius", "10% 20% 30% 40% / 15% 25% 35% 45%", ["10% 15%", "20% 25%", "30% 35%", "40% 45%"]);
+    testBorderRadiusValue("border-radius", "10% 20% 30% 40% / 15% 25% 35% 45% 55%", ["0px", "0px", "0px", "0px"]);
+    testBorderRadiusValue("border-radius", "10% 20% 30% 40% / 15% 25% 35% 45% /", ["0px", "0px", "0px", "0px"]);
+    testBorderRadiusValue("border-radius", "10% 20% 30% 40% / / 25% 35% 45%", ["0px", "0px", "0px", "0px"]);
+    testBorderRadiusValue("border-radius", "/ 10% 20% 30% 40%", ["0px", "0px", "0px", "0px"]);
+    testBorderRadiusValue("border-radius", "10% / 20% 30% 40%", ["10% 20%", "10% 30%", "10% 40%", "10% 30%"]);
+    testBorderRadiusValue("border-radius", "10% 20px", ["10%", "20px", "10%", "20px"]);
 </script>
index 8f52264..586ffea 100644 (file)
@@ -1,3 +1,48 @@
+2010-09-01  Rob Buis  <rwlbuis@gmail.com>
+
+        Reviewed by Darin Adler.
+
+        Support for Percentage Values in border-radius
+        https://bugs.webkit.org/show_bug.cgi?id=38354
+
+        Support percentage values on the border-radius family
+        of CSS properties.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::getBorderRadiusCornerValue):
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseValue):
+        (WebCore::CSSParser::parseBorderRadius):
+        * css/CSSPrimitiveValue.cpp:
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applyProperty):
+        * page/animation/AnimationBase.cpp:
+        (WebCore::AnimationBase::ensurePropertyMap):
+        * platform/Length.h:
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::repaintAfterLayoutIfNeeded):
+        * rendering/style/BorderData.h:
+        (WebCore::BorderData::BorderData):
+        (WebCore::BorderData::hasBorderRadius):
+        (WebCore::BorderData::topLeft):
+        (WebCore::BorderData::topRight):
+        (WebCore::BorderData::bottomLeft):
+        (WebCore::BorderData::bottomRight):
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::getBorderRadiiForRect):
+        (WebCore::RenderStyle::getInnerBorderRadiiForRectWithBorderWidths):
+        * rendering/style/RenderStyle.h:
+        (WebCore::InheritedFlags::borderTopLeftRadius):
+        (WebCore::InheritedFlags::borderTopRightRadius):
+        (WebCore::InheritedFlags::borderBottomLeftRadius):
+        (WebCore::InheritedFlags::borderBottomRightRadius):
+        (WebCore::InheritedFlags::setBorderTopLeftRadius):
+        (WebCore::InheritedFlags::setBorderTopRightRadius):
+        (WebCore::InheritedFlags::setBorderBottomLeftRadius):
+        (WebCore::InheritedFlags::setBorderBottomRightRadius):
+        (WebCore::InheritedFlags::setBorderRadius):
+        (WebCore::InheritedFlags::initialBorderRadius):
+
 2010-09-01  Andrey Kosyakov  <caseq@chromium.org>
 
         Reviewed by Yury Semikhatsky.
index 1da86cb..b1e8ac4 100644 (file)
@@ -384,14 +384,22 @@ PassRefPtr<CSSPrimitiveValue> CSSComputedStyleDeclaration::currentColorOrValidCo
     return CSSPrimitiveValue::createColor(color.rgb());
 }
 
-static PassRefPtr<CSSValue> getBorderRadiusCornerValue(IntSize radius)
+static PassRefPtr<CSSValue> getBorderRadiusCornerValue(LengthSize radius)
 {
-    if (radius.width() == radius.height())
-        return CSSPrimitiveValue::create(radius.width(), CSSPrimitiveValue::CSS_PX);
-
     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
-    list->append(CSSPrimitiveValue::create(radius.width(), CSSPrimitiveValue::CSS_PX));
-    list->append(CSSPrimitiveValue::create(radius.height(), CSSPrimitiveValue::CSS_PX));
+    if (radius.width() == radius.height()) {
+        if (radius.width().type() == Percent)
+            return CSSPrimitiveValue::create(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
+        return CSSPrimitiveValue::create(radius.width().value(), CSSPrimitiveValue::CSS_PX);
+    }
+    if (radius.width().type() == Percent)
+        list->append(CSSPrimitiveValue::create(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
+    else
+        list->append(CSSPrimitiveValue::create(radius.width().value(), CSSPrimitiveValue::CSS_PX));
+    if (radius.height().type() == Percent)
+        list->append(CSSPrimitiveValue::create(radius.height().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
+    else
+        list->append(CSSPrimitiveValue::create(radius.height().value(), CSSPrimitiveValue::CSS_PX));
     return list.release();
 }
 
index e20537a..687235f 100644 (file)
@@ -1160,14 +1160,14 @@ bool CSSParser::parseValue(int propId, bool important)
     case CSSPropertyBorderBottomRightRadius: {
         if (num != 1 && num != 2)
             return false;
-        validPrimitive = validUnit(value, FLength, m_strict);
+        validPrimitive = validUnit(value, FLength | FPercent, m_strict);
         if (!validPrimitive)
             return false;
         RefPtr<CSSPrimitiveValue> parsedValue1 = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit);
         RefPtr<CSSPrimitiveValue> parsedValue2;
         if (num == 2) {
             value = m_valueList->next();
-            validPrimitive = validUnit(value, FLength, m_strict);
+            validPrimitive = validUnit(value, FLength | FPercent, m_strict);
             if (!validPrimitive)
                 return false;
             parsedValue2 = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit);
@@ -1183,7 +1183,7 @@ bool CSSParser::parseValue(int propId, bool important)
     case CSSPropertyWebkitBorderRadius:
         return parseBorderRadius(propId, important);
     case CSSPropertyOutlineOffset:
-        validPrimitive = validUnit(value, FLength, m_strict);
+        validPrimitive = validUnit(value, FLength | FPercent, m_strict);
         break;
     case CSSPropertyTextShadow: // CSS2 property, dropped in CSS2.1, back in CSS3, so treat as CSS3
     case CSSPropertyWebkitBoxShadow:
@@ -4451,7 +4451,7 @@ bool CSSParser::parseBorderRadius(int propId, bool important)
         if (i - indexAfterSlash >= 4)
             return false;
 
-        if (!validUnit(value, FLength, m_strict))
+        if (!validUnit(value, FLength | FPercent, m_strict))
             return false;
 
         RefPtr<CSSPrimitiveValue> radius = CSSPrimitiveValue::create(value->fValue, static_cast<CSSPrimitiveValue::UnitTypes>(value->unit));
index 0508cd5..b4478b4 100644 (file)
@@ -329,9 +329,6 @@ int CSSPrimitiveValue::computeLengthInt(RenderStyle* style, RenderStyle* rootSty
     return static_cast<int>(result);
 }
 
-const int intMaxForLength = 0x7ffffff; // max value for a 28-bit int
-const int intMinForLength = (-0x7ffffff - 1); // min value for a 28-bit int
-
 // Lengths expect an int that is only 28-bits, so we have to check for a different overflow.
 int CSSPrimitiveValue::computeLengthIntForLength(RenderStyle* style, RenderStyle* rootStyle)
 {
index 8657843..fe59a35 100644 (file)
@@ -4765,17 +4765,26 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
         if (!pair)
             return;
 
-        int width = pair->first()->computeLengthInt(style(), m_rootElementStyle, zoomFactor);
-        int height = pair->second()->computeLengthInt(style(), m_rootElementStyle,  zoomFactor);
+        Length radiusWidth;
+        Length radiusHeight;
+        if (pair->first()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
+            radiusWidth = Length(pair->first()->getDoubleValue(), Percent);
+        else
+            radiusWidth = Length(max(intMinForLength, min(intMaxForLength, pair->first()->computeLengthInt(style(), m_rootElementStyle, zoomFactor))), Fixed);
+        if (pair->second()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
+            radiusHeight = Length(pair->second()->getDoubleValue(), Percent);
+        else
+            radiusHeight = Length(max(intMinForLength, min(intMaxForLength, pair->second()->computeLengthInt(style(), m_rootElementStyle, zoomFactor))), Fixed);
+        int width = radiusWidth.rawValue();
+        int height = radiusHeight.rawValue();
         if (width < 0 || height < 0)
             return;
-
         if (width == 0)
-            height = 0; // Null out the other value.
+            radiusHeight = radiusWidth; // Null out the other value.
         else if (height == 0)
-            width = 0; // Null out the other value.
+            radiusWidth = radiusHeight; // Null out the other value.
 
-        IntSize size(width, height);
+        LengthSize size(radiusWidth, radiusHeight);
         switch (id) {
             case CSSPropertyBorderTopLeftRadius:
                 m_style->setBorderTopLeftRadius(size);
index d2e86bd..37eaae7 100644 (file)
@@ -644,10 +644,10 @@ void AnimationBase::ensurePropertyMap()
         gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitTransformOriginX, &RenderStyle::transformOriginX, &RenderStyle::setTransformOriginX));
         gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitTransformOriginY, &RenderStyle::transformOriginY, &RenderStyle::setTransformOriginY));
         gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitTransformOriginZ, &RenderStyle::transformOriginZ, &RenderStyle::setTransformOriginZ));
-        gPropertyWrappers->append(new PropertyWrapper<const IntSize&>(CSSPropertyBorderTopLeftRadius, &RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftRadius));
-        gPropertyWrappers->append(new PropertyWrapper<const IntSize&>(CSSPropertyBorderTopRightRadius, &RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRightRadius));
-        gPropertyWrappers->append(new PropertyWrapper<const IntSize&>(CSSPropertyBorderBottomLeftRadius, &RenderStyle::borderBottomLeftRadius, &RenderStyle::setBorderBottomLeftRadius));
-        gPropertyWrappers->append(new PropertyWrapper<const IntSize&>(CSSPropertyBorderBottomRightRadius, &RenderStyle::borderBottomRightRadius, &RenderStyle::setBorderBottomRightRadius));
+        gPropertyWrappers->append(new PropertyWrapper<const LengthSize&>(CSSPropertyBorderTopLeftRadius, &RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftRadius));
+        gPropertyWrappers->append(new PropertyWrapper<const LengthSize&>(CSSPropertyBorderTopRightRadius, &RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRightRadius));
+        gPropertyWrappers->append(new PropertyWrapper<const LengthSize&>(CSSPropertyBorderBottomLeftRadius, &RenderStyle::borderBottomLeftRadius, &RenderStyle::setBorderBottomLeftRadius));
+        gPropertyWrappers->append(new PropertyWrapper<const LengthSize&>(CSSPropertyBorderBottomRightRadius, &RenderStyle::borderBottomRightRadius, &RenderStyle::setBorderBottomRightRadius));
         gPropertyWrappers->append(new PropertyWrapper<EVisibility>(CSSPropertyVisibility, &RenderStyle::visibility, &RenderStyle::setVisibility));
         gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyZoom, &RenderStyle::zoom, &RenderStyle::setZoom));
 
index a3b1eda..7dd875e 100644 (file)
@@ -30,6 +30,8 @@ namespace WebCore {
 
 const int undefinedLength = -1;
 const int percentScaleFactor = 128;
+const int intMaxForLength = 0x7ffffff; // max value for a 28-bit int
+const int intMinForLength = (-0x7ffffff - 1); // min value for a 28-bit int
 
 enum LengthType { Auto, Relative, Percent, Fixed, Static, Intrinsic, MinIntrinsic };
 
index d01b92d..e200ff9 100644 (file)
@@ -1425,7 +1425,8 @@ bool RenderObject::repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintConta
         style()->getBoxShadowHorizontalExtent(shadowLeft, shadowRight);
 
         int borderRight = isBox() ? toRenderBox(this)->borderRight() : 0;
-        int borderWidth = max(-outlineStyle->outlineOffset(), max(borderRight, max(style()->borderTopRightRadius().width(), style()->borderBottomRightRadius().width()))) + max(ow, shadowRight);
+        int boxWidth = isBox() ? toRenderBox(this)->width() : 0;
+        int borderWidth = max(-outlineStyle->outlineOffset(), max(borderRight, max(style()->borderTopRightRadius().width().calcValue(boxWidth), style()->borderBottomRightRadius().width().calcValue(boxWidth)))) + max(ow, shadowRight);
         IntRect rightRect(newOutlineBox.x() + min(newOutlineBox.width(), oldOutlineBox.width()) - borderWidth,
             newOutlineBox.y(),
             width + borderWidth,
@@ -1443,7 +1444,8 @@ bool RenderObject::repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintConta
         style()->getBoxShadowVerticalExtent(shadowTop, shadowBottom);
 
         int borderBottom = isBox() ? toRenderBox(this)->borderBottom() : 0;
-        int borderHeight = max(-outlineStyle->outlineOffset(), max(borderBottom, max(style()->borderBottomLeftRadius().height(), style()->borderBottomRightRadius().height()))) + max(ow, shadowBottom);
+        int boxHeight = isBox() ? toRenderBox(this)->height() : 0;
+        int borderHeight = max(-outlineStyle->outlineOffset(), max(borderBottom, max(style()->borderBottomLeftRadius().height().calcValue(boxHeight), style()->borderBottomRightRadius().height().calcValue(boxHeight)))) + max(ow, shadowBottom);
         IntRect bottomRect(newOutlineBox.x(),
             min(newOutlineBox.bottom(), oldOutlineBox.bottom()) - borderHeight,
             max(newOutlineBox.width(), oldOutlineBox.width()),
index 96caf97..03635d9 100644 (file)
@@ -26,7 +26,7 @@
 #define BorderData_h
 
 #include "BorderValue.h"
-#include "IntSize.h"
+#include "LengthSize.h"
 #include "NinePieceImage.h"
 
 namespace WebCore {
@@ -34,6 +34,12 @@ namespace WebCore {
 class BorderData {
 friend class RenderStyle;
 public:
+    BorderData() : m_topLeft(Length(0, Fixed), Length(0, Fixed))
+                 , m_topRight(Length(0, Fixed), Length(0, Fixed))
+                 , m_bottomLeft(Length(0, Fixed), Length(0, Fixed))
+                 , m_bottomRight(Length(0, Fixed), Length(0, Fixed))
+    {
+    }
     bool hasBorder() const
     {
         bool haveImage = m_image.hasImage();
@@ -42,13 +48,13 @@ public:
 
     bool hasBorderRadius() const
     {
-        if (m_topLeft.width() > 0)
+        if (m_topLeft.width().rawValue() > 0)
             return true;
-        if (m_topRight.width() > 0)
+        if (m_topRight.width().rawValue() > 0)
             return true;
-        if (m_bottomLeft.width() > 0)
+        if (m_bottomLeft.width().rawValue() > 0)
             return true;
-        if (m_bottomRight.width() > 0)
+        if (m_bottomRight.width().rawValue() > 0)
             return true;
         return false;
     }
@@ -99,10 +105,10 @@ public:
     
     const NinePieceImage& image() const { return m_image; }
     
-    const IntSize& topLeft() const { return m_topLeft; }
-    const IntSize& topRight() const { return m_topRight; }
-    const IntSize& bottomLeft() const { return m_bottomLeft; }
-    const IntSize& bottomRight() const { return m_bottomRight; }
+    const LengthSize& topLeft() const { return m_topLeft; }
+    const LengthSize& topRight() const { return m_topRight; }
+    const LengthSize& bottomLeft() const { return m_bottomLeft; }
+    const LengthSize& bottomRight() const { return m_bottomRight; }
     
 private:
     BorderValue m_left;
@@ -112,10 +118,10 @@ private:
 
     NinePieceImage m_image;
 
-    IntSize m_topLeft;
-    IntSize m_topRight;
-    IntSize m_bottomLeft;
-    IntSize m_bottomRight;
+    LengthSize m_topLeft;
+    LengthSize m_topRight;
+    LengthSize m_bottomLeft;
+    LengthSize m_bottomRight;
 };
 
 } // namespace WebCore
index 2d59bab..93cd8de 100644 (file)
@@ -738,21 +738,22 @@ static void constrainCornerRadiiForRect(const IntRect& r, IntSize& topLeft, IntS
 
 void RenderStyle::getBorderRadiiForRect(const IntRect& r, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) const
 {
-    topLeft = surround->border.topLeft();
-    topRight = surround->border.topRight();
+    topLeft = IntSize(surround->border.topLeft().width().calcValue(r.width()), surround->border.topLeft().height().calcValue(r.height()));
+    topRight = IntSize(surround->border.topRight().width().calcValue(r.width()), surround->border.topRight().height().calcValue(r.height()));
     
-    bottomLeft = surround->border.bottomLeft();
-    bottomRight = surround->border.bottomRight();
+    bottomLeft = IntSize(surround->border.bottomLeft().width().calcValue(r.width()), surround->border.bottomLeft().height().calcValue(r.height()));
+    bottomRight = IntSize(surround->border.bottomRight().width().calcValue(r.width()), surround->border.bottomRight().height().calcValue(r.height()));
 
     constrainCornerRadiiForRect(r, topLeft, topRight, bottomLeft, bottomRight);
 }
 
 void RenderStyle::getInnerBorderRadiiForRectWithBorderWidths(const IntRect& innerRect, unsigned short topWidth, unsigned short bottomWidth, unsigned short leftWidth, unsigned short rightWidth, IntSize& innerTopLeft, IntSize& innerTopRight, IntSize& innerBottomLeft, IntSize& innerBottomRight) const
 {
-    innerTopLeft = surround->border.topLeft();
-    innerTopRight = surround->border.topRight();
-    innerBottomLeft = surround->border.bottomLeft();
-    innerBottomRight = surround->border.bottomRight();
+    innerTopLeft = IntSize(surround->border.topLeft().width().calcValue(innerRect.width()), surround->border.topLeft().height().calcValue(innerRect.height()));
+    innerTopRight = IntSize(surround->border.topRight().width().calcValue(innerRect.width()), surround->border.topRight().height().calcValue(innerRect.height()));
+    innerBottomLeft = IntSize(surround->border.bottomLeft().width().calcValue(innerRect.width()), surround->border.bottomLeft().height().calcValue(innerRect.height()));
+    innerBottomRight = IntSize(surround->border.bottomRight().width().calcValue(innerRect.width()), surround->border.bottomRight().height().calcValue(innerRect.height()));
+
 
     innerTopLeft.setWidth(max(0, innerTopLeft.width() - leftWidth));
     innerTopLeft.setHeight(max(0, innerTopLeft.height() - topWidth));
index c9cd270..477a252 100644 (file)
@@ -393,10 +393,10 @@ public:
 
     const NinePieceImage& borderImage() const { return surround->border.image(); }
 
-    const IntSize& borderTopLeftRadius() const { return surround->border.topLeft(); }
-    const IntSize& borderTopRightRadius() const { return surround->border.topRight(); }
-    const IntSize& borderBottomLeftRadius() const { return surround->border.bottomLeft(); }
-    const IntSize& borderBottomRightRadius() const { return surround->border.bottomRight(); }
+    const LengthSize& borderTopLeftRadius() const { return surround->border.topLeft(); }
+    const LengthSize& borderTopRightRadius() const { return surround->border.topRight(); }
+    const LengthSize& borderBottomLeftRadius() const { return surround->border.bottomLeft(); }
+    const LengthSize& borderBottomRightRadius() const { return surround->border.bottomRight(); }
     bool hasBorderRadius() const { return surround->border.hasBorderRadius(); }
 
     unsigned short borderLeftWidth() const { return surround->border.borderLeftWidth(); }
@@ -774,18 +774,23 @@ public:
     
     void setBorderImage(const NinePieceImage& b) { SET_VAR(surround, border.m_image, b) }
 
-    void setBorderTopLeftRadius(const IntSize& s) { SET_VAR(surround, border.m_topLeft, s) }
-    void setBorderTopRightRadius(const IntSize& s) { SET_VAR(surround, border.m_topRight, s) }
-    void setBorderBottomLeftRadius(const IntSize& s) { SET_VAR(surround, border.m_bottomLeft, s) }
-    void setBorderBottomRightRadius(const IntSize& s) { SET_VAR(surround, border.m_bottomRight, s) }
+    void setBorderTopLeftRadius(const LengthSize& s) { SET_VAR(surround, border.m_topLeft, s) }
+    void setBorderTopRightRadius(const LengthSize& s) { SET_VAR(surround, border.m_topRight, s) }
+    void setBorderBottomLeftRadius(const LengthSize& s) { SET_VAR(surround, border.m_bottomLeft, s) }
+    void setBorderBottomRightRadius(const LengthSize& s) { SET_VAR(surround, border.m_bottomRight, s) }
 
-    void setBorderRadius(const IntSize& s)
+    void setBorderRadius(const LengthSize& s)
     {
         setBorderTopLeftRadius(s);
         setBorderTopRightRadius(s);
         setBorderBottomLeftRadius(s);
         setBorderBottomRightRadius(s);
     }
+    void setBorderRadius(const IntSize& s)
+    {
+        setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed)));
+    }
+
     
     void getBorderRadiiForRect(const IntRect&, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) const;
     void getInnerBorderRadiiForRectWithBorderWidths(const IntRect&, unsigned short topWidth, 
@@ -1117,7 +1122,7 @@ public:
     static bool initialBorderCollapse() { return false; }
     static EBorderStyle initialBorderStyle() { return BNONE; }
     static NinePieceImage initialNinePieceImage() { return NinePieceImage(); }
-    static IntSize initialBorderRadius() { return IntSize(0, 0); }
+    static LengthSize initialBorderRadius() { return LengthSize(Length(0, Fixed), Length(0, Fixed)); }
     static ECaptionSide initialCaptionSide() { return CAPTOP; }
     static EClear initialClear() { return CNONE; }
     static TextDirection initialDirection() { return LTR; }