Changeset 265098 in webkit


Ignore:
Timestamp:
Jul 30, 2020 2:51:39 PM (4 years ago)
Author:
graouts@webkit.org
Message:

[ iOS ] webanimations/accelerated-animation-with-easing.html is still flaky
https://bugs.webkit.org/show_bug.cgi?id=214327
<rdar://problem/65569237>

Reviewed by Dean Jackson.

Source/WebKit:

When we fixed bug 213495 in r263506, we started calling PlatformCAAnimation::setTimingFunction()
to set the animation-wide timing function of CSS Animations and JS-originated animations alike.
However, we neglected to update PlatformCAAnimationRemote, used on iOS, to be able to handle
both animation-wide timing functions as well as keyframe-specific timing functions. This patch
adds a new "timingFunction" member to PlatformCAAnimationRemote::Properties to allow for this
and this new member is used in setTimingFunction() and copyTimingFunctionFrom(). Finally, after
the animation is decoded in the UI process, we call -[CAKeyframeAnimation setTimingFunction:]
inside addAnimationToLayer() to use this animation-wide timing function.

This fixes the test added originally in r263506 which would only work flakily, a symptom of this
missing implementation on iOS.

  • WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h:
  • WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:

(WebKit::encodeTimingFunction):
(WebKit::decodeTimingFunction):
(WebKit::PlatformCAAnimationRemote::Properties::encode const):
(WebKit::PlatformCAAnimationRemote::Properties::decode):
(WebKit::PlatformCAAnimationRemote::setTimingFunction):
(WebKit::PlatformCAAnimationRemote::copyTimingFunctionFrom):
(WebKit::addAnimationToLayer):
(WebKit::operator<<):

LayoutTests:

