mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 11:17:44 +00:00
LibWeb: Use Performance for animation time instead of MonotonicTime
Performance handles the document origin time correctly, and prevents these times from being unusually large. Also initialize the DocumentTimeline time in the constructor, since these can be created from JS.
This commit is contained in:
parent
bdbc21c52d
commit
e91f4dcd79
3 changed files with 10 additions and 7 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <LibWeb/Animations/DocumentTimeline.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/HighResolutionTime/Performance.h>
|
||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||
|
||||
namespace Web::Animations {
|
||||
|
@ -17,7 +18,9 @@ JS_DEFINE_ALLOCATOR(DocumentTimeline);
|
|||
|
||||
JS::NonnullGCPtr<DocumentTimeline> DocumentTimeline::create(JS::Realm& realm, DOM::Document& document, HighResolutionTime::DOMHighResTimeStamp origin_time)
|
||||
{
|
||||
return realm.heap().allocate<DocumentTimeline>(realm, realm, document, origin_time);
|
||||
auto timeline = realm.heap().allocate<DocumentTimeline>(realm, realm, document, origin_time);
|
||||
timeline->set_current_time(document.window().performance()->now());
|
||||
return timeline;
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/web-animations-1/#dom-documenttimeline-documenttimeline
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue