Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (255148 => 255149)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-01-27 16:31:55 UTC (rev 255148)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-01-27 16:51:08 UTC (rev 255149)
@@ -1,3 +1,16 @@
+2020-01-27 Antoine Quint <[email protected]>
+
+ [Web Animations] Add support for the options parameter to getAnimations()
+ https://bugs.webkit.org/show_bug.cgi?id=202191
+ <rdar://problem/55697751>
+
+ Reviewed by Antti Koivisto.
+
+ Mark some WPT progressions. In the CSS Animations case, we are returning the expected animations but not quite sorted as expected.
+
+ * web-platform-tests/css/css-animations/Element-getAnimations.tentative-expected.txt:
+ * web-platform-tests/web-animations/interfaces/Animatable/getAnimations-expected.txt:
+
2020-01-26 Antoine Quint <[email protected]>
[Web Animations] Update all DocumentTimeline objects when updating animations
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/Element-getAnimations.tentative-expected.txt (255148 => 255149)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/Element-getAnimations.tentative-expected.txt 2020-01-27 16:31:55 UTC (rev 255148)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-animations/Element-getAnimations.tentative-expected.txt 2020-01-27 16:51:08 UTC (rev 255149)
@@ -17,8 +17,8 @@
PASS getAnimations for CSS Animations that are canceled
PASS getAnimations for CSS Animations follows animation-name order
PASS { subtree: false } on a leaf element returns the element's animations and ignore pseudo-elements
-FAIL { subtree: true } on a leaf element returns the element's animations and its pseudo-elements' animations assert_equals: getAnimations({ subtree: true }) should return animations on pseudo-elements expected 3 but got 1
+FAIL { subtree: true } on a leaf element returns the element's animations and its pseudo-elements' animations assert_equals: The animation targeting the ::before pseudo-element should be returned second expected (string) "::before" but got (undefined) undefined
PASS { subtree: false } on an element with a child returns only the element's animations
-FAIL { subtree: true } on an element with a child returns animations from the element, its pseudo-elements, its child and its child pseudo-elements assert_equals: Should find all elements, pesudo-elements that parent has expected 6 but got 1
-FAIL { subtree: true } on an element with many descendants returns animations from all the descendants assert_equals: Should find all descendants of the element expected 5 but got 1
+FAIL { subtree: true } on an element with a child returns animations from the element, its pseudo-elements, its child and its child pseudo-elements assert_equals: The animation targeting the ::before pseudo-element should be returned second expected (string) "::before" but got (undefined) undefined
+FAIL { subtree: true } on an element with many descendants returns animations from all the descendants assert_equals: The animation targeting the child1 element should be returned second expected Element node <div id="child1" style="animation: anim1 100s;"><div id="... but got Element node <div id="grandchild1" style="animation: anim1 100s;"></div>
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animatable/getAnimations-expected.txt (255148 => 255149)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animatable/getAnimations-expected.txt 2020-01-27 16:31:55 UTC (rev 255148)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animatable/getAnimations-expected.txt 2020-01-27 16:51:08 UTC (rev 255149)
@@ -3,9 +3,9 @@
PASS Returns both animations for an element with two animations
PASS Returns only the animations specific to each sibling element
PASS Returns only the animations specific to each parent/child element
-FAIL Returns animations on descendants when subtree: true is specified assert_array_equals: Returns expected animations from parent lengths differ, expected 3 got 0
-FAIL Returns animations on pseudo-elements when subtree: true is specified assert_equals: Returns one animation when subtree is true expected 1 but got 0
-FAIL Does NOT cross shadow-tree boundaries when subtree: true is specified assert_equals: Returns one animation when called on a parent in the shadow tree expected 1 but got 0
+PASS Returns animations on descendants when subtree: true is specified
+PASS Returns animations on pseudo-elements when subtree: true is specified
+PASS Does NOT cross shadow-tree boundaries when subtree: true is specified
PASS Returns animations for a foreign element
PASS Does not return finished animations that do not fill forwards
PASS Returns finished animations that fill forwards
Modified: trunk/Source/WebCore/CMakeLists.txt (255148 => 255149)
--- trunk/Source/WebCore/CMakeLists.txt 2020-01-27 16:31:55 UTC (rev 255148)
+++ trunk/Source/WebCore/CMakeLists.txt 2020-01-27 16:51:08 UTC (rev 255149)
@@ -589,6 +589,7 @@
animation/DocumentTimeline.idl
animation/DocumentTimelineOptions.idl
animation/FillMode.idl
+ animation/GetAnimationsOptions.idl
animation/IterationCompositeOperation.idl
animation/KeyframeAnimationOptions.idl
animation/KeyframeEffect.idl
Modified: trunk/Source/WebCore/ChangeLog (255148 => 255149)
--- trunk/Source/WebCore/ChangeLog 2020-01-27 16:31:55 UTC (rev 255148)
+++ trunk/Source/WebCore/ChangeLog 2020-01-27 16:51:08 UTC (rev 255149)
@@ -1,3 +1,30 @@
+2020-01-27 Antoine Quint <[email protected]>
+
+ [Web Animations] Add support for the options parameter to getAnimations()
+ https://bugs.webkit.org/show_bug.cgi?id=202191
+ <rdar://problem/55697751>
+
+ Reviewed by Antti Koivisto.
+
+ Add support for the GetAnimationsOptions dictionary as a parameter to Animatable.getAnimations(). When it is provided
+ and has its sole "subtree" property set to "true", we call Document.getAnimations() and filter out animations that are
+ not targeting elements that are either this element, one of its descendants, one of its pseudo-elements or one of its
+ descendants' pseudo-elements.
+
+ * CMakeLists.txt:
+ * DerivedSources-input.xcfilelist:
+ * DerivedSources-output.xcfilelist:
+ * DerivedSources.make:
+ * Headers.cmake:
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * animation/Animatable.idl:
+ * animation/GetAnimationsOptions.h: Added.
+ * animation/GetAnimationsOptions.idl: Added.
+ * dom/Element.cpp:
+ (WebCore::Element::getAnimations):
+ * dom/Element.h:
+
2020-01-27 Jonathan Bedard <[email protected]>
WebCore: Remove iOS 11 macros from NetworkStorageSessionCocoa.mm
Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (255148 => 255149)
--- trunk/Source/WebCore/DerivedSources-input.xcfilelist 2020-01-27 16:31:55 UTC (rev 255148)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist 2020-01-27 16:51:08 UTC (rev 255149)
@@ -446,6 +446,7 @@
$(PROJECT_DIR)/animation/DocumentTimelineOptions.idl
$(PROJECT_DIR)/animation/EffectTiming.idl
$(PROJECT_DIR)/animation/FillMode.idl
+$(PROJECT_DIR)/animation/GetAnimationsOptions.idl
$(PROJECT_DIR)/animation/IterationCompositeOperation.idl
$(PROJECT_DIR)/animation/KeyframeAnimationOptions.idl
$(PROJECT_DIR)/animation/KeyframeEffect.idl
Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (255148 => 255149)
--- trunk/Source/WebCore/DerivedSources-output.xcfilelist 2020-01-27 16:31:55 UTC (rev 255148)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist 2020-01-27 16:51:08 UTC (rev 255149)
@@ -689,6 +689,8 @@
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGeoposition.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGestureEvent.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGestureEvent.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGetAnimationsOptions.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGetAnimationsOptions.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGlobalCrypto.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGlobalCrypto.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGlobalEventHandlers.cpp
Modified: trunk/Source/WebCore/DerivedSources.make (255148 => 255149)
--- trunk/Source/WebCore/DerivedSources.make 2020-01-27 16:31:55 UTC (rev 255148)
+++ trunk/Source/WebCore/DerivedSources.make 2020-01-27 16:51:08 UTC (rev 255149)
@@ -491,6 +491,7 @@
$(WebCore)/animation/DocumentTimelineOptions.idl \
$(WebCore)/animation/EffectTiming.idl \
$(WebCore)/animation/FillMode.idl \
+ $(WebCore)/animation/GetAnimationsOptions.idl \
$(WebCore)/animation/IterationCompositeOperation.idl \
$(WebCore)/animation/KeyframeAnimationOptions.idl \
$(WebCore)/animation/KeyframeEffect.idl \
Modified: trunk/Source/WebCore/Headers.cmake (255148 => 255149)
--- trunk/Source/WebCore/Headers.cmake 2020-01-27 16:31:55 UTC (rev 255148)
+++ trunk/Source/WebCore/Headers.cmake 2020-01-27 16:51:08 UTC (rev 255149)
@@ -178,6 +178,7 @@
animation/CompositeOperation.h
animation/EffectTiming.h
animation/FillMode.h
+ animation/GetAnimationsOptions.h
animation/IterationCompositeOperation.h
animation/KeyframeAnimationOptions.h
animation/KeyframeEffectOptions.h
Modified: trunk/Source/WebCore/Sources.txt (255148 => 255149)
--- trunk/Source/WebCore/Sources.txt 2020-01-27 16:31:55 UTC (rev 255148)
+++ trunk/Source/WebCore/Sources.txt 2020-01-27 16:51:08 UTC (rev 255149)
@@ -2891,6 +2891,7 @@
JSFocusEvent.cpp
JSFontFace.cpp
JSFontFaceSet.cpp
+JSGetAnimationsOptions.cpp
JSGPUCanvasContext.cpp
JSGPUColor.cpp
JSGPUColorStateDescriptor.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (255148 => 255149)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-01-27 16:31:55 UTC (rev 255148)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-01-27 16:51:08 UTC (rev 255149)
@@ -2111,6 +2111,8 @@
713171341FBE78DB00F758DE /* CSSPropertyBlendingClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 713171321FBE78C500F758DE /* CSSPropertyBlendingClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
7132445120109DA500AE7FB2 /* WebAnimationUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 7132444F20109D9B00AE7FB2 /* WebAnimationUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
7134496E146941B300720312 /* SVGLengthContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 7134496C146941B300720312 /* SVGLengthContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 713F1D5A23DF1D8D003F5EFA /* GetAnimationsOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 713F1D5923DF1D7D003F5EFA /* GetAnimationsOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 713F1D5D23DF2582003F5EFA /* JSGetAnimationsOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 713F1D5B23DF2560003F5EFA /* JSGetAnimationsOptions.h */; };
71495DDB202B06F100ADFD34 /* JSEffectTiming.h in Headers */ = {isa = PBXBuildFile; fileRef = 71495DDA202B06DE00ADFD34 /* JSEffectTiming.h */; settings = {ATTRIBUTES = (Private, ); }; };
714C7C661FDAD2A100F2BEE1 /* AnimationPlaybackEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 714C7C651FDAD27B00F2BEE1 /* AnimationPlaybackEvent.h */; settings = {ATTRIBUTES = (Private, ); }; };
714C7C671FDAD2A900F2BEE1 /* AnimationPlaybackEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 714C7C621FDAD27A00F2BEE1 /* AnimationPlaybackEventInit.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -9502,6 +9504,10 @@
7134496B146941B300720312 /* SVGLengthContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLengthContext.cpp; sourceTree = "<group>"; };
7134496C146941B300720312 /* SVGLengthContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLengthContext.h; sourceTree = "<group>"; };
713E70AF1733E8B300A22D00 /* plugIns.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode._javascript_; path = plugIns.js; sourceTree = "<group>"; };
+ 713F1D5723DF1D7D003F5EFA /* GetAnimationsOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = GetAnimationsOptions.idl; sourceTree = "<group>"; };
+ 713F1D5923DF1D7D003F5EFA /* GetAnimationsOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetAnimationsOptions.h; sourceTree = "<group>"; };
+ 713F1D5B23DF2560003F5EFA /* JSGetAnimationsOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGetAnimationsOptions.h; sourceTree = "<group>"; };
+ 713F1D5C23DF2560003F5EFA /* JSGetAnimationsOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGetAnimationsOptions.cpp; sourceTree = "<group>"; };
714131471DC9D6AF00336107 /* fullscreen-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode._javascript_; path = "fullscreen-support.js"; sourceTree = "<group>"; };
714131481DC9D6EF00336107 /* js-files */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "js-files"; sourceTree = "<group>"; };
7146DF8B1DEFC2ED0046F98B /* tracks-panel.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = "tracks-panel.css"; sourceTree = "<group>"; };
@@ -16890,6 +16896,8 @@
71495DDA202B06DE00ADFD34 /* JSEffectTiming.h */,
712BE4841FE867C2002031CC /* JSFillMode.cpp */,
712BE4851FE86818002031CC /* JSFillMode.h */,
+ 713F1D5C23DF2560003F5EFA /* JSGetAnimationsOptions.cpp */,
+ 713F1D5B23DF2560003F5EFA /* JSGetAnimationsOptions.h */,
71247E281FEA5F61008C08CE /* JSIterationCompositeOperation.cpp */,
71247E2C1FEA5F64008C08CE /* JSIterationCompositeOperation.h */,
71247E291FEA5F62008C08CE /* JSKeyframeAnimationOptions.cpp */,
@@ -21084,6 +21092,8 @@
712BE47A1FE86447002031CC /* EffectTiming.idl */,
712BE4811FE865D4002031CC /* FillMode.h */,
712BE4821FE865D5002031CC /* FillMode.idl */,
+ 713F1D5923DF1D7D003F5EFA /* GetAnimationsOptions.h */,
+ 713F1D5723DF1D7D003F5EFA /* GetAnimationsOptions.idl */,
71247E331FEA5F80008C08CE /* IterationCompositeOperation.h */,
71247E311FEA5F7E008C08CE /* IterationCompositeOperation.idl */,
71247E2F1FEA5F7D008C08CE /* KeyframeAnimationOptions.h */,
@@ -30122,6 +30132,7 @@
9746AF2E14F4DDE6003E7A70 /* GeolocationPositionError.h in Headers */,
0FB6252F18DE1B1500A07C05 /* GeometryUtilities.h in Headers */,
46C83EFE1A9BBE2900A79A41 /* GeoNotifier.h in Headers */,
+ 713F1D5A23DF1D8D003F5EFA /* GetAnimationsOptions.h in Headers */,
46B95198207D634700A7D2DD /* GlobalFrameIdentifier.h in Headers */,
46B95197207D634000A7D2DD /* GlobalWindowIdentifier.h in Headers */,
086BBD0F136039C2008B15D8 /* Glyph.h in Headers */,
@@ -30808,6 +30819,7 @@
FE80DA640E9C4703000D6F75 /* JSGeolocation.h in Headers */,
FE80DA660E9C4703000D6F75 /* JSGeoposition.h in Headers */,
0FDA7C1F188322FC00C954B5 /* JSGestureEvent.h in Headers */,
+ 713F1D5D23DF2582003F5EFA /* JSGetAnimationsOptions.h in Headers */,
8482B7521198CB6B00BFB005 /* JSHashChangeEvent.h in Headers */,
BC94D14F0C275C68006BC617 /* JSHistory.h in Headers */,
57957CB71E972C78008072AB /* JSHkdfParams.h in Headers */,
@@ -30909,7 +30921,6 @@
7C193C011F5E11050088F3E6 /* JSImageSmoothingQuality.h in Headers */,
A86629D309DA2B48009633A6 /* JSInputEvent.h in Headers */,
9175CE5E21E281ED00DF2C28 /* JSInspectorAuditAccessibilityObject.h in Headers */,
- 41B8776223DE1045003638B8 /* RealtimeMediaSourceIdentifier.h in Headers */,
9175CE5C21E281ED00DF2C28 /* JSInspectorAuditDOMObject.h in Headers */,
9109E9C8222CABCA00BB6265 /* JSInspectorAuditResourcesObject.h in Headers */,
7A0E771F10C00DB100A0276E /* JSInspectorFrontendHost.h in Headers */,
@@ -31997,6 +32008,7 @@
4A4F65721AA997F100E38CDD /* RealtimeMediaSourceCapabilities.h in Headers */,
4A0FFAA21AAF5EA20062803B /* RealtimeMediaSourceCenter.h in Headers */,
0754A5EA215EA3B8002D3A99 /* RealtimeMediaSourceFactory.h in Headers */,
+ 41B8776223DE1045003638B8 /* RealtimeMediaSourceIdentifier.h in Headers */,
4A4F65741AA997F100E38CDD /* RealtimeMediaSourceSettings.h in Headers */,
07C1C0E51BFB60ED00BD2256 /* RealtimeMediaSourceSupportedConstraints.h in Headers */,
41103AAC1E39791000769F03 /* RealtimeOutgoingAudioSource.h in Headers */,
Modified: trunk/Source/WebCore/animation/Animatable.idl (255148 => 255149)
--- trunk/Source/WebCore/animation/Animatable.idl 2020-01-27 16:31:55 UTC (rev 255148)
+++ trunk/Source/WebCore/animation/Animatable.idl 2020-01-27 16:51:08 UTC (rev 255149)
@@ -28,5 +28,5 @@
NoInterfaceObject
] interface Animatable {
[MayThrowException, CallWith=GlobalObject] WebAnimation animate(object? keyframes, optional (unrestricted double or KeyframeAnimationOptions) options);
- sequence<WebAnimation> getAnimations();
+ sequence<WebAnimation> getAnimations(optional GetAnimationsOptions options);
};
Copied: trunk/Source/WebCore/animation/GetAnimationsOptions.h (from rev 255148, trunk/Source/WebCore/animation/Animatable.idl) (0 => 255149)
--- trunk/Source/WebCore/animation/GetAnimationsOptions.h (rev 0)
+++ trunk/Source/WebCore/animation/GetAnimationsOptions.h 2020-01-27 16:51:08 UTC (rev 255149)
@@ -0,0 +1,35 @@
+
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+namespace WebCore {
+
+struct GetAnimationsOptions {
+ bool subtree { false };
+};
+
+} // namespace WebCore
Copied: trunk/Source/WebCore/animation/GetAnimationsOptions.idl (from rev 255148, trunk/Source/WebCore/animation/Animatable.idl) (0 => 255149)
--- trunk/Source/WebCore/animation/GetAnimationsOptions.idl (rev 0)
+++ trunk/Source/WebCore/animation/GetAnimationsOptions.idl 2020-01-27 16:51:08 UTC (rev 255149)
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+dictionary GetAnimationsOptions {
+ boolean subtree = false;
+};
Modified: trunk/Source/WebCore/dom/Element.cpp (255148 => 255149)
--- trunk/Source/WebCore/dom/Element.cpp 2020-01-27 16:31:55 UTC (rev 255148)
+++ trunk/Source/WebCore/dom/Element.cpp 2020-01-27 16:51:08 UTC (rev 255149)
@@ -57,6 +57,7 @@
#include "FrameSelection.h"
#include "FrameView.h"
#include "FullscreenManager.h"
+#include "GetAnimationsOptions.h"
#include "HTMLBodyElement.h"
#include "HTMLCanvasElement.h"
#include "HTMLCollection.h"
@@ -4379,9 +4380,26 @@
return animation;
}
-Vector<RefPtr<WebAnimation>> Element::getAnimations()
+Vector<RefPtr<WebAnimation>> Element::getAnimations(Optional<GetAnimationsOptions> options)
{
- // FIXME: Filter and order the list as specified (webkit.org/b/179535).
+ // If we are to return animations in the subtree, we can get all of the document's animations and filter
+ // animations targeting that are not registered on this element, one of its pseudo elements or a child's
+ // pseudo element.
+ if (options && options->subtree) {
+ Vector<RefPtr<WebAnimation>> animations;
+ for (auto& animation : document().getAnimations()) {
+ auto* effect = animation->effect();
+ ASSERT(is<KeyframeEffect>(animation->effect()));
+ auto* target = downcast<KeyframeEffect>(*effect).target();
+ ASSERT(target);
+ if (is<PseudoElement>(target)) {
+ if (contains(downcast<PseudoElement>(*target).hostElement()))
+ animations.append(animation);
+ } else if (contains(target))
+ animations.append(animation);
+ }
+ return animations;
+ }
// For the list of animations to be current, we need to account for any pending CSS changes,
// such as updates to CSS Animations and CSS Transitions.
Modified: trunk/Source/WebCore/dom/Element.h (255148 => 255149)
--- trunk/Source/WebCore/dom/Element.h 2020-01-27 16:31:55 UTC (rev 255148)
+++ trunk/Source/WebCore/dom/Element.h 2020-01-27 16:51:08 UTC (rev 255149)
@@ -57,6 +57,7 @@
class StylePropertyMap;
class WebAnimation;
+struct GetAnimationsOptions;
struct KeyframeAnimationOptions;
struct ScrollIntoViewOptions;
struct ScrollToOptions;
@@ -597,7 +598,7 @@
Element* findAnchorElementForLink(String& outAnchorName);
ExceptionOr<Ref<WebAnimation>> animate(JSC::JSGlobalObject&, JSC::Strong<JSC::JSObject>&&, Optional<Variant<double, KeyframeAnimationOptions>>&&);
- Vector<RefPtr<WebAnimation>> getAnimations();
+ Vector<RefPtr<WebAnimation>> getAnimations(Optional<GetAnimationsOptions>);
ElementIdentifier createElementIdentifier();