Title: [139070] trunk
Revision
139070
Author
ale...@webkit.org
Date
2013-01-08 10:08:02 -0800 (Tue, 08 Jan 2013)

Log Message

transition-delay and transition-duration return incorrect values when querying using the computed style.
https://bugs.webkit.org/show_bug.cgi?id=105432

Reviewed by Dean Jackson.

Source/WebCore:

When setting the transition-delay to 10ms for example the value of transition-delay
on the computed style was incorrect, it should return 0.01s but it was
returning something like 0.0099999999...s. In fact the bug was after
the parsing step when creating the Animation object where a conversion
from a double to float was done. This conversion is not needed as the
animation class expects double for delay and transition times.

Test: transitions/transitions-parsing.html

* css/CSSToStyleMap.cpp:
(WebCore::CSSToStyleMap::mapAnimationDelay):
(WebCore::CSSToStyleMap::mapAnimationDuration):

LayoutTests:

Uncomment existing tests to cover the bug.

* transitions/transitions-parsing-expected.txt:
* transitions/transitions-parsing.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (139069 => 139070)


--- trunk/LayoutTests/ChangeLog	2013-01-08 18:06:28 UTC (rev 139069)
+++ trunk/LayoutTests/ChangeLog	2013-01-08 18:08:02 UTC (rev 139070)
@@ -1,3 +1,15 @@
+2013-01-08  Alexis Menard  <ale...@webkit.org>
+
+        transition-delay and transition-duration return incorrect values when querying using the computed style.
+        https://bugs.webkit.org/show_bug.cgi?id=105432
+
+        Reviewed by Dean Jackson.
+
+        Uncomment existing tests to cover the bug.
+
+        * transitions/transitions-parsing-expected.txt:
+        * transitions/transitions-parsing.html:
+
 2013-01-08  Dimitri Glazkov  <dglaz...@chromium.org>
 
         [Chromium] Tweak expectations for random-array-gc-stress.html to reflect reality.

Modified: trunk/LayoutTests/transitions/transitions-parsing-expected.txt (139069 => 139070)


--- trunk/LayoutTests/transitions/transitions-parsing-expected.txt	2013-01-08 18:06:28 UTC (rev 139069)
+++ trunk/LayoutTests/transitions/transitions-parsing-expected.txt	2013-01-08 18:08:02 UTC (rev 139070)
@@ -70,6 +70,14 @@
 PASS computedStyle.transitionDuration is '5s'
 PASS style.webkitTransitionDuration is '5s'
 PASS computedStyle.webkitTransitionDuration is '5s'
+PASS style.transitionDuration is '10ms'
+PASS computedStyle.transitionDuration is '0.01s'
+PASS style.webkitTransitionDuration is '10ms'
+PASS computedStyle.webkitTransitionDuration is '0.01s'
+PASS style.transitionDuration is '10ms, 20s'
+PASS computedStyle.transitionDuration is '0.01s, 20s'
+PASS style.webkitTransitionDuration is '10ms, 20s'
+PASS computedStyle.webkitTransitionDuration is '0.01s, 20s'
 Invalid transition-duration values.
 PASS style.transitionDuration is ''
 PASS computedStyle.transitionDuration is '0s'
@@ -95,6 +103,10 @@
 PASS computedStyle.transitionDuration is '0s'
 PASS style.webkitTransitionDuration is ''
 PASS computedStyle.webkitTransitionDuration is '0s'
+PASS style.transitionDuration is ''
+PASS computedStyle.transitionDuration is '0s'
+PASS style.webkitTransitionDuration is ''
+PASS computedStyle.webkitTransitionDuration is '0s'
 Valid transition-timing-function values.
 PASS computedStyle.transitionTimingFunction is 'ease'
 PASS computedStyle.webkitTransitionTimingFunction is 'ease'
@@ -250,6 +262,18 @@
 PASS computedStyle.transitionDelay is '5s'
 PASS style.webkitTransitionDelay is '5s'
 PASS computedStyle.webkitTransitionDelay is '5s'
