Crash when setting 'z-index' / 'flex-shrink' CSS properties to a calculated value
https://bugs.webkit.org/show_bug.cgi?id=138783
Reviewed by Andreas Kling.
Source/WebCore:
Update operators converting CSSPrimitiveValue to integer / floating
point types to properly handle calculated values (e.g. 'calc(2 * 3)').
Previously, this was not working in release builds and we would hit an
ASSERT_NOT_REACHED() in debug builds.
Tests: fast/css/flex-shrink-calculated-value.html
fast/css/z-index-calculated-value.html
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::operator unsigned short):
(WebCore::CSSPrimitiveValue::operator int):
(WebCore::CSSPrimitiveValue::operator unsigned):
(WebCore::CSSPrimitiveValue::operator float):
LayoutTests:
Add layout tests to check that settings 'z-index' / 'flex-shrink' CSS
properties to a calculated value does not crash and behaves as
expected.
* fast/css/flex-shrink-calculated-value-expected.txt: Added.
* fast/css/flex-shrink-calculated-value.html: Added.
* fast/css/z-index-calculated-value-expected.txt: Added.
* fast/css/z-index-calculated-value.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@176301 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/fast/css/z-index-calculated-value-expected.txt b/LayoutTests/fast/css/z-index-calculated-value-expected.txt
new file mode 100644
index 0000000..acda00c
--- /dev/null
+++ b/LayoutTests/fast/css/z-index-calculated-value-expected.txt
@@ -0,0 +1,13 @@
+Tests assigning a calculated value to z-index CSS property.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS testDiv.style['z-index'] is ""
+testDiv.style['z-index'] = 'calc(-2 * 3)'
+PASS testDiv.style['z-index'] is "calc(-6)"
+PASS window.getComputedStyle(testDiv).getPropertyValue('z-index') is "-6"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+