Strange Result for getComputedStyle on borderWidth set in em
https://bugs.webkit.org/show_bug.cgi?id=18294
Reviewed by Tony Chang.
Source/WebCore:
BorderValue stores its width on a 12 bits unsigned. This patch
increase it to 27. The patch also modify the way to set the
width or to get it, we now use a unsigned rather than a short.
Test: fast/css/border-width-large.html
* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::computeLength):
* css/CSSStyleApplyProperty.cpp:
(WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):
* page/animation/AnimationBase.cpp:
(WebCore::blendFunc):
(WebCore::AnimationBase::ensurePropertyMap):
* platform/animation/AnimationUtilities.h:
(WebCore::blend):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::adjustStyle):
* rendering/style/BorderData.h:
(WebCore::BorderData::borderLeftWidth):
(WebCore::BorderData::borderRightWidth):
(WebCore::BorderData::borderTopWidth):
(WebCore::BorderData::borderBottomWidth):
* rendering/style/BorderValue.h:
(WebCore::BorderValue::width):
* rendering/style/RenderStyle.cpp:
* rendering/style/RenderStyle.h:
(WebCore::RenderStyleBitfields::borderLeftWidth):
(WebCore::RenderStyleBitfields::borderRightWidth):
(WebCore::RenderStyleBitfields::borderTopWidth):
(WebCore::RenderStyleBitfields::borderBottomWidth):
(WebCore::RenderStyleBitfields::setBorderLeftWidth):
(WebCore::RenderStyleBitfields::setBorderRightWidth):
(WebCore::RenderStyleBitfields::setBorderTopWidth):
(WebCore::RenderStyleBitfields::setBorderBottomWidth):
(WebCore::RenderStyleBitfields::initialBorderWidth):
(WebCore::RenderStyleBitfields::initialColumnRuleWidth):
(WebCore::RenderStyleBitfields::initialOutlineWidth):
LayoutTests:
This test covers that setting big values to border-width will
return correct values.
* fast/css/border-width-large-expected.txt: Added.
* fast/css/border-width-large.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105403 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/fast/css/border-width-large-expected.txt b/LayoutTests/fast/css/border-width-large-expected.txt
new file mode 100644
index 0000000..de4d579
--- /dev/null
+++ b/LayoutTests/fast/css/border-width-large-expected.txt
@@ -0,0 +1,11 @@
+Test for WebKit bug 18294 : Strange Result for getComputedStyle on borderWidth set in em
+
+PASS computedStyle.getPropertyValue('border-width') is '12000px 11000px 10000px 9010px'
+PASS computedStyle.getPropertyCSSValue('border-top-width').cssText is '12000px'
+PASS computedStyle.getPropertyCSSValue('border-right-width').cssText is '11000px'
+PASS computedStyle.getPropertyCSSValue('border-bottom-width').cssText is '10000px'
+PASS computedStyle.getPropertyCSSValue('border-left-width').cssText is '9010px'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/css/border-width-large.html b/LayoutTests/fast/css/border-width-large.html
new file mode 100644
index 0000000..522bf31
--- /dev/null
+++ b/LayoutTests/fast/css/border-width-large.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>Test for WebKit bug 18294 : Strange Result for getComputedStyle on borderWidth set in em</title>
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description">Test for WebKit bug <a href="https://bugs.webkit.org/show_bug.cgi?id=18294">18294</a> : Strange Result for getComputedStyle on borderWidth set in em</p>
+<div id="console"></div>
+
+<div id="tests_container">
+
+<div id="test" style="border-style:solid;font-size:100px;"></div>
+
+</div>
+
+<script>
+ var test = document.getElementById("test");
+
+ test.style.borderWidth = "120em 110em 100em 90.1em";
+ var computedStyle = window.getComputedStyle(test, null);
+ shouldBe("computedStyle.getPropertyValue('border-width')", "'12000px 11000px 10000px 9010px'");
+ shouldBe("computedStyle.getPropertyCSSValue('border-top-width').cssText","'12000px'");
+ shouldBe("computedStyle.getPropertyCSSValue('border-right-width').cssText","'11000px'");
+ shouldBe("computedStyle.getPropertyCSSValue('border-bottom-width').cssText","'10000px'");
+ shouldBe("computedStyle.getPropertyCSSValue('border-left-width').cssText","'9010px'");
+ // clean up after ourselves
+ var tests_container = document.getElementById("tests_container");
+ tests_container.parentNode.removeChild(tests_container);
+</script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>