Skip to content
Permalink
Browse files
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:


Canonical link: https://commits.webkit.org/124526@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139070 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
darktears committed Jan 8, 2013
1 parent 050861b commit f57fba217b4a3134a580173e4d5e66a3d435d899
Showing 5 changed files with 75 additions and 21 deletions.
@@ -1,3 +1,15 @@
2013-01-08 Alexis Menard <alexis@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 <dglazkov@chromium.org>

[Chromium] Tweak expectations for random-array-gc-stress.html to reflect reality.
@@ -70,6 +70,14 @@ PASS style.transitionDuration is '5s'
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 style.transitionDuration is ''
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 style.transitionDelay is '5s'
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'
@@ -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";
@@ -1,3 +1,23 @@
2013-01-08 Alexis Menard <alexis@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 <morrita@google.com>

[Shadow DOM] Refactoring: invalidateParentDistributionIfNecessary() calls are too intrusive
@@ -296,7 +296,7 @@ void CSSToStyleMap::mapAnimationDelay(Animation* animation, CSSValue* value)
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 @@ void CSSToStyleMap::mapAnimationDuration(Animation* animation, CSSValue* value)
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)

0 comments on commit f57fba2

Please sign in to comment.