mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-05 07:39:16 +00:00
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Our previous implementation kept track of an AnimationTimeline being monotonically increasing, by looking at new time values coming in and setting `m_monotonically_increasing` to `false` whenever a new value is before the previous known time value. As far as I can tell, the spec doesn't really ask us to do so: it just defines 'monotonically increasing' as a property of a timeline, i.e. it guarantees that returned time values from `::current_time()` are always greater than or equal to the last returned value. This fixes a common crash seen when the last render opportunity lies before the document's origin time, and `::set_current_time()` was invoked with a negative value. This was especially visible in the `Text/input/wpt-import/css/cssom/CSSStyleSheet-constructable.html` test.
44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) 2024, Matthew Olsson <mattco@serenityos.org>.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/Bindings/InternalAnimationTimelinePrototype.h>
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
|
#include <LibWeb/DOM/Document.h>
|
|
#include <LibWeb/HTML/Window.h>
|
|
#include <LibWeb/Internals/InternalAnimationTimeline.h>
|
|
|
|
namespace Web::Internals {
|
|
|
|
GC_DEFINE_ALLOCATOR(InternalAnimationTimeline);
|
|
|
|
void InternalAnimationTimeline::set_current_time(Optional<double> current_time)
|
|
{
|
|
// Do nothing
|
|
(void)current_time;
|
|
}
|
|
|
|
void InternalAnimationTimeline::set_time(Optional<double> time)
|
|
{
|
|
Base::set_current_time(time);
|
|
}
|
|
|
|
InternalAnimationTimeline::InternalAnimationTimeline(JS::Realm& realm)
|
|
: AnimationTimeline(realm)
|
|
{
|
|
m_current_time = 0.0;
|
|
m_is_monotonically_increasing = true;
|
|
|
|
auto& document = as<HTML::Window>(HTML::relevant_global_object(*this)).associated_document();
|
|
document.associate_with_timeline(*this);
|
|
}
|
|
|
|
void InternalAnimationTimeline::initialize(JS::Realm& realm)
|
|
{
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(InternalAnimationTimeline);
|
|
Base::initialize(realm);
|
|
}
|
|
|
|
}
|