Remove the flaky expectation and remove the extra tolerance added in r263761 when it was thought that
this test was merely flaky and not completely broken on iOS as it turned out to be.

  • platform/ios-wk2/TestExpectations:
  • webanimations/accelerated-animation-with-easing.html:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r265093 r265098  
     12020-07-30  Antoine Quint  <graouts@webkit.org>
     2
     3        [ iOS ] webanimations/accelerated-animation-with-easing.html is still flaky
     4        https://bugs.webkit.org/show_bug.cgi?id=214327
     5        <rdar://problem/65569237>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Remove the flaky expectation and remove the extra tolerance added in r263761 when it was thought that
     10        this test was merely flaky and not completely broken on iOS as it turned out to be.
     11
     12        * platform/ios-wk2/TestExpectations:
     13        * webanimations/accelerated-animation-with-easing.html:
     14
    1152020-07-30  Kenneth Russell  <kbr@chromium.org>
    216
  • trunk/LayoutTests/platform/ios-wk2/TestExpectations

    r265063 r265098  
    17731773webkit.org/b/214322 [ Debug ] http/tests/workers/worker-importScripts-banned-mimetype.html [ Pass Crash ]
    17741774
    1775 webkit.org/b/214327 webanimations/accelerated-animation-with-easing.html [ Pass ImageOnlyFailure ]
    1776 
    17771775webkit.org/b/214363 [ Debug ] fast/text-indicator/text-indicator-empty-link.html [ Pass Crash ]
    17781776
  • trunk/LayoutTests/webanimations/accelerated-animation-with-easing.html

    r263761 r265098  
    1717    /* Allow for a 1px error on either side */
    1818    #easing-on-keyframe {
    19         left: -2px;
    20         width: 104px;
     19        left: -1px;
     20        width: 102px;
    2121        background-color: green;
    2222    }
  • trunk/Source/WebKit/ChangeLog

    r265095 r265098  
     12020-07-30  Antoine Quint  <graouts@webkit.org>
     2
     3        [ iOS ] webanimations/accelerated-animation-with-easing.html is still flaky
     4        https://bugs.webkit.org/show_bug.cgi?id=214327
     5        <rdar://problem/65569237>
     6
     7        Reviewed by Dean Jackson.
     8
     9        When we fixed bug 213495 in r263506, we started calling PlatformCAAnimation::setTimingFunction()
     10        to set the animation-wide timing function of CSS Animations and JS-originated animations alike.
     11        However, we neglected to update PlatformCAAnimationRemote, used on iOS, to be able to handle
     12        both animation-wide timing functions as well as keyframe-specific timing functions. This patch
     13        adds a new "timingFunction" member to PlatformCAAnimationRemote::Properties to allow for this
     14        and this new member is used in setTimingFunction() and copyTimingFunctionFrom(). Finally, after
     15        the animation is decoded in the UI process, we call -[CAKeyframeAnimation setTimingFunction:]
     16        inside addAnimationToLayer() to use this animation-wide timing function.
     17
     18        This fixes the test added originally in r263506 which would only work flakily, a symptom of this
     19        missing implementation on iOS.
     20
     21        * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h:
     22        * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm:
     23        (WebKit::encodeTimingFunction):
     24        (WebKit::decodeTimingFunction):
     25        (WebKit::PlatformCAAnimationRemote::Properties::encode const):
     26        (WebKit::PlatformCAAnimationRemote::Properties::decode):
     27        (WebKit::PlatformCAAnimationRemote::setTimingFunction):
     28        (WebKit::PlatformCAAnimationRemote::copyTimingFunctionFrom):
     29        (WebKit::addAnimationToLayer):
     30        (WebKit::operator<<):
     31
    1322020-07-30  Jer Noble  <jer.noble@apple.com>
    233
  • trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h

    r262933 r265098  
    277277        PlatformCAAnimation::FillModeType fillMode;
    278278        PlatformCAAnimation::ValueFunctionType valueFunction;
     279        RefPtr<WebCore::TimingFunction> timingFunction;
    279280
    280281        bool autoReverses;
  • trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm

    r264006 r265098  
    154154}
    155155
     156static void encodeTimingFunction(IPC::Encoder& encoder, TimingFunction* timingFunction)
     157{
     158    switch (timingFunction->type()) {
     159    case TimingFunction::LinearFunction:
     160        encoder << *static_cast<LinearTimingFunction*>(timingFunction);
     161        break;
     162
     163    case TimingFunction::CubicBezierFunction:
     164        encoder << *static_cast<CubicBezierTimingFunction*>(timingFunction);
     165        break;
     166
     167    case TimingFunction::StepsFunction:
     168        encoder << *static_cast<StepsTimingFunction*>(timingFunction);
     169        break;
     170
     171    case TimingFunction::SpringFunction:
     172        encoder << *static_cast<SpringTimingFunction*>(timingFunction);
     173        break;
     174    }
     175}
     176
     177static Optional<RefPtr<TimingFunction>> decodeTimingFunction(IPC::Decoder& decoder)
     178{
     179    TimingFunction::TimingFunctionType type;
     180    if (!decoder.decode(type))
     181        return WTF::nullopt;
     182
     183    RefPtr<TimingFunction> timingFunction;
     184    switch (type) {
     185    case TimingFunction::LinearFunction:
     186        timingFunction = LinearTimingFunction::create();
     187        if (!decoder.decode(*static_cast<LinearTimingFunction*>(timingFunction.get())))
     188            return WTF::nullopt;
     189        break;
     190
     191    case TimingFunction::CubicBezierFunction:
     192        timingFunction = CubicBezierTimingFunction::create();
     193        if (!decoder.decode(*static_cast<CubicBezierTimingFunction*>(timingFunction.get())))
     194            return WTF::nullopt;
     195        break;
     196
     197    case TimingFunction::StepsFunction:
     198        timingFunction = StepsTimingFunction::create();
     199        if (!decoder.decode(*static_cast<StepsTimingFunction*>(timingFunction.get())))
     200            return WTF::nullopt;
     201        break;
     202
     203    case TimingFunction::SpringFunction:
     204        timingFunction = SpringTimingFunction::create();
     205        if (!decoder.decode(*static_cast<SpringTimingFunction*>(timingFunction.get())))
     206            return WTF::nullopt;
     207        break;
     208    }
     209
     210    return timingFunction;
     211}
     212
    156213void PlatformCAAnimationRemote::Properties::encode(IPC::Encoder& encoder) const
    157214{
     
    167224    encoder << fillMode;
    168225    encoder << valueFunction;
     226    encodeTimingFunction(encoder, timingFunction.get());
    169227
    170228    encoder << autoReverses;
     
    178236   
    179237    encoder << static_cast<uint64_t>(timingFunctions.size());
    180     for (const auto& timingFunction : timingFunctions) {
    181         switch (timingFunction->type()) {
    182         case TimingFunction::LinearFunction:
    183             encoder << *static_cast<LinearTimingFunction*>(timingFunction.get());
    184             break;
    185            
    186         case TimingFunction::CubicBezierFunction:
    187             encoder << *static_cast<CubicBezierTimingFunction*>(timingFunction.get());
    188             break;
    189        
    190         case TimingFunction::StepsFunction:
    191             encoder << *static_cast<StepsTimingFunction*>(timingFunction.get());
    192             break;
    193 
    194         case TimingFunction::SpringFunction:
    195             encoder << *static_cast<SpringTimingFunction*>(timingFunction.get());
    196             break;
    197         }
    198     }
     238    for (const auto& timingFunction : timingFunctions)
     239        encodeTimingFunction(encoder, timingFunction.get());
    199240}
    200241
     
    229270        return WTF::nullopt;
    230271
     272    if (auto timingFunction = decodeTimingFunction(decoder))
     273        properties.timingFunction = WTFMove(*timingFunction);
     274    else
     275        return WTF::nullopt;
     276
    231277    if (!decoder.decode(properties.autoReverses))
    232278        return WTF::nullopt;
     
    258304
    259305        for (size_t i = 0; i < numTimingFunctions; ++i) {
    260        
    261             TimingFunction::TimingFunctionType type;
    262             if (!decoder.decode(type))
     306            if (auto timingFunction = decodeTimingFunction(decoder))
     307                properties.timingFunctions.uncheckedAppend(WTFMove(*timingFunction));
     308            else
    263309                return WTF::nullopt;
    264 
    265             RefPtr<TimingFunction> timingFunction;
    266             switch (type) {
    267             case TimingFunction::LinearFunction:
    268                 timingFunction = LinearTimingFunction::create();
    269                 if (!decoder.decode(*static_cast<LinearTimingFunction*>(timingFunction.get())))
    270                     return WTF::nullopt;
    271                 break;
    272                
    273             case TimingFunction::CubicBezierFunction:
    274                 timingFunction = CubicBezierTimingFunction::create();
    275                 if (!decoder.decode(*static_cast<CubicBezierTimingFunction*>(timingFunction.get())))
    276                     return WTF::nullopt;
    277                 break;
    278            
    279             case TimingFunction::StepsFunction:
    280                 timingFunction = StepsTimingFunction::create();
    281                 if (!decoder.decode(*static_cast<StepsTimingFunction*>(timingFunction.get())))
    282                     return WTF::nullopt;
    283                 break;
    284 
    285             case TimingFunction::SpringFunction:
    286                 timingFunction = SpringTimingFunction::create();
    287                 if (!decoder.decode(*static_cast<SpringTimingFunction*>(timingFunction.get())))
    288                     return WTF::nullopt;
    289                 break;
    290             }
    291            
    292             properties.timingFunctions.uncheckedAppend(WTFMove(timingFunction));
    293310        }
    294311    }
     
    422439}
    423440
    424 void PlatformCAAnimationRemote::setTimingFunction(const TimingFunction* value, bool reverse)
    425 {
    426     Vector<RefPtr<TimingFunction>> timingFunctions;
    427     timingFunctions.append(value->clone());
    428 
    429     m_properties.timingFunctions = WTFMove(timingFunctions);
    430     m_properties.reverseTimingFunctions = reverse;
     441void PlatformCAAnimationRemote::setTimingFunction(const TimingFunction* value, bool)
     442{
     443    RefPtr<TimingFunction> timingFunction = value->clone();
     444    m_properties.timingFunction = WTFMove(timingFunction);
    431445}
    432446
    433447void PlatformCAAnimationRemote::copyTimingFunctionFrom(const PlatformCAAnimation& value)
    434448{
    435     copyTimingFunctionsFrom(value);
     449    const PlatformCAAnimationRemote& other = downcast<PlatformCAAnimationRemote>(value);
     450    m_properties.timingFunction = other.m_properties.timingFunction;
    436451}
    437452
     
    721736            [basicAnimation setToValue:animationValueFromKeyframeValue(properties.keyValues[1])];
    722737        }
    723        
     738
    724739        if (properties.timingFunctions.size())
    725740            [basicAnimation setTimingFunction:toCAMediaTimingFunction(properties.timingFunctions[0].get(), properties.reverseTimingFunctions)];
    726        
     741
    727742        caAnimation = basicAnimation;
    728743        break;
     
    742757            }).get()];
    743758        }
     759
     760        if (properties.timingFunction)
     761            [keyframeAnimation setTimingFunction:toCAMediaTimingFunction(properties.timingFunction.get(), false)]; // FIXME: handle reverse.
    744762
    745763        if (properties.timingFunctions.size()) {
     
    871889    ts.dumpProperty("fillMode", animation.fillMode);
    872890    ts.dumpProperty("valueFunction", animation.valueFunction);
     891    ts.dumpProperty<const TimingFunction&>("timing function", *animation.timingFunction);
    873892
    874893    if (animation.autoReverses)
Note: See TracChangeset for help on using the changeset viewer.