[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

rwlbuis at webkit.org rwlbuis at webkit.org
Wed Dec 22 12:54:58 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 13f8920394a457114cc6658cff6b4e2379373ff2
Author: rwlbuis at webkit.org <rwlbuis at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Sep 1 19:51:32 2010 +0000

    2010-09-01  Rob Buis  <rwlbuis at 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):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66615 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index dbb3db4..a19b062 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-09-01  Rob Buis  <rwlbuis at 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 at chromium.org>
 
         Unreviewed, add chromium win/linux baselines for fast/multicol/float-paginate.html.
diff --git a/LayoutTests/fast/borders/border-radius-parsing-expected.txt b/LayoutTests/fast/borders/border-radius-parsing-expected.txt
index 6dbef2c..e4618b0 100644
--- a/LayoutTests/fast/borders/border-radius-parsing-expected.txt
+++ b/LayoutTests/fast/borders/border-radius-parsing-expected.txt
@@ -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
 
diff --git a/LayoutTests/fast/borders/border-radius-parsing.html b/LayoutTests/fast/borders/border-radius-parsing.html
index 9874590..772a021 100644
--- a/LayoutTests/fast/borders/border-radius-parsing.html
+++ b/LayoutTests/fast/borders/border-radius-parsing.html
@@ -47,4 +47,20 @@
     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>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 8f52264..586ffea 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,48 @@
+2010-09-01  Rob Buis  <rwlbuis at 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 at chromium.org>
 
         Reviewed by Yury Semikhatsky.
diff --git a/WebCore/css/CSSComputedStyleDeclaration.cpp b/WebCore/css/CSSComputedStyleDeclaration.cpp
index 1da86cb..b1e8ac4 100644
--- a/WebCore/css/CSSComputedStyleDeclaration.cpp
+++ b/WebCore/css/CSSComputedStyleDeclaration.cpp
@@ -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();
 }
 
diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp
index e20537a..687235f 100644
--- a/WebCore/css/CSSParser.cpp
+++ b/WebCore/css/CSSParser.cpp
@@ -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));
diff --git a/WebCore/css/CSSPrimitiveValue.cpp b/WebCore/css/CSSPrimitiveValue.cpp
index 0508cd5..b4478b4 100644
--- a/WebCore/css/CSSPrimitiveValue.cpp
+++ b/WebCore/css/CSSPrimitiveValue.cpp
@@ -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)
 {
diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp
index 8657843..fe59a35 100644
--- a/WebCore/css/CSSStyleSelector.cpp
+++ b/WebCore/css/CSSStyleSelector.cpp
@@ -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);
diff --git a/WebCore/page/animation/AnimationBase.cpp b/WebCore/page/animation/AnimationBase.cpp
index d2e86bd..37eaae7 100644
--- a/WebCore/page/animation/AnimationBase.cpp
+++ b/WebCore/page/animation/AnimationBase.cpp
@@ -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));
 
diff --git a/WebCore/platform/Length.h b/WebCore/platform/Length.h
index a3b1eda..7dd875e 100644
--- a/WebCore/platform/Length.h
+++ b/WebCore/platform/Length.h
@@ -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 };
 
diff --git a/WebCore/rendering/RenderObject.cpp b/WebCore/rendering/RenderObject.cpp
index d01b92d..e200ff9 100644
--- a/WebCore/rendering/RenderObject.cpp
+++ b/WebCore/rendering/RenderObject.cpp
@@ -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()),
diff --git a/WebCore/rendering/style/BorderData.h b/WebCore/rendering/style/BorderData.h
index 96caf97..03635d9 100644
--- a/WebCore/rendering/style/BorderData.h
+++ b/WebCore/rendering/style/BorderData.h
@@ -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
diff --git a/WebCore/rendering/style/RenderStyle.cpp b/WebCore/rendering/style/RenderStyle.cpp
index 2d59bab..93cd8de 100644
--- a/WebCore/rendering/style/RenderStyle.cpp
+++ b/WebCore/rendering/style/RenderStyle.cpp
@@ -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));
diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h
index c9cd270..477a252 100644
--- a/WebCore/rendering/style/RenderStyle.h
+++ b/WebCore/rendering/style/RenderStyle.h
@@ -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; }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list