Changeset 229327 in webkit


Ignore:
Timestamp:
Mar 6, 2018 10:34:22 AM (6 years ago)
Author:
graouts@webkit.org
Message:

[Web Animations] Add a new CSSAnimation subclass of WebAnimation
https://bugs.webkit.org/show_bug.cgi?id=183371
<rdar://problem/38181724>

Reviewed by Dean Jackson.

Adding a new CSSAnimation subclass which we will create in a later patch while resolving styles
upon identifying that a new CSS Animation has been added to an element.

  • CMakeLists.txt:
  • DerivedSources.make:
  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • animation/CSSAnimation.cpp: Added.

(WebCore::CSSAnimation::create):
(WebCore::CSSAnimation::CSSAnimation):

  • animation/CSSAnimation.h: Added.
  • animation/CSSAnimation.idl: Added.
  • animation/KeyframeEffectReadOnly.cpp
  • animation/WebAnimation.h:

(WebCore::WebAnimation::isCSSAnimation const):

  • animation/WebAnimation.idl:
  • bindings/js/JSWebAnimationCustom.cpp:

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

  • bindings/js/WebCoreBuiltinNames.h:
Location:
trunk/Source/WebCore
Files:
10 edited
3 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r229112 r229327  
    450450    animation/AnimationPlaybackEventInit.idl
    451451    animation/AnimationTimeline.idl
     452    animation/CSSAnimation.idl
    452453    animation/CompositeOperation.idl
    453454    animation/ComputedTimingProperties.idl
  • trunk/Source/WebCore/ChangeLog

    r229323 r229327  
     12018-03-06  Antoine Quint  <graouts@apple.com>
     2
     3        [Web Animations] Add a new CSSAnimation subclass of WebAnimation
     4        https://bugs.webkit.org/show_bug.cgi?id=183371
     5        <rdar://problem/38181724>
     6
     7        Reviewed by Dean Jackson.
     8
     9        Adding a new CSSAnimation subclass which we will create in a later patch while resolving styles
     10        upon identifying that a new CSS Animation has been added to an element.
     11
     12        * CMakeLists.txt:
     13        * DerivedSources.make:
     14        * Sources.txt:
     15        * WebCore.xcodeproj/project.pbxproj:
     16        * animation/CSSAnimation.cpp: Added.
     17        (WebCore::CSSAnimation::create):
     18        (WebCore::CSSAnimation::CSSAnimation):
     19        * animation/CSSAnimation.h: Added.
     20        * animation/CSSAnimation.idl: Added.
     21        * animation/KeyframeEffectReadOnly.cpp
     22        * animation/WebAnimation.h:
     23        (WebCore::WebAnimation::isCSSAnimation const):
     24        * animation/WebAnimation.idl:
     25        * bindings/js/JSWebAnimationCustom.cpp:
     26        (WebCore::toJSNewlyCreated):
     27        (WebCore::toJS):
     28        * bindings/js/WebCoreBuiltinNames.h:
     29
    1302018-03-06  Ms2ger  <Ms2ger@igalia.com>
    231
  • trunk/Source/WebCore/DerivedSources.make

    r229124 r229327  
    372372    $(WebCore)/animation/CompositeOperation.idl \
    373373    $(WebCore)/animation/ComputedTimingProperties.idl \
     374    $(WebCore)/animation/CSSAnimation.idl \
    374375    $(WebCore)/animation/DocumentTimeline.idl \
    375376    $(WebCore)/animation/FillMode.idl \
  • trunk/Source/WebCore/Sources.txt

    r229112 r229327  
    337337animation/AnimationPlaybackEvent.cpp
    338338animation/AnimationTimeline.cpp
     339animation/CSSAnimation.cpp
    339340animation/DocumentTimeline.cpp
    340341animation/KeyframeEffect.cpp
     
    24372438JSCryptoRsaHashedKeyAlgorithm.cpp
    24382439JSCryptoRsaKeyAlgorithm.cpp
     2440JSCSSAnimation.cpp
    24392441JSCustomElementRegistry.cpp
    24402442JSCustomEvent.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r229140 r229327  
    19881988                71A1B6081DEE5AD70073BCFB /* modern-media-controls-localized-strings.js in Resources */ = {isa = PBXBuildFile; fileRef = 71A1B6061DEE5A820073BCFB /* modern-media-controls-localized-strings.js */; };
    19891989                71A57DF2154BE25C0009D120 /* SVGPathUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 71A57DF0154BE25C0009D120 /* SVGPathUtilities.h */; };
     1990                71B28427203CEC4C0036AA5D /* JSCSSAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 71B28426203CEC0D0036AA5D /* JSCSSAnimation.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1991                71C29E32203CE781008F36D2 /* CSSAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = 71C29E30203CE76B008F36D2 /* CSSAnimation.h */; settings = {ATTRIBUTES = (Private, ); }; };
    19901992                71C916081D1483A300ACA47D /* UserInterfaceLayoutDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 71C916071D1483A300ACA47D /* UserInterfaceLayoutDirection.h */; settings = {ATTRIBUTES = (Private, ); }; };
    19911993                71DCB7021568197600862271 /* JSSVGZoomAndPan.h in Headers */ = {isa = PBXBuildFile; fileRef = 71DCB7001568197600862271 /* JSSVGZoomAndPan.h */; };
     
    89798981                71A57DF0154BE25C0009D120 /* SVGPathUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathUtilities.h; sourceTree = "<group>"; };
    89808982                71B0460A1DD3C2EE00EE19CF /* status-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "status-support.js"; sourceTree = "<group>"; };
     8983                71B28424203CEC0B0036AA5D /* JSCSSAnimation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSAnimation.cpp; sourceTree = "<group>"; };
     8984                71B28426203CEC0D0036AA5D /* JSCSSAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCSSAnimation.h; sourceTree = "<group>"; };
     8985                71C29E2E203CE76B008F36D2 /* CSSAnimation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSAnimation.cpp; sourceTree = "<group>"; };
     8986                71C29E30203CE76B008F36D2 /* CSSAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSAnimation.h; sourceTree = "<group>"; };
     8987                71C29E31203CE76C008F36D2 /* CSSAnimation.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CSSAnimation.idl; sourceTree = "<group>"; };
    89818988                71C5BB1B1FB611EA0007A2AE /* Animatable.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Animatable.idl; sourceTree = "<group>"; };
    89828989                71C916071D1483A300ACA47D /* UserInterfaceLayoutDirection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserInterfaceLayoutDirection.h; sourceTree = "<group>"; };
     
    1552715534                                7116E2CD1FED765200C06FDE /* JSComputedTimingProperties.cpp */,
    1552815535                                7116E2CE1FED765200C06FDE /* JSComputedTimingProperties.h */,
     15536                                71B28424203CEC0B0036AA5D /* JSCSSAnimation.cpp */,
     15537                                71B28426203CEC0D0036AA5D /* JSCSSAnimation.h */,
    1552915538                                71025EDB1F99F1A8004A250C /* JSDocumentTimeline.cpp */,
    1553015539                                71025EDC1F99F1A8004A250C /* JSDocumentTimeline.h */,
     
    1919719206                                7116E2CB1FED75D100C06FDE /* ComputedTimingProperties.h */,
    1919819207                                7116E2C91FED75D000C06FDE /* ComputedTimingProperties.idl */,
     19208                                71C29E2E203CE76B008F36D2 /* CSSAnimation.cpp */,
     19209                                71C29E30203CE76B008F36D2 /* CSSAnimation.h */,
     19210                                71C29E31203CE76C008F36D2 /* CSSAnimation.idl */,
    1919919211                                713171321FBE78C500F758DE /* CSSPropertyBlendingClient.h */,
    1920019212                                71025EC41F99F096004A250C /* DocumentTimeline.cpp */,
     
    2710827120                                7C9ACAA81F3CCEB400F3AA09 /* CryptoRsaHashedKeyAlgorithm.h in Headers */,
    2710927121                                7C9ACAA41F3CCE6900F3AA09 /* CryptoRsaKeyAlgorithm.h in Headers */,
     27122                                71C29E32203CE781008F36D2 /* CSSAnimation.h in Headers */,
    2711027123                                316FE1140E6E1DA700BF6088 /* CSSAnimationController.h in Headers */,
    2711127124                                0F15DA8A0F3AAEE70000CE47 /* CSSAnimationControllerPrivate.h in Headers */,
     
    2806728080                                7C9ACAC01F3CF1AF00F3AA09 /* JSCryptoRsaHashedKeyAlgorithm.h in Headers */,
    2806828081                                7C9ACAC21F3CF1AF00F3AA09 /* JSCryptoRsaKeyAlgorithm.h in Headers */,
     28082                                71B28427203CEC4C0036AA5D /* JSCSSAnimation.h in Headers */,
    2806928083                                BC46C1FD0C0DDC8F0020CFC3 /* JSCSSFontFaceRule.h in Headers */,
    2807028084                                BC46C1FF0C0DDC8F0020CFC3 /* JSCSSImportRule.h in Headers */,
  • trunk/Source/WebCore/animation/CSSAnimation.cpp

    r229326 r229327  
    11/*
    2  * Copyright (C) 2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 enum AnimationPlayState {
    27     "idle",
    28     "running",
    29     "paused",
    30     "finished"
    31 };
     26#include "config.h"
     27#include "CSSAnimation.h"
    3228
    33 [
    34     ActiveDOMObject,
    35     EnabledAtRuntime=WebAnimations,
    36     InterfaceName=Animation,
    37     CustomConstructor()
    38 ] interface WebAnimation : EventTarget {
    39     attribute DOMString id;
    40     attribute AnimationEffectReadOnly? effect;
    41     attribute AnimationTimeline? timeline;
    42     [ImplementedAs=bindingsStartTime] attribute double? startTime;
    43     [MayThrowException, ImplementedAs=bindingsCurrentTime] attribute double? currentTime;
    44     attribute double playbackRate;
    45     readonly attribute AnimationPlayState playState;
    46     readonly attribute boolean pending;
    47     attribute EventHandler onfinish;
    48     attribute EventHandler oncancel;
    49     readonly attribute Promise<WebAnimation> ready;
    50     readonly attribute Promise<WebAnimation> finished;
    51     void cancel();
    52     [MayThrowException] void finish();
    53     [MayThrowException] void play();
    54     [MayThrowException] void pause();
    55     [MayThrowException] void reverse();
    56 };
     29#include "Animation.h"
     30#include "Element.h"
     31
     32namespace WebCore {
     33
     34Ref<CSSAnimation> CSSAnimation::create(Element& target, const Animation&)
     35{
     36    auto& document = target.document();
     37
     38    auto result = adoptRef(*new CSSAnimation(document));
     39
     40    return result;
     41}
     42
     43CSSAnimation::CSSAnimation(Document& document)
     44    : WebAnimation(document)
     45{
     46}
     47
     48
     49} // namespace WebCore
  • trunk/Source/WebCore/animation/CSSAnimation.h

    r229326 r229327  
    11/*
    2  * Copyright (C) 2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 enum AnimationPlayState {
    27     "idle",
    28     "running",
    29     "paused",
    30     "finished"
     26#pragma once
     27
     28#include "WebAnimation.h"
     29#include <wtf/Ref.h>
     30
     31namespace WebCore {
     32
     33class Animation;
     34class Element;
     35
     36class CSSAnimation final : public WebAnimation {
     37public:
     38    static Ref<CSSAnimation> create(Element&, const Animation&);
     39    ~CSSAnimation() = default;
     40
     41    bool isCSSAnimation() const override { return true; }
     42    const String& animationName() const { return m_animationName; }
     43
     44private:
     45    CSSAnimation(Document&);
     46
     47    String m_animationName;
     48
    3149};
    3250
    33 [
    34     ActiveDOMObject,
    35     EnabledAtRuntime=WebAnimations,
    36     InterfaceName=Animation,
    37     CustomConstructor()
    38 ] interface WebAnimation : EventTarget {
    39     attribute DOMString id;
    40     attribute AnimationEffectReadOnly? effect;
    41     attribute AnimationTimeline? timeline;
    42     [ImplementedAs=bindingsStartTime] attribute double? startTime;
    43     [MayThrowException, ImplementedAs=bindingsCurrentTime] attribute double? currentTime;
    44     attribute double playbackRate;
    45     readonly attribute AnimationPlayState playState;
    46     readonly attribute boolean pending;
    47     attribute EventHandler onfinish;
    48     attribute EventHandler oncancel;
    49     readonly attribute Promise<WebAnimation> ready;
    50     readonly attribute Promise<WebAnimation> finished;
    51     void cancel();
    52     [MayThrowException] void finish();
    53     [MayThrowException] void play();
    54     [MayThrowException] void pause();
    55     [MayThrowException] void reverse();
    56 };
     51} // namespace WebCore
     52
     53SPECIALIZE_TYPE_TRAITS_WEB_ANIMATION(CSSAnimation, isCSSAnimation())
  • trunk/Source/WebCore/animation/CSSAnimation.idl

    r229326 r229327  
    11/*
    2  * Copyright (C) 2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 enum AnimationPlayState {
    27     "idle",
    28     "running",
    29     "paused",
    30     "finished"
    31 };
     26typedef USVString CSSOMString;
    3227
    3328[
    34     ActiveDOMObject,
    3529    EnabledAtRuntime=WebAnimations,
    36     InterfaceName=Animation,
    37     CustomConstructor()
    38 ] interface WebAnimation : EventTarget {
    39     attribute DOMString id;
    40     attribute AnimationEffectReadOnly? effect;
    41     attribute AnimationTimeline? timeline;
    42     [ImplementedAs=bindingsStartTime] attribute double? startTime;
    43     [MayThrowException, ImplementedAs=bindingsCurrentTime] attribute double? currentTime;
    44     attribute double playbackRate;
    45     readonly attribute AnimationPlayState playState;
    46     readonly attribute boolean pending;
    47     attribute EventHandler onfinish;
    48     attribute EventHandler oncancel;
    49     readonly attribute Promise<WebAnimation> ready;
    50     readonly attribute Promise<WebAnimation> finished;
    51     void cancel();
    52     [MayThrowException] void finish();
    53     [MayThrowException] void play();
    54     [MayThrowException] void pause();
    55     [MayThrowException] void reverse();
     30    Exposed=Window
     31] interface CSSAnimation : WebAnimation {
     32    readonly attribute CSSOMString animationName;
    5633};
  • trunk/Source/WebCore/animation/KeyframeEffectReadOnly.cpp

    r228717 r229327  
    2828
    2929#include "Animation.h"
     30#include "AnimationEffectTimingReadOnly.h"
    3031#include "CSSComputedStyleDeclaration.h"
    3132#include "CSSPropertyAnimation.h"
     
    3435#include "CSSTimingFunctionValue.h"
    3536#include "Element.h"
     37#include "FontCascade.h"
    3638#include "JSCompositeOperation.h"
    3739#include "JSKeyframeEffectReadOnly.h"
     40#include "RenderBoxModelObject.h"
     41#include "RenderElement.h"
    3842#include "RenderStyle.h"
    3943#include "StyleResolver.h"
  • trunk/Source/WebCore/animation/WebAnimation.h

    r229069 r229327  
    11/*
    2  * Copyright (C) 2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4747class RenderStyle;
    4848
    49 class WebAnimation final : public RefCounted<WebAnimation>, public EventTargetWithInlineData, public ActiveDOMObject {
     49class WebAnimation : public RefCounted<WebAnimation>, public EventTargetWithInlineData, public ActiveDOMObject {
    5050public:
    5151    static Ref<WebAnimation> create(Document&, AnimationEffectReadOnly*);
    5252    static Ref<WebAnimation> create(Document&, AnimationEffectReadOnly*, AnimationTimeline*);
    5353    ~WebAnimation();
     54
     55    virtual bool isCSSAnimation() const { return false; }
    5456
    5557    const String& id() const { return m_id; }
     
    109111    using RefCounted::deref;
    110112
    111 private:
     113protected:
    112114    explicit WebAnimation(Document&);
    113115
     116private:
    114117    enum class RespectHoldTime { Yes, No };
    115118    enum class AutoRewind { Yes, No };
     
    164167
    165168} // namespace WebCore
     169
     170#define SPECIALIZE_TYPE_TRAITS_WEB_ANIMATION(ToValueTypeName, predicate) \
     171SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ToValueTypeName) \
     172static bool isType(const WebCore::WebAnimation& value) { return value.predicate; } \
     173SPECIALIZE_TYPE_TRAITS_END()
  • trunk/Source/WebCore/animation/WebAnimation.idl

    r229058 r229327  
    3535    EnabledAtRuntime=WebAnimations,
    3636    InterfaceName=Animation,
    37     CustomConstructor()
     37    CustomConstructor(),
     38    CustomToJSObject
    3839] interface WebAnimation : EventTarget {
    3940    attribute DOMString id;
  • trunk/Source/WebCore/bindings/js/JSWebAnimationCustom.cpp

    r228333 r229327  
    2929#include "JSAnimationEffectReadOnly.h"
    3030#include "JSAnimationTimeline.h"
     31#include "JSCSSAnimation.h"
    3132#include "JSDOMConstructor.h"
    3233
     
    3435
    3536using namespace JSC;
     37
     38JSValue toJSNewlyCreated(ExecState*, JSDOMGlobalObject* globalObject, Ref<WebAnimation>&& value)
     39{
     40    if (value->isCSSAnimation())
     41        return createWrapper<CSSAnimation>(globalObject, WTFMove(value));
     42    return createWrapper<WebAnimation>(globalObject, WTFMove(value));
     43}
     44
     45JSValue toJS(ExecState* state, JSDOMGlobalObject* globalObject, WebAnimation& value)
     46{
     47    return wrap(state, globalObject, value);
     48}
    3649
    3750EncodedJSValue JSC_HOST_CALL constructJSWebAnimation(ExecState& state)
  • trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h

    r228427 r229327  
    5050    macro(Credential) \
    5151    macro(CredentialsContainer) \
     52    macro(CSSAnimation) \
    5253    macro(CustomElementRegistry) \
    5354    macro(DataTransferItem) \
Note: See TracChangeset for help on using the changeset viewer.