Changeset 138728 in webkit


Ignore:
Timestamp:
Jan 3, 2013 12:22:47 PM (11 years ago)
Author:
alexis@webkit.org
Message:

Querying transition-timing-function value on the computed style does not return keywords when it should.
https://bugs.webkit.org/show_bug.cgi?id=105442

Reviewed by Simon Fraser.

Source/WebCore:

http://www.w3.org/TR/css3-transitions/#transition-timing-function-property
contains a set of predefined timing functions which under the hood are
implemented using cubic-bezier but it's an implementation detail that
should not be exposed. It seems to be more clear to return a CSS
keyword rather than the cubic-bezier form when querying the value of
the property on the computed style. In fact the spec even say that for
example the initial value is "ease" and not cubic-bezier(0.25, 0.1,
0.25, 1.0). We could also imagine that in the future these predefined
values could contain other values not represented by a cubic-bezier
form. This behavior also align with the "linear" keyword which return
"linear" rather than cubic-bezier(0.0, 0.0, 1.0, 1.0).

Test: transitions/transitions-parsing.html has been updated to cover
the new behavior as well as making sure that an explicitly set value of
cubic-bezier(0.25, 0.1, 0.25, 1.0) does not return "ease" but the
cubic-bezier() form.

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::createAnimationValue):
(WebCore):
(WebCore::getTimingFunctionValue):

  • css/CSSToStyleMap.cpp:

(WebCore::CSSToStyleMap::mapAnimationTimingFunction):

  • platform/animation/TimingFunction.h:

(WebCore::CubicBezierTimingFunction::create):
(CubicBezierTimingFunction):
(WebCore::CubicBezierTimingFunction::operator==):
(WebCore::CubicBezierTimingFunction::timingFunctionPreset): Store the
preset value of the timing function if it is one when creating it
so we can use it later from the computed style.
(WebCore::CubicBezierTimingFunction::CubicBezierTimingFunction):

Source/WebKit2:

Update the code to pass the animations from one process to another as
the constructor of TimingFunction changed to take an extra parameter
holding the type of the cubic-bezier form.

  • Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp:

(CoreIPC::encodeTimingFunction):
(CoreIPC::decodeTimingFunction):

LayoutTests:

Update the tests to match the correct behavior of returning a keyword
rather than a cubic-bezier() form when using predefined values for the
transition-timing-function property.

  • animations/animation-shorthand-name-order-expected.txt:
  • animations/animation-shorthand-name-order.html:
  • animations/animation-shorthand-removed.html:
  • animations/animation-shorthand.html:
  • animations/computed-style-expected.txt:
  • animations/computed-style.html:
  • fast/css/getComputedStyle/computed-style-expected.txt:
  • fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
  • svg/css/getComputedStyle-basic-expected.txt:
  • transitions/inherit-other-props-expected.txt:
  • transitions/inherit-other-props.html:
  • transitions/transitions-parsing-expected.txt:
  • transitions/transitions-parsing.html:
