Title: [103774] trunk
Revision
103774
Author
alexis.men...@openbossa.org
Date
2011-12-28 12:13:44 -0800 (Wed, 28 Dec 2011)

Log Message

getComputedStyle for border-bottom, border-top, border-left, border-right is not implemented.
https://bugs.webkit.org/show_bug.cgi?id=74743

Reviewed by Tony Chang.

Source/WebCore:

Implement getComputedStyle for border-top, border-bottom, border-right, border-left.

Test: fast/css/getComputedStyle/getComputedStyle-border-shorthand.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
(WebCore::CSSComputedStyleDeclaration::getCSSPropertyValuesForShorthandProperties):
* css/CSSComputedStyleDeclaration.h:

LayoutTests:

Add test to cover that we return correct values.

* fast/css/getComputedStyle/getComputedStyle-border-shorthand-expected.txt: Added.
* fast/css/getComputedStyle/getComputedStyle-border-shorthand.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (103773 => 103774)


--- trunk/LayoutTests/ChangeLog	2011-12-28 19:47:45 UTC (rev 103773)
+++ trunk/LayoutTests/ChangeLog	2011-12-28 20:13:44 UTC (rev 103774)
@@ -1,3 +1,15 @@
+2011-12-28  Alexis Menard  <alexis.men...@openbossa.org>
+
+        getComputedStyle for border-bottom, border-top, border-left, border-right is not implemented.
+        https://bugs.webkit.org/show_bug.cgi?id=74743
+
+        Reviewed by Tony Chang.
+
+        Add test to cover that we return correct values.
+
+        * fast/css/getComputedStyle/getComputedStyle-border-shorthand-expected.txt: Added.
+        * fast/css/getComputedStyle/getComputedStyle-border-shorthand.html: Added.
+
 2011-12-28  Robert Hogan  <rob...@webkit.org>
 
         Inline flow not learning height of all text descendants

Added: trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-shorthand-expected.txt (0 => 103774)


--- trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-shorthand-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-shorthand-expected.txt	2011-12-28 20:13:44 UTC (rev 103774)
@@ -0,0 +1,117 @@
+Test to make sure border shorthand properties returns CSSValueList properly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS computedStyle.getPropertyValue('border-bottom') is '10px solid rgb(255, 0, 0)'
+PASS computedStyle.getPropertyCSSValue('border-bottom').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('border-bottom').cssText is '10px solid rgb(255, 0, 0)'
+PASS computedStyle.getPropertyCSSValue('border-bottom').length is 3
+PASS computedStyle.getPropertyCSSValue('border-bottom').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX) is 10
+PASS computedStyle.getPropertyCSSValue('border-bottom').item(1).getStringValue() is 'solid'
+PASS computedStyle.getPropertyCSSValue('border-bottom').item(2).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
+PASS computedStyle.getPropertyCSSValue('border-bottom').item(2).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('border-bottom').item(2).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyValue('border-bottom') is '320px solid rgb(0, 0, 255)'
+PASS computedStyle.getPropertyCSSValue('border-bottom').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('border-bottom').cssText is '320px solid rgb(0, 0, 255)'
+PASS computedStyle.getPropertyCSSValue('border-bottom').length is 3
+PASS computedStyle.getPropertyCSSValue('border-bottom').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX) is 320
+PASS computedStyle.getPropertyCSSValue('border-bottom').item(1).getStringValue() is 'solid'
+PASS computedStyle.getPropertyCSSValue('border-bottom').item(2).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('border-bottom').item(2).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('border-bottom').item(2).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
+PASS computedStyle.getPropertyValue('border-bottom') is '0px none rgb(0, 128, 0)'
+PASS computedStyle.getPropertyCSSValue('border-bottom').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('border-bottom').cssText is '0px none rgb(0, 128, 0)'
+PASS computedStyle.getPropertyCSSValue('border-bottom').length is 3
+PASS computedStyle.getPropertyCSSValue('border-bottom').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX) is 0
+PASS computedStyle.getPropertyCSSValue('border-bottom').item(1).getStringValue() is 'none'
+PASS computedStyle.getPropertyCSSValue('border-bottom').item(2).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('border-bottom').item(2).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 128
+PASS computedStyle.getPropertyCSSValue('border-bottom').item(2).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyValue('border-top') is '10px solid rgb(255, 0, 0)'
+PASS computedStyle.getPropertyCSSValue('border-top').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('border-top').cssText is '10px solid rgb(255, 0, 0)'
+PASS computedStyle.getPropertyCSSValue('border-top').length is 3
+PASS computedStyle.getPropertyCSSValue('border-top').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX) is 10
+PASS computedStyle.getPropertyCSSValue('border-top').item(1).getStringValue() is 'solid'
+PASS computedStyle.getPropertyCSSValue('border-top').item(2).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
+PASS computedStyle.getPropertyCSSValue('border-top').item(2).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('border-top').item(2).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyValue('border-top') is '320px solid rgb(0, 0, 255)'
+PASS computedStyle.getPropertyCSSValue('border-top').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('border-top').cssText is '320px solid rgb(0, 0, 255)'
+PASS computedStyle.getPropertyCSSValue('border-top').length is 3
+PASS computedStyle.getPropertyCSSValue('border-top').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX) is 320
+PASS computedStyle.getPropertyCSSValue('border-top').item(1).getStringValue() is 'solid'
+PASS computedStyle.getPropertyCSSValue('border-top').item(2).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('border-top').item(2).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('border-top').item(2).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
+PASS computedStyle.getPropertyValue('border-top') is '0px none rgb(0, 128, 0)'
+PASS computedStyle.getPropertyCSSValue('border-top').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('border-top').cssText is '0px none rgb(0, 128, 0)'
+PASS computedStyle.getPropertyCSSValue('border-top').length is 3
+PASS computedStyle.getPropertyCSSValue('border-top').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX) is 0
+PASS computedStyle.getPropertyCSSValue('border-top').item(1).getStringValue() is 'none'
+PASS computedStyle.getPropertyCSSValue('border-top').item(2).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('border-top').item(2).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 128
+PASS computedStyle.getPropertyCSSValue('border-top').item(2).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyValue('border-right') is '10px solid rgb(255, 0, 0)'
+PASS computedStyle.getPropertyCSSValue('border-right').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('border-right').cssText is '10px solid rgb(255, 0, 0)'
+PASS computedStyle.getPropertyCSSValue('border-right').length is 3
+PASS computedStyle.getPropertyCSSValue('border-right').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX) is 10
+PASS computedStyle.getPropertyCSSValue('border-right').item(1).getStringValue() is 'solid'
+PASS computedStyle.getPropertyCSSValue('border-right').item(2).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
+PASS computedStyle.getPropertyCSSValue('border-right').item(2).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('border-right').item(2).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyValue('border-right') is '320px solid rgb(0, 0, 255)'
+PASS computedStyle.getPropertyCSSValue('border-right').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('border-right').cssText is '320px solid rgb(0, 0, 255)'
+PASS computedStyle.getPropertyCSSValue('border-right').length is 3
+PASS computedStyle.getPropertyCSSValue('border-right').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX) is 320
+PASS computedStyle.getPropertyCSSValue('border-right').item(1).getStringValue() is 'solid'
+PASS computedStyle.getPropertyCSSValue('border-right').item(2).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('border-right').item(2).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('border-right').item(2).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
+PASS computedStyle.getPropertyValue('border-right') is '0px none rgb(0, 128, 0)'
+PASS computedStyle.getPropertyCSSValue('border-right').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('border-right').cssText is '0px none rgb(0, 128, 0)'
+PASS computedStyle.getPropertyCSSValue('border-right').length is 3
+PASS computedStyle.getPropertyCSSValue('border-right').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX) is 0
+PASS computedStyle.getPropertyCSSValue('border-right').item(1).getStringValue() is 'none'
+PASS computedStyle.getPropertyCSSValue('border-right').item(2).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('border-right').item(2).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 128
+PASS computedStyle.getPropertyCSSValue('border-right').item(2).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyValue('border-left') is '10px solid rgb(255, 0, 0)'
+PASS computedStyle.getPropertyCSSValue('border-left').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('border-left').cssText is '10px solid rgb(255, 0, 0)'
+PASS computedStyle.getPropertyCSSValue('border-left').length is 3
+PASS computedStyle.getPropertyCSSValue('border-left').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX) is 10
+PASS computedStyle.getPropertyCSSValue('border-left').item(1).getStringValue() is 'solid'
+PASS computedStyle.getPropertyCSSValue('border-left').item(2).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
+PASS computedStyle.getPropertyCSSValue('border-left').item(2).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('border-left').item(2).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyValue('border-left') is '320px solid rgb(0, 0, 255)'
+PASS computedStyle.getPropertyCSSValue('border-left').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('border-left').cssText is '320px solid rgb(0, 0, 255)'
+PASS computedStyle.getPropertyCSSValue('border-left').length is 3
+PASS computedStyle.getPropertyCSSValue('border-left').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX) is 320
+PASS computedStyle.getPropertyCSSValue('border-left').item(1).getStringValue() is 'solid'
+PASS computedStyle.getPropertyCSSValue('border-left').item(2).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('border-left').item(2).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('border-left').item(2).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
+PASS computedStyle.getPropertyValue('border-left') is '0px none rgb(0, 128, 0)'
+PASS computedStyle.getPropertyCSSValue('border-left').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('border-left').cssText is '0px none rgb(0, 128, 0)'
+PASS computedStyle.getPropertyCSSValue('border-left').length is 3
+PASS computedStyle.getPropertyCSSValue('border-left').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX) is 0
+PASS computedStyle.getPropertyCSSValue('border-left').item(1).getStringValue() is 'none'
+PASS computedStyle.getPropertyCSSValue('border-left').item(2).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('border-left').item(2).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 128
+PASS computedStyle.getPropertyCSSValue('border-left').item(2).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-shorthand.html (0 => 103774)


--- trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-shorthand.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-shorthand.html	2011-12-28 20:13:44 UTC (rev 103774)
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+</head>
+<body>
+<script>
+
+description("Test to make sure border shorthand properties returns CSSValueList properly.")
+
+var testContainer = document.createElement("div");
+testContainer.contentEditable = true;
+document.body.appendChild(testContainer);
+
+testContainer.innerHTML = '<div id="test">hello</div>';
+
+e = document.getElementById('test');
+computedStyle = window.getComputedStyle(e, null);
+
+var properties = new Array("border-bottom","border-top","border-right", "border-left");
+
+for (i = 0; i < properties.length; ++i) {
+
+    e.style.cssText = properties[i] + ": 10px solid red;";
+    shouldBe("computedStyle.getPropertyValue('" + properties[i] + "')", "'10px solid rgb(255, 0, 0)'");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').toString()", "'[object CSSValueList]'");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').cssText", "'10px solid rgb(255, 0, 0)'");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').length", "3");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX)", "10");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').item(1).getStringValue()", "'solid'");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').item(2).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "255");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').item(2).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').item(2).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+
+    e.style.cssText = properties[i] + ": 20em solid blue;";
+    shouldBe("computedStyle.getPropertyValue('" + properties[i] + "')", "'320px solid rgb(0, 0, 255)'");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').toString()", "'[object CSSValueList]'");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').cssText", "'320px solid rgb(0, 0, 255)'");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').length", "3");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX)", "320");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').item(1).getStringValue()", "'solid'");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').item(2).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').item(2).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').item(2).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "255");
+
+    e.style.cssText = properties[i] + ": 10px none green;";
+    shouldBe("computedStyle.getPropertyValue('" + properties[i] + "')", "'0px none rgb(0, 128, 0)'");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').toString()", "'[object CSSValueList]'");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').cssText", "'0px none rgb(0, 128, 0)'");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').length", "3");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX)", "0");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').item(1).getStringValue()", "'none'");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').item(2).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').item(2).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "128");
+    shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').item(2).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+
+}
+document.body.removeChild(testContainer);
+
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (103773 => 103774)


--- trunk/Source/WebCore/ChangeLog	2011-12-28 19:47:45 UTC (rev 103773)
+++ trunk/Source/WebCore/ChangeLog	2011-12-28 20:13:44 UTC (rev 103774)
@@ -1,3 +1,19 @@
+2011-12-28  Alexis Menard  <alexis.men...@openbossa.org>
+
+        getComputedStyle for border-bottom, border-top, border-left, border-right is not implemented.
+        https://bugs.webkit.org/show_bug.cgi?id=74743
+
+        Reviewed by Tony Chang.
+
+        Implement getComputedStyle for border-top, border-bottom, border-right, border-left.
+
+        Test: fast/css/getComputedStyle/getComputedStyle-border-shorthand.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+        (WebCore::CSSComputedStyleDeclaration::getCSSPropertyValuesForShorthandProperties):
+        * css/CSSComputedStyleDeclaration.h:
+
 2011-12-28  Robert Hogan  <rob...@webkit.org>
 
         Inline flow not learning height of all text descendants

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (103773 => 103774)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2011-12-28 19:47:45 UTC (rev 103773)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2011-12-28 20:13:44 UTC (rev 103774)
@@ -2138,22 +2138,38 @@
         /* Shorthand properties, currently not supported see bug 13658*/
         case CSSPropertyBackground:
         case CSSPropertyBorder:
