Skip to content

Commit 17fc57f

Browse files
committed
LibWeb: Expose AnimationTimeline::currentTime as CSSNumberish
This also allows us to remove the now redundant `CSSNumberishTime::as_milliseconds()` method
1 parent 67563c6 commit 17fc57f

File tree

3 files changed

+3
-10
lines changed

3 files changed

+3
-10
lines changed

Libraries/LibWeb/Animations/AnimationTimeline.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ class AnimationTimeline : public Bindings::PlatformObject {
1717
GC_DECLARE_ALLOCATOR(AnimationTimeline);
1818

1919
public:
20-
Optional<double> current_time_for_bindings() const
20+
NullableCSSNumberish current_time_for_bindings() const
2121
{
22-
return current_time().map([](auto const& current_time) { return current_time.as_milliseconds(); });
22+
return NullableCSSNumberish::from_optional_css_numberish_time(current_time());
2323
}
2424
Optional<TimeValue> current_time() const;
2525

Libraries/LibWeb/Animations/AnimationTimeline.idl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// https://drafts.csswg.org/web-animations-2/#the-animationtimeline-interface
44
[Exposed=Window]
55
interface AnimationTimeline {
6-
[ImplementedAs=current_time_for_bindings] readonly attribute double? currentTime;
6+
[ImplementedAs=current_time_for_bindings] readonly attribute CSSNumberish? currentTime;
77
[ImplementedAs=duration_for_bindings] readonly attribute CSSNumberish? duration;
88
[FIXME] Animation play (optional AnimationEffect? effect = null);
99
};

Libraries/LibWeb/Animations/TimeValue.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,6 @@ struct TimeValue {
7777
return type == other.type && value == other.value;
7878
}
7979

80-
// FIXME: This method is temporary as we migrate all CSS timing to use TimeValue.
81-
double as_milliseconds() const
82-
{
83-
VERIFY(type == Type::Milliseconds);
84-
return value;
85-
}
86-
8780
CSS::CSSNumberish as_css_numberish() const
8881
{
8982
switch (type) {

0 commit comments

Comments
 (0)