Title: [176458] trunk
Revision
176458
Author
[email protected]
Date
2014-11-21 11:48:21 -0800 (Fri, 21 Nov 2014)

Log Message

Crash when setting 'transition-delay' CSS property to a calculated value
https://bugs.webkit.org/show_bug.cgi?id=138784

Reviewed by Sam Weinig.

Source/WebCore:

Update CSSPrimitiveValue::computeTime() to use primitiveType() instead
of m_primitiveUnitType so that it properly handles calculated values.
Without this, we would hit the ASSERT_NOT_REACHED() assertion in
computeTime() for calculated values.

Test: fast/css/transition-delay-calculated-value.html

* css/CSSPrimitiveValue.h:
(WebCore::CSSPrimitiveValue::computeTime):

LayoutTests:

Add a layout test to check that setting the 'transition-delay' CSS
property to a calculated value does not crash and works as intended.

* fast/css/transition-delay-calculated-value-expected.txt: Added.
* fast/css/transition-delay-calculated-value.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (176457 => 176458)


--- trunk/LayoutTests/ChangeLog	2014-11-21 19:46:53 UTC (rev 176457)
+++ trunk/LayoutTests/ChangeLog	2014-11-21 19:48:21 UTC (rev 176458)
@@ -1,3 +1,16 @@
+2014-11-21  Chris Dumez  <[email protected]>
+
+        Crash when setting 'transition-delay' CSS property to a calculated value
+        https://bugs.webkit.org/show_bug.cgi?id=138784
+
+        Reviewed by Sam Weinig.
+
+        Add a layout test to check that setting the 'transition-delay' CSS
+        property to a calculated value does not crash and works as intended.
+
+        * fast/css/transition-delay-calculated-value-expected.txt: Added.
+        * fast/css/transition-delay-calculated-value.html: Added.
+
 2014-11-20  Roger Fong  <[email protected]>
 
         Two WebGL tests try to use an external resource.

Added: trunk/LayoutTests/fast/css/transition-delay-calculated-value-expected.txt (0 => 176458)


--- trunk/LayoutTests/fast/css/transition-delay-calculated-value-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/transition-delay-calculated-value-expected.txt	2014-11-21 19:48:21 UTC (rev 176458)
@@ -0,0 +1,13 @@
+Tests assigning a calculated value to 'transition-delay' CSS property.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS testDiv.style['transition-delay'] is ""
+testDiv.style['transition-delay'] = 'calc(300ms/2)'
+PASS testDiv.style['transition-delay'] is "calc(150ms)"
+PASS window.getComputedStyle(testDiv).getPropertyValue('transition-delay') is "0.15s"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/css/transition-delay-calculated-value.html (0 => 176458)


--- trunk/LayoutTests/fast/css/transition-delay-calculated-value.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/transition-delay-calculated-value.html	2014-11-21 19:48:21 UTC (rev 176458)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<body>
+<script src=""
+<div id="testDiv"></div>
+<script>
+description("Tests assigning a calculated value to 'transition-delay' CSS property.");
+
+var testDiv = document.getElementById("testDiv");
+
+shouldBeEmptyString("testDiv.style['transition-delay']");
+evalAndLog("testDiv.style['transition-delay'] = 'calc(300ms/2)'");
+shouldBeEqualToString("testDiv.style['transition-delay']", "calc(150ms)");
+shouldBeEqualToString("window.getComputedStyle(testDiv).getPropertyValue('transition-delay')", "0.15s");
+
+</script>
+<script src=""
+</body>

Modified: trunk/Source/WebCore/ChangeLog (176457 => 176458)


--- trunk/Source/WebCore/ChangeLog	2014-11-21 19:46:53 UTC (rev 176457)
+++ trunk/Source/WebCore/ChangeLog	2014-11-21 19:48:21 UTC (rev 176458)
@@ -1,5 +1,22 @@
 2014-11-21  Chris Dumez  <[email protected]>
 
+        Crash when setting 'transition-delay' CSS property to a calculated value
+        https://bugs.webkit.org/show_bug.cgi?id=138784
+
+        Reviewed by Sam Weinig.
+
+        Update CSSPrimitiveValue::computeTime() to use primitiveType() instead
+        of m_primitiveUnitType so that it properly handles calculated values.
+        Without this, we would hit the ASSERT_NOT_REACHED() assertion in
+        computeTime() for calculated values.
+
+        Test: fast/css/transition-delay-calculated-value.html
+
+        * css/CSSPrimitiveValue.h:
+        (WebCore::CSSPrimitiveValue::computeTime):
+
+2014-11-21  Chris Dumez  <[email protected]>
+
         Regression(r175381): -webkit-mask-box-image is broken
         https://bugs.webkit.org/show_bug.cgi?id=138969
         <rdar://problem/19054471>

Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.h (176457 => 176458)


--- trunk/Source/WebCore/css/CSSPrimitiveValue.h	2014-11-21 19:46:53 UTC (rev 176457)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.h	2014-11-21 19:48:21 UTC (rev 176458)
@@ -259,13 +259,13 @@
     enum TimeUnit { Seconds, Milliseconds };
     template <typename T, TimeUnit timeUnit> T computeTime()
     {
-        if (timeUnit == Seconds && m_primitiveUnitType == CSS_S)
+        if (timeUnit == Seconds && primitiveType() == CSS_S)
             return getValue<T>();
-        if (timeUnit == Seconds && m_primitiveUnitType == CSS_MS)
+        if (timeUnit == Seconds && primitiveType() == CSS_MS)
             return getValue<T>() / 1000;
-        if (timeUnit == Milliseconds && m_primitiveUnitType == CSS_MS)
+        if (timeUnit == Milliseconds && primitiveType() == CSS_MS)
             return getValue<T>();
-        if (timeUnit == Milliseconds && m_primitiveUnitType == CSS_S)
+        if (timeUnit == Milliseconds && primitiveType() == CSS_S)
             return getValue<T>() * 1000;
         ASSERT_NOT_REACHED();
         return 0;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to