Location:
trunk
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r138726 r138728  
     12013-01-03  Alexis Menard  <alexis@webkit.org>
     2
     3        Querying transition-timing-function value on the computed style does not return keywords when it should.
     4        https://bugs.webkit.org/show_bug.cgi?id=105442
     5
     6        Reviewed by Simon Fraser.
     7
     8        Update the tests to match the correct behavior of returning a keyword
     9        rather than a cubic-bezier() form when using predefined values for the
     10        transition-timing-function property.
     11
     12        * animations/animation-shorthand-name-order-expected.txt:
     13        * animations/animation-shorthand-name-order.html:
     14        * animations/animation-shorthand-removed.html:
     15        * animations/animation-shorthand.html:
     16        * animations/computed-style-expected.txt:
     17        * animations/computed-style.html:
     18        * fast/css/getComputedStyle/computed-style-expected.txt:
     19        * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
     20        * svg/css/getComputedStyle-basic-expected.txt:
     21        * transitions/inherit-other-props-expected.txt:
     22        * transitions/inherit-other-props.html:
     23        * transitions/transitions-parsing-expected.txt:
     24        * transitions/transitions-parsing.html:
     25
    1262013-01-03  Rik Cabanier  <cabanier@adobe.com>
    227
  • trunk/LayoutTests/animations/animation-shorthand-name-order-expected.txt

    r122277 r138728  
    11PASS Test 1: webkitAnimationName was test
    22PASS Test 1: webkitAnimationDuration was 3s
    3 PASS Test 1: webkitAnimationTimingFunction was cubic-bezier(0.25, 0.1, 0.25, 1)
     3PASS Test 1: webkitAnimationTimingFunction was ease
    44PASS Test 1: webkitAnimationDelay was 0s
    55PASS Test 1: webkitAnimationIterationCount was 1
     
    88PASS Test 2: webkitAnimationName was test
    99PASS Test 2: webkitAnimationDuration was 3s
    10 PASS Test 2: webkitAnimationTimingFunction was cubic-bezier(0.25, 0.1, 0.25, 1)
     10PASS Test 2: webkitAnimationTimingFunction was ease
    1111PASS Test 2: webkitAnimationDelay was 0s
    1212PASS Test 2: webkitAnimationIterationCount was 1
     
    1515PASS Test 3: webkitAnimationName was test
    1616PASS Test 3: webkitAnimationDuration was 3s
    17 PASS Test 3: webkitAnimationTimingFunction was cubic-bezier(0.25, 0.1, 0.25, 1)
     17PASS Test 3: webkitAnimationTimingFunction was ease
    1818PASS Test 3: webkitAnimationDelay was 0s
    1919PASS Test 3: webkitAnimationIterationCount was 1
     
    2222PASS Test 4: webkitAnimationName was test
    2323PASS Test 4: webkitAnimationDuration was 3s
    24 PASS Test 4: webkitAnimationTimingFunction was cubic-bezier(0.25, 0.1, 0.25, 1)
     24PASS Test 4: webkitAnimationTimingFunction was ease
    2525PASS Test 4: webkitAnimationDelay was 0s
    2626PASS Test 4: webkitAnimationIterationCount was 1
     
    6464PASS Test 10: webkitAnimationName was linear
    6565PASS Test 10: webkitAnimationDuration was 3s
    66 PASS Test 10: webkitAnimationTimingFunction was cubic-bezier(0.25, 0.1, 0.25, 1)
     66PASS Test 10: webkitAnimationTimingFunction was ease
    6767PASS Test 10: webkitAnimationDelay was 4s
    6868PASS Test 10: webkitAnimationIterationCount was infinite
  • trunk/LayoutTests/animations/animation-shorthand-name-order.html

    r122300 r138728  
    7373
    7474const EXPECTED_VALUES = [
    75     ["test", "3s", "cubic-bezier(0.25, 0.1, 0.25, 1)", "0s", "1", "normal", "none"],
    76     ["test", "3s", "cubic-bezier(0.25, 0.1, 0.25, 1)", "0s", "1", "normal", "none"],
    77     ["test", "3s", "cubic-bezier(0.25, 0.1, 0.25, 1)", "0s", "1", "normal", "forwards"],
    78     ["test", "3s", "cubic-bezier(0.25, 0.1, 0.25, 1)", "0s", "1", "normal", "forwards"],
     75    ["test", "3s", "ease", "0s", "1", "normal", "none"],
     76    ["test", "3s", "ease", "0s", "1", "normal", "none"],
     77    ["test", "3s", "ease", "0s", "1", "normal", "forwards"],
     78    ["test", "3s", "ease", "0s", "1", "normal", "forwards"],
    7979    ["test", "3s", "linear", "0s", "1", "normal", "forwards"],
    8080    ["test", "3s", "linear", "0s", "1", "normal", "forwards"],
     
    8282    ["test", "3s", "linear", "4s", "infinite", "alternate", "forwards"],
    8383    ["test", "3s", "linear", "4s", "infinite", "alternate", "none"],
    84     ["linear", "3s", "cubic-bezier(0.25, 0.1, 0.25, 1)", "4s", "infinite", "alternate", "forwards"],
     84    ["linear", "3s", "ease", "4s", "infinite", "alternate", "forwards"],
    8585];
    8686
  • trunk/LayoutTests/animations/animation-shorthand-removed.html

    r119985 r138728  
    5252      }
    5353    ];
    54     const kExpectedResults = [ "none", "0s", "cubic-bezier(0.25, 0.1, 0.25, 1)", "0s", "1", "normal", "none" ];
     54    const kExpectedResults = [ "none", "0s", "ease", "0s", "1", "normal", "none" ];
    5555
    5656    function start() {
  • trunk/LayoutTests/animations/animation-shorthand.html

    r119985 r138728  
    5555    ];
    5656    const kExpectedResults = [
    57       { id: 'a',  values: [ "none", "0s", "cubic-bezier(0.25, 0.1, 0.25, 1)", "0s", "1", "normal", "none" ] },
    58       { id: 'b',  values: [ "none", "0s", "cubic-bezier(0.25, 0.1, 0.25, 1)", "0s", "1", "normal", "none" ] },
    59       { id: 'c',  values: [ "anim1", "10s", "cubic-bezier(0.25, 0.1, 0.25, 1)", "0s", "1", "normal", "none" ] },
     57      { id: 'a',  values: [ "none", "0s", "ease", "0s", "1", "normal", "none" ] },
     58      { id: 'b',  values: [ "none", "0s", "ease", "0s", "1", "normal", "none" ] },
     59      { id: 'c',  values: [ "anim1", "10s", "ease", "0s", "1", "normal", "none" ] },
    6060      { id: 'd',  values: [ "anim1", "10s", "linear", "0s", "1", "normal", "none" ] },
    6161      { id: 'e',  values: [ "anim1", "10s", "linear", "5s", "1", "normal", "none" ] },
     
    6464      { id: 'h',  values: [ "anim1", "10s", "linear", "5s", "infinite", "alternate", "forwards" ] },
    6565      { id: 'i',  values: [ "anim1", "10s", "linear", "0s", "1", "normal", "none" ] },
    66       { id: 'j',  values: [ "anim1, anim2, anim3", "10s, 3s, 5s", "linear, cubic-bezier(0.25, 0.1, 0.25, 1), cubic-bezier(0.25, 0.1, 0.25, 1)", "0s, 0s, 0s", "infinite, 1, 1", "normal, normal, normal", "backwards, none, both" ] }
     66      { id: 'j',  values: [ "anim1, anim2, anim3", "10s, 3s, 5s", "linear, ease, ease", "0s, 0s, 0s", "infinite, 1, 1", "normal, normal, normal", "backwards, none, both" ] }
    6767    ];
    6868   
  • trunk/LayoutTests/animations/computed-style-expected.txt

    r67032 r138728  
    1414PASS test2Style.webkitAnimationIterationCount is '10, infinite'
    1515PASS test1Style.webkitAnimationTimingFunction is 'linear'
    16 PASS test2Style.webkitAnimationTimingFunction is 'linear, cubic-bezier(0.42, 0, 0.58, 1)'
     16PASS test2Style.webkitAnimationTimingFunction is 'linear, ease-in-out'
    1717PASS test3Style.webkitAnimationTimingFunction is 'steps(1, start), steps(1, end), steps(5, end)'
    1818PASS test1Style.webkitAnimationDirection is 'normal'
  • trunk/LayoutTests/animations/computed-style.html

    r99258 r138728  
    8181
    8282shouldBe("test1Style.webkitAnimationTimingFunction", "'linear'");
    83 shouldBe("test2Style.webkitAnimationTimingFunction", "'linear, cubic-bezier(0.42, 0, 0.58, 1)'");
     83shouldBe("test2Style.webkitAnimationTimingFunction", "'linear, ease-in-out'");
    8484shouldBe("test3Style.webkitAnimationTimingFunction", "'steps(1, start), steps(1, end), steps(5, end)'");
    8585
  • trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt

    r137200 r138728  
    110110-webkit-animation-name: none;
    111111-webkit-animation-play-state: running;
    112 -webkit-animation-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1);
     112-webkit-animation-timing-function: ease;
    113113-webkit-appearance: none;
    114114-webkit-backface-visibility: visible;
     
    209209-webkit-transition-duration: 0s;
    210210-webkit-transition-property: all;
    211 -webkit-transition-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1);
     211-webkit-transition-timing-function: ease;
    212212-webkit-user-drag: auto;
    213213-webkit-user-modify: read-only;
  • trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt

    r137200 r138728  
    109109-webkit-animation-name: none
    110110-webkit-animation-play-state: running
    111 -webkit-animation-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1)
     111-webkit-animation-timing-function: ease
    112112-webkit-appearance: none
    113113-webkit-backface-visibility: visible
     
    208208-webkit-transition-duration: 0s
    209209-webkit-transition-property: all
    210 -webkit-transition-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1)
     210-webkit-transition-timing-function: ease
    211211-webkit-user-drag: auto
    212212-webkit-user-modify: read-only
  • trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt

    r137200 r138728  
    217217rect: style.getPropertyValue(-webkit-animation-play-state) : running
    218218rect: style.getPropertyCSSValue(-webkit-animation-play-state) : [object CSSValueList]
    219 rect: style.getPropertyValue(-webkit-animation-timing-function) : cubic-bezier(0.25, 0.1, 0.25, 1)
     219rect: style.getPropertyValue(-webkit-animation-timing-function) : ease
    220220rect: style.getPropertyCSSValue(-webkit-animation-timing-function) : [object CSSValueList]
    221221rect: style.getPropertyValue(-webkit-appearance) : none
     
    415415rect: style.getPropertyValue(-webkit-transition-property) : all
    416416rect: style.getPropertyCSSValue(-webkit-transition-property) : [object CSSValueList]
    417 rect: style.getPropertyValue(-webkit-transition-timing-function) : cubic-bezier(0.25, 0.1, 0.25, 1)
     417rect: style.getPropertyValue(-webkit-transition-timing-function) : ease
    418418rect: style.getPropertyCSSValue(-webkit-transition-timing-function) : [object CSSValueList]
    419419rect: style.getPropertyValue(-webkit-user-drag) : auto
     
    717717g: style.getPropertyValue(-webkit-animation-play-state) : running
    718718g: style.getPropertyCSSValue(-webkit-animation-play-state) : [object CSSValueList]
    719 g: style.getPropertyValue(-webkit-animation-timing-function) : cubic-bezier(0.25, 0.1, 0.25, 1)
     719g: style.getPropertyValue(-webkit-animation-timing-function) : ease
    720720g: style.getPropertyCSSValue(-webkit-animation-timing-function) : [object CSSValueList]
    721721g: style.getPropertyValue(-webkit-appearance) : none
     
    915915g: style.getPropertyValue(-webkit-transition-property) : all
    916916g: style.getPropertyCSSValue(-webkit-transition-property) : [object CSSValueList]
    917 g: style.getPropertyValue(-webkit-transition-timing-function) : cubic-bezier(0.25, 0.1, 0.25, 1)
     917g: style.getPropertyValue(-webkit-transition-timing-function) : ease
    918918g: style.getPropertyCSSValue(-webkit-transition-timing-function) : [object CSSValueList]
    919919g: style.getPropertyValue(-webkit-user-drag) : auto
  • trunk/LayoutTests/transitions/inherit-other-props-expected.txt

    r67032 r138728  
    11PASS -- Box 1 computed transition property: all expected: all
    22PASS -- Box 1 computed transition duration: 0s expected: 0s
    3 PASS -- Box 1 computed transition timing function: cubic-bezier(0.25, 0.1, 0.25, 1) expected: cubic-bezier(0.25, 0.1, 0.25, 1)
     3PASS -- Box 1 computed transition timing function: ease expected: ease
    44PASS -- Box 2 computed transition property: left expected: left
    55PASS -- Box 2 computed transition duration: 2s expected: 2s
     
    1616PASS -- Box 6 computed transition property: all expected: all
    1717PASS -- Box 6 computed transition duration: 0s expected: 0s
    18 PASS -- Box 6 computed transition timing function: cubic-bezier(0.25, 0.1, 0.25, 1) expected: cubic-bezier(0.25, 0.1, 0.25, 1)
     18PASS -- Box 6 computed transition timing function: ease expected: ease
    1919
  • trunk/LayoutTests/transitions/inherit-other-props.html

    r120521 r138728  
    4646
    4747    var kExpectedTimingFunction = [
    48       'cubic-bezier(0.25, 0.1, 0.25, 1)', /* box1 */
     48      'ease', /* box1 */
    4949      'linear', /* box2 */
    5050      'linear', /* box3 */
    5151      'linear', /* box4 */ /* inherits from box3 */
    5252      'linear', /* box5 */
    53       'cubic-bezier(0.25, 0.1, 0.25, 1)', /* box6 */ /* does NOT inherit */
     53      'ease', /* box6 */ /* does NOT inherit */
    5454    ];
    5555
  • trunk/LayoutTests/transitions/transitions-parsing-expected.txt

    r138721 r138728  
    9797PASS computedStyle.webkitTransitionDuration is '0s'
    9898Valid transition-timing-function values.
     99PASS computedStyle.transitionTimingFunction is 'ease'
     100PASS computedStyle.webkitTransitionTimingFunction is 'ease'
     101PASS style.transitionTimingFunction is 'linear'
     102PASS computedStyle.transitionTimingFunction is 'linear'
     103PASS style.webkitTransitionTimingFunction is 'linear'
     104PASS computedStyle.webkitTransitionTimingFunction is 'linear'
     105PASS style.transitionTimingFunction is 'ease'
     106PASS computedStyle.transitionTimingFunction is 'ease'
     107PASS style.webkitTransitionTimingFunction is 'ease'
     108PASS computedStyle.webkitTransitionTimingFunction is 'ease'
     109PASS style.transitionTimingFunction is 'ease-in'
     110PASS computedStyle.transitionTimingFunction is 'ease-in'
     111PASS style.webkitTransitionTimingFunction is 'ease-in'
     112PASS computedStyle.webkitTransitionTimingFunction is 'ease-in'
     113PASS style.transitionTimingFunction is 'ease-out'
     114PASS computedStyle.transitionTimingFunction is 'ease-out'
     115PASS style.webkitTransitionTimingFunction is 'ease-out'
     116PASS computedStyle.webkitTransitionTimingFunction is 'ease-out'
     117PASS style.transitionTimingFunction is 'ease-in-out'
     118PASS computedStyle.transitionTimingFunction is 'ease-in-out'
     119PASS style.webkitTransitionTimingFunction is 'ease-in-out'
     120PASS computedStyle.webkitTransitionTimingFunction is 'ease-in-out'
     121PASS style.transitionTimingFunction is 'cubic-bezier(0.25, 0.1, 0.25, 1)'
    99122PASS computedStyle.transitionTimingFunction is 'cubic-bezier(0.25, 0.1, 0.25, 1)'
     123PASS style.webkitTransitionTimingFunction is 'cubic-bezier(0.25, 0.1, 0.25, 1)'
    100124PASS computedStyle.webkitTransitionTimingFunction is 'cubic-bezier(0.25, 0.1, 0.25, 1)'
    101 PASS style.transitionTimingFunction is 'ease'
    102 PASS computedStyle.transitionTimingFunction is 'cubic-bezier(0.25, 0.1, 0.25, 1)'
    103 PASS style.webkitTransitionTimingFunction is 'ease'
    104 PASS computedStyle.webkitTransitionTimingFunction is 'cubic-bezier(0.25, 0.1, 0.25, 1)'
    105 PASS style.transitionTimingFunction is 'ease-in'
    106 PASS computedStyle.transitionTimingFunction is 'cubic-bezier(0.42, 0, 1, 1)'
    107 PASS style.webkitTransitionTimingFunction is 'ease-in'
    108 PASS computedStyle.webkitTransitionTimingFunction is 'cubic-bezier(0.42, 0, 1, 1)'
    109 PASS style.transitionTimingFunction is 'ease-out'
    110 PASS computedStyle.transitionTimingFunction is 'cubic-bezier(0, 0, 0.58, 1)'
    111 PASS style.webkitTransitionTimingFunction is 'ease-out'
    112 PASS computedStyle.webkitTransitionTimingFunction is 'cubic-bezier(0, 0, 0.58, 1)'
    113 PASS style.transitionTimingFunction is 'ease-in-out'
    114 PASS computedStyle.transitionTimingFunction is 'cubic-bezier(0.42, 0, 0.58, 1)'
    115 PASS style.webkitTransitionTimingFunction is 'ease-in-out'
    116 PASS computedStyle.webkitTransitionTimingFunction is 'cubic-bezier(0.42, 0, 0.58, 1)'
    117125PASS style.transitionTimingFunction is 'cubic-bezier(0.1, 0, 0.23, 0.4)'
    118126PASS computedStyle.transitionTimingFunction is 'cubic-bezier(0.1, 0, 0.23, 0.4)'
     
    188196PASS computedStyle.webkitTransitionTimingFunction is 'steps(5, start)'
    189197PASS style.transitionTimingFunction is 'ease-in-out, ease-in'
    190 PASS computedStyle.transitionTimingFunction is 'cubic-bezier(0.42, 0, 0.58, 1), cubic-bezier(0.42, 0, 1, 1)'
     198PASS computedStyle.transitionTimingFunction is 'ease-in-out, ease-in'
    191199PASS style.webkitTransitionTimingFunction is 'ease-in-out, ease-in'
    192 PASS computedStyle.webkitTransitionTimingFunction is 'cubic-bezier(0.42, 0, 0.58, 1), cubic-bezier(0.42, 0, 1, 1)'
     200PASS computedStyle.webkitTransitionTimingFunction is 'ease-in-out, ease-in'
    193201PASS style.transitionTimingFunction is 'ease-in-out, cubic-bezier(0.1, 0, 0.23, 0.4)'
    194 PASS computedStyle.transitionTimingFunction is 'cubic-bezier(0.42, 0, 0.58, 1), cubic-bezier(0.1, 0, 0.23, 0.4)'
     202PASS computedStyle.transitionTimingFunction is 'ease-in-out, cubic-bezier(0.1, 0, 0.23, 0.4)'
    195203PASS style.webkitTransitionTimingFunction is 'ease-in-out, cubic-bezier(0.1, 0, 0.23, 0.4)'
    196 PASS computedStyle.webkitTransitionTimingFunction is 'cubic-bezier(0.42, 0, 0.58, 1), cubic-bezier(0.1, 0, 0.23, 0.4)'
     204PASS computedStyle.webkitTransitionTimingFunction is 'ease-in-out, cubic-bezier(0.1, 0, 0.23, 0.4)'
    197205PASS style.transitionTimingFunction is 'steps(3, start), ease-in-out'
    198 PASS computedStyle.transitionTimingFunction is 'steps(3, start), cubic-bezier(0.42, 0, 0.58, 1)'
     206PASS computedStyle.transitionTimingFunction is 'steps(3, start), ease-in-out'
    199207PASS style.webkitTransitionTimingFunction is 'steps(3, start), ease-in-out'
    200 PASS computedStyle.webkitTransitionTimingFunction is 'steps(3, start), cubic-bezier(0.42, 0, 0.58, 1)'
     208PASS computedStyle.webkitTransitionTimingFunction is 'steps(3, start), ease-in-out'
    201209Invalid transition-timing-function values.
    202210PASS style.transitionTimingFunction is ''
    203 PASS computedStyle.transitionTimingFunction is 'cubic-bezier(0.25, 0.1, 0.25, 1)'
    204 PASS style.webkitTransitionTimingFunction is ''
    205 PASS computedStyle.webkitTransitionTimingFunction is 'cubic-bezier(0.25, 0.1, 0.25, 1)'
    206 PASS style.transitionTimingFunction is ''
    207 PASS computedStyle.transitionTimingFunction is 'cubic-bezier(0.25, 0.1, 0.25, 1)'
    208 PASS style.webkitTransitionTimingFunction is ''
    209 PASS computedStyle.webkitTransitionTimingFunction is 'cubic-bezier(0.25, 0.1, 0.25, 1)'
    210 PASS style.transitionTimingFunction is ''
    211 PASS computedStyle.transitionTimingFunction is 'cubic-bezier(0.25, 0.1, 0.25, 1)'
    212 PASS style.webkitTransitionTimingFunction is ''
    213 PASS computedStyle.webkitTransitionTimingFunction is 'cubic-bezier(0.25, 0.1, 0.25, 1)'
    214 PASS style.transitionTimingFunction is ''
    215 PASS computedStyle.transitionTimingFunction is 'cubic-bezier(0.25, 0.1, 0.25, 1)'
    216 PASS style.webkitTransitionTimingFunction is ''
    217 PASS computedStyle.webkitTransitionTimingFunction is 'cubic-bezier(0.25, 0.1, 0.25, 1)'
    218 PASS style.transitionTimingFunction is ''
    219 PASS computedStyle.transitionTimingFunction is 'cubic-bezier(0.25, 0.1, 0.25, 1)'
    220 PASS style.webkitTransitionTimingFunction is ''
    221 PASS computedStyle.webkitTransitionTimingFunction is 'cubic-bezier(0.25, 0.1, 0.25, 1)'
    222 PASS style.transitionTimingFunction is ''
    223 PASS computedStyle.transitionTimingFunction is 'cubic-bezier(0.25, 0.1, 0.25, 1)'
    224 PASS style.webkitTransitionTimingFunction is ''
    225 PASS computedStyle.webkitTransitionTimingFunction is 'cubic-bezier(0.25, 0.1, 0.25, 1)'
    226 PASS style.transitionTimingFunction is ''
    227 PASS computedStyle.transitionTimingFunction is 'cubic-bezier(0.25, 0.1, 0.25, 1)'
    228 PASS style.webkitTransitionTimingFunction is ''
    229 PASS computedStyle.webkitTransitionTimingFunction is 'cubic-bezier(0.25, 0.1, 0.25, 1)'
    230 PASS style.transitionTimingFunction is ''
    231 PASS computedStyle.transitionTimingFunction is 'cubic-bezier(0.25, 0.1, 0.25, 1)'
    232 PASS style.webkitTransitionTimingFunction is ''
    233 PASS computedStyle.webkitTransitionTimingFunction is 'cubic-bezier(0.25, 0.1, 0.25, 1)'
     211PASS computedStyle.transitionTimingFunction is 'ease'
     212PASS style.webkitTransitionTimingFunction is ''
     213PASS computedStyle.webkitTransitionTimingFunction is 'ease'
     214PASS style.transitionTimingFunction is ''
     215PASS computedStyle.transitionTimingFunction is 'ease'
     216PASS style.webkitTransitionTimingFunction is ''
     217PASS computedStyle.webkitTransitionTimingFunction is 'ease'
     218PASS style.transitionTimingFunction is ''
     219PASS computedStyle.transitionTimingFunction is 'ease'
     220PASS style.webkitTransitionTimingFunction is ''
     221PASS computedStyle.webkitTransitionTimingFunction is 'ease'
     222PASS style.transitionTimingFunction is ''
     223PASS computedStyle.transitionTimingFunction is 'ease'
     224PASS style.webkitTransitionTimingFunction is ''
     225PASS computedStyle.webkitTransitionTimingFunction is 'ease'
     226PASS style.transitionTimingFunction is ''
     227PASS computedStyle.transitionTimingFunction is 'ease'
     228PASS style.webkitTransitionTimingFunction is ''
     229PASS computedStyle.webkitTransitionTimingFunction is 'ease'
     230PASS style.transitionTimingFunction is ''
     231PASS computedStyle.transitionTimingFunction is 'ease'
     232PASS style.webkitTransitionTimingFunction is ''
     233PASS computedStyle.webkitTransitionTimingFunction is 'ease'
     234PASS style.transitionTimingFunction is ''
     235PASS computedStyle.transitionTimingFunction is 'ease'
     236PASS style.webkitTransitionTimingFunction is ''
     237PASS computedStyle.webkitTransitionTimingFunction is 'ease'
     238PASS style.transitionTimingFunction is ''
     239PASS computedStyle.transitionTimingFunction is 'ease'
     240PASS style.webkitTransitionTimingFunction is ''
     241PASS computedStyle.webkitTransitionTimingFunction is 'ease'
    234242Valid transition-delay values.
    235243PASS computedStyle.transitionDelay is '0s'
  • trunk/LayoutTests/transitions/transitions-parsing.html

    r138721 r138728  
    200200debug("Valid transition-timing-function values.");
    201201// Initial test.
    202 shouldBe("computedStyle.transitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
    203 shouldBe("computedStyle.webkitTransitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
    204 
    205 // Tracked by https://bugs.webkit.org/show_bug.cgi?id=105442.
    206 /*style.transitionTimingFunction = "linear";
     202shouldBe("computedStyle.transitionTimingFunction", "'ease'");
     203shouldBe("computedStyle.webkitTransitionTimingFunction", "'ease'");
     204
     205style.transitionTimingFunction = "linear";
    207206shouldBe("style.transitionTimingFunction", "'linear'");
    208 shouldBe("computedStyle.transitionTimingFunction", "'cubic-bezier(0, 0, 1, 1)'");
     207shouldBe("computedStyle.transitionTimingFunction", "'linear'");
    209208shouldBe("style.webkitTransitionTimingFunction", "'linear'");
    210 shouldBe("computedStyle.webkitTransitionTimingFunction", "'cubic-bezier(0, 0, 1, 1)'");*/
     209shouldBe("computedStyle.webkitTransitionTimingFunction", "'linear'");
    211210
    212211style.transitionTimingFunction = "ease";
    213212shouldBe("style.transitionTimingFunction", "'ease'");
    214 shouldBe("computedStyle.transitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
     213shouldBe("computedStyle.transitionTimingFunction", "'ease'");
    215214shouldBe("style.webkitTransitionTimingFunction", "'ease'");
    216 shouldBe("computedStyle.webkitTransitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
     215shouldBe("computedStyle.webkitTransitionTimingFunction", "'ease'");
    217216
    218217style.transitionTimingFunction = "ease-in";
    219218shouldBe("style.transitionTimingFunction", "'ease-in'");
    220 shouldBe("computedStyle.transitionTimingFunction", "'cubic-bezier(0.42, 0, 1, 1)'");
     219shouldBe("computedStyle.transitionTimingFunction", "'ease-in'");
    221220shouldBe("style.webkitTransitionTimingFunction", "'ease-in'");
    222 shouldBe("computedStyle.webkitTransitionTimingFunction", "'cubic-bezier(0.42, 0, 1, 1)'");
     221shouldBe("computedStyle.webkitTransitionTimingFunction", "'ease-in'");
    223222
    224223style.transitionTimingFunction = "ease-out";
    225224shouldBe("style.transitionTimingFunction", "'ease-out'");
    226 shouldBe("computedStyle.transitionTimingFunction", "'cubic-bezier(0, 0, 0.58, 1)'");
     225shouldBe("computedStyle.transitionTimingFunction", "'ease-out'");
    227226shouldBe("style.webkitTransitionTimingFunction", "'ease-out'");
    228 shouldBe("computedStyle.webkitTransitionTimingFunction", "'cubic-bezier(0, 0, 0.58, 1)'");
     227shouldBe("computedStyle.webkitTransitionTimingFunction", "'ease-out'");
    229228
    230229style.transitionTimingFunction = "ease-in-out";
    231230shouldBe("style.transitionTimingFunction", "'ease-in-out'");
    232 shouldBe("computedStyle.transitionTimingFunction", "'cubic-bezier(0.42, 0, 0.58, 1)'");
     231shouldBe("computedStyle.transitionTimingFunction", "'ease-in-out'");
    233232shouldBe("style.webkitTransitionTimingFunction", "'ease-in-out'");
    234 shouldBe("computedStyle.webkitTransitionTimingFunction", "'cubic-bezier(0.42, 0, 0.58, 1)'");
     233shouldBe("computedStyle.webkitTransitionTimingFunction", "'ease-in-out'");
     234
     235style.transitionTimingFunction = "cubic-bezier(0.25, 0.1, 0.25, 1)";
     236shouldBe("style.transitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
     237shouldBe("computedStyle.transitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
     238shouldBe("style.webkitTransitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
     239shouldBe("computedStyle.webkitTransitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
    235240
    236241style.transitionTimingFunction = "cubic-bezier(0.1, 0, 0.23, 0.4)";
     
    346351style.transitionTimingFunction = "ease-in-out, ease-in";
    347352shouldBe("style.transitionTimingFunction", "'ease-in-out, ease-in'");
    348 shouldBe("computedStyle.transitionTimingFunction", "'cubic-bezier(0.42, 0, 0.58, 1), cubic-bezier(0.42, 0, 1, 1)'");
     353shouldBe("computedStyle.transitionTimingFunction", "'ease-in-out, ease-in'");
    349354shouldBe("style.webkitTransitionTimingFunction", "'ease-in-out, ease-in'");
    350 shouldBe("computedStyle.webkitTransitionTimingFunction", "'cubic-bezier(0.42, 0, 0.58, 1), cubic-bezier(0.42, 0, 1, 1)'");
     355shouldBe("computedStyle.webkitTransitionTimingFunction", "'ease-in-out, ease-in'");
    351356
    352357style.transitionTimingFunction = "ease-in-out, cubic-bezier(0.1, 0, 0.23, 0.4)";
    353358shouldBe("style.transitionTimingFunction", "'ease-in-out, cubic-bezier(0.1, 0, 0.23, 0.4)'");
    354 shouldBe("computedStyle.transitionTimingFunction", "'cubic-bezier(0.42, 0, 0.58, 1), cubic-bezier(0.1, 0, 0.23, 0.4)'");
     359shouldBe("computedStyle.transitionTimingFunction", "'ease-in-out, cubic-bezier(0.1, 0, 0.23, 0.4)'");
    355360shouldBe("style.webkitTransitionTimingFunction", "'ease-in-out, cubic-bezier(0.1, 0, 0.23, 0.4)'");
    356 shouldBe("computedStyle.webkitTransitionTimingFunction", "'cubic-bezier(0.42, 0, 0.58, 1), cubic-bezier(0.1, 0, 0.23, 0.4)'");
     361shouldBe("computedStyle.webkitTransitionTimingFunction", "'ease-in-out, cubic-bezier(0.1, 0, 0.23, 0.4)'");
    357362
    358363style.transitionTimingFunction = "steps(3, start), ease-in-out";
    359364shouldBe("style.transitionTimingFunction", "'steps(3, start), ease-in-out'");
    360 shouldBe("computedStyle.transitionTimingFunction", "'steps(3, start), cubic-bezier(0.42, 0, 0.58, 1)'");
     365shouldBe("computedStyle.transitionTimingFunction", "'steps(3, start), ease-in-out'");
    361366shouldBe("style.webkitTransitionTimingFunction", "'steps(3, start), ease-in-out'");
    362 shouldBe("computedStyle.webkitTransitionTimingFunction", "'steps(3, start), cubic-bezier(0.42, 0, 0.58, 1)'");
     367shouldBe("computedStyle.webkitTransitionTimingFunction", "'steps(3, start), ease-in-out'");
    363368
    364369debug("Invalid transition-timing-function values.");
     
    368373style.transitionTimingFunction = "steps(5, 3)";
    369374shouldBe("style.transitionTimingFunction", "''");
    370 shouldBe("computedStyle.transitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
    371 shouldBe("style.webkitTransitionTimingFunction", "''");
    372 shouldBe("computedStyle.webkitTransitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
     375shouldBe("computedStyle.transitionTimingFunction", "'ease'");
     376shouldBe("style.webkitTransitionTimingFunction", "''");
     377shouldBe("computedStyle.webkitTransitionTimingFunction", "'ease'");
    373378
    374379style.transitionTimingFunction = "steps(-5, start)";
    375380shouldBe("style.transitionTimingFunction", "''");
    376 shouldBe("computedStyle.transitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
    377 shouldBe("style.webkitTransitionTimingFunction", "''");
    378 shouldBe("computedStyle.webkitTransitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
     381shouldBe("computedStyle.transitionTimingFunction", "'ease'");
     382shouldBe("style.webkitTransitionTimingFunction", "''");
     383shouldBe("computedStyle.webkitTransitionTimingFunction", "'ease'");
    379384
    380385style.transitionTimingFunction = "steps(5, start, end)";
    381386shouldBe("style.transitionTimingFunction", "''");
    382 shouldBe("computedStyle.transitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
    383 shouldBe("style.webkitTransitionTimingFunction", "''");
    384 shouldBe("computedStyle.webkitTransitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
     387shouldBe("computedStyle.transitionTimingFunction", "'ease'");
     388shouldBe("style.webkitTransitionTimingFunction", "''");
     389shouldBe("computedStyle.webkitTransitionTimingFunction", "'ease'");
    385390
    386391style.transitionTimingFunction = "step(5)";
    387392shouldBe("style.transitionTimingFunction", "''");
    388 shouldBe("computedStyle.transitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
    389 shouldBe("style.webkitTransitionTimingFunction", "''");
    390 shouldBe("computedStyle.webkitTransitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
     393shouldBe("computedStyle.transitionTimingFunction", "'ease'");
     394shouldBe("style.webkitTransitionTimingFunction", "''");
     395shouldBe("computedStyle.webkitTransitionTimingFunction", "'ease'");
    391396
    392397style.transitionTimingFunction = "red";
    393398shouldBe("style.transitionTimingFunction", "''");
    394 shouldBe("computedStyle.transitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
    395 shouldBe("style.webkitTransitionTimingFunction", "''");
    396 shouldBe("computedStyle.webkitTransitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
     399shouldBe("computedStyle.transitionTimingFunction", "'ease'");
     400shouldBe("style.webkitTransitionTimingFunction", "''");
     401shouldBe("computedStyle.webkitTransitionTimingFunction", "'ease'");
    397402
    398403style.transitionTimingFunction = "cubic-bezier(0.25, 0.1, 0.25)";
    399404shouldBe("style.transitionTimingFunction", "''");
    400 shouldBe("computedStyle.transitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
    401 shouldBe("style.webkitTransitionTimingFunction", "''");
    402 shouldBe("computedStyle.webkitTransitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
     405shouldBe("computedStyle.transitionTimingFunction", "'ease'");
     406shouldBe("style.webkitTransitionTimingFunction", "''");
     407shouldBe("computedStyle.webkitTransitionTimingFunction", "'ease'");
    403408
    404409style.transitionTimingFunction = "cubic-bezier(0.25, 0.1, 0.25, 1, 2)";
    405410shouldBe("style.transitionTimingFunction", "''");
    406 shouldBe("computedStyle.transitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
    407 shouldBe("style.webkitTransitionTimingFunction", "''");
    408 shouldBe("computedStyle.webkitTransitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
     411shouldBe("computedStyle.transitionTimingFunction", "'ease'");
     412shouldBe("style.webkitTransitionTimingFunction", "''");
     413shouldBe("computedStyle.webkitTransitionTimingFunction", "'ease'");
    409414
    410415style.transitionTimingFunction = "cubic-foo(0.25, 0.1, 0.25, 1)";
    411416shouldBe("style.transitionTimingFunction", "''");
    412 shouldBe("computedStyle.transitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
    413 shouldBe("style.webkitTransitionTimingFunction", "''");
    414 shouldBe("computedStyle.webkitTransitionTimingFunction", "'cubic-bezier(0.25, 0.1, 0.25, 1)'");
     417shouldBe("computedStyle.transitionTimingFunction", "'ease'");
     418shouldBe("style.webkitTransitionTimingFunction", "''");
     419shouldBe("computedStyle.webkitTransitionTimingFunction", "'ease'");
    415420
    416421debug("Valid transition-delay values.");
  • trunk/Source/WebCore/ChangeLog

    r138727 r138728  
     12013-01-03  Alexis Menard  <alexis@webkit.org>
     2
     3        Querying transition-timing-function value on the computed style does not return keywords when it should.
     4        https://bugs.webkit.org/show_bug.cgi?id=105442
     5
     6        Reviewed by Simon Fraser.
     7
     8        http://www.w3.org/TR/css3-transitions/#transition-timing-function-property
     9        contains a set of predefined timing functions which under the hood are
     10        implemented using cubic-bezier but it's an implementation detail that
     11        should not be exposed. It seems to be more clear to return a CSS
     12        keyword rather than the cubic-bezier form when querying the value of
     13        the property on the computed style. In fact the spec even say that for
     14        example the initial value is "ease" and not cubic-bezier(0.25, 0.1,
     15        0.25, 1.0). We could also imagine that in the future these predefined
     16        values could contain other values not represented by a cubic-bezier
     17        form. This behavior also align with the "linear" keyword which return
     18        "linear" rather than cubic-bezier(0.0, 0.0, 1.0, 1.0).
     19
     20        Test: transitions/transitions-parsing.html has been updated to cover
     21        the new behavior as well as making sure that an explicitly set value of
     22        cubic-bezier(0.25, 0.1, 0.25, 1.0) does not return "ease" but the
     23        cubic-bezier() form.
     24
     25        * css/CSSComputedStyleDeclaration.cpp:
     26        (WebCore::createAnimationValue):
     27        (WebCore):
     28        (WebCore::getTimingFunctionValue):
     29        * css/CSSToStyleMap.cpp:
     30        (WebCore::CSSToStyleMap::mapAnimationTimingFunction):
     31        * platform/animation/TimingFunction.h:
     32        (WebCore::CubicBezierTimingFunction::create):
     33        (CubicBezierTimingFunction):
     34        (WebCore::CubicBezierTimingFunction::operator==):
     35        (WebCore::CubicBezierTimingFunction::timingFunctionPreset): Store the
     36        preset value of the timing function if it is one when creating it
     37        so we can use it later from the computed style.
     38        (WebCore::CubicBezierTimingFunction::CubicBezierTimingFunction):
     39
    1402013-01-03  Tony Chang  <tony@chromium.org>
    241
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r137754 r138728  
    10751075}
    10761076
     1077static PassRefPtr<CSSValue> createAnimationValue(const TimingFunction* timingFunction)
     1078{
     1079    if (timingFunction->isCubicBezierTimingFunction()) {
     1080        const CubicBezierTimingFunction* bezierTimingFunction = static_cast<const CubicBezierTimingFunction*>(timingFunction);
     1081        if (bezierTimingFunction->timingFunctionPreset() != CubicBezierTimingFunction::Custom) {
     1082            CSSValueID valueId = CSSValueInvalid;
     1083            switch (bezierTimingFunction->timingFunctionPreset()) {
     1084            case CubicBezierTimingFunction::Ease:
     1085                valueId = CSSValueEase;
     1086                break;
     1087            case CubicBezierTimingFunction::EaseIn:
     1088                valueId = CSSValueEaseIn;
     1089                break;
     1090            case CubicBezierTimingFunction::EaseOut:
     1091                valueId = CSSValueEaseOut;
     1092                break;
     1093            case CubicBezierTimingFunction::EaseInOut:
     1094                valueId = CSSValueEaseInOut;
     1095                break;
     1096            default:
     1097                ASSERT_NOT_REACHED();
     1098                return 0;
     1099            }
     1100            return cssValuePool().createIdentifierValue(valueId);
     1101        }
     1102        return CSSCubicBezierTimingFunctionValue::create(bezierTimingFunction->x1(), bezierTimingFunction->y1(), bezierTimingFunction->x2(), bezierTimingFunction->y2());
     1103    }
     1104
     1105    if (timingFunction->isStepsTimingFunction()) {
     1106        const StepsTimingFunction* stepsTimingFunction = static_cast<const StepsTimingFunction*>(timingFunction);
     1107        return CSSStepsTimingFunctionValue::create(stepsTimingFunction->numberOfSteps(), stepsTimingFunction->stepAtStart());
     1108    }
     1109
     1110    return CSSLinearTimingFunctionValue::create();
     1111}
     1112
    10771113static PassRefPtr<CSSValue> getTimingFunctionValue(const AnimationList* animList)
    10781114{
     
    10801116    if (animList) {
    10811117        for (size_t i = 0; i < animList->size(); ++i) {
    1082             const TimingFunction* tf = animList->animation(i)->timingFunction().get();
    1083             if (tf->isCubicBezierTimingFunction()) {
    1084                 const CubicBezierTimingFunction* ctf = static_cast<const CubicBezierTimingFunction*>(tf);
    1085                 list->append(CSSCubicBezierTimingFunctionValue::create(ctf->x1(), ctf->y1(), ctf->x2(), ctf->y2()));
    1086             } else if (tf->isStepsTimingFunction()) {
    1087                 const StepsTimingFunction* stf = static_cast<const StepsTimingFunction*>(tf);
    1088                 list->append(CSSStepsTimingFunctionValue::create(stf->numberOfSteps(), stf->stepAtStart()));
    1089             } else {
    1090                 list->append(CSSLinearTimingFunctionValue::create());
    1091             }
     1118            RefPtr<TimingFunction> timingFunction = animList->animation(i)->timingFunction();
     1119            list->append(createAnimationValue(timingFunction.get()));
    10921120        }
    10931121    } else {
    10941122        // Note that initialAnimationTimingFunction() is used for both transitions and animations
    1095         RefPtr<TimingFunction> tf = Animation::initialAnimationTimingFunction();
    1096         if (tf->isCubicBezierTimingFunction()) {
    1097             const CubicBezierTimingFunction* ctf = static_cast<const CubicBezierTimingFunction*>(tf.get());
    1098             list->append(CSSCubicBezierTimingFunctionValue::create(ctf->x1(), ctf->y1(), ctf->x2(), ctf->y2()));
    1099         } else if (tf->isStepsTimingFunction()) {
    1100             const StepsTimingFunction* stf = static_cast<const StepsTimingFunction*>(tf.get());
    1101             list->append(CSSStepsTimingFunctionValue::create(stf->numberOfSteps(), stf->stepAtStart()));
    1102         } else {
    1103             list->append(CSSLinearTimingFunctionValue::create());
    1104         }
     1123        RefPtr<TimingFunction> timingFunction = Animation::initialAnimationTimingFunction();
     1124        list->append(createAnimationValue(timingFunction.get()));
    11051125    }
    11061126    return list.release();
  • trunk/Source/WebCore/css/CSSToStyleMap.cpp

    r137166 r138728  
    458458            break;
    459459        case CSSValueEaseIn:
    460             animation->setTimingFunction(CubicBezierTimingFunction::create(0.42, 0.0, 1.0, 1.0));
     460            animation->setTimingFunction(CubicBezierTimingFunction::create(CubicBezierTimingFunction::EaseIn));
    461461            break;
    462462        case CSSValueEaseOut:
    463             animation->setTimingFunction(CubicBezierTimingFunction::create(0.0, 0.0, 0.58, 1.0));
     463            animation->setTimingFunction(CubicBezierTimingFunction::create(CubicBezierTimingFunction::EaseOut));
    464464            break;
    465465        case CSSValueEaseInOut:
    466             animation->setTimingFunction(CubicBezierTimingFunction::create(0.42, 0.0, 0.58, 1.0));
     466            animation->setTimingFunction(CubicBezierTimingFunction::create(CubicBezierTimingFunction::EaseInOut));
    467467            break;
    468468        case CSSValueStepStart:
  • trunk/Source/WebCore/platform/animation/TimingFunction.h

    r95901 r138728  
    7979class CubicBezierTimingFunction : public TimingFunction {
    8080public:
     81    enum TimingFunctionPreset {
     82        Ease,
     83        EaseIn,
     84        EaseOut,
     85        EaseInOut,
     86        Custom
     87    };
     88   
    8189    static PassRefPtr<CubicBezierTimingFunction> create(double x1, double y1, double x2, double y2)
    8290    {
    83         return adoptRef(new CubicBezierTimingFunction(x1, y1, x2, y2));
     91        return adoptRef(new CubicBezierTimingFunction(Custom, x1, y1, x2, y2));
    8492    }
    8593
     
    8795    {
    8896        return adoptRef(new CubicBezierTimingFunction());
     97    }
     98   
     99    static PassRefPtr<CubicBezierTimingFunction> create(TimingFunctionPreset preset)
     100    {
     101        switch (preset) {
     102        case Ease:
     103            return adoptRef(new CubicBezierTimingFunction());
     104        case EaseIn:
     105            return adoptRef(new CubicBezierTimingFunction(EaseIn, 0.42, 0.0, 1.0, 1.0));
     106        case EaseOut:
     107            return adoptRef(new CubicBezierTimingFunction(EaseOut, 0.0, 0.0, 0.58, 1.0));
     108        case EaseInOut:
     109            return adoptRef(new CubicBezierTimingFunction(EaseInOut, 0.42, 0.0, 0.58, 1.0));
     110        default:
     111            ASSERT_NOT_REACHED();
     112            return 0;
     113        }
    89114    }
    90115
     
    95120        if (other.isCubicBezierTimingFunction()) {
    96121            const CubicBezierTimingFunction* ctf = static_cast<const CubicBezierTimingFunction*>(&other);
     122            if (m_timingFunctionPreset != Custom)
     123                return m_timingFunctionPreset == ctf->m_timingFunctionPreset;
     124           
    97125            return m_x1 == ctf->m_x1 && m_y1 == ctf->m_y1 && m_x2 == ctf->m_x2 && m_y2 == ctf->m_y2;
    98126        }
     
    105133    double y2() const { return m_y2; }
    106134   
     135    TimingFunctionPreset timingFunctionPreset() const { return m_timingFunctionPreset; }
     136   
    107137    static const CubicBezierTimingFunction* defaultTimingFunction()
    108138    {
     
    112142   
    113143private:
    114     CubicBezierTimingFunction(double x1 = 0.25, double y1 = 0.1, double x2 = 0.25, double y2 = 1.0)
     144    explicit CubicBezierTimingFunction(TimingFunctionPreset preset = Ease, double x1 = 0.25, double y1 = 0.1, double x2 = 0.25, double y2 = 1.0)
    115145        : TimingFunction(CubicBezierFunction)
    116146        , m_x1(x1)
     
    118148        , m_x2(x2)
    119149        , m_y2(y2)
     150        , m_timingFunctionPreset(preset)
    120151    {
    121152    }
     
    125156    double m_x2;
    126157    double m_y2;
     158    TimingFunctionPreset m_timingFunctionPreset;
    127159};
    128160
  • trunk/Source/WebKit2/ChangeLog

    r138726 r138728  
     12013-01-03  Alexis Menard  <alexis@webkit.org>
     2
     3        Querying transition-timing-function value on the computed style does not return keywords when it should.
     4        https://bugs.webkit.org/show_bug.cgi?id=105442
     5
     6        Reviewed by Simon Fraser.
     7
     8        Update the code to pass the animations from one process to another as
     9        the constructor of TimingFunction changed to take an extra parameter
     10        holding the type of the cubic-bezier form.
     11
     12        * Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp:
     13        (CoreIPC::encodeTimingFunction):
     14        (CoreIPC::decodeTimingFunction):
     15
    1162013-01-03  Rik Cabanier  <cabanier@adobe.com>
    217
  • trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp

    r137754 r138728  
    556556    case TimingFunction::CubicBezierFunction: {
    557557        const CubicBezierTimingFunction* cubic = static_cast<const CubicBezierTimingFunction*>(timingFunction);
     558        encoder.encodeEnum(cubic->timingFunctionPreset());
    558559        encoder << cubic->x1();
    559560        encoder << cubic->y1();
     
    586587    case TimingFunction::CubicBezierFunction: {
    587588        double x1, y1, x2, y2;
     589        CubicBezierTimingFunction::TimingFunctionPreset bezierPreset;
     590        if (!decoder->decodeEnum(bezierPreset))
     591            return false;
     592        if (bezierPreset != CubicBezierTimingFunction::Custom) {
     593            timingFunction = CubicBezierTimingFunction::create(bezierPreset);
     594            return true;
     595        }
    588596        if (!decoder->decodeDouble(x1))
    589597            return false;
Note: See TracChangeset for help on using the changeset viewer.