Changeset 139070 in webkit


Ignore:
Timestamp:
Jan 8, 2013 10:08:02 AM (11 years ago)
Author:
alexis@webkit.org
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:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r139069 r139070  
     12013-01-08  Alexis Menard  <alexis@webkit.org>
     2
     3        transition-delay and transition-duration return incorrect values when querying using the computed style.
     4        https://bugs.webkit.org/show_bug.cgi?id=105432
     5
     6        Reviewed by Dean Jackson.
     7
     8        Uncomment existing tests to cover the bug.
     9
     10        * transitions/transitions-parsing-expected.txt:
     11        * transitions/transitions-parsing.html:
     12
    1132013-01-08  Dimitri Glazkov  <dglazkov@chromium.org>
    214
  • trunk/LayoutTests/transitions/transitions-parsing-expected.txt

    r138728 r139070  
    7171PASS style.webkitTransitionDuration is '5s'
    7272PASS computedStyle.webkitTransitionDuration is '5s'
     73PASS style.transitionDuration is '10ms'
     74PASS computedStyle.transitionDuration is '0.01s'
     75PASS style.webkitTransitionDuration is '10ms'
     76PASS computedStyle.webkitTransitionDuration is '0.01s'
     77PASS style.transitionDuration is '10ms, 20s'
     78PASS computedStyle.transitionDuration is '0.01s, 20s'
     79PASS style.webkitTransitionDuration is '10ms, 20s'
     80PASS computedStyle.webkitTransitionDuration is '0.01s, 20s'
    7381Invalid transition-duration values.
     82PASS style.transitionDuration is ''
     83PASS computedStyle.transitionDuration is '0s'
     84PASS style.webkitTransitionDuration is ''
     85PASS computedStyle.webkitTransitionDuration is '0s'
    7486PASS style.transitionDuration is ''
    7587PASS computedStyle.transitionDuration is '0s'
     
    251263PASS style.webkitTransitionDelay is '5s'
    252264PASS computedStyle.webkitTransitionDelay is '5s'
     265PASS style.transitionDelay is '10ms'
     266PASS computedStyle.transitionDelay is '0.01s'
     267PASS style.webkitTransitionDelay is '10ms'
     268PASS computedStyle.webkitTransitionDelay is '0.01s'
     269PASS style.transitionDelay is '-10ms'
     270PASS computedStyle.transitionDelay is '-0.01s'
     271PASS style.webkitTransitionDelay is '-10ms'
     272PASS computedStyle.webkitTransitionDelay is '-0.01s'
     273PASS style.transitionDelay is '-10ms, 20s'
     274PASS computedStyle.transitionDelay is '-0.01s, 20s'
     275PASS style.webkitTransitionDelay is '-10ms, 20s'
     276PASS computedStyle.webkitTransitionDelay is '-0.01s, 20s'
    253277Invalid transition-duration values.
    254278PASS style.transitionDelay is ''
  • trunk/LayoutTests/transitions/transitions-parsing.html

    r138728 r139070  
    136136shouldBe("computedStyle.webkitTransitionDuration", "'5s'");
    137137
    138 // Tracked by https://bugs.webkit.org/show_bug.cgi?id=105432.
    139 /*style.transitionDuration = "10ms";
     138style.transitionDuration = "10ms";
    140139shouldBe("style.transitionDuration", "'10ms'");
    141140shouldBe("computedStyle.transitionDuration", "'0.01s'");
     
    143142shouldBe("computedStyle.webkitTransitionDuration", "'0.01s'");
    144143
    145 // Negative values should be treated as 0s.
    146 style.transitionDuration = "-10ms";
    147 shouldBe("style.transitionDuration", "'0s'");
    148 shouldBe("computedStyle.transitionDuration", "'0s'");
    149 shouldBe("style.webkitTransitionDuration", "'0s'");
    150 shouldBe("computedStyle.webkitTransitionDuration", "'0s'");
    151 
    152144style.transitionProperty = "opacity, width";
    153145
    154 style.transitionDuration = "-10ms, 20s";
    155 shouldBe("style.transitionDuration", "'0s, 20s'");
    156 shouldBe("computedStyle.transitionDuration", "'0s, 20s'");
    157 shouldBe("style.webkitTransitionDuration", "'0s, 20s'");
    158 shouldBe("computedStyle.webkitTransitionDuration", "'0s, 20s'");*/
     146style.transitionDuration = "10ms, 20s";
     147shouldBe("style.transitionDuration", "'10ms, 20s'");
     148shouldBe("computedStyle.transitionDuration", "'0.01s, 20s'");
     149shouldBe("style.webkitTransitionDuration", "'10ms, 20s'");
     150shouldBe("computedStyle.webkitTransitionDuration", "'0.01s, 20s'");
    159151
    160152debug("Invalid transition-duration values.");
    161153style.transitionProperty = "opacity";
    162154style.transitionDuration = "";
     155
     156// Negative values are invalid.
     157style.transitionDuration = "-10ms";
     158shouldBe("style.transitionDuration", "''");
     159shouldBe("computedStyle.transitionDuration", "'0s'");
     160shouldBe("style.webkitTransitionDuration", "''");
     161shouldBe("computedStyle.webkitTransitionDuration", "'0s'");
    163162
    164163style.transitionDuration = "'5ms'";
     
    436435shouldBe("computedStyle.webkitTransitionDelay", "'5s'");
    437436
    438 // Tracked by https://bugs.webkit.org/show_bug.cgi?id=105432.
    439 /*style.transitionDelay = "10ms";
     437style.transitionDelay = "10ms";
    440438shouldBe("style.transitionDelay", "'10ms'");
    441 shouldBe("computedStyle.transitionDelay", "'10ms'");
     439shouldBe("computedStyle.transitionDelay", "'0.01s'");
    442440shouldBe("style.webkitTransitionDelay", "'10ms'");
    443 shouldBe("computedStyle.webkitTransitionDelay", "'10ms'");
     441shouldBe("computedStyle.webkitTransitionDelay", "'0.01s'");
    444442
    445443style.transitionDelay = "-10ms";
     
    455453shouldBe("computedStyle.transitionDelay", "'-0.01s, 20s'");
    456454shouldBe("style.webkitTransitionDelay", "'-10ms, 20s'");
    457 shouldBe("computedStyle.webkitTransitionDelay", "'-0.01s, 20s'");*/
     455shouldBe("computedStyle.webkitTransitionDelay", "'-0.01s, 20s'");
    458456
    459457debug("Invalid transition-duration values.");
  • trunk/Source/WebCore/ChangeLog

    r139064 r139070  
     12013-01-08  Alexis Menard  <alexis@webkit.org>
     2
     3        transition-delay and transition-duration return incorrect values when querying using the computed style.
     4        https://bugs.webkit.org/show_bug.cgi?id=105432
     5
     6        Reviewed by Dean Jackson.
     7
     8        When setting the transition-delay to 10ms for example the value of transition-delay
     9        on the computed style was incorrect, it should return 0.01s but it was
     10        returning something like 0.0099999999...s. In fact the bug was after
     11        the parsing step when creating the Animation object where a conversion
     12        from a double to float was done. This conversion is not needed as the
     13        animation class expects double for delay and transition times.
     14
     15        Test: transitions/transitions-parsing.html
     16
     17        * css/CSSToStyleMap.cpp:
     18        (WebCore::CSSToStyleMap::mapAnimationDelay):
     19        (WebCore::CSSToStyleMap::mapAnimationDuration):
     20
    1212013-01-08  Hajime Morrita  <morrita@google.com>
    222
  • trunk/Source/WebCore/css/CSSToStyleMap.cpp

    r138728 r139070  
    297297
    298298    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
    299     animation->setDelay(primitiveValue->computeTime<float, CSSPrimitiveValue::Seconds>());
     299    animation->setDelay(primitiveValue->computeTime<double, CSSPrimitiveValue::Seconds>());
    300300}
    301301
     
    338338
    339339    CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
    340     animation->setDuration(primitiveValue->computeTime<float, CSSPrimitiveValue::Seconds>());
     340    animation->setDuration(primitiveValue->computeTime<double, CSSPrimitiveValue::Seconds>());
    341341}
    342342
Note: See TracChangeset for help on using the changeset viewer.