Title: [103096] trunk
Revision
103096
Author
alexis.men...@openbossa.org
Date
2011-12-16 12:50:31 -0800 (Fri, 16 Dec 2011)

Log Message

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

Reviewed by Tony Chang.

Source/WebCore:

Implement getComputedStyle for border-width.

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

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

LayoutTests:

Implement a test to cover getComputedStyle for border-width.

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

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (103095 => 103096)


--- trunk/LayoutTests/ChangeLog	2011-12-16 20:41:51 UTC (rev 103095)
+++ trunk/LayoutTests/ChangeLog	2011-12-16 20:50:31 UTC (rev 103096)
@@ -1,3 +1,15 @@
+2011-12-16  Alexis Menard  <alexis.men...@openbossa.org>
+
+        getComputedStyle for border-width is not implemented.
+        https://bugs.webkit.org/show_bug.cgi?id=74635
+
+        Reviewed by Tony Chang.
+
+        Implement a test to cover getComputedStyle for border-width.
+
+        * fast/css/getComputedStyle/getComputedStyle-border-width-expected.txt: Added.
+        * fast/css/getComputedStyle/getComputedStyle-border-width.html: Added.
+
 2011-12-16  Dmitry Lomov  <dslo...@google.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=74657

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


--- trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-width-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-width-expected.txt	2011-12-16 20:50:31 UTC (rev 103096)
@@ -0,0 +1,49 @@
+Test to make sure border-width property returns CSSValueList properly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS computedStyle.getPropertyValue('border-width') is '10px 5px 4px 3px'
+PASS computedStyle.getPropertyCSSValue('border-width').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('border-width').cssText is '10px 5px 4px 3px'
+PASS computedStyle.getPropertyCSSValue('border-width').length is 4
+PASS computedStyle.getPropertyCSSValue('border-width').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX) is 10
+PASS computedStyle.getPropertyCSSValue('border-width').item(1).getFloatValue(CSSPrimitiveValue.CSS_PX) is 5
+PASS computedStyle.getPropertyCSSValue('border-width').item(2).getFloatValue(CSSPrimitiveValue.CSS_PX) is 4
+PASS computedStyle.getPropertyCSSValue('border-width').item(3).getFloatValue(CSSPrimitiveValue.CSS_PX) is 3
+PASS computedStyle.getPropertyValue('border-width') is '320px 160px 64px 80px'
+PASS computedStyle.getPropertyCSSValue('border-width').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('border-width').cssText is '320px 160px 64px 80px'
+PASS computedStyle.getPropertyCSSValue('border-width').length is 4
+PASS computedStyle.getPropertyCSSValue('border-width').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX) is 320
+PASS computedStyle.getPropertyCSSValue('border-width').item(1).getFloatValue(CSSPrimitiveValue.CSS_PX) is 160
+PASS computedStyle.getPropertyCSSValue('border-width').item(2).getFloatValue(CSSPrimitiveValue.CSS_PX) is 64
+PASS computedStyle.getPropertyCSSValue('border-width').item(3).getFloatValue(CSSPrimitiveValue.CSS_PX) is 80
+PASS computedStyle.getPropertyValue('border-width') is '10px 0px 0px 0px'
+PASS computedStyle.getPropertyCSSValue('border-width').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('border-width').cssText is '10px 0px 0px 0px'
+PASS computedStyle.getPropertyCSSValue('border-width').length is 4
+PASS computedStyle.getPropertyCSSValue('border-width').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX) is 10
+PASS computedStyle.getPropertyCSSValue('border-width').item(1).getFloatValue(CSSPrimitiveValue.CSS_PX) is 0
+PASS computedStyle.getPropertyCSSValue('border-width').item(2).getFloatValue(CSSPrimitiveValue.CSS_PX) is 0
+PASS computedStyle.getPropertyCSSValue('border-width').item(3).getFloatValue(CSSPrimitiveValue.CSS_PX) is 0
+PASS computedStyle.getPropertyValue('border-width') is '0px 0px 0px 0px'
+PASS computedStyle.getPropertyCSSValue('border-width').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('border-width').cssText is '0px 0px 0px 0px'
+PASS computedStyle.getPropertyCSSValue('border-width').length is 4
+PASS computedStyle.getPropertyCSSValue('border-width').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX) is 0
+PASS computedStyle.getPropertyCSSValue('border-width').item(1).getFloatValue(CSSPrimitiveValue.CSS_PX) is 0
+PASS computedStyle.getPropertyCSSValue('border-width').item(2).getFloatValue(CSSPrimitiveValue.CSS_PX) is 0
+PASS computedStyle.getPropertyCSSValue('border-width').item(3).getFloatValue(CSSPrimitiveValue.CSS_PX) is 0
+PASS computedStyle.getPropertyValue('border-width') is '0px 0px 0px 0px'
+PASS computedStyle.getPropertyCSSValue('border-width').toString() is '[object CSSValueList]'
+PASS computedStyle.getPropertyCSSValue('border-width').cssText is '0px 0px 0px 0px'
+PASS computedStyle.getPropertyCSSValue('border-width').length is 4
+PASS computedStyle.getPropertyCSSValue('border-width').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX) is 0
+PASS computedStyle.getPropertyCSSValue('border-width').item(1).getFloatValue(CSSPrimitiveValue.CSS_PX) is 0
+PASS computedStyle.getPropertyCSSValue('border-width').item(2).getFloatValue(CSSPrimitiveValue.CSS_PX) is 0
+PASS computedStyle.getPropertyCSSValue('border-width').item(3).getFloatValue(CSSPrimitiveValue.CSS_PX) is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

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


--- trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-width.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-width.html	2011-12-16 20:50:31 UTC (rev 103096)
@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+</head>
+<body>
+<script>
+
+description("Test to make sure border-width property returns CSSValueList properly.")
+
+var testContainer = document.createElement("div");
+testContainer.contentEditable = true;
+document.body.appendChild(testContainer);
+
+testContainer.innerHTML = '<div id="test" style="border-width: 10px 5px 4px 3px; border-style: solid solid;">hello</div>';
+
+e = document.getElementById('test');
+computedStyle = window.getComputedStyle(e, null);
+
+shouldBe("computedStyle.getPropertyValue('border-width')", "'10px 5px 4px 3px'");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').cssText", "'10px 5px 4px 3px'");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').length", "4");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX)", "10");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').item(1).getFloatValue(CSSPrimitiveValue.CSS_PX)", "5");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').item(2).getFloatValue(CSSPrimitiveValue.CSS_PX)", "4");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').item(3).getFloatValue(CSSPrimitiveValue.CSS_PX)", "3");
+
+e.style.borderWidth="20em 10em 4em 5em";
+shouldBe("computedStyle.getPropertyValue('border-width')", "'320px 160px 64px 80px'");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').cssText", "'320px 160px 64px 80px'");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').length", "4");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX)", "320");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').item(1).getFloatValue(CSSPrimitiveValue.CSS_PX)", "160");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').item(2).getFloatValue(CSSPrimitiveValue.CSS_PX)", "64");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').item(3).getFloatValue(CSSPrimitiveValue.CSS_PX)", "80");
+
+e.style.borderWidth=""
+e.style.borderStyle=""
+e.style.borderTop = "10px solid"
+shouldBe("computedStyle.getPropertyValue('border-width')", "'10px 0px 0px 0px'");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').cssText", "'10px 0px 0px 0px'");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').length", "4");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX)", "10");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').item(1).getFloatValue(CSSPrimitiveValue.CSS_PX)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').item(2).getFloatValue(CSSPrimitiveValue.CSS_PX)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').item(3).getFloatValue(CSSPrimitiveValue.CSS_PX)", "0");
+
+e.style.borderTop=""
+e.style.borderWidth="10px 5px 4px 3px"
+e.style.borderStyle="none";
+shouldBe("computedStyle.getPropertyValue('border-width')", "'0px 0px 0px 0px'");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').cssText", "'0px 0px 0px 0px'");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').length", "4");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').item(1).getFloatValue(CSSPrimitiveValue.CSS_PX)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').item(2).getFloatValue(CSSPrimitiveValue.CSS_PX)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').item(3).getFloatValue(CSSPrimitiveValue.CSS_PX)", "0");
+
+e.style.borderStyle="hidden";
+shouldBe("computedStyle.getPropertyValue('border-width')", "'0px 0px 0px 0px'");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').toString()", "'[object CSSValueList]'");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').cssText", "'0px 0px 0px 0px'");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').length", "4");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').item(0).getFloatValue(CSSPrimitiveValue.CSS_PX)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').item(1).getFloatValue(CSSPrimitiveValue.CSS_PX)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').item(2).getFloatValue(CSSPrimitiveValue.CSS_PX)", "0");
+shouldBe("computedStyle.getPropertyCSSValue('border-width').item(3).getFloatValue(CSSPrimitiveValue.CSS_PX)", "0");
+
+document.body.removeChild(testContainer);
+
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (103095 => 103096)


--- trunk/Source/WebCore/ChangeLog	2011-12-16 20:41:51 UTC (rev 103095)
+++ trunk/Source/WebCore/ChangeLog	2011-12-16 20:50:31 UTC (rev 103096)
@@ -1,3 +1,17 @@
+2011-12-16  Alexis Menard  <alexis.men...@openbossa.org>
+
+        getComputedStyle for border-width is not implemented.
+        https://bugs.webkit.org/show_bug.cgi?id=74635
+
+        Reviewed by Tony Chang.
+
+        Implement getComputedStyle for border-width.
+
+        Test: fast/css/getComputedStyle/getComputedStyle-border-width.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+
 2011-12-16  Branimir Lambov  <blam...@google.com>
 
         [chromium] svg/clip-path/clip-in-mask.svg fails on Windows and Linux

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (103095 => 103096)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2011-12-16 20:41:51 UTC (rev 103095)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2011-12-16 20:50:31 UTC (rev 103096)
@@ -2157,7 +2157,15 @@
         case CSSPropertyBorderRight:
         case CSSPropertyBorderStyle:
         case CSSPropertyBorderTop:
-        case CSSPropertyBorderWidth:
+            break;
+        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();
+        }
         case CSSPropertyListStyle:
         case CSSPropertyMargin:
         case CSSPropertyOutline:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to