Changeset 223883 in webkit


Ignore:
Timestamp:
Oct 24, 2017 12:51:59 AM (6 years ago)
Author:
commit-queue@webkit.org
Message:

[Web Animations] Add basic timing and target properties
https://bugs.webkit.org/show_bug.cgi?id=178674

Patch by Antoine Quint <Antoine Quint> on 2017-10-24
Reviewed by Dean Jackson.

Source/WebCore:

We add three new interfaces to expose enough properties to establish basic timing properties,
a start time and duration, and the target of an animation. The startTime property is set on
the Animation object, the target is set on the KeyframeEffect set as the effect property on
the Animation object, and the duration is set on the AnimationEffectTiming set on the effect.

Tests: webanimations/animation-effect-timing.html

webanimations/animation-effect.html
webanimations/animation-interface-effect-property.html
webanimations/animation-interface-start-time-property.html
webanimations/keyframe-effect-interface-timing-duration.html
webanimations/keyframe-effect.html

  • CMakeLists.txt:
  • DerivedSources.make:
  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • animation/AnimationEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl.

(WebCore::AnimationEffect::AnimationEffect):
(WebCore::AnimationEffect::~AnimationEffect):

  • animation/AnimationEffect.h: Copied from Source/WebCore/animation/WebAnimation.h.

(WebCore::AnimationEffect::isKeyframeEffect const):
(WebCore::AnimationEffect::timing const):
(WebCore::AnimationEffect::classType const):

  • animation/AnimationEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl.
  • animation/AnimationEffectTiming.cpp: Copied from Source/WebCore/animation/WebAnimation.idl.

(WebCore::AnimationEffectTiming::create):
(WebCore::AnimationEffectTiming::AnimationEffectTiming):
(WebCore::AnimationEffectTiming::~AnimationEffectTiming):

  • animation/AnimationEffectTiming.h: Copied from Source/WebCore/animation/WebAnimation.h.
  • animation/AnimationEffectTiming.idl: Copied from Source/WebCore/animation/WebAnimation.idl.
  • animation/KeyframeEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl.

(WebCore::KeyframeEffect::create):
(WebCore::KeyframeEffect::KeyframeEffect):

  • animation/KeyframeEffect.h: Copied from Source/WebCore/animation/WebAnimation.h.
  • animation/KeyframeEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl.
  • animation/WebAnimation.cpp:

(WebCore::WebAnimation::setEffect):

  • animation/WebAnimation.h:
  • animation/WebAnimation.idl:
  • bindings/js/JSAnimationEffectCustom.cpp: Copied from Source/WebCore/animation/WebAnimation.cpp.

(WebCore::toJSNewlyCreated):
(WebCore::toJS):

  • bindings/js/WebCoreBuiltinNames.h:

LayoutTests:

Add new tests to check the behavior of the newly exposed interfaces,
constructors and properties.

  • webanimations/animation-effect-expected.txt: Added.
  • webanimations/animation-effect-timing-expected.txt: Added.
  • webanimations/animation-effect-timing.html: Added.
  • webanimations/animation-effect.html: Added.
  • webanimations/animation-interface-effect-property-expected.txt: Added.
  • webanimations/animation-interface-effect-property.html: Added.
  • webanimations/animation-interface-start-time-property-expected.txt: Added.
  • webanimations/animation-interface-start-time-property.html: Added.
  • webanimations/keyframe-effect-expected.txt: Added.
  • webanimations/keyframe-effect-interface-timing-duration-expected.txt: Added.
  • webanimations/keyframe-effect-interface-timing-duration.html: Added.
  • webanimations/keyframe-effect.html: Added.
