Changeset 290123 in webkit
- Timestamp:
- Feb 18, 2022 7:38:23 AM (5 months ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/webanimations/frame-rate/animation-frame-rate-expected.txt (modified) (1 diff)
-
LayoutTests/webanimations/frame-rate/animation-frame-rate.html (modified) (4 diffs)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/animation/KeyframeAnimationOptions.h (modified) (2 diffs)
-
Source/WebCore/animation/KeyframeAnimationOptions.idl (modified) (1 diff)
-
Source/WebCore/dom/Element.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r290122 r290123 1 2022-02-18 Antoine Quint <graouts@webkit.org> 2 3 [frame-rate] allow setting frameRate as an option passed to Element.animate() 4 https://bugs.webkit.org/show_bug.cgi?id=236830 5 6 Reviewed by Dean Jackson. 7 8 * webanimations/frame-rate/animation-frame-rate-expected.txt: 9 * webanimations/frame-rate/animation-frame-rate.html: 10 1 11 2022-02-18 Antoine Quint <graouts@webkit.org> 2 12 -
trunk/LayoutTests/webanimations/frame-rate/animation-frame-rate-expected.txt
r286915 r290123 2 2 PASS Valid animation.frameRate values 3 3 PASS Invalid animation.frameRate values 4 PASS Calling element.animate() allows setting animation.frameRate 4 5 -
trunk/LayoutTests/webanimations/frame-rate/animation-frame-rate.html
r288806 r290123 9 9 'use strict'; 10 10 11 const presets = ["low", "high", "highest", "auto"]; 12 const invalidValues = ["default", "120", null, [], {}]; 13 11 14 test(t => { 12 15 const animation = new Animation; … … 15 18 16 19 // AnimationFrameRatePreset values. 17 for (let value of ["low", "high", "highest", "auto"]) {20 for (let value of presets) { 18 21 animation.frameRate = value; 19 22 assert_equals(animation.frameRate, value, `The value "${value}" can be set`); … … 27 30 test(t => { 28 31 const animation = new Animation; 29 for (let value of ["default", "120", null, undefined, [], {}]) {32 for (let value of invalidValues.concat(undefined)) { 30 33 assert_throws_js(TypeError, () => animation.frameRate = value, `Setting the value ${value} throws`); 31 34 assert_equals(animation.frameRate, "auto", `Setting the invalid value "${value}" does not change the value`); … … 33 36 }, "Invalid animation.frameRate values"); 34 37 38 test(t => { 39 const target = document.createElement("div"); 40 const animation = frameRate => target.animate(null, { frameRate }); 41 42 // Numeric value. 43 assert_equals(animation(30).frameRate, 30, "frameRate can be set to a numeric value"); 44 45 // Presets. 46 for (let value of presets) 47 assert_equals(animation(value).frameRate, value, "frameRate can be set to a preset value"); 48 49 // Invalid values. 50 for (let value of invalidValues) 51 assert_throws_js(TypeError, () => animation(value), `providing the invalid value "${value}" throws`); 52 }, "Calling element.animate() allows setting animation.frameRate"); 53 35 54 </script> 36 55 </body> -
trunk/Source/WebCore/ChangeLog
r290122 r290123 1 2022-02-18 Antoine Quint <graouts@webkit.org> 2 3 [frame-rate] allow setting frameRate as an option passed to Element.animate() 4 https://bugs.webkit.org/show_bug.cgi?id=236830 5 6 Reviewed by Dean Jackson. 7 8 * animation/KeyframeAnimationOptions.h: 9 * animation/KeyframeAnimationOptions.idl: 10 * dom/Element.cpp: 11 (WebCore::Element::animate): 12 1 13 2022-02-18 Antoine Quint <graouts@webkit.org> 2 14 -
trunk/Source/WebCore/animation/KeyframeAnimationOptions.h
r226289 r290123 26 26 #pragma once 27 27 28 #include "AnimationFrameRate.h" 29 #include "AnimationFrameRatePreset.h" 28 30 #include "KeyframeEffectOptions.h" 29 31 … … 32 34 struct KeyframeAnimationOptions : KeyframeEffectOptions { 33 35 String id; 36 std::variant<FramesPerSecond, AnimationFrameRatePreset> frameRate; 34 37 }; 35 38 -
trunk/Source/WebCore/animation/KeyframeAnimationOptions.idl
r226289 r290123 24 24 */ 25 25 26 typedef unsigned long FramesPerSecond; 27 26 28 dictionary KeyframeAnimationOptions : KeyframeEffectOptions { 27 29 DOMString id = ""; 30 [EnabledBySetting=WebAnimationsCustomFrameRateEnabled] (FramesPerSecond or AnimationFrameRatePreset) frameRate = "auto"; 28 31 }; -
trunk/Source/WebCore/dom/Element.cpp
r289682 r290123 4687 4687 { 4688 4688 String id = ""; 4689 std::variant<FramesPerSecond, AnimationFrameRatePreset> frameRate = AnimationFrameRatePreset::Auto; 4689 4690 std::optional<std::variant<double, KeyframeEffectOptions>> keyframeEffectOptions; 4690 4691 if (options) { … … 4696 4697 auto keyframeEffectOptions = std::get<KeyframeAnimationOptions>(optionsValue); 4697 4698 id = keyframeEffectOptions.id; 4699 frameRate = keyframeEffectOptions.frameRate; 4698 4700 keyframeEffectOptionsVariant = WTFMove(keyframeEffectOptions); 4699 4701 } … … 4707 4709 auto animation = WebAnimation::create(document(), &keyframeEffectResult.returnValue().get()); 4708 4710 animation->setId(id); 4711 animation->setBindingsFrameRate(WTFMove(frameRate)); 4709 4712 4710 4713 auto animationPlayResult = animation->play();
Note: See TracChangeset
for help on using the changeset viewer.