+PASS style.transitionDelay is '10ms'
+PASS computedStyle.transitionDelay is '0.01s'
+PASS style.webkitTransitionDelay is '10ms'
+PASS computedStyle.webkitTransitionDelay is '0.01s'
+PASS style.transitionDelay is '-10ms'
+PASS computedStyle.transitionDelay is '-0.01s'
+PASS style.webkitTransitionDelay is '-10ms'
+PASS computedStyle.webkitTransitionDelay is '-0.01s'
+PASS style.transitionDelay is '-10ms, 20s'
+PASS computedStyle.transitionDelay is '-0.01s, 20s'
+PASS style.webkitTransitionDelay is '-10ms, 20s'
+PASS computedStyle.webkitTransitionDelay is '-0.01s, 20s'
 Invalid transition-duration values.
 PASS style.transitionDelay is ''
 PASS computedStyle.transitionDelay is '0s'

Modified: trunk/LayoutTests/transitions/transitions-parsing.html (139069 => 139070)


--- trunk/LayoutTests/transitions/transitions-parsing.html	2013-01-08 18:06:28 UTC (rev 139069)
+++ trunk/LayoutTests/transitions/transitions-parsing.html	2013-01-08 18:08:02 UTC (rev 139070)
@@ -135,32 +135,31 @@
 shouldBe("style.webkitTransitionDuration", "'5s'");
 shouldBe("computedStyle.webkitTransitionDuration", "'5s'");
 
-// Tracked by https://bugs.webkit.org/show_bug.cgi?id=105432.
-/*style.transitionDuration = "10ms";
+style.transitionDuration = "10ms";
 shouldBe("style.transitionDuration", "'10ms'");
 shouldBe("computedStyle.transitionDuration", "'0.01s'");
 shouldBe("style.webkitTransitionDuration", "'10ms'");
 shouldBe("computedStyle.webkitTransitionDuration", "'0.01s'");
 
-// Negative values should be treated as 0s.
-style.transitionDuration = "-10ms";
-shouldBe("style.transitionDuration", "'0s'");
-shouldBe("computedStyle.transitionDuration", "'0s'");
-shouldBe("style.webkitTransitionDuration", "'0s'");
-shouldBe("computedStyle.webkitTransitionDuration", "'0s'");
-
 style.transitionProperty = "opacity, width";
 
-style.transitionDuration = "-10ms, 20s";
-shouldBe("style.transitionDuration", "'0s, 20s'");
-shouldBe("computedStyle.transitionDuration", "'0s, 20s'");
-shouldBe("style.webkitTransitionDuration", "'0s, 20s'");
-shouldBe("computedStyle.webkitTransitionDuration", "'0s, 20s'");*/
+style.transitionDuration = "10ms, 20s";
+shouldBe("style.transitionDuration", "'10ms, 20s'");
+shouldBe("computedStyle.transitionDuration", "'0.01s, 20s'");
+shouldBe("style.webkitTransitionDuration", "'10ms, 20s'");
+shouldBe("computedStyle.webkitTransitionDuration", "'0.01s, 20s'");
 
 debug("Invalid transition-duration values.");
 style.transitionProperty = "opacity";
 style.transitionDuration = "";
 
+// Negative values are invalid.
+style.transitionDuration = "-10ms";
+shouldBe("style.transitionDuration", "''");
+shouldBe("computedStyle.transitionDuration", "'0s'");
+shouldBe("style.webkitTransitionDuration", "''");
+shouldBe("computedStyle.webkitTransitionDuration", "'0s'");
+
 style.transitionDuration = "'5ms'";
 shouldBe("style.transitionDuration", "''");
 shouldBe("computedStyle.transitionDuration", "'0s'");
@@ -435,12 +434,11 @@
 shouldBe("style.webkitTransitionDelay", "'5s'");
 shouldBe("computedStyle.webkitTransitionDelay", "'5s'");
 
