Changeset 236247 in webkit
- Timestamp:
- Sep 20, 2018, 12:33:42 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 edited
-
ChangeLog (modified) (1 diff)
-
animation/DocumentTimeline.cpp (modified) (2 diffs)
-
animation/DocumentTimeline.h (modified) (1 diff)
-
platform/graphics/GraphicsLayer.h (modified) (1 diff)
-
platform/graphics/ca/GraphicsLayerCA.cpp (modified) (1 diff)
-
platform/graphics/ca/GraphicsLayerCA.h (modified) (1 diff)
-
testing/Internals.cpp (modified) (1 diff)
-
testing/Internals.h (modified) (1 diff)
-
testing/Internals.idl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r236241 r236247 1 2018-09-20 Antoine Quint <graouts@apple.com> 2 3 [Web Animations] Provide a way to query accelerated animations for internal testing 4 https://bugs.webkit.org/show_bug.cgi?id=189762 5 6 Reviewed by Dean Jackson. 7 8 Expose a new internals.acceleratedAnimationsForElement(element) method to allow layout tests to query the current list 9 of accelerated animations for a given element. Currently only the animated property and animation speed are exposed, which 10 will allow us to identify missing, running and paused accelerated animations. 11 12 * animation/DocumentTimeline.cpp: 13 (WebCore::DocumentTimeline::acceleratedAnimationsForElement const): 14 * animation/DocumentTimeline.h: 15 * platform/graphics/GraphicsLayer.h: 16 (WebCore::GraphicsLayer::acceleratedAnimationsForTesting const): 17 * platform/graphics/ca/GraphicsLayerCA.cpp: 18 (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): 19 * platform/graphics/ca/GraphicsLayerCA.h: 20 * testing/Internals.cpp: 21 (WebCore::Internals::acceleratedAnimationsForElement): 22 * testing/Internals.h: 23 * testing/Internals.idl: 24 1 25 2018-09-19 Ryosuke Niwa <rniwa@webkit.org> 2 26 -
trunk/Source/WebCore/animation/DocumentTimeline.cpp
r234279 r236247 32 32 #include "DeclarativeAnimation.h" 33 33 #include "Document.h" 34 #include "GraphicsLayer.h" 34 35 #include "KeyframeEffect.h" 35 36 #include "Microtasks.h" 36 37 #include "Page.h" 37 38 #include "RenderElement.h" 39 #include "RenderLayer.h" 40 #include "RenderLayerBacking.h" 38 41 39 42 static const Seconds defaultAnimationInterval { 15_ms }; … … 486 489 } 487 490 491 Vector<std::pair<String, double>> DocumentTimeline::acceleratedAnimationsForElement(Element& element) const 492 { 493 auto* renderer = element.renderer(); 494 if (renderer && renderer->isComposited()) { 495 auto* compositedRenderer = downcast<RenderBoxModelObject>(renderer); 496 if (auto* graphicsLayer = compositedRenderer->layer()->backing()->graphicsLayer()) 497 return graphicsLayer->acceleratedAnimationsForTesting(); 498 } 499 return { }; 500 } 501 488 502 } // namespace WebCore -
trunk/Source/WebCore/animation/DocumentTimeline.h
r234250 r236247 76 76 WEBCORE_EXPORT bool animationsAreSuspended(); 77 77 WEBCORE_EXPORT unsigned numberOfActiveAnimationsForTesting() const; 78 WEBCORE_EXPORT Vector<std::pair<String, double>> acceleratedAnimationsForElement(Element&) const; 78 79 79 80 private: -
trunk/Source/WebCore/platform/graphics/GraphicsLayer.h
r236016 r236247 462 462 WEBCORE_EXPORT virtual void resumeAnimations(); 463 463 464 virtual Vector<std::pair<String, double>> acceleratedAnimationsForTesting() const { return { }; } 465 464 466 // Layer contents 465 467 virtual void setContentsToImage(Image*) { } -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
r236016 r236247 4217 4217 } 4218 4218 4219 static String animatedPropertyIDAsString(AnimatedPropertyID property) 4220 { 4221 if (property == AnimatedPropertyTransform) 4222 return "transform"; 4223 if (property == AnimatedPropertyOpacity) 4224 return "opacity"; 4225 if (property == AnimatedPropertyBackgroundColor) 4226 return "background-color"; 4227 if (property == AnimatedPropertyFilter) 4228 return "filter"; 4229 if (property == AnimatedPropertyInvalid) 4230 return "invalid"; 4231 #if ENABLE(FILTERS_LEVEL_2) 4232 if (property == AnimatedPropertyWebkitBackdropFilter) 4233 return "backdrop-filter"; 4234 #endif 4235 return ""; 4236 } 4237 4238 Vector<std::pair<String, double>> GraphicsLayerCA::acceleratedAnimationsForTesting() const 4239 { 4240 Vector<std::pair<String, double>> animations; 4241 4242 if (hasAnimations()) { 4243 for (auto it : m_animations->runningAnimations) { 4244 auto& propertyAnimations = it.value; 4245 size_t numAnimations = propertyAnimations.size(); 4246 for (size_t i = 0; i < numAnimations; ++i) { 4247 const LayerPropertyAnimation& currAnimation = propertyAnimations[i]; 4248 animations.append({ animatedPropertyIDAsString(currAnimation.m_property), currAnimation.m_animation->speed() }); 4249 } 4250 } 4251 } 4252 4253 return animations; 4254 } 4255 4219 4256 } // namespace WebCore 4220 4257 -
trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
r236016 r236247 171 171 172 172 WEBCORE_EXPORT TiledBacking* tiledBacking() const override; 173 174 WEBCORE_EXPORT Vector<std::pair<String, double>> acceleratedAnimationsForTesting() const final; 173 175 174 176 protected: -
trunk/Source/WebCore/testing/Internals.cpp
r236094 r236247 1066 1066 } 1067 1067 1068 Vector<Internals::AcceleratedAnimation> Internals::acceleratedAnimationsForElement(Element& element) 1069 { 1070 if (!RuntimeEnabledFeatures::sharedFeatures().webAnimationsCSSIntegrationEnabled()) 1071 return { }; 1072 1073 Vector<Internals::AcceleratedAnimation> animations; 1074 for (auto animationAsPair : element.document().timeline().acceleratedAnimationsForElement(element)) 1075 animations.append({ animationAsPair.first, animationAsPair.second }); 1076 return animations; 1077 } 1078 1068 1079 ExceptionOr<RefPtr<Element>> Internals::pseudoElement(Element& element, const String& pseudoId) 1069 1080 { -
trunk/Source/WebCore/testing/Internals.h
r236094 r236247 201 201 ExceptionOr<bool> pauseTransitionAtTimeOnPseudoElement(const String& property, double pauseTime, Element&, const String& pseudoId); 202 202 203 // Web Animations testing. 204 struct AcceleratedAnimation { 205 String property; 206 double speed; 207 }; 208 Vector<AcceleratedAnimation> acceleratedAnimationsForElement(Element&); 209 203 210 // For animations testing, we need a way to get at pseudo elements. 204 211 ExceptionOr<RefPtr<Element>> pseudoElement(Element&, const String&); -
trunk/Source/WebCore/testing/Internals.idl
r236094 r236247 138 138 [ 139 139 ExportMacro=WEBCORE_TESTSUPPORT_EXPORT, 140 JSGenerateToJSObject, 141 ] dictionary AcceleratedAnimation { 142 DOMString property; 143 double speed; 144 }; 145 146 [ 147 ExportMacro=WEBCORE_TESTSUPPORT_EXPORT, 140 148 NoInterfaceObject, 141 149 ] interface Internals { … … 201 209 [MayThrowException] boolean pauseTransitionAtTimeOnElement(DOMString propertyName, unrestricted double pauseTime, Element element); 202 210 [MayThrowException] boolean pauseTransitionAtTimeOnPseudoElement(DOMString property, unrestricted double pauseTime, Element element, DOMString pseudoId); 211 212 // Web Animations testing. 213 sequence<AcceleratedAnimation> acceleratedAnimationsForElement(Element element); 203 214 204 215 // For animations testing, we need a way to get at pseudo elements.
Note:
See TracChangeset
for help on using the changeset viewer.