WebKit Bugzilla
Attachment 350142 Details for
Bug 189762
: [Web Animations] Provide a way to query accelerated animations for internal testing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189762-20180919213722.patch (text/plain), 9.83 KB, created by
Antoine Quint
on 2018-09-19 12:37:24 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Antoine Quint
Created:
2018-09-19 12:37:24 PDT
Size:
9.83 KB
patch
obsolete
>Subversion Revision: 236162 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index a54aa17bf287fe7ac5d6e69d503d77d4a658e452..b5521c9e8f7bc842bde85082cd438b6cd4f03522 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,27 @@ >+2018-09-19 Antoine Quint <graouts@apple.com> >+ >+ [Web Animations] Provide a way to query accelerated animations for internal testing >+ https://bugs.webkit.org/show_bug.cgi?id=189762 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Expose a new internals.acceleratedAnimationsForElement(element) method to allow layout tests to query the current list >+ of accelerated animations for a given element. Currently only the animated property and animation speed are exposed, which >+ will allow us to identify missing, running and paused accelerated animations. >+ >+ * animation/DocumentTimeline.cpp: >+ (WebCore::DocumentTimeline::acceleratedAnimationsForElement const): >+ * animation/DocumentTimeline.h: >+ * platform/graphics/GraphicsLayer.h: >+ (WebCore::GraphicsLayer::acceleratedAnimationsForTesting const): >+ * platform/graphics/ca/GraphicsLayerCA.cpp: >+ (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): >+ * platform/graphics/ca/GraphicsLayerCA.h: >+ * testing/Internals.cpp: >+ (WebCore::Internals::acceleratedAnimationsForElement): >+ * testing/Internals.h: >+ * testing/Internals.idl: >+ > 2018-09-18 Basuke Suzuki <Basuke.Suzuki@sony.com> > > [Curl] Limit capturing extra metrics for Web Inspector when not required. >diff --git a/Source/WebCore/animation/DocumentTimeline.cpp b/Source/WebCore/animation/DocumentTimeline.cpp >index a386c18c177d5df98a856e3246524559791eedc4..772b491038916f3ab44f1cde2449c46d532b9aaa 100644 >--- a/Source/WebCore/animation/DocumentTimeline.cpp >+++ b/Source/WebCore/animation/DocumentTimeline.cpp >@@ -31,10 +31,13 @@ > #include "DOMWindow.h" > #include "DeclarativeAnimation.h" > #include "Document.h" >+#include "GraphicsLayer.h" > #include "KeyframeEffect.h" > #include "Microtasks.h" > #include "Page.h" > #include "RenderElement.h" >+#include "RenderLayer.h" >+#include "RenderLayerBacking.h" > > static const Seconds defaultAnimationInterval { 15_ms }; > static const Seconds throttledAnimationInterval { 30_ms }; >@@ -485,4 +488,15 @@ void DocumentTimeline::performEventDispatchTask() > pendingEvent->target()->dispatchEvent(pendingEvent); > } > >+Vector<std::pair<String, double>> DocumentTimeline::acceleratedAnimationsForElement(Element& element) const >+{ >+ auto* renderer = element.renderer(); >+ if (renderer && renderer->isComposited()) { >+ auto* compositedRenderer = downcast<RenderBoxModelObject>(renderer); >+ if (auto* graphicsLayer = compositedRenderer->layer()->backing()->graphicsLayer()) >+ return graphicsLayer->acceleratedAnimationsForTesting(); >+ } >+ return { }; >+} >+ > } // namespace WebCore >diff --git a/Source/WebCore/animation/DocumentTimeline.h b/Source/WebCore/animation/DocumentTimeline.h >index d267d4f6cca954213f67e064969688d0297a5817..9e336f2d6dc572920a964a66db587c3725233638 100644 >--- a/Source/WebCore/animation/DocumentTimeline.h >+++ b/Source/WebCore/animation/DocumentTimeline.h >@@ -75,6 +75,7 @@ public: > WEBCORE_EXPORT void resumeAnimations(); > WEBCORE_EXPORT bool animationsAreSuspended(); > WEBCORE_EXPORT unsigned numberOfActiveAnimationsForTesting() const; >+ WEBCORE_EXPORT Vector<std::pair<String, double>> acceleratedAnimationsForElement(Element&) const; > > private: > DocumentTimeline(Document&, Seconds); >diff --git a/Source/WebCore/platform/graphics/GraphicsLayer.h b/Source/WebCore/platform/graphics/GraphicsLayer.h >index bb4fbae6d67001040d2856f59b9ca4c4e6730034..bdd0f864c949f4b3fb25656e8a0e2f27b177478d 100644 >--- a/Source/WebCore/platform/graphics/GraphicsLayer.h >+++ b/Source/WebCore/platform/graphics/GraphicsLayer.h >@@ -461,6 +461,8 @@ public: > WEBCORE_EXPORT virtual void suspendAnimations(MonotonicTime); > WEBCORE_EXPORT virtual void resumeAnimations(); > >+ virtual Vector<std::pair<String, double>> acceleratedAnimationsForTesting() const { return { }; } >+ > // Layer contents > virtual void setContentsToImage(Image*) { } > virtual bool shouldDirectlyCompositeImage(Image*) const { return true; } >diff --git a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp >index b0bc6baeae0cd14eaf4b8ddd7805bb26a3211797..b239e7541ec497dea71d3b079059d3cefaa65bd0 100644 >--- a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp >+++ b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp >@@ -4216,6 +4216,44 @@ double GraphicsLayerCA::backingStoreMemoryEstimate() const > return m_layer->backingStoreBytesPerPixel() * size().width() * m_layer->contentsScale() * size().height() * m_layer->contentsScale(); > } > >+static String animatedPropertyIDAsString(AnimatedPropertyID property) >+{ >+ switch (property) { >+ case AnimatedPropertyInvalid: >+ return "invalid"; >+ case AnimatedPropertyTransform: >+ return "transform"; >+ case AnimatedPropertyOpacity: >+ return "opacity"; >+ case AnimatedPropertyBackgroundColor: >+ return "background-color"; >+ case AnimatedPropertyFilter: >+ return "filter"; >+#if ENABLE(FILTERS_LEVEL_2) >+ case AnimatedPropertyWebkitBackdropFilter: >+ return "backdrop-filter"; >+#endif >+ } >+} >+ >+Vector<std::pair<String, double>> GraphicsLayerCA::acceleratedAnimationsForTesting() const >+{ >+ Vector<std::pair<String, double>> animations; >+ >+ if (hasAnimations()) { >+ for (auto it : m_animations->runningAnimations) { >+ const auto& propertyAnimations = it.value; >+ size_t numAnimations = propertyAnimations.size(); >+ for (size_t i = 0; i < numAnimations; ++i) { >+ const LayerPropertyAnimation& currAnimation = propertyAnimations[i]; >+ animations.append({ animatedPropertyIDAsString(currAnimation.m_property), currAnimation.m_animation->speed() }); >+ } >+ } >+ } >+ >+ return animations; >+} >+ > } // namespace WebCore > > #endif >diff --git a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h >index a9a365a73ef3c57f20747ed2fe574a232bee49cc..6df2176f7f6b1a6f928987f6b78ec4c74f637d13 100644 >--- a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h >+++ b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h >@@ -171,6 +171,8 @@ public: > > WEBCORE_EXPORT TiledBacking* tiledBacking() const override; > >+ WEBCORE_EXPORT Vector<std::pair<String, double>> acceleratedAnimationsForTesting() const override; >+ > protected: > WEBCORE_EXPORT void setOpacityInternal(float) override; > >diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp >index da18f6a21a759be2afd32aae82e0cea03c2eb77d..56b5e258479adfdb740202a72549b1e379b4c159 100644 >--- a/Source/WebCore/testing/Internals.cpp >+++ b/Source/WebCore/testing/Internals.cpp >@@ -1065,6 +1065,17 @@ ExceptionOr<bool> Internals::pauseTransitionAtTimeOnPseudoElement(const String& > return frame()->animation().pauseTransitionAtTime(*pseudoElement, property, pauseTime); > } > >+Vector<Internals::AcceleratedAnimation> Internals::acceleratedAnimationsForElement(Element& element) >+{ >+ if (!RuntimeEnabledFeatures::sharedFeatures().webAnimationsCSSIntegrationEnabled()) >+ return { }; >+ >+ Vector<Internals::AcceleratedAnimation> animations; >+ for (auto animationAsPair : element.document().timeline().acceleratedAnimationsForElement(element)) >+ animations.append({ animationAsPair.first, animationAsPair.second }); >+ return animations; >+} >+ > ExceptionOr<RefPtr<Element>> Internals::pseudoElement(Element& element, const String& pseudoId) > { > if (pseudoId != "before" && pseudoId != "after") >diff --git a/Source/WebCore/testing/Internals.h b/Source/WebCore/testing/Internals.h >index 68b79c77f0f68ce9a72a840b7fef7407b5e3c2ae..4407d1e6f258cb8bdd7adb981520bd51e6e8c870 100644 >--- a/Source/WebCore/testing/Internals.h >+++ b/Source/WebCore/testing/Internals.h >@@ -200,6 +200,13 @@ public: > ExceptionOr<bool> pauseTransitionAtTimeOnElement(const String& propertyName, double pauseTime, Element&); > ExceptionOr<bool> pauseTransitionAtTimeOnPseudoElement(const String& property, double pauseTime, Element&, const String& pseudoId); > >+ // Web Animations testing. >+ struct AcceleratedAnimation { >+ String property; >+ double speed; >+ }; >+ Vector<AcceleratedAnimation> acceleratedAnimationsForElement(Element&); >+ > // For animations testing, we need a way to get at pseudo elements. > ExceptionOr<RefPtr<Element>> pseudoElement(Element&, const String&); > >diff --git a/Source/WebCore/testing/Internals.idl b/Source/WebCore/testing/Internals.idl >index a7e375543b6c9b76c68520ec7d66cdab1f1cd990..55fabf415f959b933607e3e795b62d0c7b5071e4 100644 >--- a/Source/WebCore/testing/Internals.idl >+++ b/Source/WebCore/testing/Internals.idl >@@ -135,6 +135,14 @@ enum CompositingPolicy { > sequence<unsigned short> constraintFlags; > }; > >+[ >+ ExportMacro=WEBCORE_TESTSUPPORT_EXPORT, >+ JSGenerateToJSObject, >+] dictionary AcceleratedAnimation { >+ DOMString property; >+ double speed; >+}; >+ > [ > ExportMacro=WEBCORE_TESTSUPPORT_EXPORT, > NoInterfaceObject, >@@ -201,6 +209,9 @@ enum CompositingPolicy { > [MayThrowException] boolean pauseTransitionAtTimeOnElement(DOMString propertyName, unrestricted double pauseTime, Element element); > [MayThrowException] boolean pauseTransitionAtTimeOnPseudoElement(DOMString property, unrestricted double pauseTime, Element element, DOMString pseudoId); > >+ // Web Animations testing. >+ sequence<AcceleratedAnimation> acceleratedAnimationsForElement(Element element); >+ > // For animations testing, we need a way to get at pseudo elements. > [MayThrowException] Element? pseudoElement(Element element, DOMString pseudoId); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
dino
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189762
: 350142