-// Tracked by https://bugs.webkit.org/show_bug.cgi?id=105432.
-/*style.transitionDelay = "10ms";
+style.transitionDelay = "10ms";
 shouldBe("style.transitionDelay", "'10ms'");
-shouldBe("computedStyle.transitionDelay", "'10ms'");
+shouldBe("computedStyle.transitionDelay", "'0.01s'");
 shouldBe("style.webkitTransitionDelay", "'10ms'");
-shouldBe("computedStyle.webkitTransitionDelay", "'10ms'");
+shouldBe("computedStyle.webkitTransitionDelay", "'0.01s'");
 
 style.transitionDelay = "-10ms";
 shouldBe("style.transitionDelay", "'-10ms'");
@@ -454,7 +452,7 @@
 shouldBe("style.transitionDelay", "'-10ms, 20s'");
 shouldBe("computedStyle.transitionDelay", "'-0.01s, 20s'");
 shouldBe("style.webkitTransitionDelay", "'-10ms, 20s'");
-shouldBe("computedStyle.webkitTransitionDelay", "'-0.01s, 20s'");*/
+shouldBe("computedStyle.webkitTransitionDelay", "'-0.01s, 20s'");
 
 debug("Invalid transition-duration values.");
 style.transitionProperty = "opacity";

Modified: trunk/Source/WebCore/ChangeLog (139069 => 139070)


--- trunk/Source/WebCore/ChangeLog	2013-01-08 18:06:28 UTC (rev 139069)
+++ trunk/Source/WebCore/ChangeLog	2013-01-08 18:08:02 UTC (rev 139070)
@@ -1,3 +1,23 @@
+2013-01-08  Alexis Menard  <ale...@webkit.org>
+
+        transition-delay and transition-duration return incorrect values when querying using the computed style.
+        https://bugs.webkit.org/show_bug.cgi?id=105432
+
+        Reviewed by Dean Jackson.
+
+        When setting the transition-delay to 10ms for example the value of transition-delay
+        on the computed style was incorrect, it should return 0.01s but it was
+        returning something like 0.0099999999...s. In fact the bug was after
+        the parsing step when creating the Animation object where a conversion
+        from a double to float was done. This conversion is not needed as the
+        animation class expects double for delay and transition times.
+
+        Test: transitions/transitions-parsing.html
+
+        * css/CSSToStyleMap.cpp:
+        (WebCore::CSSToStyleMap::mapAnimationDelay):
+        (WebCore::CSSToStyleMap::mapAnimationDuration):
+
 2013-01-08  Hajime Morrita  <morr...@google.com>
 
         [Shadow DOM] Refactoring: invalidateParentDistributionIfNecessary() calls are too intrusive

Modified: trunk/Source/WebCore/css/CSSToStyleMap.cpp (139069 => 139070)


--- trunk/Source/WebCore/css/CSSToStyleMap.cpp	2013-01-08 18:06:28 UTC (rev 139069)
+++ trunk/Source/WebCore/css/CSSToStyleMap.cpp	2013-01-08 18:08:02 UTC (rev 139070)
@@ -296,7 +296,7 @@
         return;
 
     CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
-    animation->setDelay(primitiveValue->computeTime<float, CSSPrimitiveValue::Seconds>());
+    animation->setDelay(primitiveValue->computeTime<double, CSSPrimitiveValue::Seconds>());
 }
 
 void CSSToStyleMap::mapAnimationDirection(Animation* layer, CSSValue* value)
@@ -337,7 +337,7 @@
         return;
 
     CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
-    animation->setDuration(primitiveValue->computeTime<float, CSSPrimitiveValue::Seconds>());
+    animation->setDuration(primitiveValue->computeTime<double, CSSPrimitiveValue::Seconds>());
 }
 
 void CSSToStyleMap::mapAnimationFillMode(Animation* layer, CSSValue* value)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to