Changeset 224128 in webkit


Ignore:
Timestamp:
Oct 27, 2017 1:29:59 PM (7 years ago)
Author:
graouts@webkit.org
Message:

[Web Animations] Expose the currentTime property on AnimationTimeline
https://bugs.webkit.org/show_bug.cgi?id=178928

Reviewed by Dean Jackson.

Source/WebCore:

We add the currentTime property on AnimationTimeline and add an internals method
to set it in a test which will allow us to validate the timing model state for
a given time.

Test: webanimations/timeline-current-time.html

  • animation/AnimationTimeline.cpp:

(WebCore::AnimationTimeline::bindingsCurrentTime const):
(WebCore::AnimationTimeline::setCurrentTime):

  • animation/AnimationTimeline.h:

(WebCore::AnimationTimeline::currentTime const):

  • animation/AnimationTimeline.idl:
  • testing/Internals.cpp:

(WebCore::Internals::setTimelineCurrentTime):

  • testing/Internals.h:
  • testing/Internals.idl:

LayoutTests:

Add a new test that checks we can read the document's timeline currentTime
property and set it via the internals method.

  • webanimations/timeline-current-time-expected.txt: Added.
  • webanimations/timeline-current-time.html: Added.
Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r224126 r224128  
     12017-10-27  Antoine Quint  <graouts@apple.com>
     2
     3        [Web Animations] Expose the currentTime property on AnimationTimeline
     4        https://bugs.webkit.org/show_bug.cgi?id=178928
     5
     6        Reviewed by Dean Jackson.
     7
     8        Add a new test that checks we can read the document's timeline currentTime
     9        property and set it via the internals method.
     10
     11        * webanimations/timeline-current-time-expected.txt: Added.
     12        * webanimations/timeline-current-time.html: Added.
     13
    1142017-10-27  Ryan Haddad  <ryanhaddad@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r224127 r224128  
     12017-10-27  Antoine Quint  <graouts@apple.com>
     2
     3        [Web Animations] Expose the currentTime property on AnimationTimeline
     4        https://bugs.webkit.org/show_bug.cgi?id=178928
     5
     6        Reviewed by Dean Jackson.
     7
     8        We add the currentTime property on AnimationTimeline and add an internals method
     9        to set it in a test which will allow us to validate the timing model state for
     10        a given time.
     11
     12        Test: webanimations/timeline-current-time.html
     13
     14        * animation/AnimationTimeline.cpp:
     15        (WebCore::AnimationTimeline::bindingsCurrentTime const):
     16        (WebCore::AnimationTimeline::setCurrentTime):
     17        * animation/AnimationTimeline.h:
     18        (WebCore::AnimationTimeline::currentTime const):
     19        * animation/AnimationTimeline.idl:
     20        * testing/Internals.cpp:
     21        (WebCore::Internals::setTimelineCurrentTime):
     22        * testing/Internals.h:
     23        * testing/Internals.idl:
     24
    1252017-10-27  Antoine Quint  <graouts@apple.com>
    226
  • trunk/Source/WebCore/animation/AnimationTimeline.cpp

    r223825 r224128  
    5353}
    5454
     55std::optional<double> AnimationTimeline::bindingsCurrentTime() const
     56{
     57    if (!m_currentTime)
     58        return std::nullopt;
     59    return m_currentTime->value();
     60}
     61
     62void AnimationTimeline::setCurrentTime(Seconds currentTime)
     63{
     64    m_currentTime = currentTime;
     65}
     66
    5567String AnimationTimeline::description()
    5668{
  • trunk/Source/WebCore/animation/AnimationTimeline.h

    r223825 r224128  
    3030#include <wtf/Forward.h>
    3131#include <wtf/HashSet.h>
     32#include <wtf/Optional.h>
    3233#include <wtf/Ref.h>
    3334#include <wtf/RefCounted.h>
     35#include <wtf/Seconds.h>
    3436
    3537namespace WebCore {
     
    4244    void addAnimation(Ref<WebAnimation>&&);
    4345    void removeAnimation(Ref<WebAnimation>&&);
     46    std::optional<double> bindingsCurrentTime() const;
     47    std::optional<Seconds> currentTime() const { return m_currentTime; }
     48    WEBCORE_EXPORT void setCurrentTime(Seconds);
    4449    WEBCORE_EXPORT String description();
    4550
     
    5762private:
    5863    ClassType m_classType;
     64    std::optional<Seconds> m_currentTime;
    5965    HashSet<RefPtr<WebAnimation>> m_animations;
    6066};
  • trunk/Source/WebCore/animation/AnimationTimeline.idl

    r223825 r224128  
    2929    CustomToJSObject
    3030] interface AnimationTimeline {
     31    [ImplementedAs=bindingsCurrentTime] readonly attribute double? currentTime;
    3132};
  • trunk/Source/WebCore/testing/Internals.cpp

    r223855 r224128  
    42624262}
    42634263
     4264void Internals::setTimelineCurrentTime(AnimationTimeline& timeline, double currentTime)
     4265{
     4266    timeline.setCurrentTime(Seconds(currentTime));
     4267}
     4268
    42644269#if ENABLE(APPLE_PAY)
    42654270MockPaymentCoordinator& Internals::mockPaymentCoordinator() const
  • trunk/Source/WebCore/testing/Internals.h

    r223855 r224128  
    626626
    627627    String timelineDescription(AnimationTimeline&);
     628    void setTimelineCurrentTime(AnimationTimeline&, double);
    628629
    629630private:
  • trunk/Source/WebCore/testing/Internals.idl

    r223855 r224128  
    564564
    565565    [EnabledAtRuntime=WebAnimations] DOMString timelineDescription(AnimationTimeline timeline);
     566    [EnabledAtRuntime=WebAnimations] void setTimelineCurrentTime(AnimationTimeline timeline, double currentTime);
    566567    [Conditional=APPLE_PAY] readonly attribute MockPaymentCoordinator mockPaymentCoordinator;
    567568};
Note: See TracChangeset for help on using the changeset viewer.