Location:
trunk
Files:
12 added
10 edited
10 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r223881 r223883  
     12017-10-24  Antoine Quint  <graouts@apple.com>
     2
     3        [Web Animations] Add basic timing and target properties
     4        https://bugs.webkit.org/show_bug.cgi?id=178674
     5
     6        Reviewed by Dean Jackson.
     7
     8        Add new tests to check the behavior of the newly exposed interfaces,
     9        constructors and properties.
     10
     11        * webanimations/animation-effect-expected.txt: Added.
     12        * webanimations/animation-effect-timing-expected.txt: Added.
     13        * webanimations/animation-effect-timing.html: Added.
     14        * webanimations/animation-effect.html: Added.
     15        * webanimations/animation-interface-effect-property-expected.txt: Added.
     16        * webanimations/animation-interface-effect-property.html: Added.
     17        * webanimations/animation-interface-start-time-property-expected.txt: Added.
     18        * webanimations/animation-interface-start-time-property.html: Added.
     19        * webanimations/keyframe-effect-expected.txt: Added.
     20        * webanimations/keyframe-effect-interface-timing-duration-expected.txt: Added.
     21        * webanimations/keyframe-effect-interface-timing-duration.html: Added.
     22        * webanimations/keyframe-effect.html: Added.
     23
    1242017-10-24  Nan Wang  <n_wang@apple.com>
    225
  • trunk/Source/WebCore/CMakeLists.txt

    r223878 r223883  
    419419    Modules/webvr/VRStageParameters.idl
    420420
     421    animation/AnimationEffect.idl
     422    animation/AnimationEffectTiming.idl
    421423    animation/AnimationTimeline.idl
    422424    animation/DocumentTimeline.idl
     425    animation/KeyframeEffect.idl
    423426    animation/WebAnimation.idl
    424427
  • trunk/Source/WebCore/ChangeLog

    r223882 r223883  
     12017-10-24  Antoine Quint  <graouts@apple.com>
     2
     3        [Web Animations] Add basic timing and target properties
     4        https://bugs.webkit.org/show_bug.cgi?id=178674
     5
     6        Reviewed by Dean Jackson.
     7
     8        We add three new interfaces to expose enough properties to establish basic timing properties,
     9        a start time and duration, and the target of an animation. The startTime property is set on
     10        the Animation object, the target is set on the KeyframeEffect set as the effect property on
     11        the Animation object, and the duration is set on the AnimationEffectTiming set on the effect.
     12
     13        Tests: webanimations/animation-effect-timing.html
     14               webanimations/animation-effect.html
     15               webanimations/animation-interface-effect-property.html
     16               webanimations/animation-interface-start-time-property.html
     17               webanimations/keyframe-effect-interface-timing-duration.html
     18               webanimations/keyframe-effect.html
     19
     20        * CMakeLists.txt:
     21        * DerivedSources.make:
     22        * Sources.txt:
     23        * WebCore.xcodeproj/project.pbxproj:
     24        * animation/AnimationEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl.
     25        (WebCore::AnimationEffect::AnimationEffect):
     26        (WebCore::AnimationEffect::~AnimationEffect):
     27        * animation/AnimationEffect.h: Copied from Source/WebCore/animation/WebAnimation.h.
     28        (WebCore::AnimationEffect::isKeyframeEffect const):
     29        (WebCore::AnimationEffect::timing const):
     30        (WebCore::AnimationEffect::classType const):
     31        * animation/AnimationEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl.
     32        * animation/AnimationEffectTiming.cpp: Copied from Source/WebCore/animation/WebAnimation.idl.
     33        (WebCore::AnimationEffectTiming::create):
     34        (WebCore::AnimationEffectTiming::AnimationEffectTiming):
     35        (WebCore::AnimationEffectTiming::~AnimationEffectTiming):
     36        * animation/AnimationEffectTiming.h: Copied from Source/WebCore/animation/WebAnimation.h.
     37        * animation/AnimationEffectTiming.idl: Copied from Source/WebCore/animation/WebAnimation.idl.
     38        * animation/KeyframeEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl.
     39        (WebCore::KeyframeEffect::create):
     40        (WebCore::KeyframeEffect::KeyframeEffect):
     41        * animation/KeyframeEffect.h: Copied from Source/WebCore/animation/WebAnimation.h.
     42        * animation/KeyframeEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl.
     43        * animation/WebAnimation.cpp:
     44        (WebCore::WebAnimation::setEffect):
     45        * animation/WebAnimation.h:
     46        * animation/WebAnimation.idl:
     47        * bindings/js/JSAnimationEffectCustom.cpp: Copied from Source/WebCore/animation/WebAnimation.cpp.
     48        (WebCore::toJSNewlyCreated):
     49        (WebCore::toJS):
     50        * bindings/js/WebCoreBuiltinNames.h:
     51
    1522017-10-24  Ryosuke Niwa  <rniwa@webkit.org>
    253
  • trunk/Source/WebCore/DerivedSources.make

    r223855 r223883  
    343343    $(WebCore)/Modules/webvr/VRPose.idl \
    344344    $(WebCore)/Modules/webvr/VRStageParameters.idl \
     345    $(WebCore)/animation/AnimationEffect.idl \
     346    $(WebCore)/animation/AnimationEffectTiming.idl \
    345347    $(WebCore)/animation/AnimationTimeline.idl \
    346348    $(WebCore)/animation/DocumentTimeline.idl \
     349    $(WebCore)/animation/KeyframeEffect.idl \
    347350    $(WebCore)/animation/WebAnimation.idl \
    348351    $(WebCore)/crypto/CryptoAlgorithmParameters.idl \
  • trunk/Source/WebCore/Sources.txt

    r223876 r223883  
    312312accessibility/AccessibilityTreeItem.cpp
    313313
     314animation/AnimationEffect.cpp
     315animation/AnimationEffectTiming.cpp
    314316animation/AnimationTimeline.cpp
    315317animation/DocumentTimeline.cpp
     318animation/KeyframeEffect.cpp
    316319animation/WebAnimation.cpp
    317 
    318320
    319321bindings/js/CachedModuleScriptLoader.cpp
     
    324326bindings/js/GCController.cpp
    325327bindings/js/IDBBindingUtilities.cpp
     328bindings/js/JSAnimationEffectCustom.cpp
    326329bindings/js/JSAnimationTimelineCustom.cpp
    327330bindings/js/JSAttrCustom.cpp
     
    906909JSAnalyserNode.cpp
    907910JSAnimationEvent.cpp
     911JSAnimationEffect.cpp
     912JSAnimationEffectTiming.cpp
    908913JSAnimationTimeline.cpp
    909914JSAttr.cpp
     
    12221227JSJsonWebKey.cpp
    12231228JSKeyboardEvent.cpp
     1229JSKeyframeEffect.cpp
    12241230JSLocation.cpp
    12251231JSLongRange.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r223876 r223883  
    25552555                7134496E146941B300720312 /* SVGLengthContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 7134496C146941B300720312 /* SVGLengthContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
    25562556                71537A01146BD9D7008BD615 /* SVGPathData.h in Headers */ = {isa = PBXBuildFile; fileRef = 715379FF146BD9D6008BD615 /* SVGPathData.h */; };
     2557                71556CB21F9F09BA00E78D08 /* AnimationEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = 71556CAD1F9F099D00E78D08 /* AnimationEffect.h */; settings = {ATTRIBUTES = (Private, ); }; };
     2558                71556CB31F9F09BA00E78D08 /* AnimationEffectTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 71556CAE1F9F099D00E78D08 /* AnimationEffectTiming.h */; settings = {ATTRIBUTES = (Private, ); }; };
     2559                71556CB41F9F09BA00E78D08 /* KeyframeEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = 71556CAA1F9F099B00E78D08 /* KeyframeEffect.h */; settings = {ATTRIBUTES = (Private, ); }; };
     2560                71556CBC1F9F0A4900E78D08 /* JSAnimationEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = 71556CB81F9F09FC00E78D08 /* JSAnimationEffect.h */; };
     2561                71556CBD1F9F0A4900E78D08 /* JSAnimationEffectTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 71556CB91F9F09FD00E78D08 /* JSAnimationEffectTiming.h */; };
     2562                71556CBE1F9F0A4900E78D08 /* JSKeyframeEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = 71556CB71F9F09FC00E78D08 /* JSKeyframeEffect.h */; };
    25572563                7157F062150B6564006EAABD /* SVGAnimatedTransformList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7157F061150B6564006EAABD /* SVGAnimatedTransformList.cpp */; };
    25582564                71A1B6081DEE5AD70073BCFB /* modern-media-controls-localized-strings.js in Resources */ = {isa = PBXBuildFile; fileRef = 71A1B6061DEE5A820073BCFB /* modern-media-controls-localized-strings.js */; };
     
    99209926                715379FE146BD9D6008BD615 /* SVGPathData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathData.cpp; sourceTree = "<group>"; };
    99219927                715379FF146BD9D6008BD615 /* SVGPathData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathData.h; sourceTree = "<group>"; };
     9928                71556CA81F9F099B00E78D08 /* KeyframeEffect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeyframeEffect.cpp; sourceTree = "<group>"; };
     9929                71556CAA1F9F099B00E78D08 /* KeyframeEffect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyframeEffect.h; sourceTree = "<group>"; };
     9930                71556CAB1F9F099C00E78D08 /* KeyframeEffect.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = KeyframeEffect.idl; sourceTree = "<group>"; };
     9931                71556CAC1F9F099D00E78D08 /* AnimationEffectTiming.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AnimationEffectTiming.cpp; sourceTree = "<group>"; };
     9932                71556CAD1F9F099D00E78D08 /* AnimationEffect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnimationEffect.h; sourceTree = "<group>"; };
     9933                71556CAE1F9F099D00E78D08 /* AnimationEffectTiming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnimationEffectTiming.h; sourceTree = "<group>"; };
     9934                71556CAF1F9F099E00E78D08 /* AnimationEffectTiming.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AnimationEffectTiming.idl; sourceTree = "<group>"; };
     9935                71556CB01F9F099E00E78D08 /* AnimationEffect.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AnimationEffect.idl; sourceTree = "<group>"; };
     9936                71556CB11F9F099F00E78D08 /* AnimationEffect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AnimationEffect.cpp; sourceTree = "<group>"; };
     9937                71556CB51F9F09DC00E78D08 /* JSAnimationEffectCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAnimationEffectCustom.cpp; sourceTree = "<group>"; };
     9938                71556CB61F9F09FC00E78D08 /* JSKeyframeEffect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSKeyframeEffect.cpp; sourceTree = "<group>"; };
     9939                71556CB71F9F09FC00E78D08 /* JSKeyframeEffect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSKeyframeEffect.h; sourceTree = "<group>"; };
     9940                71556CB81F9F09FC00E78D08 /* JSAnimationEffect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAnimationEffect.h; sourceTree = "<group>"; };
     9941                71556CB91F9F09FD00E78D08 /* JSAnimationEffectTiming.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAnimationEffectTiming.h; sourceTree = "<group>"; };
     9942                71556CBA1F9F09FD00E78D08 /* JSAnimationEffect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAnimationEffect.cpp; sourceTree = "<group>"; };
     9943                71556CBB1F9F09FE00E78D08 /* JSAnimationEffectTiming.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAnimationEffectTiming.cpp; sourceTree = "<group>"; };
    99229944                7157E3D11DC1EE4B0094550E /* scrubbing-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "scrubbing-support.js"; sourceTree = "<group>"; };
    99239945                7157F061150B6564006EAABD /* SVGAnimatedTransformList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedTransformList.cpp; sourceTree = "<group>"; };
     
    1609816120                        isa = PBXGroup;
    1609916121                        children = (
     16122                                71556CBA1F9F09FD00E78D08 /* JSAnimationEffect.cpp */,
     16123                                71556CB81F9F09FC00E78D08 /* JSAnimationEffect.h */,
     16124                                71556CBB1F9F09FE00E78D08 /* JSAnimationEffectTiming.cpp */,
     16125                                71556CB91F9F09FD00E78D08 /* JSAnimationEffectTiming.h */,
    1610016126                                71025EDA1F99F1A7004A250C /* JSAnimationTimeline.cpp */,
    1610116127                                71025ED91F99F1A7004A250C /* JSAnimationTimeline.h */,
    1610216128                                71025EDB1F99F1A8004A250C /* JSDocumentTimeline.cpp */,
    1610316129                                71025EDC1F99F1A8004A250C /* JSDocumentTimeline.h */,
     16130                                71556CB61F9F09FC00E78D08 /* JSKeyframeEffect.cpp */,
     16131                                71556CB71F9F09FC00E78D08 /* JSKeyframeEffect.h */,
    1610416132                                71025ED71F99F1A6004A250C /* JSWebAnimation.cpp */,
    1610516133                                71025ED81F99F1A6004A250C /* JSWebAnimation.h */,
     
    1930419332                        isa = PBXGroup;
    1930519333                        children = (
     19334                                71556CB11F9F099F00E78D08 /* AnimationEffect.cpp */,
     19335                                71556CAD1F9F099D00E78D08 /* AnimationEffect.h */,
     19336                                71556CB01F9F099E00E78D08 /* AnimationEffect.idl */,
     19337                                71556CAC1F9F099D00E78D08 /* AnimationEffectTiming.cpp */,
     19338                                71556CAE1F9F099D00E78D08 /* AnimationEffectTiming.h */,
     19339                                71556CAF1F9F099E00E78D08 /* AnimationEffectTiming.idl */,
    1930619340                                71025EC61F99F096004A250C /* AnimationTimeline.cpp */,
    1930719341                                71025EC71F99F096004A250C /* AnimationTimeline.h */,
     
    1931019344                                71025EC51F99F096004A250C /* DocumentTimeline.h */,
    1931119345                                71025ECA1F99F096004A250C /* DocumentTimeline.idl */,
     19346                                71556CA81F9F099B00E78D08 /* KeyframeEffect.cpp */,
     19347                                71556CAA1F9F099B00E78D08 /* KeyframeEffect.h */,
     19348                                71556CAB1F9F099C00E78D08 /* KeyframeEffect.idl */,
    1931219349                                71025EC31F99F096004A250C /* WebAnimation.cpp */,
    1931319350                                71025EC21F99F096004A250C /* WebAnimation.h */,
     
    1955819595                        isa = PBXGroup;
    1955919596                        children = (
     19597                                71556CB51F9F09DC00E78D08 /* JSAnimationEffectCustom.cpp */,
    1956019598                                71025ED51F99F147004A250C /* JSAnimationTimelineCustom.cpp */,
    1956119599                                BC2ED6BB0C6BD2F000920BFF /* JSAttrCustom.cpp */,
     
    2656026598                                49E912AB0EFAC906009D0CAF /* Animation.h in Headers */,
    2656126599                                316FE1120E6E1DA700BF6088 /* AnimationBase.h in Headers */,
     26600                                71556CB21F9F09BA00E78D08 /* AnimationEffect.h in Headers */,
     26601                                71556CB31F9F09BA00E78D08 /* AnimationEffectTiming.h in Headers */,
    2656226602                                319848011A1D817B00A13318 /* AnimationEvent.h in Headers */,
    2656326603                                49E912AD0EFAC906009D0CAF /* AnimationList.h in Headers */,
     
    2782727867                                576814451E70CB1F00E77754 /* JSAesKeyParams.h in Headers */,
    2782827868                                FDA15ECA12B03F50003A583A /* JSAnalyserNode.h in Headers */,
     27869                                71556CBC1F9F0A4900E78D08 /* JSAnimationEffect.h in Headers */,
     27870                                71556CBD1F9F0A4900E78D08 /* JSAnimationEffectTiming.h in Headers */,
    2782927871                                3198480C1A1E6CE800A13318 /* JSAnimationEvent.h in Headers */,
    2783027872                                71025EDE1F99F1EC004A250C /* JSAnimationTimeline.h in Headers */,
     
    2818828230                                57E2335B1DC7D5E500F28D01 /* JSJsonWebKey.h in Headers */,
    2818928231                                A86629D309DA2B48009633A5 /* JSKeyboardEvent.h in Headers */,
     28232                                71556CBE1F9F0A4900E78D08 /* JSKeyframeEffect.h in Headers */,
    2819028233                                935F45430F7C3B5F00D7C1FB /* JSLazyEventListener.h in Headers */,
    2819128234                                BCE1C43C0D9830D3003B02F2 /* JSLocation.h in Headers */,
     
    2863628679                                265541391489811C000DFC5D /* KeyEventCodesIOS.h in Headers */,
    2863728680                                316FE11A0E6E1DA700BF6088 /* KeyframeAnimation.h in Headers */,
     28681                                71556CB41F9F09BA00E78D08 /* KeyframeEffect.h in Headers */,
    2863828682                                BC5EBA110E823E4700B25965 /* KeyframeList.h in Headers */,
    2863928683                                E15FF7D518C9553800FE4C87 /* KeypressCommand.h in Headers */,
  • trunk/Source/WebCore/animation/AnimationEffect.cpp

    r223882 r223883  
    2424 */
    2525
    26 [
    27     EnabledAtRuntime=WebAnimations,
    28     InterfaceName=Animation,
    29     ImplementationLacksVTable,
    30     Constructor(optional AnimationTimeline? timeline)
    31 ] interface WebAnimation {
    32     readonly attribute AnimationTimeline? timeline;
    33 };
     26#include "config.h"
     27#include "AnimationEffect.h"
     28
     29#include "AnimationEffectTiming.h"
     30
     31namespace WebCore {
     32
     33AnimationEffect::AnimationEffect(ClassType classType)
     34    : m_classType(classType)
     35{
     36    m_timing = AnimationEffectTiming::create();
     37}
     38
     39} // namespace WebCore
  • trunk/Source/WebCore/animation/AnimationEffect.h

    r223882 r223883  
    2626#pragma once
    2727
     28#include "AnimationEffectTiming.h"
    2829#include <wtf/Forward.h>
    2930#include <wtf/Ref.h>
     
    3334namespace WebCore {
    3435
    35 class AnimationTimeline;
     36class AnimationEffect : public RefCounted<AnimationEffect> {
     37public:
     38    bool isKeyframeEffect() const { return m_classType == KeyframeEffectClass; }
     39    AnimationEffectTiming* timing() const { return m_timing.get(); }
    3640
    37 class WebAnimation final : public RefCounted<WebAnimation> {
    38 public:
    39     static Ref<WebAnimation> create(AnimationTimeline*);
    40     ~WebAnimation();
     41    virtual ~AnimationEffect() { }
    4142
    42     AnimationTimeline* timeline() const { return m_timeline.get(); }
    43     String description();
     43protected:
     44    enum ClassType {
     45        KeyframeEffectClass
     46    };
     47
     48    ClassType classType() const { return m_classType; }
     49
     50    explicit AnimationEffect(ClassType);
    4451
    4552private:
    46     WebAnimation(AnimationTimeline*);
    47     RefPtr<AnimationTimeline> m_timeline;
     53    ClassType m_classType;
     54    RefPtr<AnimationEffectTiming> m_timing;
    4855};
    4956
    5057} // namespace WebCore
     58
     59#define SPECIALIZE_TYPE_TRAITS_ANIMATION_EFFECT(ToValueTypeName, predicate) \
     60SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ToValueTypeName) \
     61static bool isType(const WebCore::AnimationEffect& value) { return value.predicate; } \
     62SPECIALIZE_TYPE_TRAITS_END()
  • trunk/Source/WebCore/animation/AnimationEffect.idl

    r223882 r223883  
    2626[
    2727    EnabledAtRuntime=WebAnimations,
    28     InterfaceName=Animation,
    29     ImplementationLacksVTable,
    30     Constructor(optional AnimationTimeline? timeline)
    31 ] interface WebAnimation {
    32     readonly attribute AnimationTimeline? timeline;
     28    CustomToJSObject
     29] interface AnimationEffect {
     30    readonly attribute AnimationEffectTiming timing;
    3331};
  • trunk/Source/WebCore/animation/AnimationEffectTiming.cpp

    r223882 r223883  
    2424 */
    2525
    26 [
    27     EnabledAtRuntime=WebAnimations,
    28     InterfaceName=Animation,
    29     ImplementationLacksVTable,
    30     Constructor(optional AnimationTimeline? timeline)
    31 ] interface WebAnimation {
    32     readonly attribute AnimationTimeline? timeline;
    33 };
     26#include "config.h"
     27#include "AnimationEffectTiming.h"
     28
     29namespace WebCore {
     30
     31Ref<AnimationEffectTiming> AnimationEffectTiming::create()
     32{
     33    return adoptRef(*new AnimationEffectTiming());
     34}
     35
     36AnimationEffectTiming::AnimationEffectTiming()
     37    : m_duration(0)
     38{
     39}
     40
     41AnimationEffectTiming::~AnimationEffectTiming()
     42{
     43}
     44
     45} // namespace WebCore
  • trunk/Source/WebCore/animation/AnimationEffectTiming.h

    r223882 r223883  
    3030#include <wtf/RefCounted.h>
    3131#include <wtf/RefPtr.h>
     32#include <wtf/Seconds.h>
    3233
    3334namespace WebCore {
    3435
    35 class AnimationTimeline;
     36class AnimationEffectTiming final : public RefCounted<AnimationEffectTiming> {
     37public:
     38    static Ref<AnimationEffectTiming> create();
     39    ~AnimationEffectTiming();
    3640
    37 class WebAnimation final : public RefCounted<WebAnimation> {
    38 public:
    39     static Ref<WebAnimation> create(AnimationTimeline*);
    40     ~WebAnimation();
    41 
    42     AnimationTimeline* timeline() const { return m_timeline.get(); }
    43     String description();
     41    double bindingsDuration() const { return m_duration.value(); }
     42    void setBindingsDuration(double duration) { m_duration = Seconds(duration); }
     43    Seconds duration() const { return m_duration; }
     44    void setDuration(Seconds& duration) { m_duration = duration; }
    4445
    4546private:
    46     WebAnimation(AnimationTimeline*);
    47     RefPtr<AnimationTimeline> m_timeline;
     47    AnimationEffectTiming();
     48    Seconds m_duration;
    4849};
    4950
  • trunk/Source/WebCore/animation/AnimationEffectTiming.idl

    r223882 r223883  
    2626[
    2727    EnabledAtRuntime=WebAnimations,
    28     InterfaceName=Animation,
    29     ImplementationLacksVTable,
    30     Constructor(optional AnimationTimeline? timeline)
    31 ] interface WebAnimation {
    32     readonly attribute AnimationTimeline? timeline;
     28    ImplementationLacksVTable
     29] interface AnimationEffectTiming {
     30    [ImplementedAs=bindingsDuration] attribute unrestricted double duration;
    3331};
  • trunk/Source/WebCore/animation/KeyframeEffect.cpp

    r223882 r223883  
    2424 */
    2525
    26 [
    27     EnabledAtRuntime=WebAnimations,
    28     InterfaceName=Animation,
    29     ImplementationLacksVTable,
    30     Constructor(optional AnimationTimeline? timeline)
    31 ] interface WebAnimation {
    32     readonly attribute AnimationTimeline? timeline;
    33 };
     26#include "config.h"
     27#include "KeyframeEffect.h"
     28
     29#include "Element.h"
     30
     31namespace WebCore {
     32
     33Ref<KeyframeEffect> KeyframeEffect::create(Element* target)
     34{
     35    return adoptRef(*new KeyframeEffect(target));
     36}
     37
     38KeyframeEffect::KeyframeEffect(Element* target)
     39    : AnimationEffect(KeyframeEffectClass)
     40    , m_target(target)
     41{
     42}
     43
     44} // namespace WebCore
  • trunk/Source/WebCore/animation/KeyframeEffect.h

    r223882 r223883  
    2626#pragma once
    2727
    28 #include <wtf/Forward.h>
     28#include "AnimationEffect.h"
    2929#include <wtf/Ref.h>
    30 #include <wtf/RefCounted.h>
    31 #include <wtf/RefPtr.h>
    3230
    3331namespace WebCore {
    3432
    35 class AnimationTimeline;
     33class Element;
    3634
    37 class WebAnimation final : public RefCounted<WebAnimation> {
     35class KeyframeEffect final : public AnimationEffect {
    3836public:
    39     static Ref<WebAnimation> create(AnimationTimeline*);
    40     ~WebAnimation();
     37    static Ref<KeyframeEffect> create(Element*);
     38    ~KeyframeEffect() { }
    4139
    42     AnimationTimeline* timeline() const { return m_timeline.get(); }
    43     String description();
     40    Element* target() const { return m_target.get(); }
    4441
    4542private:
    46     WebAnimation(AnimationTimeline*);
    47     RefPtr<AnimationTimeline> m_timeline;
     43    KeyframeEffect(Element*);
     44    RefPtr<Element> m_target;
     45
    4846};
    4947
    5048} // namespace WebCore
     49
     50SPECIALIZE_TYPE_TRAITS_ANIMATION_EFFECT(KeyframeEffect, isKeyframeEffect());
  • trunk/Source/WebCore/animation/KeyframeEffect.idl

    r223882 r223883  
    2626[
    2727    EnabledAtRuntime=WebAnimations,
    28     InterfaceName=Animation,
    29     ImplementationLacksVTable,
    30     Constructor(optional AnimationTimeline? timeline)
    31 ] interface WebAnimation {
    32     readonly attribute AnimationTimeline? timeline;
     28    Constructor(Element? target)
     29] interface KeyframeEffect : AnimationEffect {
     30    readonly attribute Element? target;
    3331};
  • trunk/Source/WebCore/animation/WebAnimation.cpp

    r223825 r223883  
    2626#include "config.h"
    2727#include "WebAnimation.h"
     28
     29#include "AnimationEffect.h"
     30#include "AnimationTimeline.h"
    2831#include <wtf/text/WTFString.h>
    29 
    30 #include "AnimationTimeline.h"
    3132
    3233namespace WebCore {
     
    5354}
    5455
     56void WebAnimation::setEffect(RefPtr<AnimationEffect>&& effect)
     57{
     58    m_effect = WTFMove(effect);
     59}
     60
     61std::optional<double> WebAnimation::bindingsStartTime() const
     62{
     63    if (m_startTime)
     64        return m_startTime->secondsSinceEpoch().value();
     65    return std::nullopt;
     66}
     67
     68void WebAnimation::setBindingsStartTime(std::optional<double> startTime)
     69{
     70    if (startTime == std::nullopt)
     71        m_startTime = std::nullopt;
     72    else
     73        m_startTime = MonotonicTime::fromRawSeconds(startTime.value());
     74}
     75
    5576String WebAnimation::description()
    5677{
  • trunk/Source/WebCore/animation/WebAnimation.h

    r223825 r223883  
    2727
    2828#include <wtf/Forward.h>
     29#include <wtf/MonotonicTime.h>
     30#include <wtf/Optional.h>
    2931#include <wtf/Ref.h>
    3032#include <wtf/RefCounted.h>
     
    3335namespace WebCore {
    3436
     37class AnimationEffect;
    3538class AnimationTimeline;
    3639
     
    4043    ~WebAnimation();
    4144
     45    AnimationEffect* effect() const { return m_effect.get(); }
     46    void setEffect(RefPtr<AnimationEffect>&&);
    4247    AnimationTimeline* timeline() const { return m_timeline.get(); }
     48    std::optional<double> bindingsStartTime() const;
     49    void setBindingsStartTime(std::optional<double>);
     50    std::optional<MonotonicTime> startTime() const { return m_startTime; }
     51    void setStartTime(MonotonicTime& startTime) { m_startTime = startTime; }
     52
    4353    String description();
    4454
    4555private:
    4656    WebAnimation(AnimationTimeline*);
     57    RefPtr<AnimationEffect> m_effect;
    4758    RefPtr<AnimationTimeline> m_timeline;
     59    std::optional<MonotonicTime> m_startTime;
    4860};
    4961
  • trunk/Source/WebCore/animation/WebAnimation.idl

    r223779 r223883  
    3030    Constructor(optional AnimationTimeline? timeline)
    3131] interface WebAnimation {
     32    attribute AnimationEffect? effect;
    3233    readonly attribute AnimationTimeline? timeline;
     34    [ImplementedAs=bindingsStartTime] attribute double? startTime;
    3335};
  • trunk/Source/WebCore/bindings/js/JSAnimationEffectCustom.cpp

    r223882 r223883  
    2525
    2626#include "config.h"
    27 #include "WebAnimation.h"
    28 #include <wtf/text/WTFString.h>
     27#include "JSAnimationEffect.h"
    2928
    30 #include "AnimationTimeline.h"
     29#include "JSDOMBinding.h"
     30#include "JSKeyframeEffect.h"
     31#include "KeyframeEffect.h"
     32
     33using namespace JSC;
    3134
    3235namespace WebCore {
    3336
    34 Ref<WebAnimation> WebAnimation::create(AnimationTimeline* timeline)
     37JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<AnimationEffect>&& value)
    3538{
    36     auto result = adoptRef(*new WebAnimation(timeline));
    37 
    38     if (timeline)
    39         timeline->addAnimation(result.copyRef());
    40    
    41     return result;
     39    if (value->isKeyframeEffect())
     40        return createWrapper<KeyframeEffect>(globalObject, WTFMove(value));
     41    return createWrapper<AnimationEffect>(globalObject, WTFMove(value));
    4242}
    4343
    44 WebAnimation::WebAnimation(AnimationTimeline* timeline)
    45     : m_timeline(timeline)
     44JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, AnimationEffect& value)
    4645{
    47 }
    48 
    49 WebAnimation::~WebAnimation()
    50 {
    51     if (m_timeline)
    52         m_timeline->removeAnimation(*this);
    53 }
    54 
    55 String WebAnimation::description()
    56 {
    57     return "Animation";
     46    return wrap(state, globalObject, value);
    5847}
    5948
  • trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h

    r223779 r223883  
    3333#define WEBCORE_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(macro) \
    3434    macro(Animation) \
     35    macro(AnimationEffect) \
     36    macro(AnimationEffectTiming) \
    3537    macro(AnimationTimeline) \
    3638    macro(ApplePaySession) \
     
    7678    macro(IntersectionObserver) \
    7779    macro(IntersectionObserverEntry) \
     80    macro(KeyframeEffect) \
    7881    macro(MediaEncryptedEvent) \
    7982    macro(MediaKeyMessageEvent) \
Note: See TracChangeset for help on using the changeset viewer.