Title: [103948] trunk
Revision
103948
Author
alexis.men...@openbossa.org
Date
2012-01-03 11:13:48 -0800 (Tue, 03 Jan 2012)

Log Message

getComputedStyle for border is not implemented.
https://bugs.webkit.org/show_bug.cgi?id=75319

Reviewed by Tony Chang.

Source/WebCore:

Implement getComputedStyle for border.

fast/css/getComputedStyle/getComputedStyle-border-shorthand.html was extented.

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

LayoutTests:

Extend existing test to cover that we return correct values.

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

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (103947 => 103948)


--- trunk/LayoutTests/ChangeLog	2012-01-03 19:03:37 UTC (rev 103947)
+++ trunk/LayoutTests/ChangeLog	2012-01-03 19:13:48 UTC (rev 103948)
@@ -1,5 +1,17 @@
 2012-01-03  Alexis Menard  <alexis.men...@openbossa.org>
 
+        getComputedStyle for border is not implemented.
+        https://bugs.webkit.org/show_bug.cgi?id=75319
+
+        Reviewed by Tony Chang.
+
+        Extend existing test to cover that we return correct values.
+
+        * fast/css/getComputedStyle/getComputedStyle-border-shorthand-expected.txt:
+        * fast/css/getComputedStyle/getComputedStyle-border-shorthand.html:
+
+2012-01-03  Alexis Menard  <alexis.men...@openbossa.org>
+
         getComputedStyle for outline is not implemented.
         https://bugs.webkit.org/show_bug.cgi?id=75441
 

Modified: trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-shorthand-expected.txt (103947 => 103948)


--- trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-shorthand-expected.txt	2012-01-03 19:03:37 UTC (rev 103947)
+++ trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-shorthand-expected.txt	2012-01-03 19:13:48 UTC (rev 103948)
@@ -111,6 +111,16 @@
 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 computedStyle.getPropertyValue('border') is '320px solid rgb(255, 0, 0)'
+PASS computedStyle.getPropertyCSSValue('border').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('border').cssText is '320px solid rgb(255, 0, 0)'
+PASS computedStyle.getPropertyCSSValue('border').length is 3
+PASS computedStyle.getPropertyCSSValue('border').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX) is 320
+PASS computedStyle.getPropertyCSSValue('border').item(1).getStringValue() is 'solid'
+PASS computedStyle.getPropertyCSSValue('border').item(2).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 255
+PASS computedStyle.getPropertyCSSValue('border').item(2).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyCSSValue('border').item(2).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER) is 0
+PASS computedStyle.getPropertyValue('border') is ''
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-shorthand.html (103947 => 103948)


--- trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-shorthand.html	2012-01-03 19:03:37 UTC (rev 103947)
+++ trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-shorthand.html	2012-01-03 19:13:48 UTC (rev 103948)
@@ -56,6 +56,25 @@
     shouldBe("computedStyle.getPropertyCSSValue('" + properties[i] + "').item(2).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
 
 }
+
+e.style.cssText = "";
+e.style.border = "20em solid red";
+shouldBe("computedStyle.getPropertyValue('border')", "'320px solid rgb(255, 0, 0)'");
+shouldBe("computedStyle.getPropertyCSSValue('border').toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('border').cssText", "'320px solid rgb(255, 0, 0)'");
+shouldBe("computedStyle.getPropertyCSSValue('border').length", "3");
+shouldBe("computedStyle.getPropertyCSSValue('border').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX)", "320");
+shouldBe("computedStyle.getPropertyCSSValue('border').item(1).getStringValue()", "'solid'");
+shouldBe("computedStyle.getPropertyCSSValue('border').item(2).getRGBColorValue().red.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "255");
+shouldBe("computedStyle.getPropertyCSSValue('border').item(2).getRGBColorValue().green.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('border').item(2).getRGBColorValue().blue.getFloatValue(CSSPrimitiveValue.CSS_NUMBER)", "0");
+
+
+e.style.border = "20em solid red";
+e.style.borderTop = "10px groove blue";
+shouldBe("computedStyle.getPropertyValue('border')", "''");
+
+
 document.body.removeChild(testContainer);
 
 </script>

Modified: trunk/Source/WebCore/ChangeLog (103947 => 103948)


--- trunk/Source/WebCore/ChangeLog	2012-01-03 19:03:37 UTC (rev 103947)
+++ trunk/Source/WebCore/ChangeLog	2012-01-03 19:13:48 UTC (rev 103948)
@@ -1,5 +1,19 @@
 2012-01-03  Alexis Menard  <alexis.men...@openbossa.org>
 
+        getComputedStyle for border is not implemented.
+        https://bugs.webkit.org/show_bug.cgi?id=75319
+
+        Reviewed by Tony Chang.
+
+        Implement getComputedStyle for border.
+
+        fast/css/getComputedStyle/getComputedStyle-border-shorthand.html was extented.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+
+2012-01-03  Alexis Menard  <alexis.men...@openbossa.org>
+
         Sort the WebCore XCode project file
 
         Reviewed by Dimitri Glazkov.

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (103947 => 103948)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2012-01-03 19:03:37 UTC (rev 103947)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2012-01-03 19:13:48 UTC (rev 103948)
@@ -2137,8 +2137,17 @@
 #endif
         /* Shorthand properties, currently not supported see bug 13658*/
         case CSSPropertyBackground:
-        case CSSPropertyBorder:
             break;
+        case CSSPropertyBorder: {
+            RefPtr<CSSValue> value = getPropertyCSSValue(CSSPropertyBorderTop, DoNotUpdateLayout);
+            const int properties[3] = { CSSPropertyBorderRight, CSSPropertyBorderBottom,
+                                        CSSPropertyBorderLeft };
+            for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) {
+                if (value->cssText() !=  getPropertyCSSValue(properties[i], DoNotUpdateLayout)->cssText())
+                    return 0;
+            }
+            return value.release();
+        }
         case CSSPropertyBorderBottom: {
             const int properties[3] = { CSSPropertyBorderBottomWidth, CSSPropertyBorderBottomStyle,
                                         CSSPropertyBorderBottomColor };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to