-        case CSSPropertyBorderBottom:
+            break;
+        case CSSPropertyBorderBottom: {
+            const int properties[3] = { CSSPropertyBorderBottomWidth, CSSPropertyBorderBottomStyle,
+                                        CSSPropertyBorderBottomColor };
+            return getCSSPropertyValuesForShorthandProperties(properties, WTF_ARRAY_LENGTH(properties));
+        }
         case CSSPropertyBorderColor:
-        case CSSPropertyBorderLeft:
+            break;
+        case CSSPropertyBorderLeft: {
+            const int properties[3] = { CSSPropertyBorderLeftWidth, CSSPropertyBorderLeftStyle,
+                                        CSSPropertyBorderLeftColor };
+            return getCSSPropertyValuesForShorthandProperties(properties, WTF_ARRAY_LENGTH(properties));
+        }
         case CSSPropertyBorderImage:
         case CSSPropertyBorderRadius:
-        case CSSPropertyBorderRight:
+            break;
+        case CSSPropertyBorderRight: {
+            const int properties[3] = { CSSPropertyBorderRightWidth, CSSPropertyBorderRightStyle,
+                                        CSSPropertyBorderRightColor };
+            return getCSSPropertyValuesForShorthandProperties(properties, WTF_ARRAY_LENGTH(properties));
+        }
         case CSSPropertyBorderStyle:
-        case CSSPropertyBorderTop:
             break;
+        case CSSPropertyBorderTop: {
+            const int properties[3] = { CSSPropertyBorderTopWidth, CSSPropertyBorderTopStyle,
+                                        CSSPropertyBorderTopColor };
+            return getCSSPropertyValuesForShorthandProperties(properties, WTF_ARRAY_LENGTH(properties));
+        }
         case CSSPropertyBorderWidth: {
-            RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
-            list->append(zoomAdjustedPixelValue(style->borderTopWidth(), style.get(), cssValuePool));
-            list->append(zoomAdjustedPixelValue(style->borderRightWidth(), style.get(), cssValuePool));
-            list->append(zoomAdjustedPixelValue(style->borderBottomWidth(), style.get(), cssValuePool));
-            list->append(zoomAdjustedPixelValue(style->borderLeftWidth(), style.get(), cssValuePool));
-            return list.release();
+            const int properties[4] = { CSSPropertyBorderTopWidth, CSSPropertyBorderRightWidth,
+                                        CSSPropertyBorderBottomWidth, CSSPropertyBorderLeftWidth };
+            return getCSSPropertyValuesForShorthandProperties(properties, WTF_ARRAY_LENGTH(properties));
         }
         case CSSPropertyListStyle:
         case CSSPropertyMargin:
@@ -2373,4 +2389,14 @@
     return copy();
 }
 
+PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getCSSPropertyValuesForShorthandProperties(const int* properties, size_t size) const
+{
+    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+    for (size_t i = 0; i < size; ++i) {
+        RefPtr<CSSValue> value = getPropertyCSSValue(properties[i], DoNotUpdateLayout);
+        list->append(value);
+    }
+    return list.release();
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h (103773 => 103774)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h	2011-12-28 19:47:45 UTC (rev 103773)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.h	2011-12-28 20:13:44 UTC (rev 103774)
@@ -31,6 +31,8 @@
 class Color;
 class CSSMutableStyleDeclaration;
 class CSSPrimitiveValue;
+class CSSValueList;
+class CSSValuePool;
 class Node;
 class RenderStyle;
 class ShadowData;
@@ -85,6 +87,8 @@
     PassRefPtr<CSSValue> valueForFilter(RenderStyle*) const;
 #endif
 
+    PassRefPtr<CSSValueList> getCSSPropertyValuesForShorthandProperties(const int* properties, size_t) const;
+
     RefPtr<Node> m_node;
     PseudoId m_pseudoElementSpecifier;
     bool m_allowVisitedStyle;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to