Truly independent web browser
LibWeb: Trace rendering work instead of counting it
Aliaksandr Kalenikbe256b09974b
diff --git a/Libraries/LibWeb/Animations/AnimationTimeline.cpp b/Libraries/LibWeb/Animations/AnimationTimeline.cppindex 1f07959c631..d261af03080 100644--- a/Libraries/LibWeb/Animations/AnimationTimeline.cpp+++ b/Libraries/LibWeb/Animations/AnimationTimeline.cpp@@ -76,7 +76,7 @@ Optional<TimeValue> AnimationTimeline::current_time_for_observation()HighResolutionTime::unsafe_shared_current_time(), settings.global_object());m_observed_current_time = current_time_at_timestamp(timestamp);m_last_current_time_update_task_generation = task_generation;- ++associated_document()->style_invalidation_counters().animation_timeline_synchronizations;+ HTML::note_rendering_trace_event("animation timeline synchronized"sv);return m_observed_current_time;}@@ -109,7 +109,7 @@ void AnimationTimeline::update_associated_animations()// updated.// - Queueing animation events for any such animations.// NB: Since we dispatch events for all animations regardless of whether they have a timeline we handle them all together in Document::update_animations_and_send_events()- ++associated_document()->style_invalidation_counters().animation_timeline_associated_animation_updates;+ HTML::note_rendering_trace_event("animation timeline updated its animations"sv);// NB: Updating an animation can run script that changes which animations are associated with this timeline. Skip// the ones it disassociates.GC::RootVector<GC::Ref<Animation>> animations;diff --git a/Libraries/LibWeb/Animations/KeyframeEffect.cpp b/Libraries/LibWeb/Animations/KeyframeEffect.cppindex 5ac6edca3b3..f49f1c908f2 100644--- a/Libraries/LibWeb/Animations/KeyframeEffect.cpp+++ b/Libraries/LibWeb/Animations/KeyframeEffect.cpp@@ -24,6 +24,7 @@#include <LibWeb/DOM/AbstractElement.h>#include <LibWeb/DOM/Document.h>#include <LibWeb/DOM/Slot.h>+#include <LibWeb/HTML/EventLoop/EventLoop.h>#include <LibWeb/HTML/EventNames.h>#include <LibWeb/HTML/HTMLSlotElement.h>#include <LibWeb/HTML/LocalNavigable.h>@@ -1162,11 +1163,11 @@ bool KeyframeEffect::can_skip_per_frame_style_update() const&& m_can_skip_per_frame_style_update_cache->target_subtree_style_generation == target->animation_subtree_style_generation()&& m_can_skip_per_frame_style_update_cache->target_is_connected == target->is_connected()&& m_can_skip_per_frame_style_update_cache->layout_node == layout_node) {- ++target->document().style_invalidation_counters().animation_style_skip_cache_hits;+ HTML::note_rendering_trace_event("animation style skip cache hit"sv);return m_can_skip_per_frame_style_update_cache->result;}if (m_can_skip_per_frame_style_update_cache.has_value())- ++target->document().style_invalidation_counters().animation_style_skip_cache_misses;+ HTML::note_rendering_trace_event("animation style skip cache miss"sv);}// Restrict throttling within a rendered document to infinite transform-only effects until animation overflowdiff --git a/Libraries/LibWeb/CSS/ComputedStyleWorkingSet.cpp b/Libraries/LibWeb/CSS/ComputedStyleWorkingSet.cppindex 544d4157a2d..0a493482bc0 100644--- a/Libraries/LibWeb/CSS/ComputedStyleWorkingSet.cpp+++ b/Libraries/LibWeb/CSS/ComputedStyleWorkingSet.cpp@@ -36,7 +36,6 @@namespace Web::CSS {static Atomic<u64> s_next_animated_properties_identity { 1 };-static u64 s_longhand_wrappers_minted { 0 };AnimatedProperties::~AnimatedProperties(){@@ -116,21 +115,6 @@ AnimatedProperties::AnimatedProperties(ComputedValuesFFI::AnimatedOverlay const*{}-u64 longhand_wrappers_minted()-{- return s_longhand_wrappers_minted;-}--void reset_longhand_wrappers_minted()-{- s_longhand_wrappers_minted = 0;-}--void count_longhand_wrapper_mint()-{- ++s_longhand_wrappers_minted;-}-AnimatedProperties const& ComputedStyleWorkingSet::animated_properties() const{static NeverDestroyed<AnimatedProperties> empty_animated_properties;@@ -277,7 +261,6 @@ void ComputedStyleWorkingSet::clear_animated_properties(Badge<StyleComputer>)NonnullRefPtr<StyleValue const> wrap_computed_longhand_slot(void const* value_data){- ++s_longhand_wrappers_minted;return StyleValue::adopt_rust_style_value_data(StyleValueFFI::rust_style_value_retain(static_cast<StyleValueFFI::StyleValueData const*>(value_data)));}diff --git a/Libraries/LibWeb/CSS/ComputedStyleWorkingSet.h b/Libraries/LibWeb/CSS/ComputedStyleWorkingSet.hindex 0c3d192189b..87563a8bc95 100644--- a/Libraries/LibWeb/CSS/ComputedStyleWorkingSet.h+++ b/Libraries/LibWeb/CSS/ComputedStyleWorkingSet.h@@ -181,8 +181,5 @@ NonnullRefPtr<StyleValue const> wrap_computed_longhand_slot(void const* value_da// How many C++ longhand wrappers have been minted process-wide, counting the on-demand mints// property() performs and the specified-value wrappers the drive's side effects still need.// Exposed through internals for the laziness measurements.-u64 longhand_wrappers_minted();-void reset_longhand_wrappers_minted();-void count_longhand_wrapper_mint();}diff --git a/Libraries/LibWeb/CSS/ComputedValues.cpp b/Libraries/LibWeb/CSS/ComputedValues.cppindex f335a06e4fa..b31349302ac 100644--- a/Libraries/LibWeb/CSS/ComputedValues.cpp+++ b/Libraries/LibWeb/CSS/ComputedValues.cpp@@ -432,7 +432,6 @@ RefPtr<StyleValue const> ComputedValues::style_value_from_handle(PropertyID propreturn it->value;}auto value = StyleValue::adopt_rust_style_value_data(StyleValueFFI::rust_style_value_retain(handle.data()));- count_longhand_wrapper_mint();if (!m_style_value_cache)m_style_value_cache = make<HashMap<PropertyID, NonnullRefPtr<StyleValue const>>>();m_style_value_cache->set(property_id, value);@@ -533,7 +532,6 @@ RefPtr<StyleValue const> ComputedValues::computed_style_value(PropertyID propertreturn it->value;}auto value = StyleValue::adopt_rust_style_value_data(StyleValueFFI::rust_style_value_retain(static_cast<StyleValueFFI::StyleValueData const*>(stored)));- count_longhand_wrapper_mint();if (!m_style_value_cache)m_style_value_cache = make<HashMap<PropertyID, NonnullRefPtr<StyleValue const>>>();m_style_value_cache->set(property_id, value);diff --git a/Libraries/LibWeb/CSS/Invalidation/MediaQueryInvalidator.cpp b/Libraries/LibWeb/CSS/Invalidation/MediaQueryInvalidator.cppindex 3127a0b7dec..2ae2857dff8 100644--- a/Libraries/LibWeb/CSS/Invalidation/MediaQueryInvalidator.cpp+++ b/Libraries/LibWeb/CSS/Invalidation/MediaQueryInvalidator.cpp@@ -12,6 +12,7 @@#include <LibWeb/CSS/StyleSheetState.h>#include <LibWeb/DOM/Document.h>#include <LibWeb/DOM/ShadowRoot.h>+#include <LibWeb/HTML/EventLoop/EventLoop.h>namespace Web::CSS::Invalidation {@@ -23,7 +24,7 @@ namespace Web::CSS::Invalidation {// conditions, and drop the scope's cached rule set.void evaluate_media_rules_and_publish_conditions(DOM::Document& document){- ++document.style_invalidation_counters().media_rule_evaluations;+ HTML::note_rendering_trace_event("media rules evaluated"sv);HashTable<StyleScope*> scopes_with_changed_layer_order;Function<void(StyleSheetState&)> evaluate_author_sheet = [&](StyleSheetState& style_sheet) {diff --git a/Libraries/LibWeb/CSS/StyleComputer.cpp b/Libraries/LibWeb/CSS/StyleComputer.cppindex 90a37d30a1c..e2e9c24c36e 100644--- a/Libraries/LibWeb/CSS/StyleComputer.cpp+++ b/Libraries/LibWeb/CSS/StyleComputer.cpp@@ -85,6 +85,7 @@#include <LibWeb/DOM/ShadowRoot.h>#include <LibWeb/DOM/Text.h>#include <LibWeb/HTML/AttributeNames.h>+#include <LibWeb/HTML/EventLoop/EventLoop.h>#include <LibWeb/HTML/HTMLBRElement.h>#include <LibWeb/HTML/HTMLImageElement.h>#include <LibWeb/HTML/HTMLInputElement.h>@@ -414,7 +415,7 @@ void StyleComputer::commit_transition_stabilization_epoch()auto commit_proposed_transition = [&] {VERIFY(state.proposed_transition);state.proposed_transition->commit_provisional_transition();- ++document().style_invalidation_counters().committed_transitions_started;+ HTML::note_rendering_trace_event("transition started"sv);};switch (state.action) {@@ -440,7 +441,7 @@ void StyleComputer::commit_transition_stabilization_epoch()commit_proposed_transition();break;}- ++document().style_invalidation_counters().committed_transition_actions;+ HTML::note_rendering_trace_event("transition action committed"sv);}m_provisional_transition_states.clear();m_provisional_transition_state_indices.clear();@@ -1196,9 +1197,9 @@ RefPtr<ComputedStyleWorkingSet> StyleComputer::start_needed_transitions(Layout::// A transition action is provisional until the stabilization epoch commits; a later pass of the epoch decides// again, superseding the decision of this one.auto decide = [&](ProvisionalTransitionState& state, StyleValueFFI::FfiTransitionActionKind action) {- ++document().style_invalidation_counters().provisional_transition_decisions;+ HTML::note_rendering_trace_event("provisional transition decision"sv);if (state.has_decision)- ++document().style_invalidation_counters().superseded_provisional_transition_decisions;+ HTML::note_rendering_trace_event("provisional transition decision superseded"sv);state.has_decision = true;if (state.proposed_transition)state.proposed_transition->discard_provisional_transition();diff --git a/Libraries/LibWeb/CSS/StyleEngineBridge.h b/Libraries/LibWeb/CSS/StyleEngineBridge.hindex f93d48c9fda..40b280eca9a 100644--- a/Libraries/LibWeb/CSS/StyleEngineBridge.h+++ b/Libraries/LibWeb/CSS/StyleEngineBridge.h@@ -105,13 +105,11 @@ bool style_engine_pending_transaction_may_affect_layout_geometry(DocumentHost covoid style_engine_defer_pending_transaction_for_geometry_read(DocumentHost const*, BegunRead const*);bool style_engine_begin_deferred_geometry_transaction_flush(DocumentHost const*, BegunRead const*);bool style_engine_has_deferred_geometry_transaction(DocumentHost const*, BegunRead const*);-u64 style_engine_animated_style_samples(DocumentHost const*, BegunRead const*, bool rebuilt_every_group, bool reset);bool style_engine_begin_style_trace(DocumentHost const*, BegunRead const*);bool style_engine_end_style_trace(DocumentHost const*, BegunRead const*);u32 style_engine_style_trace_size(DocumentHost const*, BegunRead const*, StyleNodeID root);u64 style_engine_style_trace_entry(DocumentHost const*, BegunRead const*, StyleNodeID root, u32 index);u32 style_engine_layer_index(DocumentHost const*, BegunRead const*, TreeScopeID tree_scope, u32 layer);-u64 style_engine_size_query_container_scan_visits(DocumentHost const*, BegunRead const*, bool reset);u64 style_engine_ensure_random_base_value(DocumentHost const*, BegunRead const*, StyleNodeID node, ReadonlySpan<u16> name, bool element_shared);}diff --git a/Libraries/LibWeb/CSS/UpdateStyle.cpp b/Libraries/LibWeb/CSS/UpdateStyle.cppindex 519f476265f..387f6f304c2 100644--- a/Libraries/LibWeb/CSS/UpdateStyle.cpp+++ b/Libraries/LibWeb/CSS/UpdateStyle.cpp@@ -170,7 +170,7 @@ void StyleEngineFFI::web_css_run_style_update(StyleReactionApplication* applicatauto const& read = application->read;auto& document = *application->document;auto& style_engine = document.style_computer().style_engine();- auto& counters = document.style_invalidation_counters();+ auto& counters = document.style_update_statistics();StyleEngine::StyleUpdateTimings transaction {};if (flown) {transaction = style_engine.drain_flown_style_update(read);@@ -459,7 +459,7 @@ Optional<StyleUpdateInputs> begin_style_update_inputs(Layout::BegunRead const& r// change selector or cascade inputs. Apply an animation-only update first, then take a// transaction only if the resulting inherited-style feedback requires one.record_non_author_stylesheets(document);- document.style_invalidation_counters().style_update_submission_microseconds += microseconds_since(submission_started_at);+ document.style_update_statistics().style_update_submission_microseconds += microseconds_since(submission_started_at);// Settle the counter-style registry of each tree scope that may have moved before the engine answers any row: a// record naming a counter style names the registry it was computed against, and a shadow tree can define its own.// None of it depends on layout.@@ -485,7 +485,7 @@ static void update_style(Layout::BegunRead const& read, DOM::Document& document,// NB: The style update of a read with no transaction in flight is compiled without the drain's steps.constexpr bool drains_flown_transaction = IsSame<FirstTransaction, FlownStyleUpdate>;auto style_update_started_at = MonotonicTime::now();- auto& timing_counters = document.style_invalidation_counters();+ auto& timing_counters = document.style_update_statistics();auto const submission_before = timing_counters.style_update_submission_microseconds;auto const bridge_before = timing_counters.style_update_bridge_microseconds;auto const apply_before = timing_counters.style_update_apply_microseconds;@@ -832,7 +832,7 @@ static bool update_style_for_element(Layout::BegunRead const& read, DOM::Documendocument.sample_animation_effects_needing_style_update();// NB: A style update stops after a number of passes with what they fed back still pending, as a chain of// custom property animations does that moves one level per pass. The read wants them all.- auto const stopped_passes = [&] { return document.style_invalidation_counters().style_update_pass_guard_hits; };+ auto const stopped_passes = [&] { return document.style_update_statistics().style_update_pass_guard_hits; };auto stopped_before = stopped_passes();bool update = !document.is_running_update_layout()&& (can_run_regular_style_update || document.style_computer().style_engine().has_pending_transaction(read));@@ -894,7 +894,7 @@ void Document::update_style(){Layout::ForcedReadScope read { style_computer().style_engine().render_document() };drain_flown_style_update(read);- auto const stopped_passes = [&] { return style_invalidation_counters().style_update_pass_guard_hits; };+ auto const stopped_passes = [&] { return style_update_statistics().style_update_pass_guard_hits; };auto stopped_before = stopped_passes();CSS::update_style(read, *this);if (stopped_passes() == stopped_before)diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cppindex d71e40fd0f9..6078bdca0eb 100644--- a/Libraries/LibWeb/DOM/Document.cpp+++ b/Libraries/LibWeb/DOM/Document.cpp@@ -927,16 +927,10 @@ Layout::NodeArena& Document::layout_node_arena()return *m_layout_node_arena;}-void Document::reset_style_invalidation_counters(Layout::BegunRead const& read) const+void Document::bump_style_environment_version(){- m_style_invalidation_counters = {};- (void)CSS::StyleEngineFFI::style_engine_size_query_container_scan_visits(style_computer().style_engine().host(), &read, true);- (void)CSS::StyleEngineFFI::style_engine_animated_style_samples(style_computer().style_engine().host(), &read, false, true);- (void)CSS::StyleEngineFFI::style_engine_animated_style_samples(style_computer().style_engine().host(), &read, true, true);- if (m_layout_node_arena) {- Layout::RustFFI::render_state_scrollable_overflow_recalculation_count(m_layout_node_arena->host(), true);- }- CSS::reset_longhand_wrappers_minted();+ ++m_style_environment_version;+ HTML::note_rendering_trace_event("style environment changed"sv);}bool Document::needs_full_layout_tree_update(Layout::BegunRead const& read) const@@ -2394,25 +2388,25 @@ void Document::begin_style_stabilization_epoch()m_style_stabilization_has_style_reactions = false;m_animated_custom_property_changes_in_stabilization_epoch.clear();m_animated_custom_property_moves_in_stabilization_epoch = 0;- ++m_style_invalidation_counters.style_stabilization_epochs;+ HTML::note_rendering_trace_event("style stabilization epoch"sv);++m_transition_generation;}void Document::record_style_stabilization_pass(Layout::BegunRead const& read){VERIFY(m_style_stabilization_epoch_depth > 0);- ++m_style_invalidation_counters.provisional_style_passes;+ HTML::note_rendering_trace_event("provisional style pass"sv);++m_style_stabilization_pass_count;if (m_style_stabilization_pass_count == 2)- ++m_style_invalidation_counters.style_stabilization_feedback_epochs;+ HTML::note_rendering_trace_event("style stabilization feedback epoch"sv);constexpr u64 ordinary_stabilization_round_limit = 8;if (m_style_stabilization_pass_count == ordinary_stabilization_round_limit + 1)- ++m_style_invalidation_counters.style_stabilization_round_guard_hits;+ HTML::note_rendering_trace_event("style stabilization round guard"sv);// The exact bound is never reached within the ordinary rounds, so they need not ask the engine for it.if (m_style_stabilization_pass_count <= ordinary_stabilization_round_limit)return;- ++m_style_invalidation_counters.exact_stabilization_passes;+ HTML::note_rendering_trace_event("exact stabilization pass"sv);// Size-query and style-reaction dependencies are acyclic, so a coherent pass settles at// least one more connected element, or moves the animated custom properties of one that reads@@ -2420,10 +2414,8 @@ void Document::record_style_stabilization_pass(Layout::BegunRead const& read)// StyleEngine transactions in the same exact bound as layout feedback so neither feedback path// can spin independently of the epoch.auto const exact_stabilization_round_limit = static_cast<u64>(CSS::StyleEngineFFI::style_engine_connected_element_count(style_computer().style_engine().host(), &read)) + m_animated_custom_property_moves_in_stabilization_epoch + 1;- if (m_style_stabilization_pass_count > ordinary_stabilization_round_limit + exact_stabilization_round_limit) {- ++m_style_invalidation_counters.style_stabilization_bound_failures;+ if (m_style_stabilization_pass_count > ordinary_stabilization_round_limit + exact_stabilization_round_limit)VERIFY_NOT_REACHED();- }}u64 Document::note_animated_custom_properties_moved_in_stabilization_epoch(CSS::StyleNodeID style_node)@@ -2459,7 +2451,7 @@ void Document::end_style_stabilization_epoch()if (m_animations_created_in_stabilization_epoch.contains(event.animation) && event.animation->is_idle())continue;m_pending_animation_event_queue.append(event);- ++m_style_invalidation_counters.committed_animation_events;+ HTML::note_rendering_trace_event("animation events committed"sv);}m_provisional_animation_event_queue.clear();m_animations_created_in_stabilization_epoch.clear();@@ -8881,7 +8873,7 @@ int Document::compare_elements_in_tree_order_for_composite_order(Element& first,auto compares_before_tree_positions = max(minimum_compares_before_tree_positions, m_element_count_at_last_tree_positions_walk / 8);auto compare_in_tree = [&] {- ++style_invalidation_counters().composite_order_document_position_compares;+ HTML::note_rendering_trace_event("composite order compared by tree position"sv);auto position = first.compare_document_position(second);if (position & Node::DOCUMENT_POSITION_FOLLOWING)return -1;@@ -9241,9 +9233,9 @@ void Document::service_compositor_animation_wakeup(double timestamp)if (reached_wakeup) {if (reached_compositor_active_start) {Layout::ForcedReadScope read { *this };- paint_state().republish_visual_animations(read, *this);+ paint_state().republish_visual_animations(read);}- ++m_style_invalidation_counters.animation_frame_pump_requests;+ HTML::note_rendering_trace_event("animation frame pump request"sv);set_rendering_pending(*this, RenderingPendingReason::NeedsRenderingUpdate, 1);page().client().request_frame_for(*this);}@@ -9989,12 +9981,12 @@ void Document::update_compositor_animations(Layout::BegunRead const& read)// A descriptor must target the tree it is published with. The selection pass above can force// or release animation-only visual context nodes, so redo it after applying those updates.if (Layout::RustFFI::document_host_visual_contexts_need_update(layout_node_arena().host())) {- paint_state().publish_compositor_animations(read, *this, Painting::DocumentPaintState::PublishPendingCompositorAnimations::No);+ paint_state().publish_compositor_animations(read, Painting::DocumentPaintState::PublishPendingCompositorAnimations::No);update_compositor_animations(read);return;}- paint_state().publish_compositor_animations(read, *this, Painting::DocumentPaintState::PublishPendingCompositorAnimations::Yes);+ paint_state().publish_compositor_animations(read, Painting::DocumentPaintState::PublishPendingCompositorAnimations::Yes);if (compositor_animation_wakeup_delay_ms.has_value())schedule_compositor_animation_wakeup(*compositor_animation_wakeup_delay_ms);@@ -10005,7 +9997,7 @@ void Document::update_compositor_animations(Layout::BegunRead const& read)} else {if (!m_compositor_animation_observation_timer) {m_compositor_animation_observation_timer = Core::Timer::create_single_shot(AK::Duration::from_milliseconds(100), GC::weak_callback(*this, [](auto& document) {- ++document.m_style_invalidation_counters.animation_frame_pump_requests;+ HTML::note_rendering_trace_event("animation frame pump request"sv);set_rendering_pending(document, RenderingPendingReason::NeedsRenderingUpdate, 1);document.page().client().request_frame_for(document);document.m_compositor_animation_observation_timer->start();@@ -10016,20 +10008,19 @@ void Document::update_compositor_animations(Layout::BegunRead const& read)}}- if (requested_withdrawn_effect_sample) {- ++m_style_invalidation_counters.animation_frame_pump_requests;- }+ if (requested_withdrawn_effect_sample)+ HTML::note_rendering_trace_event("animation frame pump request"sv);}void Document::append_pending_animation_event(Web::DOM::Document::PendingAnimationEvent const& event){if (m_style_stabilization_epoch_depth > 0) {m_provisional_animation_event_queue.append(event);- ++m_style_invalidation_counters.provisional_animation_events;+ HTML::note_rendering_trace_event("provisional animation events"sv);return;}m_pending_animation_event_queue.append(event);- ++m_style_invalidation_counters.committed_animation_events;+ HTML::note_rendering_trace_event("animation events committed"sv);}void Document::prepare_to_observe_css_animation_events()@@ -10177,7 +10168,7 @@ void Document::update_animations_and_send_events(double timestamp)}}}- ++m_style_invalidation_counters.animation_frame_pump_requests;+ HTML::note_rendering_trace_event("animation frame pump request"sv);set_rendering_pending(*this, RenderingPendingReason::NeedsRenderingUpdate, 1);page().client().request_frame_for(*this);break;@@ -12890,7 +12881,7 @@ void Document::build_registered_properties_cache()return;m_needs_registered_properties_cache_update = false;- ++m_style_invalidation_counters.registered_properties_cache_rebuilds;+ HTML::note_rendering_trace_event("registered properties cache rebuilt"sv);HashMap<Utf16FlyString, CSS::CustomPropertyRegistration> cached_registered_properties_from_css_property_rules;for_each_active_css_style_sheet([&](CSS::StyleSheetState const& style_sheet) {diff --git a/Libraries/LibWeb/DOM/Document.h b/Libraries/LibWeb/DOM/Document.hindex 365d58ce8f9..a3a6da685a2 100644--- a/Libraries/LibWeb/DOM/Document.h+++ b/Libraries/LibWeb/DOM/Document.h@@ -358,7 +358,7 @@ public:// a counter style arriving, or another untracked environment input changing. A record taken under one version// answers for nothing once it moves.u64 style_environment_version() const { return m_style_environment_version; }- void bump_style_environment_version() { ++m_style_environment_version; }+ void bump_style_environment_version();u64 next_counter_style_environment_identity(){auto identity = m_next_counter_style_environment_identity++;@@ -1473,43 +1473,16 @@ public:void set_needs_animated_style_update(Animations::KeyframeEffect&);- // Test-only counters for observing style invalidation and recomputation work. See Internals.idl.- struct StyleInvalidationCounters {+ // What the style updates of the document measured, for the style update capture tools, and how often a style+ // update stopped at its pass guard.+ struct StyleUpdateStatistics {// A run consumes one non-empty semantic reaction batch. The element count includes derived// inheritance reactions; the published count names reactions emitted at the transaction// boundary before that propagation.u64 style_engine_reaction_batch_runs { 0 };u64 style_engine_reaction_elements { 0 };u64 style_engine_published_reactions { 0 };- u64 layout_style_record_publications { 0 };- // Animation frames that rebuilt only the groups the animated properties write, against- // frames that had to rebuild the whole style.- u64 animation_frame_pump_requests { 0 };- u64 animation_style_skip_cache_hits { 0 };- u64 animation_style_skip_cache_misses { 0 };- u64 animation_timeline_synchronizations { 0 };- u64 animation_timeline_associated_animation_updates { 0 };- u64 compositor_visual_animation_updates { 0 };- u64 compositor_visual_animation_timing_anchor_updates { 0 };- u64 compositor_keyframe_value_resolutions { 0 };- u64 style_stabilization_epochs { 0 };- u64 style_stabilization_feedback_epochs { 0 };- u64 provisional_style_passes { 0 };- u64 style_stabilization_round_guard_hits { 0 };u64 style_update_pass_guard_hits { 0 };- // What sorting animations in tree order asked of the tree itself, rather than of the document's tree positions.- u64 composite_order_document_position_compares { 0 };- u64 exact_stabilization_passes { 0 };- u64 style_stabilization_bound_failures { 0 };- u64 provisional_animation_events { 0 };- u64 committed_animation_events { 0 };- u64 provisional_transition_decisions { 0 };- u64 superseded_provisional_transition_decisions { 0 };- u64 committed_transition_actions { 0 };- u64 committed_transitions_started { 0 };- u64 media_rule_evaluations { 0 };- u64 registered_properties_cache_rebuilds { 0 };- u64 style_query_container_scans { 0 };u64 style_engine_transaction_setups { 0 };u64 style_engine_transaction_setup_microseconds { 0 };// Exclusive intervals within style_update_microseconds. Rust phases subdivide bridge.@@ -1519,8 +1492,7 @@ public:u64 style_update_remainder_microseconds { 0 };u64 style_update_microseconds { 0 };};- StyleInvalidationCounters& style_invalidation_counters() const { return m_style_invalidation_counters; }- void reset_style_invalidation_counters(Layout::BegunRead const& read) const;+ StyleUpdateStatistics& style_update_statistics() const { return m_style_update_statistics; }enum class AccumulatedVisualContextUpdateScope : u8 {Values,@@ -2508,7 +2480,7 @@ private:// the next recording. Rotated only by cache-read-write recordings; survives display list invalidation.Optional<CSSPixelRect> m_caret_hit_test_debug_rect;- mutable StyleInvalidationCounters m_style_invalidation_counters;+ mutable StyleUpdateStatistics m_style_update_statistics;mutable GC::Ptr<WebIDL::ObservableArray> m_adopted_style_sheets;diff --git a/Libraries/LibWeb/DOM/Element.cpp b/Libraries/LibWeb/DOM/Element.cppindex 79f0d62f261..492cf0ad930 100644--- a/Libraries/LibWeb/DOM/Element.cpp+++ b/Libraries/LibWeb/DOM/Element.cpp@@ -2267,8 +2267,6 @@ void Element::invalidate_descendant_styles_depending_on_style_container_query()if (!m_is_style_query_container)return;- ++document().style_invalidation_counters().style_query_container_scans;-for_each_shadow_including_descendant([](auto& node) {auto* element = as_if<Element>(node);if (!element || !element->style_depends_on_style_container_query())diff --git a/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp b/Libraries/LibWeb/HTML/EventLoop/EventLoop.cppindex dddb433fa57..af55716aad8 100644--- a/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp+++ b/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp@@ -81,11 +81,33 @@ EventLoop::EventLoop(Type type)EventLoop::~EventLoop() = default;-void EventLoop::reset_rendering_scheduler_counters()+String EventLoop::take_rendering_trace()+{+ StringBuilder builder;+ for (auto const& line : m_rendering_trace.value_or({})) {+ builder.append(line.text);+ if (line.repeats > 1)+ builder.appendff(" x{}", line.repeats);+ builder.append('\n');+ }+ m_rendering_trace.clear();+ return builder.to_string_without_validation();+}++void EventLoop::note_rendering_trace_event(StringView event)+{+ if (!m_rendering_trace.has_value())+ return;+ if (!m_rendering_trace->is_empty() && m_rendering_trace->last().text == event) {+ ++m_rendering_trace->last().repeats;+ return;+ }+ m_rendering_trace->append({ MUST(String::from_utf8(event)) });+}++void note_rendering_trace_event(StringView event){- m_rendering_scheduler_counters = {};- m_rendering_scheduler_counters_at_last_update = {};- m_last_rendering_update_end_time = 0;+ main_thread_event_loop().note_rendering_trace_event(event);}void EventLoop::visit_edges(Visitor& visitor)@@ -410,8 +432,10 @@ void EventLoop::request_rendering_update()if (m_rendering_update_requested || m_rendering_task_queued) {++m_rendering_scheduler_counters.coalesced_update_requests;+ note_rendering_trace_event(m_running_rendering_task ? "request while rendering, coalesced"sv : "request, coalesced"sv);return;}+ note_rendering_trace_event(m_running_rendering_task ? "request while rendering"sv : "request"sv);m_rendering_update_requested = true;}@@ -422,6 +446,7 @@ bool EventLoop::rendering_opportunity(HighResolutionTime::DOMHighResTimeStamp fr++m_rendering_scheduler_counters.opportunities_received;if (source == RenderingOpportunitySource::Watchdog)++m_rendering_scheduler_counters.watchdog_opportunities;+ note_rendering_trace_event(source == RenderingOpportunitySource::Watchdog ? "opportunity (watchdog)"sv : "opportunity"sv);// FIXME: 1. Wait until at least one navigable whose active document's relevant agent's event loop is eventLoop might have a rendering opportunity.@@ -985,6 +1010,7 @@ void EventLoop::update_the_rendering()page->client().will_begin_rendering_update();auto update_start_time = HighResolutionTime::unsafe_shared_current_time();++m_rendering_scheduler_counters.updates_run;+ note_rendering_trace_event("update"sv);++m_rendering_update_serial;// AD-HOC: The last rendering update may have ended as its style update flew. Its layout runs beside this@@ -1440,6 +1466,7 @@ void EventLoop::update_the_rendering_after_style_and_layout(Vector<GC::Root<DOM:if (!navigable || !navigable->paint_next_frame_if_needed(DOM::UpdateLayoutReason::HTMLEventLoopRenderingUpdate, lay_out_first))continue;++m_rendering_scheduler_counters.paints;+ note_rendering_trace_event("paint"sv);if (navigable->is_local_root())navigable->page().process_screenshot_requests();}diff --git a/Libraries/LibWeb/HTML/EventLoop/EventLoop.h b/Libraries/LibWeb/HTML/EventLoop/EventLoop.hindex 602bde2b37a..42cc62c6605 100644--- a/Libraries/LibWeb/HTML/EventLoop/EventLoop.h+++ b/Libraries/LibWeb/HTML/EventLoop/EventLoop.h@@ -80,7 +80,6 @@ public:u64 opportunities_that_queued_a_task { 0 };u64 watchdog_opportunities { 0 };u64 updates_run { 0 };- u64 updates_skipped_as_unnecessary { 0 };u64 update_microseconds { 0 };u64 tasks_between_updates { 0 };u64 task_microseconds_between_updates { 0 };@@ -237,7 +236,10 @@ public:void release_held_frames_for_testing();RenderingSchedulerCounters const& rendering_scheduler_counters() const { return m_rendering_scheduler_counters; }- void reset_rendering_scheduler_counters();++ void begin_rendering_trace() { m_rendering_trace = Vector<RenderingTraceLine> {}; }+ String take_rendering_trace();+ void note_rendering_trace_event(StringView);private:bool rendering_update_in_flight_holds_tasks_of(DOM::Document const*) const;@@ -326,6 +328,12 @@ private:RenderingSchedulerCounters m_rendering_scheduler_counters;RenderingSchedulerCounters m_rendering_scheduler_counters_at_last_update;++ struct RenderingTraceLine {+ String text;+ size_t repeats { 1 };+ };+ Optional<Vector<RenderingTraceLine>> m_rendering_trace;double m_last_rendering_update_end_time { 0 };GC::Ptr<GC::Function<void()>> m_rendering_task_function;@@ -361,6 +369,9 @@ WEB_API EventLoop& main_thread_event_loop();// The event loop of the agent on the current thread.WEB_API EventLoop& current_event_loop();+// Notes an event of the rendering of the window agent for a test tracing it, as the next line of the trace.+void note_rendering_trace_event(StringView);+WEB_API void run_when_event_loop_reaches_step_1(GC::Ref<GC::Function<void()>> steps);WEB_API TaskID queue_a_task(HTML::Task::Source, GC::Ptr<EventLoop>, GC::Ptr<DOM::Document>, GC::Ref<GC::Function<void()>> steps, Task::Priority = Task::Priority::Normal, GC::Ptr<GC::Function<void()>> discard_steps = {});WEB_API TaskID queue_global_task(HTML::Task::Source, JS::Object&, GC::Ref<GC::Function<void()>> steps, Task::Priority = Task::Priority::Normal, GC::Ptr<GC::Function<void()>> discard_steps = {});diff --git a/Libraries/LibWeb/Internals/Internals.cpp b/Libraries/LibWeb/Internals/Internals.cppindex 64108ae9908..e3b139748de 100644--- a/Libraries/LibWeb/Internals/Internals.cpp+++ b/Libraries/LibWeb/Internals/Internals.cpp@@ -218,6 +218,46 @@ void Internals::force_incompatible_visual_context_tree_rebuild()document.schedule_full_accumulated_visual_context_rebuild(Layout::RustFFI::VisualContextUpdateScope::FreshTree);}+Utf16String Internals::dump_compositor_animations()+{+ auto& document = window().associated_document();+ Layout::ForcedReadScope read { document };+ struct Context {+ GC::Ref<CSS::StyleComputer> style_computer;+ Vector<Utf16String> animations;+ } context { document.style_computer(), {} };+ u8 flags = 3;+ if (document.has_committed_viewport_box()) {+ flags = Layout::RustFFI::render_state_dump_compositor_animations(document.layout_node_arena().host(), read, Painting::viewport_row_slot(read, document), &context,+ [](void* raw_context, u8 kind, u32 element) {+ auto& context = *static_cast<Context*>(raw_context);+ static constexpr Array kind_names { "opacity"sv, "background-color"sv, "filter"sv, "transform"sv };+ GC::Ptr<DOM::Element> dom_element;+ if (element)+ dom_element = context.style_computer->element_for_style_node(CSS::StyleNodeID { element });+ if (dom_element)+ context.animations.append(Utf16String::formatted("{} {}", kind_names[kind], dom_element->debug_description()));+ else+ context.animations.append(Utf16String::formatted("{} (no element)", kind_names[kind]));+ });+ }+ quick_sort(context.animations);+ Utf16StringBuilder builder;+ for (auto const& animation : context.animations) {+ builder.append(animation);+ builder.append_ascii('\n');+ }+ if (!context.animations.is_empty() && !(flags & 1))+ builder.append_ascii("timing anchors differ\n"sv);+ if (!(flags & 2))+ builder.append_ascii("an animation drives no live node\n"sv);+ if (document.compositor_animation_wakeup_timer_is_active())+ builder.append_ascii("wakeup timer armed\n"sv);+ if (document.compositor_animation_observation_timer_is_active())+ builder.append_ascii("observation timer armed\n"sv);+ return builder.to_string();+}+Utf16String Internals::dump_visual_context_nodes(DOM::Element& element){auto& document = window().associated_document();@@ -258,42 +298,6 @@ Utf16String Internals::dump_visual_context_nodes(DOM::Element& element)return Utf16String::from_utf8_without_validation(context.builder.string_view());}-GC::Ref<JS::Object> Internals::visual_context_node_indices(DOM::Element& element)-{- auto& realm = window().principal_realm();- auto& document = window().associated_document();- Layout::ForcedReadScope read { document };- document.update_layout(DOM::UpdateLayoutReason::Debugging);- auto const* layout_node = element.layout_node(read);- auto owned_indices_as_array = [&](Layout::RustFFI::FfiVisualContextBoxNodeList list) -> GC::Ref<JS::Array> {- Vector<u32> indices;- if (layout_node)- indices = Painting::rust_owned_visual_context_node_indices(*layout_node, list);- return JS::Array::create_from<u32>(realm, indices.span(), [](u32 index) { return JS::Value { index }; });- };- auto object = JS::Object::create(realm, nullptr);- object->define_direct_property("spatial"_utf16_fly_string, owned_indices_as_array(Layout::RustFFI::FfiVisualContextBoxNodeList::SpatialNodes), JS::default_attributes);- object->define_direct_property("clips"_utf16_fly_string, owned_indices_as_array(Layout::RustFFI::FfiVisualContextBoxNodeList::ClipNodes), JS::default_attributes);- object->define_direct_property("effects"_utf16_fly_string, owned_indices_as_array(Layout::RustFFI::FfiVisualContextBoxNodeList::EffectNodes), JS::default_attributes);- object->define_direct_property("needsCompositorEffectsLayer"_utf16_fly_string, JS::Value(layout_node && layout_node->needs_compositor_effects_layer()), JS::default_attributes);- object->define_direct_property("needsCompositorBackgroundColorFrame"_utf16_fly_string, JS::Value(layout_node && layout_node->needs_compositor_background_color_frame()), JS::default_attributes);- Vector<Gfx::Color> background_color_animation_keyframe_colors;- if (layout_node) {- Layout::BegunRead const& begun_read = read;- for (auto effect_node_index : Painting::rust_owned_visual_context_node_indices(*layout_node, Layout::RustFFI::FfiVisualContextBoxNodeList::EffectNodes)) {- Layout::RustFFI::render_state_background_color_animation_keyframe_colors(document.layout_node_arena().host(), &begun_read, effect_node_index, &background_color_animation_keyframe_colors, [](void* colors, Gfx::Color color) {- static_cast<Vector<Gfx::Color>*>(colors)->append(color);- });- }- }- object->define_direct_property("backgroundColorAnimationKeyframes"_utf16_fly_string,- JS::Array::create_from<Gfx::Color>(realm, background_color_animation_keyframe_colors.span(), [&](Gfx::Color const& color) {- return JS::PrimitiveString::create(realm.vm(), Utf16String::from_utf8(color.to_string()));- }),- JS::default_attributes);- return object;-}-void Internals::set_force_dark_enabled(bool enabled){auto& document = window().associated_document();@@ -1561,14 +1565,6 @@ Utf16String Internals::take_layout_trace()return Utf16String::from_utf8_without_validation(builder.string_view());}-WebIDL::UnsignedLongLong Internals::accumulated_visual_context_tree_build_count()-{- auto& document = window().associated_document();- if (!document.has_committed_viewport_box())- return 0;- return Layout::RustFFI::document_host_visual_context_tree_build_count(document.layout_node_arena().host());-}-void Internals::begin_display_list_trace(){auto& document = window().associated_document();@@ -2735,50 +2731,6 @@ void Internals::disconnect_audio_server()connection.value()->shutdown();}-DOM::Document::StyleInvalidationCounters const& Internals::style_invalidation_counters() const-{- return window().associated_document().style_invalidation_counters();-}--void Internals::reset_style_invalidation_counters()-{- Layout::ForcedReadScope read { window().associated_document() };- window().associated_document().reset_style_invalidation_counters(read);-}--GC::Ref<JS::Object> Internals::get_rendering_scheduler_counters() const-{- auto& realm = HTML::relevant_realm(window());- auto const& counters = HTML::main_thread_event_loop().rendering_scheduler_counters();- auto object = JS::Object::create(realm, nullptr);- object->define_direct_property("updateRequests"_utf16_fly_string, JS::Value(counters.update_requests), JS::default_attributes);- object->define_direct_property("coalescedUpdateRequests"_utf16_fly_string, JS::Value(counters.coalesced_update_requests), JS::default_attributes);- object->define_direct_property("updateRequestsWhileRendering"_utf16_fly_string, JS::Value(counters.update_requests_while_rendering), JS::default_attributes);- object->define_direct_property("opportunitiesReceived"_utf16_fly_string, JS::Value(counters.opportunities_received), JS::default_attributes);- object->define_direct_property("opportunitiesThatQueuedATask"_utf16_fly_string, JS::Value(counters.opportunities_that_queued_a_task), JS::default_attributes);- object->define_direct_property("watchdogOpportunities"_utf16_fly_string, JS::Value(counters.watchdog_opportunities), JS::default_attributes);- object->define_direct_property("updatesRun"_utf16_fly_string, JS::Value(counters.updates_run), JS::default_attributes);- object->define_direct_property("updatesSkippedAsUnnecessary"_utf16_fly_string, JS::Value(counters.updates_skipped_as_unnecessary), JS::default_attributes);- object->define_direct_property("updateMicroseconds"_utf16_fly_string, JS::Value(counters.update_microseconds), JS::default_attributes);- object->define_direct_property("tasksBetweenUpdates"_utf16_fly_string, JS::Value(counters.tasks_between_updates), JS::default_attributes);- object->define_direct_property("taskMicrosecondsBetweenUpdates"_utf16_fly_string, JS::Value(counters.task_microseconds_between_updates), JS::default_attributes);- object->define_direct_property("postedMessageTasksBetweenUpdates"_utf16_fly_string, JS::Value(counters.posted_message_tasks_between_updates), JS::default_attributes);- object->define_direct_property("postedMessageTaskMicrosecondsBetweenUpdates"_utf16_fly_string, JS::Value(counters.posted_message_task_microseconds_between_updates), JS::default_attributes);- object->define_direct_property("timerTasksBetweenUpdates"_utf16_fly_string, JS::Value(counters.timer_tasks_between_updates), JS::default_attributes);- object->define_direct_property("timerTaskMicrosecondsBetweenUpdates"_utf16_fly_string, JS::Value(counters.timer_task_microseconds_between_updates), JS::default_attributes);- object->define_direct_property("networkingTasksBetweenUpdates"_utf16_fly_string, JS::Value(counters.networking_tasks_between_updates), JS::default_attributes);- object->define_direct_property("networkingTaskMicrosecondsBetweenUpdates"_utf16_fly_string, JS::Value(counters.networking_task_microseconds_between_updates), JS::default_attributes);- object->define_direct_property("domManipulationTasksBetweenUpdates"_utf16_fly_string, JS::Value(counters.dom_manipulation_tasks_between_updates), JS::default_attributes);- object->define_direct_property("domManipulationTaskMicrosecondsBetweenUpdates"_utf16_fly_string, JS::Value(counters.dom_manipulation_task_microseconds_between_updates), JS::default_attributes);- object->define_direct_property("paints"_utf16_fly_string, JS::Value(counters.paints), JS::default_attributes);- return object;-}--void Internals::reset_rendering_scheduler_counters()-{- HTML::main_thread_event_loop().reset_rendering_scheduler_counters();-}-static void inject_clock_tick_at_scroll_offset(DOM::Document& document, double frame_time_ms, Layout::RustFFI::FfiScrollOffset const* scroll_offset){auto frame_time = document.relevant_settings_object().time_origin() + frame_time_ms;@@ -2933,12 +2885,18 @@ GC::Ptr<Geometry::DOMRect> Internals::presented_border_box(DOM::Element& elementreturn Geometry::DOMRect::create(rect.x().to_double(), rect.y().to_double(), rect.width().to_double(), rect.height().to_double());}-Optional<u32> Internals::presented_compositor_animation_count(DOM::Element& element)+Optional<Vector<String>> Internals::presented_compositor_animations(DOM::Element& element){- u32 count = 0;- if (!element.style_node_id() || !Layout::RustFFI::document_host_presented_compositor_animation_count(element.document().layout_node_arena().host(), element.style_node_id().value(), &count))+ u32 properties = 0;+ if (!element.style_node_id() || !Layout::RustFFI::document_host_presented_compositor_animation_properties(element.document().layout_node_arena().host(), element.style_node_id().value(), &properties))return {};- return count;+ static constexpr Array property_names { "opacity"sv, "background-color"sv, "filter"sv, "transform"sv };+ Vector<String> animated;+ for (size_t index = 0; index < property_names.size(); ++index) {+ if (properties & (1u << index))+ animated.append(MUST(String::from_utf8(property_names[index])));+ }+ return animated;}Optional<double> Internals::presented_opacity(DOM::Element& element)@@ -3193,6 +3151,24 @@ GC::Ref<JS::Object> Internals::style_engine_counters()JS::Value(static_cast<double>(value)),JS::default_attributes);}+ auto const& statistics = window().associated_document().style_update_statistics();+ struct NamedStatistic {+ StringView name;+ u64 value;+ };+ for (auto const& [key, value] : Array<NamedStatistic, 10> {+ NamedStatistic { "styleEngineReactionBatchRuns"sv, statistics.style_engine_reaction_batch_runs },+ NamedStatistic { "styleEngineReactionElements"sv, statistics.style_engine_reaction_elements },+ NamedStatistic { "styleEnginePublishedReactions"sv, statistics.style_engine_published_reactions },+ NamedStatistic { "styleEngineTransactionSetups"sv, statistics.style_engine_transaction_setups },+ NamedStatistic { "styleEngineTransactionSetupMicroseconds"sv, statistics.style_engine_transaction_setup_microseconds },+ NamedStatistic { "styleUpdateMicroseconds"sv, statistics.style_update_microseconds },+ NamedStatistic { "styleUpdateSubmissionMicroseconds"sv, statistics.style_update_submission_microseconds },+ NamedStatistic { "styleUpdateBridgeMicroseconds"sv, statistics.style_update_bridge_microseconds },+ NamedStatistic { "styleUpdateApplyMicroseconds"sv, statistics.style_update_apply_microseconds },+ NamedStatistic { "styleUpdateRemainderMicroseconds"sv, statistics.style_update_remainder_microseconds },+ })+ object->define_direct_property(Utf16FlyString::from_utf8(key), JS::Value(static_cast<double>(value)), JS::default_attributes);return object;}@@ -3215,6 +3191,16 @@ Vector<String> Internals::style_self_check()return lines;}+void Internals::begin_rendering_trace()+{+ HTML::main_thread_event_loop().begin_rendering_trace();+}++String Internals::take_rendering_trace()+{+ return HTML::main_thread_event_loop().take_rendering_trace();+}+void Internals::begin_style_trace(){// A script reads the render state, which waits for a frame in flight.@@ -3887,84 +3873,6 @@ GC::Ptr<JS::Object> Internals::hit_test_result(double x, double y)return nullptr;}-GC::Ref<JS::Object> Internals::style_invalidation_counters_object() const-{- Layout::ForcedReadScope read { window().associated_document() };- auto& realm = HTML::relevant_realm(window());- auto const& counters = style_invalidation_counters();- auto& document = window().associated_document();- auto object = JS::Object::create(realm, nullptr);- object->define_direct_property("styleEnvironmentVersion"_utf16_fly_string, JS::Value(window().associated_document().style_environment_version()), JS::default_attributes);- object->define_direct_property("styleEngineReactionBatchRuns"_utf16_fly_string, JS::Value(counters.style_engine_reaction_batch_runs), JS::default_attributes);- object->define_direct_property("styleEngineReactionElements"_utf16_fly_string, JS::Value(counters.style_engine_reaction_elements), JS::default_attributes);- object->define_direct_property("styleEnginePublishedReactions"_utf16_fly_string, JS::Value(counters.style_engine_published_reactions), JS::default_attributes);- object->define_direct_property("layoutStyleRecordPublications"_utf16_fly_string, JS::Value(counters.layout_style_record_publications), JS::default_attributes);- auto animated_style_samples = [&](bool rebuilt_every_group) {- return static_cast<double>(CSS::StyleEngineFFI::style_engine_animated_style_samples(document.style_computer().style_engine().host(), read, rebuilt_every_group, false));- };- object->define_direct_property("animatedStyleOverlayBuilds"_utf16_fly_string, JS::Value(animated_style_samples(false)), JS::default_attributes);- object->define_direct_property("animatedStyleFullBuilds"_utf16_fly_string, JS::Value(animated_style_samples(true)), JS::default_attributes);- object->define_direct_property("animationFramePumpRequests"_utf16_fly_string, JS::Value(counters.animation_frame_pump_requests), JS::default_attributes);- object->define_direct_property("animationStyleSkipCacheHits"_utf16_fly_string, JS::Value(counters.animation_style_skip_cache_hits), JS::default_attributes);- object->define_direct_property("animationStyleSkipCacheMisses"_utf16_fly_string, JS::Value(counters.animation_style_skip_cache_misses), JS::default_attributes);- object->define_direct_property("animationTimelineSynchronizations"_utf16_fly_string, JS::Value(counters.animation_timeline_synchronizations), JS::default_attributes);- object->define_direct_property("animationTimelineAssociatedAnimationUpdates"_utf16_fly_string, JS::Value(counters.animation_timeline_associated_animation_updates), JS::default_attributes);- object->define_direct_property("associatedAnimations"_utf16_fly_string, JS::Value(document.associated_animation_count()), JS::default_attributes);- object->define_direct_property("compositorVisualAnimationUpdates"_utf16_fly_string, JS::Value(counters.compositor_visual_animation_updates), JS::default_attributes);- object->define_direct_property("compositorVisualAnimationTimingAnchorUpdates"_utf16_fly_string, JS::Value(counters.compositor_visual_animation_timing_anchor_updates), JS::default_attributes);- object->define_direct_property("compositorKeyframeValueResolutions"_utf16_fly_string, JS::Value(counters.compositor_keyframe_value_resolutions), JS::default_attributes);- size_t compositor_visual_animation_count = 0;- Optional<double> compositor_visual_animation_local_time_at_anchor;- bool compositor_visual_animations_share_timing_anchor = true;- bool compositor_visual_animation_targets_are_valid = true;- if (document.has_committed_viewport_box() && document.paint_state().has_visual_context_tree(read)) {- auto visual_context_tree = document.paint_state().visual_context_tree(document);- auto summary = visual_context_tree.visual_animation_summary();- compositor_visual_animation_count = summary.count;- if (summary.count > 0)- compositor_visual_animation_local_time_at_anchor = summary.local_time_at_anchor_ms_of_first;- compositor_visual_animations_share_timing_anchor = summary.share_timing_anchor;- compositor_visual_animation_targets_are_valid = summary.targets_are_valid;- }- object->define_direct_property("compositorVisualAnimations"_utf16_fly_string, JS::Value(compositor_visual_animation_count), JS::default_attributes);- object->define_direct_property("compositorVisualAnimationLocalTimeAtAnchor"_utf16_fly_string, compositor_visual_animation_local_time_at_anchor.has_value() ? JS::Value(*compositor_visual_animation_local_time_at_anchor) : JS::js_null(), JS::default_attributes);- object->define_direct_property("compositorVisualAnimationsShareTimingAnchor"_utf16_fly_string, JS::Value(compositor_visual_animations_share_timing_anchor), JS::default_attributes);- object->define_direct_property("compositorVisualAnimationTargetsAreValid"_utf16_fly_string, JS::Value(compositor_visual_animation_targets_are_valid), JS::default_attributes);- auto document_timeline_current_time = document.timeline()->current_time();- object->define_direct_property("documentTimelineCurrentTime"_utf16_fly_string, document_timeline_current_time.has_value() ? JS::Value(document_timeline_current_time->value) : JS::js_null(), JS::default_attributes);- object->define_direct_property("compositorAnimationWakeupTimerActive"_utf16_fly_string, JS::Value(document.compositor_animation_wakeup_timer_is_active()), JS::default_attributes);- object->define_direct_property("compositorAnimationObservationTimerActive"_utf16_fly_string, JS::Value(document.compositor_animation_observation_timer_is_active()), JS::default_attributes);- object->define_direct_property("longhandWrappersMinted"_utf16_fly_string, JS::Value(CSS::longhand_wrappers_minted()), JS::default_attributes);- object->define_direct_property("styleStabilizationEpochs"_utf16_fly_string, JS::Value(counters.style_stabilization_epochs), JS::default_attributes);- object->define_direct_property("styleStabilizationFeedbackEpochs"_utf16_fly_string, JS::Value(counters.style_stabilization_feedback_epochs), JS::default_attributes);- object->define_direct_property("provisionalStylePasses"_utf16_fly_string, JS::Value(counters.provisional_style_passes), JS::default_attributes);- object->define_direct_property("styleStabilizationRoundGuardHits"_utf16_fly_string, JS::Value(counters.style_stabilization_round_guard_hits), JS::default_attributes);- object->define_direct_property("compositeOrderDocumentPositionCompares"_utf16_fly_string, JS::Value(counters.composite_order_document_position_compares), JS::default_attributes);- object->define_direct_property("styleUpdatePassGuardHits"_utf16_fly_string, JS::Value(counters.style_update_pass_guard_hits), JS::default_attributes);- object->define_direct_property("exactStabilizationPasses"_utf16_fly_string, JS::Value(counters.exact_stabilization_passes), JS::default_attributes);- object->define_direct_property("styleStabilizationBoundFailures"_utf16_fly_string, JS::Value(counters.style_stabilization_bound_failures), JS::default_attributes);- object->define_direct_property("provisionalAnimationEvents"_utf16_fly_string, JS::Value(counters.provisional_animation_events), JS::default_attributes);- object->define_direct_property("committedAnimationEvents"_utf16_fly_string, JS::Value(counters.committed_animation_events), JS::default_attributes);- object->define_direct_property("provisionalTransitionDecisions"_utf16_fly_string, JS::Value(counters.provisional_transition_decisions), JS::default_attributes);- object->define_direct_property("supersededProvisionalTransitionDecisions"_utf16_fly_string, JS::Value(counters.superseded_provisional_transition_decisions), JS::default_attributes);- object->define_direct_property("committedTransitionActions"_utf16_fly_string, JS::Value(counters.committed_transition_actions), JS::default_attributes);- object->define_direct_property("committedTransitionsStarted"_utf16_fly_string, JS::Value(counters.committed_transitions_started), JS::default_attributes);- object->define_direct_property("mediaRuleEvaluations"_utf16_fly_string, JS::Value(counters.media_rule_evaluations), JS::default_attributes);- object->define_direct_property("registeredPropertiesCacheRebuilds"_utf16_fly_string, JS::Value(counters.registered_properties_cache_rebuilds), JS::default_attributes);- object->define_direct_property("styleQueryContainerScans"_utf16_fly_string, JS::Value(counters.style_query_container_scans), JS::default_attributes);- object->define_direct_property("sizeQueryContainerScanVisits"_utf16_fly_string, JS::Value(CSS::StyleEngineFFI::style_engine_size_query_container_scan_visits(document.style_computer().style_engine().host(), read, false)), JS::default_attributes);- object->define_direct_property("styleEngineTransactionSetups"_utf16_fly_string, JS::Value(counters.style_engine_transaction_setups), JS::default_attributes);- object->define_direct_property("styleEngineTransactionSetupMicroseconds"_utf16_fly_string, JS::Value(counters.style_engine_transaction_setup_microseconds), JS::default_attributes);- object->define_direct_property("styleEnginePlanningMicroseconds"_utf16_fly_string, JS::Value(counters.style_update_bridge_microseconds), JS::default_attributes);- object->define_direct_property("styleUpdateMicroseconds"_utf16_fly_string, JS::Value(counters.style_update_microseconds), JS::default_attributes);- object->define_direct_property("styleUpdateSubmissionMicroseconds"_utf16_fly_string, JS::Value(counters.style_update_submission_microseconds), JS::default_attributes);- object->define_direct_property("styleUpdateBridgeMicroseconds"_utf16_fly_string, JS::Value(counters.style_update_bridge_microseconds), JS::default_attributes);- object->define_direct_property("styleUpdateApplyMicroseconds"_utf16_fly_string, JS::Value(counters.style_update_apply_microseconds), JS::default_attributes);- object->define_direct_property("styleUpdateRemainderMicroseconds"_utf16_fly_string, JS::Value(counters.style_update_remainder_microseconds), JS::default_attributes);- object->define_direct_property("scrollableOverflowRecalculations"_utf16_fly_string, JS::Value(Layout::RustFFI::render_state_scrollable_overflow_recalculation_count(document.layout_node_arena().host(), false)), JS::default_attributes);- return object;-}-GC::Ref<JS::Object> Internals::recorded_async_scrolling_state_object(){auto& document = window().associated_document();diff --git a/Libraries/LibWeb/Internals/Internals.h b/Libraries/LibWeb/Internals/Internals.hindex 77d470d60ad..e7c8a4c160f 100644--- a/Libraries/LibWeb/Internals/Internals.h+++ b/Libraries/LibWeb/Internals/Internals.h@@ -56,8 +56,8 @@ public:void set_force_dark_enabled(bool);void set_show_line_box_borders(bool);void set_force_dark_thresholds(i32, i32);- GC::Ref<JS::Object> visual_context_node_indices(DOM::Element&);Utf16String dump_visual_context_nodes(DOM::Element&);+ Utf16String dump_compositor_animations();void send_mismatched_visual_context_tree_update_to_compositor();WebIDL::ExceptionOr<void> load_reference_test_metadata();@@ -187,7 +187,6 @@ public:void begin_layout_trace(Bindings::LayoutTraceOptions const&);void update_layout_for_testing();Utf16String take_layout_trace();- WebIDL::UnsignedLongLong accumulated_visual_context_tree_build_count();void begin_display_list_trace();void begin_visual_context_trace();Utf16String take_visual_context_trace();@@ -299,11 +298,6 @@ public:void dismiss_notification_for_testing(NotificationsAPI::Notification&);u64 parser_non_append_insertions();- DOM::Document::StyleInvalidationCounters const& style_invalidation_counters() const;- GC::Ref<JS::Object> style_invalidation_counters_object() const;- void reset_style_invalidation_counters();- GC::Ref<JS::Object> get_rendering_scheduler_counters() const;- void reset_rendering_scheduler_counters();void set_manual_rendering_opportunities(bool enabled);void inject_rendering_opportunity(double frame_time_ms);Utf16String frame_scheduler_state() const;@@ -323,7 +317,7 @@ public:Utf16String presented_selection();Utf16String painted_selection();GC::Ptr<Geometry::DOMRect> presented_border_box(DOM::Element&);- Optional<u32> presented_compositor_animation_count(DOM::Element&);+ Optional<Vector<String>> presented_compositor_animations(DOM::Element&);Optional<double> presented_opacity(DOM::Element&);Optional<String> presented_color(DOM::Element&, Optional<Utf16String> const& pseudo_element);bool last_frame_keyboard_scroll_state_is_current();@@ -342,6 +336,8 @@ public:void panic_render_state_for_testing();Vector<String> style_self_check();void begin_style_trace();+ void begin_rendering_trace();+ String take_rendering_trace();Utf16String take_style_trace();Utf16String style_engine_matched_rules();Utf16String dump_style_records(GC::Ptr<DOM::Node> root, Bindings::StyleRecordsDumpOptions const&);diff --git a/Libraries/LibWeb/Internals/Internals.idl b/Libraries/LibWeb/Internals/Internals.idlindex 16946f6a474..91289395acc 100644--- a/Libraries/LibWeb/Internals/Internals.idl+++ b/Libraries/LibWeb/Internals/Internals.idl@@ -11,10 +11,13 @@ interface Internals {undefined setForceDarkEnabled(boolean enabled);undefined setShowLineBoxBorders(boolean enabled);undefined setForceDarkThresholds(long foreground, long background);- object visualContextNodeIndices(Element element);// The nodes of the visual context tree the box of the element owns, one per line as the tree dump describes them// with their indices, then whether the box needs a compositor effects layer or a compositor background-color frame.DOMString dumpVisualContextNodes(Element element);+ // The animations the compositor runs for the document, one per line, sorted, as the property it animates and the+ // element of the box it drives, then whether their timing anchors differ or one drives no live node, and which of+ // the document's compositor animation timers are armed.+ DOMString dumpCompositorAnimations();undefined sendMismatchedVisualContextTreeUpdateToCompositor();undefined loadReferenceTestMetadata();@@ -197,7 +200,6 @@ interface Internals {undefined beginLayoutTrace(optional LayoutTraceOptions options = {});undefined updateLayoutForTesting();DOMString takeLayoutTrace();- unsigned long long accumulatedVisualContextTreeBuildCount();undefined beginDisplayListTrace();DOMString takeDisplayListTrace();// Traces what the updates of the visual context tree do until takeVisualContextTrace(), which answers one block per@@ -341,13 +343,11 @@ interface Internals {// Returns the number of insertions that computed an explicit child offset instead of using the append sentinel.unsigned long long parserNonAppendInsertions();- // Returns a snapshot of the style engine counters exposed to LibWeb tests.- // Keys include styleEngineReactionBatchRuns, styleEnginePublishedReactions,- // elementStyleRecomputations, and styleEnvironmentVersion.- [ImplementedAs=style_invalidation_counters_object] object getStyleInvalidationCounters();- undefined resetStyleInvalidationCounters();- object getRenderingSchedulerCounters();- undefined resetRenderingSchedulerCounters();+ // Records what the rendering of the window agent does until takeRenderingTrace(), one event per line, a run of the+ // same event as one line with how many times it ran: rendering update requests, opportunities, updates and paints,+ // and the animation, compositor, style stabilization and environment work of its documents.+ undefined beginRenderingTrace();+ DOMString takeRenderingTrace();undefined setManualRenderingOpportunities(boolean enabled);undefined injectRenderingOpportunity(double frameTimeMs);// Hands the clock lanes of the current document a tick at the given time, and waits until it has run.@@ -389,9 +389,9 @@ interface Internals {DOMString paintedSelection();// The border box of the element in the last frame a clock tick presented.DOMRect? presentedBorderBox(Element element);- // How many compositor animations drove the box of the element in the last frame a clock tick presented, or null- // where the frame showed no border box of it.- unsigned long? presentedCompositorAnimationCount(Element element);+ // The properties compositor animations drove on the box of the element in the last frame a clock tick presented, or+ // null where the frame showed no border box of it.+ sequence<DOMString>? presentedCompositorAnimations(Element element);// The opacity the visual contexts of the box of the element gave it in the last frame a clock tick presented, or// null where the frame showed no border box of it.double? presentedOpacity(Element element);@@ -427,6 +427,8 @@ interface Internals {// returns { matches }, plus { incremental, full } on mismatch. This is a test oracle for// incremental tree builds.object compareLayoutTreeWithFullRebuild();+ // What the style engine and the style updates of the document counted and measured, for the style update capture+ // tools. Tests do not read it: traces and dumps say what the engine did.object styleEngineCounters();// What the document's style engine holds on the heap, by owner, with the C++ style state its elements hold:// { owners: { name: bytes }, elements, styledElements }.diff --git a/Libraries/LibWeb/Layout/Node.cpp b/Libraries/LibWeb/Layout/Node.cppindex bf9092b8271..4051c36d159 100644--- a/Libraries/LibWeb/Layout/Node.cpp+++ b/Libraries/LibWeb/Layout/Node.cpp@@ -652,7 +652,6 @@ void NodeWithStyle::publish_style_record_to_node_data()auto const installed = RustFFI::render_state_installed_style_record(document_host(), slot_id(this));VERIFY(installed == 0 || installed == m_style_record_identity.value());}- ++document().style_invalidation_counters().layout_style_record_publications;auto const style = document().style_computer().install_style(held_read(), m_style_record_identity);VERIFY(style);m_style_record = style.groups();diff --git a/Libraries/LibWeb/Layout/UpdateLayout.cpp b/Libraries/LibWeb/Layout/UpdateLayout.cppindex ee07aae10af..5a2dd6b9376 100644--- a/Libraries/LibWeb/Layout/UpdateLayout.cpp+++ b/Libraries/LibWeb/Layout/UpdateLayout.cpp@@ -87,7 +87,6 @@ Layout::RustFFI::FfiLayoutUpdateHostCallbacks Document::layout_update_host_callb.evaluate_pending_container_queries = [](void* context, Layout::BegunRead const* read) { static_cast<Document*>(context)->style_computer().style_engine().evaluate_size_containers_needing_evaluation_after_layout(*read); },.record_stabilization_bound_failure = [](void* context, Layout::BegunRead const* read) -> Layout::RustFFI::FfiStabilizationBoundFailureHostFacts {auto& document = *static_cast<Document*>(context);- ++document.m_style_invalidation_counters.style_stabilization_bound_failures;auto navigable = document.navigable();return {.document_is_top_level = navigable && navigable->is_top_level_traversable(),diff --git a/Libraries/LibWeb/Painting/CompositorAnimationEffectState.cpp b/Libraries/LibWeb/Painting/CompositorAnimationEffectState.cppindex acaa0bf1b77..8718eeb68cc 100644--- a/Libraries/LibWeb/Painting/CompositorAnimationEffectState.cpp+++ b/Libraries/LibWeb/Painting/CompositorAnimationEffectState.cpp@@ -14,6 +14,7 @@#include <LibWeb/DOM/AbstractElement.h>#include <LibWeb/DOM/Document.h>#include <LibWeb/DOM/Element.h>+#include <LibWeb/HTML/EventLoop/EventLoop.h>#include <LibWeb/Layout/LayoutRustFFI.h>#include <LibWeb/Layout/Node.h>#include <LibWeb/Page/Page.h>@@ -116,7 +117,7 @@ CompositorAnimationKeyframes::~CompositorAnimationKeyframes() = default;static RefPtr<CSS::StyleValue const> resolved_compositor_animation_style_value(Layout::BegunRead const& read, CSS::PropertyID property_id, CSS::RustStyleValueHandle const& value, DOM::AbstractElement target){- ++target.document().style_invalidation_counters().compositor_keyframe_value_resolutions;+ HTML::note_rendering_trace_event("compositor keyframe values resolved"sv);auto style_value = CSS::StyleValue::adopt_rust_style_value_data(CSS::StyleValueFFI::rust_style_value_retain(value.data()));if (style_value->is_unresolved()) {// The engine substitutes the value as a sample on the main thread would, against the custom properties thediff --git a/Libraries/LibWeb/Painting/DocumentPaintState.cpp b/Libraries/LibWeb/Painting/DocumentPaintState.cppindex d4feeb13bf9..b86006a00c2 100644--- a/Libraries/LibWeb/Painting/DocumentPaintState.cpp+++ b/Libraries/LibWeb/Painting/DocumentPaintState.cpp@@ -11,6 +11,7 @@#include <LibWeb/DOM/Range.h>#include <LibWeb/DOM/Text.h>#include <LibWeb/Editing/SpellingMarkers.h>+#include <LibWeb/HTML/EventLoop/EventLoop.h>#include <LibWeb/HTML/LocalNavigable.h>#include <LibWeb/HTML/Window.h>#include <LibWeb/Layout/TextNode.h>@@ -91,23 +92,23 @@ void DocumentPaintState::begin_compositor_animation_update()Layout::RustFFI::render_state_begin_compositor_animation_update(m_layout_node_arena->host());}-void DocumentPaintState::publish_compositor_animations(Layout::BegunRead const& read, DOM::Document& document, PublishPendingCompositorAnimations publish_pending)+void DocumentPaintState::publish_compositor_animations(Layout::BegunRead const& read, PublishPendingCompositorAnimations publish_pending){auto outcome = Layout::RustFFI::render_state_publish_compositor_animations(m_layout_node_arena->host(), &read, publish_pending == PublishPendingCompositorAnimations::Yes);if (!outcome.published)return;if (outcome.parameters_changed)- ++document.style_invalidation_counters().compositor_visual_animation_updates;+ HTML::note_rendering_trace_event("compositor animations updated"sv);if (outcome.timing_anchors_changed)- ++document.style_invalidation_counters().compositor_visual_animation_timing_anchor_updates;+ HTML::note_rendering_trace_event("compositor animation timing anchor updated"sv);}-void DocumentPaintState::republish_visual_animations(Layout::BegunRead const& read, DOM::Document& document)+void DocumentPaintState::republish_visual_animations(Layout::BegunRead const& read){if (!Layout::RustFFI::render_state_visual_context_tree_has_visual_animations(m_layout_node_arena->host(), &read))return;did_update_visual_context_values();- ++document.style_invalidation_counters().compositor_visual_animation_updates;+ HTML::note_rendering_trace_event("compositor animations updated"sv);}void DocumentPaintState::append_paint_command_cache_source_resources(Compositing::DisplayListResourceSet& retained_resources) constdiff --git a/Libraries/LibWeb/Painting/DocumentPaintState.h b/Libraries/LibWeb/Painting/DocumentPaintState.hindex 83a87321357..72414647657 100644--- a/Libraries/LibWeb/Painting/DocumentPaintState.h+++ b/Libraries/LibWeb/Painting/DocumentPaintState.h@@ -48,8 +48,8 @@ public:No,Yes,};- void publish_compositor_animations(Layout::BegunRead const& read, DOM::Document&, PublishPendingCompositorAnimations);- void republish_visual_animations(Layout::BegunRead const& read, DOM::Document&);+ void publish_compositor_animations(Layout::BegunRead const& read, PublishPendingCompositorAnimations);+ void republish_visual_animations(Layout::BegunRead const& read);// Whether the visual context tree changed since a frame last took it to the compositor, which the caller's frame now// does.bool take_visual_context_tree_compositor_update(Layout::BegunRead const& read);diff --git a/Libraries/LibWeb/Painting/PaintingRustBridge.cpp b/Libraries/LibWeb/Painting/PaintingRustBridge.cppindex 7eb04731bd5..05468308445 100644--- a/Libraries/LibWeb/Painting/PaintingRustBridge.cpp+++ b/Libraries/LibWeb/Painting/PaintingRustBridge.cpp@@ -202,19 +202,6 @@ static Layout::RustFFI::DocumentHost* document_host(DOM::Document const& documenreturn const_cast<DOM::Document&>(document).layout_node_arena().host();}-Vector<u32> rust_owned_visual_context_node_indices(Layout::Node const& layout_node, Layout::RustFFI::FfiVisualContextBoxNodeList list)-{- Vector<u32> indices;- if (!has_committed_box(layout_node))- return indices;- auto* host = layout_node.document_host();- auto slot = committed_row_slot(layout_node);- indices.resize(Layout::RustFFI::render_state_paintable_visual_context_node_count(host, slot, list));- if (!indices.is_empty())- Layout::RustFFI::render_state_paintable_visual_context_copy_node_indices(host, slot, list, indices.span());- return indices;-}-bool rust_background_color_can_be_compositor_animated(Layout::Node const& layout_node){if (!has_committed_box(layout_node))diff --git a/Libraries/LibWeb/Painting/PaintingRustBridge.h b/Libraries/LibWeb/Painting/PaintingRustBridge.hindex b5e657e2c5e..f19607d71b3 100644--- a/Libraries/LibWeb/Painting/PaintingRustBridge.h+++ b/Libraries/LibWeb/Painting/PaintingRustBridge.h@@ -36,7 +36,6 @@ WEB_API void dump_stacking_context_tree(Layout::BegunRead const&, StringBuilder&WEB_API void dump_layout_tree(StringBuilder&, Layout::Node const&, bool interactive);WEB_API Compositing::RustFFI::FfiVisualContextTreeInputs visual_context_tree_inputs(DOM::Document&);-WEB_API Vector<u32> rust_owned_visual_context_node_indices(Layout::Node const&, Layout::RustFFI::FfiVisualContextBoxNodeList);WEB_API bool rust_background_color_can_be_compositor_animated(Layout::Node const&);WEB_API void const* retain_rust_main_visual_context_tree(Layout::BegunRead const&, DOM::Document const&);WEB_API Layout::RustFFI::FfiPhysicalOverflowDirections rust_physical_overflow_directions(Layout::Node const&);diff --git a/Libraries/LibWeb/Rust/src/css/style/boundary.rs b/Libraries/LibWeb/Rust/src/css/style/boundary.rsindex 0a795a0d81a..c47c39b8457 100644--- a/Libraries/LibWeb/Rust/src/css/style/boundary.rs+++ b/Libraries/LibWeb/Rust/src/css/style/boundary.rs@@ -524,10 +524,7 @@ style_boundary! {let entries = retained.live_counters.trace_entries(&retained.projection, root);entries.get(index as usize).copied().unwrap_or(0)});- animated_style_samples(rebuilt_every_group: bool, reset: bool) -> u64 =>- engine.retained.live_counters.animated_samples(rebuilt_every_group, reset);layer_index(tree_scope: TreeScopeID, layer: CascadeLayerID) -> u32;- size_query_container_scan_visits(reset: bool) -> u64;ensure_random_base_value(node: Option<StyleNodeID>, name: FfiSpan<u16>, element_shared: bool) -> u64 => {// SAFETY: The host lends the name for the call.let name = unsafe { borrow(name.data, name.size) };diff --git a/Libraries/LibWeb/Rust/src/css/style/pipeline/counters.rs b/Libraries/LibWeb/Rust/src/css/style/pipeline/counters.rsindex c695dabfc7c..32337beafef 100644--- a/Libraries/LibWeb/Rust/src/css/style/pipeline/counters.rs+++ b/Libraries/LibWeb/Rust/src/css/style/pipeline/counters.rs@@ -324,17 +324,13 @@ impl OutcomeCounts {}}-/// What the engine did on a document's render state, the passes it ran while a test traces them,-/// and how often the host composed animations over records.+/// What the engine did on a document's render state, and the passes it ran while a test traces+/// them.#[derive(Clone, Default)]pub(in super::super) struct Counters {counts: [u64; StyleCounter::COUNT],/// A fork starts without one: it restyles nothing until the host moves on under it.trace: crate::fork::ForkReset<Option<Box<StyleTrace>>>,- /// The animation samples the host composed over the record an element installed, by whether- /// composing them rebuilt every group of the record or only the ones they write. These are- /// reset with the host's style invalidation counters, not with the others.- animated_samples: [u64; 2],}impl Counters {@@ -468,7 +464,6 @@ impl Counters {/// Note that the host composed an animation sample over the record `node` installed,/// rebuilding every group of it where `rebuilt_every_group` is.pub(in super::super) fn note_animated_sample(&mut self, node: StyleNodeID, rebuilt_every_group: bool) {- self.animated_samples[usize::from(rebuilt_every_group)] += 1;if let Some(trace) = &mut *self.trace {let outcome = match rebuilt_every_group {true => TracedOutcome::SampledEveryGroup,@@ -486,15 +481,4 @@ impl Counters {trace.entries = None;}}-- /// How many animation samples the host composed, of those that rebuilt every group where- /// `rebuilt_every_group` is, zeroing the count where `reset` is.- pub(in super::super) fn animated_samples(&mut self, rebuilt_every_group: bool, reset: bool) -> u64 {- let count = &mut self.animated_samples[usize::from(rebuilt_every_group)];- let answer = *count;- if reset {- *count = 0;- }- answer- }}diff --git a/Libraries/LibWeb/Rust/src/css/style/size_container_invalidation.rs b/Libraries/LibWeb/Rust/src/css/style/size_container_invalidation.rsindex fe9b8f0f9fa..426883161b7 100644--- a/Libraries/LibWeb/Rust/src/css/style/size_container_invalidation.rs+++ b/Libraries/LibWeb/Rust/src/css/style/size_container_invalidation.rs@@ -175,6 +175,7 @@ impl StyleEngine {}/// The elements the dependent walks have visited, optionally starting the count again.+ #[cfg(test)]pub fn size_query_container_scan_visits(&mut self, reset: bool) -> u64 {let visits = &mut self.retained.size_container_queries.scan_visits;if reset { std::mem::take(visits) } else { *visits }diff --git a/Libraries/LibWeb/Rust/src/layout/fragment_overflow.rs b/Libraries/LibWeb/Rust/src/layout/fragment_overflow.rsindex 6bac5edca5a..3054d0be27e 100644--- a/Libraries/LibWeb/Rust/src/layout/fragment_overflow.rs+++ b/Libraries/LibWeb/Rust/src/layout/fragment_overflow.rs@@ -786,7 +786,6 @@ impl LayoutNodeArena {if self.scrollable_overflow.recalculation_requests.is_empty() {return;}- self.scrollable_overflow.recalculations += 1;let requests = std::mem::take(&mut self.scrollable_overflow.recalculation_requests);let mut queued = crate::fast_hash::FastSet::default();let mut queue = std::collections::BinaryHeap::new();diff --git a/Libraries/LibWeb/Rust/src/painting/display_list/dump.rs b/Libraries/LibWeb/Rust/src/painting/display_list/dump.rsindex 9ee39bb3991..bad60332b23 100644--- a/Libraries/LibWeb/Rust/src/painting/display_list/dump.rs+++ b/Libraries/LibWeb/Rust/src/painting/display_list/dump.rs@@ -116,6 +116,64 @@ impl VisualContextNodeOwners {}}+/// Hands `append_line` each animation the compositor runs for the document of `host`, in the order the tree holds+/// them: the property it animates (0 for opacity, 1 for background color, 2 for filter, 3 for transform) and the element+/// of the box owning the node it drives, or zero. Answers, in bit 0, whether the animations share one timing anchor and,+/// in bit 1, whether every one drives a live node.+///+/// # Safety+///+/// `host` must be a live document host, on its document's thread, and `append_line` must return before the next call.+#[unsafe(no_mangle)]+pub unsafe extern "C" fn render_state_dump_compositor_animations(+ host: &crate::render_state::DocumentHost,+ read: &crate::render_state::BegunRead,+ viewport: NodeSlotId,+ context: *mut c_void,+ append_line: unsafe extern "C" fn(*mut c_void, u8, u32),+) -> u8 {+ use crate::painting::host::FfiVisualAnimationTargetKind;+ let (lines, flags) = crate::painting::ffi::read_arena(host, read, viewport, |arena, viewport| {+ let Some(tree) = arena.paint_state().visual_context.tree.clone() else {+ return (Vec::new(), 3);+ };+ let owners = VisualContextNodeOwners::collect(arena, viewport);+ let lines = tree+ .visual_animations()+ .iter()+ .map(|animation| {+ let kind = match animation.target_kind {+ FfiVisualAnimationTargetKind::Opacity => 0,+ FfiVisualAnimationTargetKind::BackgroundColor => 1,+ FfiVisualAnimationTargetKind::Filter => 2,+ FfiVisualAnimationTargetKind::Transform => 3,+ };+ let slot_kind = match animation.target_kind {+ FfiVisualAnimationTargetKind::Transform => SlotKind::Spatial,+ _ => SlotKind::Effect,+ };+ let element = animation+ .node_indices+ .first()+ .and_then(|&index| owners.owner(slot_kind, index))+ .and_then(|slot| arena.node_style_node(slot))+ .map_or(0, |element| element.raw());+ (kind, element)+ })+ .collect::<Vec<_>>();+ let summary = tree.visual_animation_summary();+ (+ lines,+ u8::from(summary.share_timing_anchor) | (u8::from(summary.targets_are_valid) << 1),+ )+ });+ for (kind, element) in lines {+ // SAFETY: Guaranteed by the caller.+ unsafe { append_line(context, kind, element) };+ }+ flags+}+/// # Safety////// `host` must be a live document host, on its document's thread, and `visual_context_tree` a live retained treediff --git a/Libraries/LibWeb/Rust/src/painting/ffi.rs b/Libraries/LibWeb/Rust/src/painting/ffi.rsindex c46afa8af1b..5d1dba3344f 100644--- a/Libraries/LibWeb/Rust/src/painting/ffi.rs+++ b/Libraries/LibWeb/Rust/src/painting/ffi.rs@@ -189,12 +189,6 @@ pub extern "C" fn document_host_note_visual_context_tree_needs_compositor_update.set(true);}-/// How many times the visual context tree of `host`'s document was built anew.-#[unsafe(no_mangle)]-pub extern "C" fn document_host_visual_context_tree_build_count(host: &DocumentHost) -> u64 {- host.paint_preparation().visual_context_tree_build_count.get()-}-/// Has `host` forget its document's scroll state and the visual context tree changes left for the compositor, as the/// viewport's row or the document's paint state starts over.#[unsafe(no_mangle)]diff --git a/Libraries/LibWeb/Rust/src/painting/ffi/main_thread_entries.rs b/Libraries/LibWeb/Rust/src/painting/ffi/main_thread_entries.rsindex 4d1c44680cb..9330cdd0fa9 100644--- a/Libraries/LibWeb/Rust/src/painting/ffi/main_thread_entries.rs+++ b/Libraries/LibWeb/Rust/src/painting/ffi/main_thread_entries.rs@@ -496,54 +496,6 @@ pub unsafe extern "C" fn render_state_sticky_device_offset(true}-/// The visual context nodes of `list` that the box in `slot` of `host`'s document owns, as the prepared tree has them.-fn paintable_visual_context_node_indices(- host: &crate::render_state::DocumentHost,- slot: NodeSlotId,- list: crate::painting::host::FfiVisualContextBoxNodeList,-) -> Vec<u32> {- read_arena(host, super::node_read(), (slot, list), |arena, (slot, list)| {- use crate::painting::host::FfiVisualContextBoxNodeList;- arena.with_paintable_visual_context_node_handles(slot, |handles| -> Vec<u32> {- match list {- FfiVisualContextBoxNodeList::SpatialNodes => handles.spatial.iter().map(|index| index.0).collect(),- FfiVisualContextBoxNodeList::ClipNodes => handles.clip_handles().map(|index| index.0).collect(),- FfiVisualContextBoxNodeList::EffectNodes => handles.effects.iter().map(|index| index.0).collect(),- }- })- })-}--/// # Safety-///-/// `host` must be a live document host, on its document's thread.-#[unsafe(no_mangle)]-pub unsafe extern "C" fn render_state_paintable_visual_context_node_count(- host: &crate::render_state::DocumentHost,- slot: NodeSlotId,- list: crate::painting::host::FfiVisualContextBoxNodeList,-) -> usize {- // SAFETY: Guaranteed by the caller.- unsafe { prepare_paint_properties(host, host.begun_read_of_held_node(super::node_read())) };- paintable_visual_context_node_indices(host, slot, list).len()-}--/// # Safety-///-/// `host` must be a live document host, on its document's thread.-#[unsafe(no_mangle)]-pub unsafe extern "C" fn render_state_paintable_visual_context_copy_node_indices(- host: &crate::render_state::DocumentHost,- slot: NodeSlotId,- list: crate::painting::host::FfiVisualContextBoxNodeList,- out: ak::SpanMut<'_, u32>,-) {- // SAFETY: Guaranteed by the caller.- unsafe { prepare_paint_properties(host, host.begun_read_of_held_node(super::node_read())) };- let indices = paintable_visual_context_node_indices(host, slot, list);- out.into_slice()[..indices.len()].copy_from_slice(&indices);-}-/// Hands `append_line` each node of the prepared visual context tree the box in `slot` owns, as the tree dump describes/// it: its kind (0 for spatial, 1 for clip, 2 for effect), its index and its description.///diff --git a/Libraries/LibWeb/Rust/src/painting/host/visual_context.rs b/Libraries/LibWeb/Rust/src/painting/host/visual_context.rsindex 330b9cc00af..45f5a90647e 100644--- a/Libraries/LibWeb/Rust/src/painting/host/visual_context.rs+++ b/Libraries/LibWeb/Rust/src/painting/host/visual_context.rs@@ -30,16 +30,6 @@ impl VisualContextUpdateScope {}}-#[derive(Clone, Copy, Debug, PartialEq, Eq)]-#[repr(u8)]-#[expect(dead_code, reason = "C++ constructs the variants")]-#[expect(clippy::enum_variant_names, reason = "C++ names the variants")]-pub enum FfiVisualContextBoxNodeList {- SpatialNodes,- ClipNodes,- EffectNodes,-}-#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]#[repr(u8)]#[expect(dead_code, reason = "C++ constructs the variants")]diff --git a/Libraries/LibWeb/Rust/src/painting/paint_passes.rs b/Libraries/LibWeb/Rust/src/painting/paint_passes.rsindex a7c779e4166..025eafc250e 100644--- a/Libraries/LibWeb/Rust/src/painting/paint_passes.rs+++ b/Libraries/LibWeb/Rust/src/painting/paint_passes.rs@@ -346,9 +346,6 @@ pub(crate) struct PaintPreparationNotes {pub(crate) visual_contexts_need_update: Cell<bool>,/// Whether the visual context tree changed since a frame last took it to the compositor.pub(crate) visual_context_tree_needs_compositor_update: Cell<bool>,- /// How many times the preparations built the visual context tree anew, which tests read through Internals as- /// differences.- pub(crate) visual_context_tree_build_count: Cell<u64>,}/// The document's viewport row, where its box is committed.@@ -474,10 +471,6 @@ fn update_visual_contexts();}let notes = host.paint_preparation();- if outcome.performed_full_build {- let count = ¬es.visual_context_tree_build_count;- count.set(count.get() + 1);- }if outcome.requires_display_list_recording || svg_paint_resources_changed {callbacks.require_display_list_recording(main_thread, false);}diff --git a/Libraries/LibWeb/Rust/src/painting/scrollable_overflow.rs b/Libraries/LibWeb/Rust/src/painting/scrollable_overflow.rsindex e33d0c02286..2524ba7ed7e 100644--- a/Libraries/LibWeb/Rust/src/painting/scrollable_overflow.rs+++ b/Libraries/LibWeb/Rust/src/painting/scrollable_overflow.rs@@ -99,7 +99,6 @@ pub(crate) struct ScrollableOverflowState {pub(crate) scroll_offset_clamp_candidates: Vec<NodeSlotId>,pub(crate) geometry_changed: bool,pub(crate) scrollability_changed: bool,- pub(crate) recalculations: u64,}impl ScrollableOverflowState {diff --git a/Libraries/LibWeb/Rust/src/render_state/clock.rs b/Libraries/LibWeb/Rust/src/render_state/clock.rsindex 13811347330..8371e754fbd 100644--- a/Libraries/LibWeb/Rust/src/render_state/clock.rs+++ b/Libraries/LibWeb/Rust/src/render_state/clock.rs@@ -951,14 +951,14 @@ impl ClockTicks {.find_map(|&(presented, rect)| (presented == element).then_some(rect))}- /// How many compositor animations drove the box of `element` in the last frame a tick presented, where the frame- /// showed its border box.- pub(super) fn presented_compositor_animation_count(&self, element: StyleNodeID) -> Option<u32> {+ /// The properties compositor animations drove on the box of `element` in the last frame a tick presented, one bit+ /// each in the order of `FfiVisualAnimationTargetKind`, where the frame showed its border box.+ pub(super) fn presented_compositor_animation_properties(&self, element: StyleNodeID) -> Option<u32> {let presented = self.presented_boxes.lock().expect("presented boxes");presented.compositor_animations.iter()- .find_map(|&(presented, count, _)| (presented == element).then_some(count))+ .find_map(|&(presented, properties, _)| (presented == element).then_some(properties))}/// The opacity the effect nodes of the box of `element` gave it in the last frame a tick presented, where the frame@@ -1725,11 +1725,13 @@ impl Lane {self.presented_compositor_animations.extend(self.presented_border_boxes.iter().map(|&(element, _)| {let nodes = arena.box_animation_nodes(arena.bound_row(element));- let count = tree+ let properties = tree.visual_animations().iter().filter(|animation| nodes.driven_by(animation))- .count();+ .fold(0u32, |properties, animation| {+ properties | 1 << animation.target_kind as u32+ });let opacity = nodes.effects.iter()@@ -1737,7 +1739,7 @@ impl Lane {tree.effects_opacity(crate::painting::visual_context::EffectNodeIndex(node))}).product();- (element, count as u32, opacity)+ (element, properties, opacity)}));}self.presented_colors.clear();@@ -2115,21 +2117,22 @@ pub extern "C" fn document_host_mouse_event_is_outdated(host: &DocumentHost, inpoutdated}-/// Writes how many compositor animations drove the box of `element` in the last frame a tick of a lane of `host`'s-/// document presented to `count`, and answers whether the frame showed the box's border box. For a test.+/// Writes the properties compositor animations drove on the box of `element` in the last frame a tick of a lane of+/// `host`'s document presented to `properties`, one bit each in the order of `FfiVisualAnimationTargetKind`, and answers+/// whether the frame showed the box's border box. For a test.#[unsafe(no_mangle)]-pub extern "C" fn document_host_presented_compositor_animation_count(+pub extern "C" fn document_host_presented_compositor_animation_properties(host: &DocumentHost,element: u32,- count: &mut u32,+ properties: &mut u32,) -> bool {super::wait_for_render_side();let Some(presented) = StyleNodeID::from_raw(element)- .and_then(|element| host.clock_ticks().presented_compositor_animation_count(element))+ .and_then(|element| host.clock_ticks().presented_compositor_animation_properties(element))else {return false;};- *count = presented;+ *properties = presented;true}diff --git a/Libraries/LibWeb/Rust/src/render_state/devtools.rs b/Libraries/LibWeb/Rust/src/render_state/devtools.rsindex 18695c1788b..01ed3cb192a 100644--- a/Libraries/LibWeb/Rust/src/render_state/devtools.rs+++ b/Libraries/LibWeb/Rust/src/render_state/devtools.rs@@ -36,16 +36,3 @@ fn read_arena<R>(host: &DocumentHost, read: impl FnOnce(&mut LayoutNodeArena) ->pub extern "C" fn render_state_live_slot_count(host: &DocumentHost) -> u64 {read_arena(host, |arena| arena.live_slot_count().into())}--/// How many times scrollable overflow was recalculated outside layout, counting from zero again where `reset`.-#[unsafe(no_mangle)]-pub extern "C" fn render_state_scrollable_overflow_recalculation_count(host: &DocumentHost, reset: bool) -> u64 {- read_arena(host, |arena| {- let recalculations = &mut arena.scrollable_overflow.recalculations;- if reset {- std::mem::take(recalculations)- } else {- *recalculations- }- })-}diff --git a/Meta/StyleUpdateCapture/README.md b/Meta/StyleUpdateCapture/README.mdindex 78852068769..1cb3ba592c6 100644--- a/Meta/StyleUpdateCapture/README.md+++ b/Meta/StyleUpdateCapture/README.md@@ -21,7 +21,7 @@ Two ledgers, each additive on its own and never to be summed with the other.boundary: `transactionMicroseconds` is exactly the sum of `commitMicroseconds` and`transactionRemainderMicroseconds`.-`internals.getStyleInvalidationCounters()` reports the C++ side, where+The same object reports the C++ side, where`styleUpdateMicroseconds` is the sum of `styleUpdateSubmissionMicroseconds`,`styleUpdateBridgeMicroseconds`, `styleUpdateApplyMicroseconds` and`styleUpdateRemainderMicroseconds`. The transaction clocks above subdividediff --git a/Meta/StyleUpdateCapture/stylebench.js b/Meta/StyleUpdateCapture/stylebench.jsindex 3196c29dbf5..b1a56e408b5 100644--- a/Meta/StyleUpdateCapture/stylebench.js+++ b/Meta/StyleUpdateCapture/stylebench.js@@ -9,7 +9,7 @@const capture = (window.styleUpdateCapture = { samples: [], done: false, started: false, expected: [] });const snapshot = window => ({rust: window.internals.styleEngineCounters(),- cpp: window.internals.getStyleInvalidationCounters(),+ cpp: window.internals.styleEngineCounters(),});const zero = value =>Object.fromEntries(diff --git a/Meta/measure-style-scale.py b/Meta/measure-style-scale.pyindex 45b5523d8de..96f825da17a 100644--- a/Meta/measure-style-scale.py+++ b/Meta/measure-style-scale.py@@ -60,13 +60,13 @@ function difference(after, before, names) {function toggle(active) {const graphBefore = internals.styleEngineCounters();- const styleBefore = internals.getStyleInvalidationCounters();+ const styleBefore = internals.styleEngineCounters();const wallBefore = performance.now();target.classList.toggle('active', active);target.offsetWidth;const wallMicroseconds = (performance.now() - wallBefore) * 1000;const graphAfter = internals.styleEngineCounters();- const styleAfter = internals.getStyleInvalidationCounters();+ const styleAfter = internals.styleEngineCounters();return {wallMicroseconds,styleUpdateMicroseconds: styleAfter.styleUpdateMicroseconds - styleBefore.styleUpdateMicroseconds,diff --git a/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-keeps-compositor-animations-of-a-restructured-tree.txt b/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-keeps-compositor-animations-of-a-restructured-tree.txtindex 0cd22e19e83..6bf1fe95bf1 100644--- a/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-keeps-compositor-animations-of-a-restructured-tree.txt+++ b/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-keeps-compositor-animations-of-a-restructured-tree.txt@@ -1,3 +1,4 @@last frame presented by: clock-compositor animations of #a: null-compositor animations of #b: 0+compositor animations of #b: []+nodes of #b once the host took the hover in: transform=[1,0,0,1,10,0] origin=(50,25)+compositor animations once the host restructured the tree: transform div#a.moveddiff --git a/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-stops-a-finished-compositor-animation-a-hover-moves.txt b/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-stops-a-finished-compositor-animation-a-hover-moves.txtindex b464a06b265..3971d1f905b 100644--- a/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-stops-a-finished-compositor-animation-a-hover-moves.txt+++ b/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-stops-a-finished-compositor-animation-a-hover-moves.txt@@ -1,3 +1,3 @@-compositor animations of the box as the hover moves its opacity: 0+compositor animations of the box as the hover moves its opacity: []box opacity: 0.6000000238418579last frame presented by: clockdiff --git a/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-stops-a-finished-compositor-animation-it-samples-over.txt b/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-stops-a-finished-compositor-animation-it-samples-over.txtindex 20a4e80320c..4fac8e4fd37 100644--- a/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-stops-a-finished-compositor-animation-it-samples-over.txt+++ b/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-stops-a-finished-compositor-animation-it-samples-over.txt@@ -1,3 +1,3 @@-compositor animations of the box as the hover starts its transition: 0+compositor animations of the box as the hover starts its transition: []box opacity halfway through: 0.4000000059604645last frame presented by: clockdiff --git a/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-stops-compositor-animations-of-cancelled-transitions.txt b/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-stops-compositor-animations-of-cancelled-transitions.txtindex 923a8ad9d17..94bfca81e97 100644--- a/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-stops-compositor-animations-of-cancelled-transitions.txt+++ b/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-stops-compositor-animations-of-cancelled-transitions.txt@@ -1,3 +1,3 @@transitions the main thread runs before the hover: 1-compositor animations of the box as the hover cancels the transition: 0+compositor animations of the box as the hover cancels the transition: []last frame presented by: clockdiff --git a/Tests/LibWeb/Text/expected/HTML/frame-in-flight/style-flight-compositor-animation-wakeup.txt b/Tests/LibWeb/Text/expected/HTML/frame-in-flight/style-flight-compositor-animation-wakeup.txtindex bcb4d3ec023..40284e76c9f 100644--- a/Tests/LibWeb/Text/expected/HTML/frame-in-flight/style-flight-compositor-animation-wakeup.txt+++ b/Tests/LibWeb/Text/expected/HTML/frame-in-flight/style-flight-compositor-animation-wakeup.txt@@ -1,4 +1,4 @@state in the next task: in-flight-wake-up republishes beside the frame: 1-wake-up requests a frame: 1+wake-up republishes beside the frame: [compositor animations updated]+wake-up requests a frame: [animation frame pump request]probe box width: 60diff --git a/Tests/LibWeb/Text/expected/HTML/preference-change-requests-rendering.txt b/Tests/LibWeb/Text/expected/HTML/preference-change-requests-rendering.txtindex 4ca5f1fca81..0cfe68541a3 100644--- a/Tests/LibWeb/Text/expected/HTML/preference-change-requests-rendering.txt+++ b/Tests/LibWeb/Text/expected/HTML/preference-change-requests-rendering.txt@@ -1,2 +1,2 @@-preference requested rendering: true+rendering requests of the preference change: [request, coalesced]media query changed: truediff --git a/Tests/LibWeb/Text/expected/HTML/rendering-opportunity-allows-posted-messages.txt b/Tests/LibWeb/Text/expected/HTML/rendering-opportunity-allows-posted-messages.txtindex 62dc7539f3e..9d7da9d3618 100644--- a/Tests/LibWeb/Text/expected/HTML/rendering-opportunity-allows-posted-messages.txt+++ b/Tests/LibWeb/Text/expected/HTML/rendering-opportunity-allows-posted-messages.txt@@ -1,5 +1,6 @@posted messages before opportunity: 10animation frame stayed pending: true-posted-message tasks progressed: trueanimation frame ran after opportunity: true-one update ran: true+rendering after the opportunity:+ opportunity+ updatediff --git a/Tests/LibWeb/Text/expected/HTML/rendering-opportunity-coalesces-requests.txt b/Tests/LibWeb/Text/expected/HTML/rendering-opportunity-coalesces-requests.txtindex 3bbbf575e30..b0d27fa1d3c 100644--- a/Tests/LibWeb/Text/expected/HTML/rendering-opportunity-coalesces-requests.txt+++ b/Tests/LibWeb/Text/expected/HTML/rendering-opportunity-coalesces-requests.txt@@ -1,5 +1,7 @@-updates before opportunity: 0callbacks after one opportunity: 20-one opportunity received: true-one update ran: true-requests were coalesced: true+rendering:+ request+ request, coalesced x19+ opportunity+ request, coalesced+ updatediff --git a/Tests/LibWeb/Text/expected/HTML/rendering-opportunity-defers-next-frame.txt b/Tests/LibWeb/Text/expected/HTML/rendering-opportunity-defers-next-frame.txtindex ec98bfb44db..29b8056fc48 100644--- a/Tests/LibWeb/Text/expected/HTML/rendering-opportunity-defers-next-frame.txt+++ b/Tests/LibWeb/Text/expected/HTML/rendering-opportunity-defers-next-frame.txt@@ -1,4 +1,3 @@callbacks after first opportunity: 1callbacks after another task: 1callbacks after second opportunity: 2-two updates ran: truediff --git a/Tests/LibWeb/Text/expected/HTML/rendering-opportunity-hidden-document.txt b/Tests/LibWeb/Text/expected/HTML/rendering-opportunity-hidden-document.txtindex 6bdbb15cf12..a318de72861 100644--- a/Tests/LibWeb/Text/expected/HTML/rendering-opportunity-hidden-document.txt+++ b/Tests/LibWeb/Text/expected/HTML/rendering-opportunity-hidden-document.txt@@ -1,4 +1,8 @@callback count while hidden: 0-updates while hidden: 0+rendering while hidden:+ request, coalescedcallback count after visible opportunity: 1-one update ran: true+rendering after the visible opportunity:+ opportunity+ request, coalesced+ updatediff --git a/Tests/LibWeb/Text/expected/Internals/internals-object-results-receiver-realm.txt b/Tests/LibWeb/Text/expected/Internals/internals-object-results-receiver-realm.txtindex 5ebe60becb3..57ce07063f2 100644--- a/Tests/LibWeb/Text/expected/Internals/internals-object-results-receiver-realm.txt+++ b/Tests/LibWeb/Text/expected/Internals/internals-object-results-receiver-realm.txt@@ -1,5 +1,3 @@-style counters has null prototype: true-style counters has animated overlay builds: truecompositor scroll state has null prototype: truecompositor scroll state scrollNodes uses iframe Array: falsecompositor scroll state scrollNodes uses top Array: truediff --git a/Tests/LibWeb/Text/expected/content-blocker-irrelevant-class-id-change-skips-refresh.txt b/Tests/LibWeb/Text/expected/content-blocker-irrelevant-class-id-change-skips-refresh.txtindex bebbb02cc5e..3e51646684c 100644--- a/Tests/LibWeb/Text/expected/content-blocker-irrelevant-class-id-change-skips-refresh.txt+++ b/Tests/LibWeb/Text/expected/content-blocker-irrelevant-class-id-change-skips-refresh.txt@@ -2,6 +2,6 @@ blockblockrgb(1, 2, 3)rgb(4, 5, 6)-PASS: irrelevant class/id changes skipped content blocker refresh+environment changes from irrelevant class/id changes: []nonenonediff --git a/Tests/LibWeb/Text/expected/css/animated-style-dirty-effects.txt b/Tests/LibWeb/Text/expected/css/animated-style-dirty-effects.txtindex 58c97bc5c48..be97d34c110 100644--- a/Tests/LibWeb/Text/expected/css/animated-style-dirty-effects.txt+++ b/Tests/LibWeb/Text/expected/css/animated-style-dirty-effects.txt@@ -1,9 +1,12 @@-completed effects stay out of animated style updates: true-stable skip eligibility is cached: true-unrelated style changes preserve skip eligibility: true-timing changes invalidate skip eligibility: true-descendant style changes invalidate skip eligibility: true+steady steps sample only the active effect: [active]+steady steps skip cache: [animation style skip cache hit]+unrelated style changes keep the skip cache: [animation style skip cache hit]+timing changes invalidate skip eligibility: [hidden]+descendant style changes invalidate skip eligibility, step 1: [hidden]+descendant style changes invalidate skip eligibility, step 2: [hidden]+descendant style changes invalidate skip eligibility, step 3: [hidden]+descendant style changes invalidate skip eligibility, step 4: [hidden]finished sibling contribution is retained: trueactive sibling contributes to computed style: trueempty dirty updates preserve throttled reads: true-paused animation builds no overlays: true+paused animation samples: []diff --git a/Tests/LibWeb/Text/expected/css/animation-display-none-pseudo-element.txt b/Tests/LibWeb/Text/expected/css/animation-display-none-pseudo-element.txtindex f79e643c40b..019406f84fc 100644--- a/Tests/LibWeb/Text/expected/css/animation-display-none-pseudo-element.txt+++ b/Tests/LibWeb/Text/expected/css/animation-display-none-pseudo-element.txt@@ -1,2 +1,2 @@pseudo-element is hidden: true-hidden pseudo-element skips animation sampling: true+hidden pseudo-element samples: []diff --git a/Tests/LibWeb/Text/expected/css/animation-events-of-many-siblings-in-tree-order.txt b/Tests/LibWeb/Text/expected/css/animation-events-of-many-siblings-in-tree-order.txtindex de330e921ae..749bcc69e0b 100644--- a/Tests/LibWeb/Text/expected/css/animation-events-of-many-siblings-in-tree-order.txt+++ b/Tests/LibWeb/Text/expected/css/animation-events-of-many-siblings-in-tree-order.txt@@ -1,4 +1,6 @@events in tree order: trueafter moving the last element first: true-walks of the tree are bounded: true-walks of the tree after an attribute change: 0+compares before each walk of the tree:+ composite order compared by tree position x256+ composite order compared by tree position x256+compares after an attribute change:diff --git a/Tests/LibWeb/Text/expected/css/animation-in-display-none-iframe.txt b/Tests/LibWeb/Text/expected/css/animation-in-display-none-iframe.txtindex 0c4fd12960e..3b5f54f69e8 100644--- a/Tests/LibWeb/Text/expected/css/animation-in-display-none-iframe.txt+++ b/Tests/LibWeb/Text/expected/css/animation-in-display-none-iframe.txt@@ -1,12 +1,12 @@-hidden iframe skips animation frame requests: true-hidden iframe skips animated style builds: true+hidden iframe frame requests: []+hidden iframe samples: []hidden iframe style read samples animation: true-showing iframe resumes animation frame requests: true-showing iframe resumes animated style builds: true-hiding iframe stops animation frame requests: true-hidden iframe iteration listener uses wake-up timer: true+shown iframe frame requests: [animation frame pump request]+shown iframe samples: [circle]+frame requests after hiding the iframe: []+hidden iframe iteration listener frame requests: [], armed timers: [wakeup timer armed]hidden iframe dispatches iteration event: true-hidden ancestor iframe stops nested animation frame requests: true-showing ancestor iframe resumes nested animation: true+nested iframe in a hidden ancestor iframe frame requests: []+nested iframe in a shown ancestor iframe frame requests: [animation frame pump request]reversed infinite animation can finish while hidden: truezero-duration infinite animation finishes after its end delay while hidden: truediff --git a/Tests/LibWeb/Text/expected/css/animation-observation-timeline.txt b/Tests/LibWeb/Text/expected/css/animation-observation-timeline.txtindex b476c98753c..aa80525b6b8 100644--- a/Tests/LibWeb/Text/expected/css/animation-observation-timeline.txt+++ b/Tests/LibWeb/Text/expected/css/animation-observation-timeline.txt@@ -1,3 +1,4 @@-one synchronization in a task: 1-getter updates associated animations: 0-next task synchronizes again: 2+getters in one task:+ animation timeline synchronized+getter in the next task:+ animation timeline synchronizeddiff --git a/Tests/LibWeb/Text/expected/css/compositor-animation-animated-observer-ancestor.txt b/Tests/LibWeb/Text/expected/css/compositor-animation-animated-observer-ancestor.txtindex a7da208c4e2..6b7741beef1 100644--- a/Tests/LibWeb/Text/expected/css/compositor-animation-animated-observer-ancestor.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-animation-animated-observer-ancestor.txt@@ -1,3 +1,6 @@target starts outside root: true-only ancestor animation uses compositor: true+compositor animations:+ transform div#rotated-parent+ wakeup timer armed+ observation timer armedtarget enters root: truediff --git a/Tests/LibWeb/Text/expected/css/compositor-animation-forced-effects-frame-removal.txt b/Tests/LibWeb/Text/expected/css/compositor-animation-forced-effects-frame-removal.txtindex 2d3709ca3ef..f6ac7ce4743 100644--- a/Tests/LibWeb/Text/expected/css/compositor-animation-forced-effects-frame-removal.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-animation-forced-effects-frame-removal.txt@@ -1,4 +1,5 @@stale animation creates an effects frame: truestale effects frame is removed: true-target background-color animation remains published: true-published animation targets match the rebuilt visual tree: true+compositor animations after the rebuild:+ background-color div#target.box+ wakeup timer armeddiff --git a/Tests/LibWeb/Text/expected/css/compositor-animation-hidden-iframe.txt b/Tests/LibWeb/Text/expected/css/compositor-animation-hidden-iframe.txtindex 0f7d697e7c2..78ab2b88e82 100644--- a/Tests/LibWeb/Text/expected/css/compositor-animation-hidden-iframe.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-animation-hidden-iframe.txt@@ -1,3 +1,4 @@-opacity uses compositor: true-child rendering does not sample parent animations: true+compositor animations:+ opacity div#target+child rendering samples: []explicit style observation remains current: truediff --git a/Tests/LibWeb/Text/expected/css/compositor-animation-implicit-keyframes-over-other-effects.txt b/Tests/LibWeb/Text/expected/css/compositor-animation-implicit-keyframes-over-other-effects.txtindex 6cf63375813..8824a46b1d3 100644--- a/Tests/LibWeb/Text/expected/css/compositor-animation-implicit-keyframes-over-other-effects.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-animation-implicit-keyframes-over-other-effects.txt@@ -1,2 +1,3 @@-over another animation: 0-alone: 1+over another animation:+alone:+ opacity div#targetdiff --git a/Tests/LibWeb/Text/expected/css/compositor-animation-implicit-keyframes.txt b/Tests/LibWeb/Text/expected/css/compositor-animation-implicit-keyframes.txtindex 91a603dceec..9bc9a1a2cf9 100644--- a/Tests/LibWeb/Text/expected/css/compositor-animation-implicit-keyframes.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-animation-implicit-keyframes.txt@@ -1,3 +1,3 @@-opacity-pulse: 1-color-pulse: 1-filter-pulse: 1+opacity-pulse: opacity div#target+color-pulse: background-color div#target+filter-pulse: filter div#targetdiff --git a/Tests/LibWeb/Text/expected/css/compositor-animation-intersection-observer.txt b/Tests/LibWeb/Text/expected/css/compositor-animation-intersection-observer.txtindex 14c4b21b486..de70f823a37 100644--- a/Tests/LibWeb/Text/expected/css/compositor-animation-intersection-observer.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-animation-intersection-observer.txt@@ -1,15 +1,22 @@-animation initially uses compositor: 1-observer keeps transform on compositor: 1+compositor animations initially:+ transform div#target+compositor animations with an observer:+ transform div#target+ observation timer armedinitial position is intersecting: trueanimated position leaves viewport: true-disconnect restores compositor animation: 1-offscreen observed clip uses compositor: true+compositor animations after disconnecting:+ transform div#target+compositor animations of an offscreen observed clip:+ transform div#clipped-targetoffscreen clipped target is not intersecting: true-scrolling observed clip retains compositor: true-observed compositor animation requests sample frame: true+compositor animations after scrolling the observed clip:+ transform div#clipped-target+ observation timer armed+observed compositor animation frame requests: [animation frame pump request]scrolled clipped target enters viewport: trueobserved animation still updates intersection: trueancestor compositor motion updates descendant intersection: trueleaving target starts inside root: trueobserved compositor motion is sampled within 250ms: true-observation timer builds no animation overlays: true+observation timer samples: []diff --git a/Tests/LibWeb/Text/expected/css/compositor-animation-iteration-wakeup.txt b/Tests/LibWeb/Text/expected/css/compositor-animation-iteration-wakeup.txtindex 3304517b2ca..d8bac4ac6cd 100644--- a/Tests/LibWeb/Text/expected/css/compositor-animation-iteration-wakeup.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-animation-iteration-wakeup.txt@@ -1,12 +1,14 @@-animation uses compositor: true-ancestor listeners do not keep frame pump running: true-iteration wake-up is armed: true-early wake-up requests no frame: true-iteration requests one frame: true-iteration needs no animated style overlays: true+frame requests with ancestor listeners: []+compositor animations:+ transform svg#spinner+ wakeup timer armed+early wake-up frame requests: []+iteration frame requests: [animation frame pump request]+iteration samples: []events: start 0, iteration 1000-next iteration re-arms the wake-up: true-adjusted iteration does not wake early: true-negative delay, iteration start, and playback rate are respected: true-paused animation does not re-arm iteration wake-up: true+next iteration re-arms the wake-up: iteration 2000, frame requests: [animation frame pump request]+adjusted iteration early wake-up frame requests: []+negative delay, iteration start, and playback rate are respected: iteration 750, frame requests: [animation frame pump request]+paused animation wake-up frame requests: []+paused animation armed timers: []cancellation still dispatches: truediff --git a/Tests/LibWeb/Text/expected/css/compositor-animation-missing-endpoint.txt b/Tests/LibWeb/Text/expected/css/compositor-animation-missing-endpoint.txtindex 34018755e2c..de1ca6d3ec2 100644--- a/Tests/LibWeb/Text/expected/css/compositor-animation-missing-endpoint.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-animation-missing-endpoint.txt@@ -1,3 +1,9 @@-missing endpoints take the underlying style on the compositor: true-complete keyframes use the compositor: true-removing the endpoint stays on the compositor: true+missing endpoints take the underlying style on the compositor:+ background-color div#target.target+ filter div#filter-target.target+complete keyframes use the compositor:+ background-color div#target.target+ filter div#filter-target.target+removing the endpoint stays on the compositor:+ background-color div#target.target+ filter div#filter-target.targetdiff --git a/Tests/LibWeb/Text/expected/css/compositor-animation-observe-scoped-flush.txt b/Tests/LibWeb/Text/expected/css/compositor-animation-observe-scoped-flush.txtindex df51eeb019d..9af1cf5e86f 100644--- a/Tests/LibWeb/Text/expected/css/compositor-animation-observe-scoped-flush.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-animation-observe-scoped-flush.txt@@ -1,3 +1,4 @@-animation uses compositor: true-unrelated observation skips animation sample: true-descendant observation samples ancestor animation: true+compositor animations:+ transform div#animated+unrelated observation samples: []+descendant observation samples: [div#animated]diff --git a/Tests/LibWeb/Text/expected/css/compositor-animation-pseudo-element-underlying-style.txt b/Tests/LibWeb/Text/expected/css/compositor-animation-pseudo-element-underlying-style.txtindex c349a3d346e..db506a2a8a9 100644--- a/Tests/LibWeb/Text/expected/css/compositor-animation-pseudo-element-underlying-style.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-animation-pseudo-element-underlying-style.txt@@ -1,2 +1,3 @@-compositor animations: 1-keyframes resolved again: true+compositor animations:+ opacity div#target+keyframes resolved again: [compositor keyframe values resolved]diff --git a/Tests/LibWeb/Text/expected/css/compositor-animation-retained-content.txt b/Tests/LibWeb/Text/expected/css/compositor-animation-retained-content.txtindex c1bbf6200a4..ce402bd0bf2 100644--- a/Tests/LibWeb/Text/expected/css/compositor-animation-retained-content.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-animation-retained-content.txt@@ -1,4 +1,7 @@-culled animations move immediately to compositor: 2+culled animations move immediately to compositor:+ opacity div#opacity+ transform div#transform+ wakeup timer armedopacity-zero animation content is retained: truesingular-transform animation content is retained: true-culled compositor animations build no overlays: true+culled compositor animations sample: []diff --git a/Tests/LibWeb/Text/expected/css/compositor-animation-rotated-observer-ancestor.txt b/Tests/LibWeb/Text/expected/css/compositor-animation-rotated-observer-ancestor.txtindex c0caceddee6..31f69d2d3f3 100644--- a/Tests/LibWeb/Text/expected/css/compositor-animation-rotated-observer-ancestor.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-animation-rotated-observer-ancestor.txt@@ -1,3 +1,3 @@target starts outside root: true-animation stays on main thread: true+compositor animations:target enters root: truediff --git a/Tests/LibWeb/Text/expected/css/compositor-animation-start-delay.txt b/Tests/LibWeb/Text/expected/css/compositor-animation-start-delay.txtindex 1d5d5e35320..6c32a726b24 100644--- a/Tests/LibWeb/Text/expected/css/compositor-animation-start-delay.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-animation-start-delay.txt@@ -1,5 +1,21 @@-delayed effects use the compositor before starting: true+delayed effects use the compositor before starting:+ opacity div#backwards-fill+ opacity div#both-fill+ opacity div#forwards-fill+ opacity div#no-fill+ wakeup timer armedfill modes apply before the active phase: true-sought negative delay stays off the compositor before zero: true-delayed effects remain on the compositor while active: true-effects are withdrawn after their active interval: true+sought negative delay stays off the compositor before zero:+ opacity div#backwards-fill+ opacity div#both-fill+ opacity div#forwards-fill+ opacity div#no-fill+ wakeup timer armed+delayed effects remain on the compositor while active:+ opacity div#backwards-fill+ opacity div#both-fill+ opacity div#forwards-fill+ opacity div#no-fill+ wakeup timer armed+effects are withdrawn after their active interval:+ wakeup timer armeddiff --git a/Tests/LibWeb/Text/expected/css/compositor-animation-starts-on-compositor-with-constant-output.txt b/Tests/LibWeb/Text/expected/css/compositor-animation-starts-on-compositor-with-constant-output.txtindex e93e580bc1f..b436bf00554 100644--- a/Tests/LibWeb/Text/expected/css/compositor-animation-starts-on-compositor-with-constant-output.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-animation-starts-on-compositor-with-constant-output.txt@@ -1,2 +1,4 @@animation is no longer pending: true-compositor animations: 1+compositor animations:+ opacity div#target+ wakeup timer armeddiff --git a/Tests/LibWeb/Text/expected/css/compositor-animation-timers-stop-for-inactive-document.txt b/Tests/LibWeb/Text/expected/css/compositor-animation-timers-stop-for-inactive-document.txtindex 9634e838d0f..b3494bf02b8 100644--- a/Tests/LibWeb/Text/expected/css/compositor-animation-timers-stop-for-inactive-document.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-animation-timers-stop-for-inactive-document.txt@@ -1,4 +1,4 @@-timers armed before navigation: true-timers stopped after navigation: true-timers armed before destruction: true-timers stopped after destruction: true+timers armed before navigation: [wakeup timer armed, observation timer armed]+timers armed after navigation: []+timers armed before destruction: [wakeup timer armed, observation timer armed]+timers armed after destruction: []diff --git a/Tests/LibWeb/Text/expected/css/compositor-background-color-animation.txt b/Tests/LibWeb/Text/expected/css/compositor-background-color-animation.txtindex 962008b2eac..cd151e6eb28 100644--- a/Tests/LibWeb/Text/expected/css/compositor-background-color-animation.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-background-color-animation.txt@@ -1,12 +1,16 @@-background color animations use compositor: true-background color marker does not create effects layer: true+background color animations use compositor:+ background-color div#legacy.target+ background-color div#transparent-delay.target+ wakeup timer armed+background color marker does not create effects layer: [background-color-animation keyframes=[rgba(255, 0, 0, 0), rgb(0, 0, 255)], compositor background-color frame]transparent background color retains animated fill: true-root background color stays on main thread: true+root background color stays on main thread: []complex and propagated backgrounds stay on main thread: true-modern color interpolation stays on main thread: true+modern color interpolation samples on the main thread: truemodern color creates no compositor marker: truecurrentcolor creates no compositor marker: trueunsupported timing creates no compositor marker: true-stable background color builds no overlays: true-stable background color requests no animation frames: true-cancel removes background color animation: true+stable background color samples: []+stable background color frame requests: []+cancel removes background color animation:+ wakeup timer armeddiff --git a/Tests/LibWeb/Text/expected/css/compositor-competing-replace-effects.txt b/Tests/LibWeb/Text/expected/css/compositor-competing-replace-effects.txtindex 4744aad9201..e35976dd5ed 100644--- a/Tests/LibWeb/Text/expected/css/compositor-competing-replace-effects.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-competing-replace-effects.txt@@ -1,20 +1,21 @@-Azure pair publishes opacity and transform: true-Azure pair avoids main-thread overlays: true-later duplicate fade wins opacity: true+Azure pair publishes opacity and transform: [opacity div#target.azure-pair, transform div#target.azure-pair]+Azure pair main-thread samples: []+later duplicate fade wins opacity: [opacity div#target.double-fade]short winner controls the boundary sample: true-loser is published when winner ends: true-winner change republishes descriptors: true-later script animation wins over CSS animation: true-paused winner is sampled on the main thread: true-cancelling winner republishes CSS animation: true-add competitor stays on the main thread: true-opacity loser still hands off transform: true-pseudo-element pair publishes opacity and transform: true-finite loser receives an end wake-up: true+loser is published when winner ends: true, compositor animations [opacity div#target]+winner change republishes descriptors: [compositor animations updated]+CSS animation on the compositor: [opacity div#target.css-fade]+later script animation wins over CSS animation: true, compositor animations [opacity div#target.css-fade]+paused winner is sampled on the main thread: true, compositor animations []+cancelling winner republishes CSS animation: [opacity div#target.css-fade]+add competitor stays on the main thread: []+opacity loser still hands off transform: [opacity div#target.split-winners, transform div#target.split-winners]+pseudo-element pair publishes opacity and transform: [opacity div#pseudo.enabled, transform div#pseudo.enabled]+finite loser receives an end wake-up: [wakeup timer armed]finite loser finishes after deterministic advance: true-competing finite effects register an end wake-up: true+competing finite effects register an end wake-up: [wakeup timer armed]losing finite effect finishes after deterministic advance: trueboth competing finite effects dispatch animationend: truelosing finite effect restores base opacity: truelosing infinite effect dispatches iteration events: true-losing infinite listener uses iteration wake-ups: true+losing infinite listener uses iteration wake-ups: frame requests [], armed timers [wakeup timer armed]diff --git a/Tests/LibWeb/Text/expected/css/compositor-driven-animations.txt b/Tests/LibWeb/Text/expected/css/compositor-driven-animations.txtindex ec3e89e425d..9d450c78a3c 100644--- a/Tests/LibWeb/Text/expected/css/compositor-driven-animations.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-driven-animations.txt@@ -1,18 +1,18 @@-compositor visual animations: 4-reference box resize updates compositor animation: true-reference box resize resolves keyframes: true-style change resolves keyframes: true-style change updates compositor animation: true-main-thread animation overlay builds: 0-main-thread animation frame pump requests: 0-stable compositor animations reuse resolved keyframes: true-stable compositor animation updates: 0-stable compositor animation updates with changing visual nodes: 0-cancel removes compositor animations: 0-cancel updates compositor animations: true-empty compositor animation updates: 0-finite animation uses compositor: true-finite animation requests only end frames: true+compositor animations:+ opacity div#opacity+ transform div#individual-transform+ transform div#relative-transform+ transform div#transform+reference box resize: [compositor keyframe values resolved x2, compositor animations updated]+style change: [compositor keyframe values resolved x2, compositor animations updated]+stable compositor animations: []+stable compositor animations main-thread samples: []+stable compositor animations with changing visual nodes: []+cancel: [compositor animations updated]+cancel removes compositor animations: []+empty compositor animations: []+finite animation uses compositor: [opacity div#finite, transform div#finite]+finite animation requests only end frames: [animation frame pump request, compositor animations updated]finite animation dispatches end event: truefinite animation reaches end opacity: truefinite animation reaches end style: truediff --git a/Tests/LibWeb/Text/expected/css/compositor-filter-animation.txt b/Tests/LibWeb/Text/expected/css/compositor-filter-animation.txtindex c794cb06d11..7773b678b4f 100644--- a/Tests/LibWeb/Text/expected/css/compositor-filter-animation.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-filter-animation.txt@@ -1,5 +1,7 @@-CSS filter functions use compositor: true-URL filter stays on main thread: true-stable CSS filters build no overlays: true-stable CSS filters request no animation frames: true-cancel removes CSS filter animations: true+animations: 3+CSS filter functions use compositor, URL filter stays on main thread:+ filter div#functions.target+ filter div#shadow.target+stable CSS filters sample: []+stable CSS filters frame requests: []+cancel removes CSS filter animations:diff --git a/Tests/LibWeb/Text/expected/css/compositor-opacity-track-visibility.txt b/Tests/LibWeb/Text/expected/css/compositor-opacity-track-visibility.txtindex 9e763471cbf..9374b45bba3 100644--- a/Tests/LibWeb/Text/expected/css/compositor-opacity-track-visibility.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-opacity-track-visibility.txt@@ -1,3 +1,3 @@-infinite and finite opacity animations stay on main thread: true+compositor animations:infinite opacity is current: truefinite opacity is current: truediff --git a/Tests/LibWeb/Text/expected/css/compositor-svg-internal-transform.txt b/Tests/LibWeb/Text/expected/css/compositor-svg-internal-transform.txtindex 3df310bfb75..5f324f336d6 100644--- a/Tests/LibWeb/Text/expected/css/compositor-svg-internal-transform.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-svg-internal-transform.txt@@ -1,41 +1,40 @@runs on the compositor:- a rect: true- a rect in a group: true- a rect in a transformed group: true- a group: true- a rect in a translucent group: true- a rect in a group with a filter function: true- a rect in a group with a clip path in user space: true- a rect in a group with a mask in user space: true- a use element: true- a use element with a position: true- a nested svg: true- a fading rect: true- a fading group: true- a fading use element: true- a fading rect in a group with a filter element: true- a dimming rect: true- a dimming group: true- a dimming use element: true- a dimming rect in a group with a filter element: true+ a rect: [transform rect.bar]+ a rect in a group: [transform rect.bar]+ a rect in a transformed group: [transform rect.bar]+ a group: [transform g.bar]+ a rect in a translucent group: [transform rect.bar]+ a rect in a group with a filter function: [transform rect.bar]+ a rect in a group with a clip path in user space: [transform rect.bar]+ a rect in a group with a mask in user space: [transform rect.bar]+ a use element: [transform use.bar]+ a use element with a position: [transform use.bar]+ a nested svg: [transform svg.bar]+ a fading rect: [opacity rect.fading]+ a fading group: [opacity g.fading]+ a fading use element: [opacity use.fading]+ a fading rect in a group with a filter element: [opacity rect.fading]+ a dimming rect: [filter rect.dimming]+ a dimming group: [filter g.dimming]+ a dimming use element: [filter use.dimming]+ a dimming rect in a group with a filter element: [filter rect.dimming]runs on the compositor, though it must not:- a rect in a group with a filter element: false- a rect in a group with a clip path in its bounding box: false- a rect in a group with a clip path shape: false- a rect in a group with a mask in its bounding box: false- a rect in a group with a mask image: false- a rect in a group transformed about its fill box: false- a rect in a group rotated about its fill box: false- a rect in a group scaled about its fill box: false- a rect with a non-scaling stroke: false- a group around a non-scaling stroke: false- a rect in a mask: false- a fading rect in a mask: false- a dimming rect in a mask: false- a rect animating a filter element: false-the main thread leaves the animated style alone: true-the main thread asks for no frames: true-the main thread runs no rendering updates: true-the box a script reads runs on the compositor: true+ a rect in a group with a filter element: []+ a rect in a group with a clip path in its bounding box: []+ a rect in a group with a clip path shape: []+ a rect in a group with a mask in its bounding box: []+ a rect in a group with a mask image: []+ a rect in a group transformed about its fill box: []+ a rect in a group rotated about its fill box: []+ a rect in a group scaled about its fill box: []+ a rect with a non-scaling stroke: []+ a group around a non-scaling stroke: []+ a rect in a mask: []+ a fading rect in a mask: []+ a dimming rect in a mask: []+ a rect animating a filter element: []+the main thread samples: []+frame requests and rendering updates of the main thread: []+the box a script reads runs on the compositor: [transform rect]height of its group at the start: 10height of its group halfway: 7.5diff --git a/Tests/LibWeb/Text/expected/css/compositor-svg-root-transform.txt b/Tests/LibWeb/Text/expected/css/compositor-svg-root-transform.txtindex cd9f09a1eb5..227fa113147 100644--- a/Tests/LibWeb/Text/expected/css/compositor-svg-root-transform.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-svg-root-transform.txt@@ -1,4 +1,5 @@-outer SVG uses compositor: true-no animated style overlays: true-no main-thread frame pump: true+outer SVG uses compositor:+ transform svg#spinner+main-thread samples: []+main-thread frame requests: []rotation uses CSS box center: truediff --git a/Tests/LibWeb/Text/expected/css/compositor-transform-synthesized-endpoint.txt b/Tests/LibWeb/Text/expected/css/compositor-transform-synthesized-endpoint.txtindex be0976864f1..a625e7febe6 100644--- a/Tests/LibWeb/Text/expected/css/compositor-transform-synthesized-endpoint.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-transform-synthesized-endpoint.txt@@ -1,4 +1,6 @@-synthesized transform endpoint uses compositor: true-no main-thread animated style work: true-underlying style change preserves handoff: true+synthesized transform endpoint uses compositor:+ transform svg#spinner+main-thread samples: []+underlying style change preserves handoff:+ transform svg#spinnersynthesized endpoint follows underlying style: truediff --git a/Tests/LibWeb/Text/expected/css/compositor-transition-between-functions-of-one-primitive.txt b/Tests/LibWeb/Text/expected/css/compositor-transition-between-functions-of-one-primitive.txtindex 4b27f49c1fe..26bd73d6249 100644--- a/Tests/LibWeb/Text/expected/css/compositor-transition-between-functions-of-one-primitive.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-transition-between-functions-of-one-primitive.txt@@ -1,7 +1,7 @@-translate(10px, 0px) to translateX(100px) runs on the compositor: true-translateY(5px) to translate(0px, 50px) runs on the compositor: true-translate(10px) to translateY(50px) runs on the compositor: true-scale(2) to scaleX(3) runs on the compositor: true-scaleY(2) to scale(3, 4) runs on the compositor: true-translateZ(5px) to translate3d(0px, 0px, 50px) runs on the compositor: true-transition retargeted from its current value runs on the compositor: true+translate(10px, 0px) to translateX(100px) on the compositor: [transform div#target, wakeup timer armed]+translateY(5px) to translate(0px, 50px) on the compositor: [transform div#target, wakeup timer armed]+translate(10px) to translateY(50px) on the compositor: [transform div#target, wakeup timer armed]+scale(2) to scaleX(3) on the compositor: [transform div#target, wakeup timer armed]+scaleY(2) to scale(3, 4) on the compositor: [transform div#target, wakeup timer armed]+translateZ(5px) to translate3d(0px, 0px, 50px) on the compositor: [transform div#target, wakeup timer armed]+transition retargeted from its current value on the compositor: [transform div#target, wakeup timer armed]diff --git a/Tests/LibWeb/Text/expected/css/compositor-transition-none-transform.txt b/Tests/LibWeb/Text/expected/css/compositor-transition-none-transform.txtindex 763bc088899..e40f140a21a 100644--- a/Tests/LibWeb/Text/expected/css/compositor-transition-none-transform.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-transition-none-transform.txt@@ -1,2 +1,8 @@-none transform transitions use the compositor in 2D and 3D: true+none transform transitions use the compositor in 2D and 3D:+ transform div#individual.target+ transform div#list.target+ transform div#rotate-x.target+ transform div#scale-3d.target+ transform div#translate-3d.target+ wakeup timer armedwithdrawn mid-transition positions match: truediff --git a/Tests/LibWeb/Text/expected/css/compositor-transition-pending-start.txt b/Tests/LibWeb/Text/expected/css/compositor-transition-pending-start.txtindex 5b446ece85d..a5a648cc875 100644--- a/Tests/LibWeb/Text/expected/css/compositor-transition-pending-start.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-transition-pending-start.txt@@ -2,23 +2,39 @@ new transition remains pending: truenew transition start time remains unresolved: truenew transition ready promise remains pending: truenew transition start event remains pending: true-new transition starts on compositor: true+new transition starts on compositor:+ opacity div#target.target+ wakeup timer armednext update resolves pending play: truenext update resolves start time: truenext update resolves ready promise: truenext update dispatches transition events: true-transition remains on compositor: true-resolved start retains compositor anchor: true-pending current-time seek re-anchors compositor: true-pending start-time change re-anchors compositor: true-pending transition retarget replaces descriptor: true+transition remains on compositor:+ opacity div#target.target+ wakeup timer armed+compositor updates resolving the start: []+pending current-time seek re-anchors compositor: true, [compositor animation timing anchor updated]+pending start-time change re-anchors compositor: true, [compositor animation timing anchor updated]+pending transition retarget replaces descriptor: true, [compositor animations updated]+compositor animations after the retarget:+ opacity div#retarget.target.first.second+ wakeup timer armedstatic opacity transition declarations do not create effects frames: true-paired opacity and translate transitions start on compositor: true-paired transitions share their provisional timing anchor: true+paired transitions: 2+paired opacity and translate transitions start on compositor and share their provisional timing anchor:+ opacity div#paired.paired.changed+ transform div#paired.paired.changed+ wakeup timer armedpending fade-out creates an effects frame: truewithdrawn fade-out removes its effects frame: trueadding an opacity animation creates an effects frame: true-adding a filter keeps mixed effect on compositor: true+adding a filter keeps mixed effect on compositor:+ filter div#paired.paired+ opacity div#paired.paired+ wakeup timer armedadding a filter retains the effects frame: true-retargeted opacity starts with paired translate on compositor: true-retargeted paired transitions share their provisional timing anchor: true+retargeted opacity replaces its transition: true+retargeted opacity starts with paired translate on compositor and shares its provisional timing anchor:+ opacity div#paired-retarget.paired.second+ transform div#paired-retarget.paired.second+ wakeup timer armeddiff --git a/Tests/LibWeb/Text/expected/css/delayed-script-animation-start-wakeup.txt b/Tests/LibWeb/Text/expected/css/delayed-script-animation-start-wakeup.txtindex 9a57df67e71..58485cedbbd 100644--- a/Tests/LibWeb/Text/expected/css/delayed-script-animation-start-wakeup.txt+++ b/Tests/LibWeb/Text/expected/css/delayed-script-animation-start-wakeup.txt@@ -1,6 +1,8 @@-delayed transition uses the compositor before start: true-delayed compositor effect requests one start frame: true-delayed compositor effect republishes at active start: true+delayed transition uses the compositor before start:+ transform div#target.changed+ wakeup timer armed+delayed compositor effect requests one start frame: [animation frame pump request]+delayed compositor effect republishes at active start: [compositor animations updated]seeking reaches the delayed transition's active phase: truetransitionstart fires after seeking and rendering: true-active compositor effect retains an end wake-up: true+active compositor effect retains an end wake-up: [wakeup timer armed]diff --git a/Tests/LibWeb/Text/expected/css/display-none-subtree-animation-throttling.txt b/Tests/LibWeb/Text/expected/css/display-none-subtree-animation-throttling.txtindex 094e8d4f2a1..809fdf4bf7f 100644--- a/Tests/LibWeb/Text/expected/css/display-none-subtree-animation-throttling.txt+++ b/Tests/LibWeb/Text/expected/css/display-none-subtree-animation-throttling.txt@@ -1,10 +1,10 @@-animation with no box builds overlays: false-animation with no box requests frames: false+animation with no box samples: []+animation with no box frame requests: []computed style samples animation: 50px-referenceable geometry builds overlays: true-SVG resource builds overlays: true-custom property animation requests frames: true+referenceable geometry samples: [referenced-circle]+SVG resource samples: [stop]+custom property animation frame requests: [animation frame pump request]reverse playback finisheszero duration infinite iterations finishes-revealed animation builds overlays: true+revealed animation samples: [circle]revealed computed style: advanceddiff --git a/Tests/LibWeb/Text/expected/css/element-scoped-animation-sampling.txt b/Tests/LibWeb/Text/expected/css/element-scoped-animation-sampling.txtindex f139dd6fe29..c80a9f78b22 100644--- a/Tests/LibWeb/Text/expected/css/element-scoped-animation-sampling.txt+++ b/Tests/LibWeb/Text/expected/css/element-scoped-animation-sampling.txt@@ -1,5 +1,6 @@-unrelated reads do not sample animation: true-related reads sample once per task: true-related read samples in a later task: true-ancestor style reads sample descendant animations: true-ancestor reads sample descendant animations: true+unrelated reads sample: []+related reads in one task sample: [animated]+related read in a later task samples: [animated]+ancestor style read samples: [overflow-animated]+ancestor geometry read samples: [animated]+ancestor geometry read sees the sampled transform: truediff --git a/Tests/LibWeb/Text/expected/css/finished-compositor-animation-content-culling.txt b/Tests/LibWeb/Text/expected/css/finished-compositor-animation-content-culling.txtindex 5eeda3b7676..7ed131e0543 100644--- a/Tests/LibWeb/Text/expected/css/finished-compositor-animation-content-culling.txt+++ b/Tests/LibWeb/Text/expected/css/finished-compositor-animation-content-culling.txt@@ -1,4 +1,7 @@-animations start on the compositor: true+animations start on the compositor:+ opacity div#opacity.target+ transform div#scale.target+ wakeup timer armedactive animation content is retained: truepaused opacity-zero content is culled: truemain-thread opacity-zero content is culled: truediff --git a/Tests/LibWeb/Text/expected/css/finite-compositor-animation-completion.txt b/Tests/LibWeb/Text/expected/css/finite-compositor-animation-completion.txtindex 80923267783..8fc7e1ff93b 100644--- a/Tests/LibWeb/Text/expected/css/finite-compositor-animation-completion.txt+++ b/Tests/LibWeb/Text/expected/css/finite-compositor-animation-completion.txt@@ -1,9 +1,13 @@-finite effects use the compositor: true+finite effects use the compositor:+ opacity div#opacity+ opacity div#opacity-without-fill+ transform div#transform+ wakeup timer armedfinished promises resolve: trueanimationend events fire: trueanimationend sees terminal style: true-finite effects request one end frame: true-wake-up timer leaves animation updates to frames: true+finite effects request one end frame: [animation frame pump request]+animation updates outside rendering updates before the end event: []forwards fill retains opacity: trueno fill restores transform: trueno fill restores opacity: truediff --git a/Tests/LibWeb/Text/expected/css/finite-compositor-targeted-wakeup.txt b/Tests/LibWeb/Text/expected/css/finite-compositor-targeted-wakeup.txtindex 030bc161d11..f48b6d40f7d 100644--- a/Tests/LibWeb/Text/expected/css/finite-compositor-targeted-wakeup.txt+++ b/Tests/LibWeb/Text/expected/css/finite-compositor-targeted-wakeup.txt@@ -1,6 +1,18 @@-all effects use the compositor: true-early wake-up does no work: true-finite end samples only its target: true-finite end requests one frame: true-infinite effects remain on the compositor: true+all effects use the compositor:+ opacity div#finite+ opacity div.infinite+ opacity div.infinite+ opacity div.infinite+ opacity div.infinite+ opacity div.infinite+ wakeup timer armed+early wake-up samples: [], frame requests: []+finite end samples: [div#finite]+finite end frame requests: [animation frame pump request]+infinite effects remain on the compositor:+ opacity div.infinite+ opacity div.infinite+ opacity div.infinite+ opacity div.infinite+ opacity div.infinitefinite animation dispatches its end event: truediff --git a/Tests/LibWeb/Text/expected/css/font-face-css-connected-registration-invalidation.txt b/Tests/LibWeb/Text/expected/css/font-face-css-connected-registration-invalidation.txtindex 590139aa1ac..571f824853d 100644--- a/Tests/LibWeb/Text/expected/css/font-face-css-connected-registration-invalidation.txt+++ b/Tests/LibWeb/Text/expected/css/font-face-css-connected-registration-invalidation.txt@@ -1,20 +1,20 @@-append unloaded CSS-connected face: 0+append unloaded CSS-connected face: []UnloadedSheetFace count after append: 1public delete CSS-connected face: false-public delete CSS-connected face delta: 0+public delete CSS-connected face environment changes: []UnloadedSheetFace count after public delete: 1-remove unloaded CSS-connected face: 0+remove unloaded CSS-connected face: []UnloadedSheetFace count after removal: 0-add unloaded script-created face: 0+add unloaded script-created face: []ScriptFace count after add: 1ScriptFace status before removal: loaded-delete loaded script-created face: 0+delete loaded script-created face: []ScriptFace count after delete: 0LoadedSheetFace status before removal: loaded-remove loaded CSS-connected face: 0+remove loaded CSS-connected face: []LoadedSheetFace count after removal: 0-adopt constructed CSS-connected face: 0+adopt constructed CSS-connected face: []ConstructedSheetFace count after adoption: 1ConstructedSheetFace status before removal: loaded-unadopt constructed CSS-connected face: 0+unadopt constructed CSS-connected face: []ConstructedSheetFace count after removal: 0diff --git a/Tests/LibWeb/Text/expected/css/font-face-sheet-invalidation-batching.txt b/Tests/LibWeb/Text/expected/css/font-face-sheet-invalidation-batching.txtindex 2fa8916aa2f..874401632ac 100644--- a/Tests/LibWeb/Text/expected/css/font-face-sheet-invalidation-batching.txt+++ b/Tests/LibWeb/Text/expected/css/font-face-sheet-invalidation-batching.txt@@ -1,21 +1,21 @@-append sheet with multiple CSS-connected faces: 0+append sheet with multiple CSS-connected faces: []Batch face count after append: 4Document target width after BatchFamilyA loads: 100-remove sheet with multiple CSS-connected faces: 0+remove sheet with multiple CSS-connected faces: []Batch face count after removal: 0-append first repeated sheet: 0+append first repeated sheet: []RepeatedBatch face count after first append: 2-append second repeated sheet: 0+append second repeated sheet: []RepeatedBatch face count after second append: 4-remove first repeated sheet: 0+remove first repeated sheet: []RepeatedBatch face count after first removal: 2-remove second repeated sheet: 0+remove second repeated sheet: []RepeatedBatch face count after second removal: 0-append shadow sheet with shadow-only font faces: 0+append shadow sheet with shadow-only font faces: []ShadowBatch face count after append: 0Shadow target ignores shadow-only font face: true-remove shadow sheet with shadow-only font faces: 0+remove shadow sheet with shadow-only font faces: []ShadowBatch face count after removal: 0-add unloaded script-created face: 0-load script-created face: 0-delete loaded script-created face: 0+add unloaded script-created face: []+load script-created face: []+delete loaded script-created face: []diff --git a/Tests/LibWeb/Text/expected/css/force-dark-keeps-background-color-animations-on-the-main-thread.txt b/Tests/LibWeb/Text/expected/css/force-dark-keeps-background-color-animations-on-the-main-thread.txtindex fc1992b5f35..0a71fabdcb5 100644--- a/Tests/LibWeb/Text/expected/css/force-dark-keeps-background-color-animations-on-the-main-thread.txt+++ b/Tests/LibWeb/Text/expected/css/force-dark-keeps-background-color-animations-on-the-main-thread.txt@@ -1,9 +1,9 @@force-dark on from the start: no compositor marker: true-force-dark on from the start: no compositor animation: true-force-dark on from the start: the main thread keeps ticking: true+force-dark on from the start: compositor animations: []+force-dark on from the start: main thread frame requests: [animation frame pump request]force-dark off: compositor marker: true-force-dark off: compositor animation: true-force-dark off: the main thread stops ticking: true+force-dark off: compositor animations: [background-color div#target]+force-dark off: main thread frame requests: []force-dark turned on mid-animation: no compositor marker: true-force-dark turned on mid-animation: no compositor animation: true-force-dark turned on mid-animation: the main thread ticks again: true+force-dark turned on mid-animation: compositor animations: []+force-dark turned on mid-animation: main thread frame requests: [animation frame pump request]diff --git a/Tests/LibWeb/Text/expected/css/interrupted-css-transitions.txt b/Tests/LibWeb/Text/expected/css/interrupted-css-transitions.txtindex 3207821a764..6224ac8fb62 100644--- a/Tests/LibWeb/Text/expected/css/interrupted-css-transitions.txt+++ b/Tests/LibWeb/Text/expected/css/interrupted-css-transitions.txt@@ -1,6 +1,6 @@-interrupted transitions do not accumulate: true+interrupted transitions do not accumulate: [opacity]the replacement transition is still running: true-a transition dropped by transition-property is disassociated: true+a transition dropped by transition-property is disassociated: [opacity]the dropped transition is no longer relevant: true-a CSS animation is associated while its name applies: true-a CSS animation dropped by animation-name is disassociated: true+a CSS animation is associated while its name applies: [opacity, spin]+a CSS animation dropped by animation-name is disassociated: [opacity]diff --git a/Tests/LibWeb/Text/expected/css/invisible-animation-style-throttling.txt b/Tests/LibWeb/Text/expected/css/invisible-animation-style-throttling.txtindex 2fb84a18acb..730b86e9030 100644--- a/Tests/LibWeb/Text/expected/css/invisible-animation-style-throttling.txt+++ b/Tests/LibWeb/Text/expected/css/invisible-animation-style-throttling.txt@@ -1,20 +1,20 @@-hidden animation overlay builds: 0-hidden animation frame pump requests: 0-animation event listener uses iteration wake-ups: true+hidden animation samples: []+hidden animation frame requests: []+animation event listener uses iteration wake-ups: frame requests [], armed timers [wakeup timer armed]animation event listener skips past events: 0-removing animation event listener stops frame pump: 0-computed style samples hidden animation: true-offscreen clipped animation overlay builds: 0-offscreen clipped animation frame pump requests: 0-revealed clipped animation resumes: true-revealed clipped animation requests frame: true+frame requests after removing the animation event listener: []+computed style samples: [div#hidden.animated]+offscreen clipped animation samples: []+offscreen clipped animation frame requests: []+revealed clipped animation samples: [div#hidden.animated, div#offscreen.animated]+revealed clipped animation frame requests: [animation frame pump request]computed style uses current timeline sample: truecomputed timing uses current timeline sample: truegeometry uses current timeline sample: true-becoming visible flushes throttled animations: true-detached animation stops frame pump: 0+becoming visible flushes throttled animations: [div#hidden.animated, div#visibility-target]+detached animation frame requests: []detached animation current time advances: true-visible animation builds while hidden stays throttled: true-computed style samples hidden animation alongside visible animation: true-style-only visibility change samples animation: true-visible descendant keeps animation updating: true+visible animation beside a throttled hidden one samples: [div#visible.animated]+computed style beside a visible animation samples: [div#hidden.animated, div#visible.animated]+style-only visibility change samples: [div#hidden.animated, div#style-only-visibility-change.animated]+visible descendant keeps animation updating: [div#hidden.animated]diff --git a/Tests/LibWeb/Text/expected/css/offscreen-animation-fixed-descendant.txt b/Tests/LibWeb/Text/expected/css/offscreen-animation-fixed-descendant.txtindex 6992dd66f42..9922f3be1e2 100644--- a/Tests/LibWeb/Text/expected/css/offscreen-animation-fixed-descendant.txt+++ b/Tests/LibWeb/Text/expected/css/offscreen-animation-fixed-descendant.txt@@ -1,3 +1,3 @@-animation stays on main thread: true-animation is not offscreen throttled: true+compositor animations:+frame requests: [animation frame pump request]fixed descendant is intersecting: truediff --git a/Tests/LibWeb/Text/expected/css/offscreen-paint-only-animation-events.txt b/Tests/LibWeb/Text/expected/css/offscreen-paint-only-animation-events.txtindex 3d943223532..638dcb2bf9a 100644--- a/Tests/LibWeb/Text/expected/css/offscreen-paint-only-animation-events.txt+++ b/Tests/LibWeb/Text/expected/css/offscreen-paint-only-animation-events.txt@@ -1,10 +1,10 @@-finite and infinite offscreen paint animations build no overlays: true-animation listeners do not keep the frame pump running: true-offscreen paint animations publish no compositor descriptors: true-animation event wake-up is armed: true-early wake-up requests no frame: true+finite and infinite offscreen paint animations sample: []+frame requests with animation listeners: []+offscreen paint animations on the compositor:+ wakeup timer armed+early wake-up frame requests: []finite and infinite offscreen animations dispatch iteration: true-iteration needs no animated style overlays: true+iteration samples: []finite offscreen animations dispatch their end events: truefinite offscreen animation finishes: truefinite offscreen animation applies its final color: truediff --git a/Tests/LibWeb/Text/expected/css/offscreen-paint-only-animation.txt b/Tests/LibWeb/Text/expected/css/offscreen-paint-only-animation.txtindex 233104f4d88..4b90e60ccbf 100644--- a/Tests/LibWeb/Text/expected/css/offscreen-paint-only-animation.txt+++ b/Tests/LibWeb/Text/expected/css/offscreen-paint-only-animation.txt@@ -1,22 +1,22 @@-offscreen background builds no overlays: true-offscreen background stops the frame pump: true+offscreen background samples: []+offscreen background frame requests: []computed style samples the current color: truescrolling into view samples the current color: true-visible background resumes the frame pump: true-scrolling out of view stops the frame pump again: true-paint outside a nested scrollport stops the frame pump: true-scrolling a nested scrollport resumes visible paint: true-visible fixed descendant keeps inherited paint updating: true-ancestor filter animation keeps paint updating even before it expands: true-mixed layout and paint animation keeps updating: true-offscreen clipped shadow stops the frame pump: true-expanded overflow clip keeps potentially visible shadow updating: true-horizontal clip does not hide vertical shadow overflow: true-unclipped shadow that can reach the viewport keeps updating: true-offscreen shorthand with variable substitution stops the frame pump: true-offscreen shorthand with variable substitution builds no overlays: true-visible shorthand with variable substitution resumes the frame pump: true-offscreen clipped fade and blur stops the frame pump: true-offscreen clipped fade and blur builds no overlays: true+visible background frame requests: [animation frame pump request]+frame requests after scrolling out of view: []+paint outside a nested scrollport frame requests: []+frame requests after scrolling a nested scrollport to the paint: [animation frame pump request]+visible fixed descendant inheriting the paint frame requests: [animation frame pump request]+ancestor filter animation before it expands frame requests: [animation frame pump request]+mixed layout and paint animation frame requests: [animation frame pump request]+offscreen clipped shadow frame requests: []+potentially visible shadow in an expanded overflow clip frame requests: [animation frame pump request]+vertical shadow overflow past a horizontal clip frame requests: [animation frame pump request]+unclipped shadow that can reach the viewport frame requests: [animation frame pump request]+offscreen shorthand with variable substitution frame requests: []+offscreen shorthand with variable substitution samples: []+visible shorthand with variable substitution frame requests: [animation frame pump request]+offscreen clipped fade and blur frame requests: []+offscreen clipped fade and blur samples: []offscreen clipped fade and blur finishes: trueoffscreen clipped blur applies its final value: truediff --git a/Tests/LibWeb/Text/expected/css/offscreen-pseudo-element-paint-animation.txt b/Tests/LibWeb/Text/expected/css/offscreen-pseudo-element-paint-animation.txtindex af9ccbc68e5..1c0641faa9a 100644--- a/Tests/LibWeb/Text/expected/css/offscreen-pseudo-element-paint-animation.txt+++ b/Tests/LibWeb/Text/expected/css/offscreen-pseudo-element-paint-animation.txt@@ -1,7 +1,7 @@-offscreen pseudo-element builds no overlays: true-offscreen pseudo-element stops the frame pump: true+offscreen pseudo-element samples: []+offscreen pseudo-element frame requests: []pseudo-element style observes the current time: truescrolling into view samples the pseudo-element: true-visible pseudo-element resumes the frame pump: true-scrolling out of view stops the frame pump again: true-fixed pseudo-element escaping its host's clip keeps updating: true+visible pseudo-element frame requests: [animation frame pump request]+frame requests after scrolling out of view: []+fixed pseudo-element escaping its host's clip frame requests: [animation frame pump request]diff --git a/Tests/LibWeb/Text/expected/css/offscreen-svg-and-pseudo-animation-events.txt b/Tests/LibWeb/Text/expected/css/offscreen-svg-and-pseudo-animation-events.txtindex 26569821d0c..cd03491c7bc 100644--- a/Tests/LibWeb/Text/expected/css/offscreen-svg-and-pseudo-animation-events.txt+++ b/Tests/LibWeb/Text/expected/css/offscreen-svg-and-pseudo-animation-events.txt@@ -1,6 +1,7 @@-offscreen SVG and pseudo-element event listeners do not keep the frame pump running: true-offscreen SVG and pseudo-element animations build no overlays: true-animation event wake-up is armed: true+frame requests with offscreen SVG and pseudo-element event listeners: []+offscreen SVG and pseudo-element animations sample: []+compositor animations:+ wakeup timer armedSVG dispatches its iteration event: truepseudo-element dispatches its iteration event: trueSVG dispatches its end event: truediff --git a/Tests/LibWeb/Text/expected/css/offscreen-svg-opacity-animation.txt b/Tests/LibWeb/Text/expected/css/offscreen-svg-opacity-animation.txtindex 66c2ada2ca2..403f78121ef 100644--- a/Tests/LibWeb/Text/expected/css/offscreen-svg-opacity-animation.txt+++ b/Tests/LibWeb/Text/expected/css/offscreen-svg-opacity-animation.txt@@ -1,11 +1,11 @@-offscreen SVG opacity builds no overlays: true-an outer clip stops updates around transformed and filtered SVG: true+offscreen SVG opacity samples: []+updates of transformed and filtered SVG in an outer clip: frame requests [], compositor animations []SVG style observes the current opacity: truescrolling into view samples SVG opacity: true-visible SVG opacity resumes updating: true-scrolling out of view stops updating again: true-a transform outside the clip keeps SVG opacity updating: true-a filter outside the clip keeps SVG opacity updating: true-potentially referenced SVG keeps updating: true-SVG paint resources are not throttled by their DOM position: true-mixed SVG geometry and opacity animation keeps updating: true+updates of visible SVG opacity: frame requests [], compositor animations [opacity circle]+updates after scrolling out of view: frame requests [], compositor animations []+updates with a transform outside the clip: frame requests [], compositor animations [opacity circle]+updates with a filter outside the clip: frame requests [], compositor animations [opacity circle]+updates of potentially referenced SVG: frame requests [], compositor animations [opacity circle#referenced]+updates of an SVG paint resource: frame requests [animation frame pump request], compositor animations []+updates of a mixed SVG geometry and opacity animation: frame requests [animation frame pump request], compositor animations []diff --git a/Tests/LibWeb/Text/expected/css/reentrant-animation-style-flush.txt b/Tests/LibWeb/Text/expected/css/reentrant-animation-style-flush.txtindex 9707a07d4de..1a19f35a69b 100644--- a/Tests/LibWeb/Text/expected/css/reentrant-animation-style-flush.txt+++ b/Tests/LibWeb/Text/expected/css/reentrant-animation-style-flush.txt@@ -1 +1 @@-reentrant style read queues a follow-up sample: true+reentrant style read queues a follow-up sample: [div#target]diff --git a/Tests/LibWeb/Text/expected/css/removed-css-animations.txt b/Tests/LibWeb/Text/expected/css/removed-css-animations.txtindex e54a96fadaa..639df61b568 100644--- a/Tests/LibWeb/Text/expected/css/removed-css-animations.txt+++ b/Tests/LibWeb/Text/expected/css/removed-css-animations.txt@@ -1,8 +1,8 @@large animation-free subtree is removed: true-animations are associated after insertion: true+animations are associated after insertion: [opacity, spin, spin, spin, spin, spin]removed CSS animations are cancelled: trueremoved CSS transitions are cancelled: true-removed CSS animations are disassociated: true+removed CSS animations are disassociated: []reinsertion creates a fresh animation: truereinserted animation starts near the beginning: truereinsertion dispatches animationstart: truediff --git a/Tests/LibWeb/Text/expected/css/revived-cancelled-animations.txt b/Tests/LibWeb/Text/expected/css/revived-cancelled-animations.txtindex f3ece6a08b9..971421a8119 100644--- a/Tests/LibWeb/Text/expected/css/revived-cancelled-animations.txt+++ b/Tests/LibWeb/Text/expected/css/revived-cancelled-animations.txt@@ -1,22 +1,23 @@seeking a cancelled animation makes it relevant again: truea seeked cancelled animation survives a style change: true-cancelling it again disassociates it: true+cancelling it again disassociates it: []seeking in the same task as cancelling keeps it relevant: truepausing a cancelled animation makes it relevant again: truesetting the start time of a cancelled animation makes it run again: truefinishing a cancelled animation dispatches its events: true-a finished cancelled animation is disassociated again: true+a finished cancelled animation is disassociated again: []playing a cancelled animation dispatches animationstart: trueseeking a cancelled transition makes it relevant again: true-a removed completed transition is disassociated: true+a removed completed transition is disassociated: []seeking a removed completed transition makes it relevant again: true-a cancelled script animation is disassociated: true+a cancelled script animation is disassociated: []seeking a cancelled script animation makes it relevant again: true+compositor animations before cancelling: [opacity div]a revived compositor animation is sampled again: true-replacing the effect of a disassociated animation keeps it disassociated: true-retargeting a disassociated animation keeps it disassociated: true+replacing the effect of a disassociated animation keeps it disassociated: []+retargeting a disassociated animation keeps it disassociated: []reviving a retargeted animation associates it with its new target: true-a finished animation without a fill is disassociated: true-a removed completed transition that is still filling stays associated: true-a removed completed transition is disassociated once it becomes inert: true-no animations remain associated: true+a finished animation without a fill is disassociated: []+a removed completed transition that is still filling stays associated: [margin-left, margin-left]+a removed completed transition is disassociated once it becomes inert: [margin-left]+no animations remain associated: []diff --git a/Tests/LibWeb/Text/expected/css/style-engine/animated-element-pseudo-element-composition.txt b/Tests/LibWeb/Text/expected/css/style-engine/animated-element-pseudo-element-composition.txtindex c00c1d6d8ed..ce496e5f50f 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/animated-element-pseudo-element-composition.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/animated-element-pseudo-element-composition.txt@@ -1,2 +1,4 @@-style update pass guard hits: 0+style passes of the update:+ style PARTIAL+ span#target (computed, changed)rgb(50, 0, 150) rgb(50, 0, 150) rgb(0, 128, 0)diff --git a/Tests/LibWeb/Text/expected/css/style-engine/gc-aba-style-input-keys.txt b/Tests/LibWeb/Text/expected/css/style-engine/gc-aba-style-input-keys.txtindex f7e2b10a226..f0c50aaa838 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/gc-aba-style-input-keys.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/gc-aba-style-input-keys.txt@@ -1,4 +1,4 @@initial: rgb(255, 0, 0)-deletion advances the environment: false-insertion advances the environment: false+deletion environment changes: []+insertion environment changes: []replacement: rgb(0, 0, 255)diff --git a/Tests/LibWeb/Text/expected/css/style-engine/geometry-read-defers-paint-only-style.txt b/Tests/LibWeb/Text/expected/css/style-engine/geometry-read-defers-paint-only-style.txtindex 3e32f49f5ed..899a3bdaa7e 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/geometry-read-defers-paint-only-style.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/geometry-read-defers-paint-only-style.txt@@ -1,11 +1,10 @@paint-only geometry: 100paint-only offset width: 100paint-only client height: 10-inline style setup preserves geometry deferral: true-paint-only style deferred: true+paint-only style updates after inline style setup: []deferred style is observable: rgb(255, 0, 0)layout offset size: 200x20-layout style settled: true+layout style updates: [style stabilization epoch]transformed geometry: 18-visual geometry style settled: true+visual geometry style updates: [style stabilization epoch]merged deferred style is observable: rgb(0, 0, 255)diff --git a/Tests/LibWeb/Text/expected/css/style-engine/stabilization-epoch.txt b/Tests/LibWeb/Text/expected/css/style-engine/stabilization-epoch.txtindex df025df03d1..c43c07026d4 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/stabilization-epoch.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/stabilization-epoch.txt@@ -1,7 +1,9 @@-feedback-free epoch: true-feedback-free pass: true-feedback-free state: true-feedback shares one epoch: true-feedback uses multiple passes: true-feedback state is visible: true+feedback-free change:+ style stabilization epoch+ provisional style pass+change with container query feedback:+ style stabilization epoch+ provisional style pass+ provisional style pass+ style stabilization feedback epochstable query result: rgb(0, 128, 0)diff --git a/Tests/LibWeb/Text/expected/css/style-engine/stabilization-round-guard.txt b/Tests/LibWeb/Text/expected/css/style-engine/stabilization-round-guard.txtindex fd184dd12a1..a63f7d03c97 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/stabilization-round-guard.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/stabilization-round-guard.txt@@ -1,5 +1,61 @@-continuation adds passes: true-round guard reached: true-exact continuation ran: true-exact continuation stabilized: true+nested container query feedback:+ style stabilization epoch+ provisional style pass+ provisional style pass+ style stabilization feedback epoch+ provisional style pass+ provisional style pass+ provisional style pass+ provisional style pass+ provisional style pass+ provisional style pass+ provisional style pass+ style stabilization round guard+ exact stabilization pass+ provisional style pass+ exact stabilization pass+ provisional style pass+ exact stabilization pass+ provisional style pass+ exact stabilization pass+ provisional style pass+ exact stabilization pass+ provisional style pass+ exact stabilization pass+ provisional style pass+ exact stabilization pass+ provisional style pass+ exact stabilization pass+ provisional style pass+ exact stabilization pass+ provisional style pass+ exact stabilization pass+ provisional style pass+ exact stabilization pass+ provisional style pass+ exact stabilization pass+ provisional style pass+ exact stabilization pass+ provisional style pass+ exact stabilization pass+ provisional style pass+ exact stabilization pass+ provisional style pass+ exact stabilization pass+ provisional style pass+ exact stabilization pass+ provisional style pass+ exact stabilization pass+ provisional style pass+ exact stabilization pass+ provisional style pass+ exact stabilization pass+ provisional style pass+ exact stabilization pass+ provisional style pass+ exact stabilization pass+ provisional style pass+ exact stabilization pass+ provisional style pass+ exact stabilization passstable nested query result: rgb(0, 128, 0)diff --git a/Tests/LibWeb/Text/expected/css/style-engine/stabilization-transition-events.txt b/Tests/LibWeb/Text/expected/css/style-engine/stabilization-transition-events.txtindex 3cfaa8b0b8b..8f0b1fa25c0 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/stabilization-transition-events.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/stabilization-transition-events.txt@@ -1,10 +1,56 @@-feedback used provisional passes: true-transition decisions were provisional: true-intermediate decisions were superseded: true-two transition actions committed: true-two transitions started: true-intermediate transition events were not created: true-no provisional events committed: true+container query feedback with transitions:+ style stabilization epoch+ provisional style pass+ provisional style pass+ style stabilization feedback epoch+ provisional transition decision+ provisional transition decision+ provisional style pass+ provisional transition decision+ provisional transition decision superseded+ provisional transition decision+ provisional transition decision superseded+ provisional transition decision+ provisional style pass+ provisional transition decision+ provisional transition decision superseded+ provisional style pass+ provisional transition decision+ provisional transition decision superseded+ provisional style pass+ provisional transition decision+ provisional transition decision superseded+ provisional style pass+ provisional transition decision+ provisional transition decision superseded+ provisional style pass+ provisional transition decision+ provisional transition decision superseded+ provisional style pass+ style stabilization round guard+ exact stabilization pass+ provisional transition decision+ provisional transition decision superseded+ provisional style pass+ exact stabilization pass+ provisional transition decision+ provisional transition decision superseded+ provisional style pass+ exact stabilization pass+ provisional transition decision+ provisional transition decision superseded+ provisional style pass+ exact stabilization pass+ provisional transition decision+ provisional transition decision superseded+ provisional style pass+ exact stabilization pass+ provisional transition decision+ provisional transition decision superseded+ transition started+ transition action committed+ transition started+ transition action committedone stable transition remains: truediscarded transition was not published: truelate transition used the committed baseline: truediff --git a/Tests/LibWeb/Text/expected/css/style-engine/transition-baseline-without-size-query.txt b/Tests/LibWeb/Text/expected/css/style-engine/transition-baseline-without-size-query.txtindex 72d0af7000e..59317def948 100644--- a/Tests/LibWeb/Text/expected/css/style-engine/transition-baseline-without-size-query.txt+++ b/Tests/LibWeb/Text/expected/css/style-engine/transition-baseline-without-size-query.txt@@ -1,3 +1,3 @@-feedback used provisional passes: false+provisional passes: [provisional style pass]one transition started: truetransition midpoint width: 20pxdiff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/match-media-does-not-evaluate-rules.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/match-media-does-not-evaluate-rules.txtindex 3dc17bb5ccb..80d9ddde2b3 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/match-media-does-not-evaluate-rules.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/match-media-does-not-evaluate-rules.txt@@ -1 +1 @@-media rule evaluations after matchMedia: 0+media rule evaluations after matchMedia: []diff --git a/Tests/LibWeb/Text/expected/css/style-invalidation/registered-properties-cache-rebuilds.txt b/Tests/LibWeb/Text/expected/css/style-invalidation/registered-properties-cache-rebuilds.txtindex 5cf90fdd96f..2ff240f7eb7 100644--- a/Tests/LibWeb/Text/expected/css/style-invalidation/registered-properties-cache-rebuilds.txt+++ b/Tests/LibWeb/Text/expected/css/style-invalidation/registered-properties-cache-rebuilds.txt@@ -1,4 +1,4 @@-rebuilds after class churn: 0-cache rebuilt after sheet insertion: true+rebuilds after class churn: []+rebuilds after sheet insertion: [registered properties cache rebuilt]late registration works: rgb(4, 5, 6)early registration works: rgb(1, 2, 3)diff --git a/Tests/LibWeb/Text/expected/css/throttled-animation-late-iteration-listener.txt b/Tests/LibWeb/Text/expected/css/throttled-animation-late-iteration-listener.txtindex 4dfb7e501a5..fb8f6e62ae8 100644--- a/Tests/LibWeb/Text/expected/css/throttled-animation-late-iteration-listener.txt+++ b/Tests/LibWeb/Text/expected/css/throttled-animation-late-iteration-listener.txt@@ -1,8 +1,12 @@-visible, display-none, and closed-details rotations skip per-frame work: true-unobserved rotations need no wake-up timer: true+visible, display-none, and closed-details rotations per-frame work: frame requests [], samples []+unobserved rotations armed timers: []late listener receives no past events: true-late ancestor listener arms wake-up: true+late ancestor listener armed timers: [wakeup timer armed]next iteration reaches late listener: closed 3000, visible 3000-one wake-up serves the CSS effects: true-removing iteration listener leaves no periodic wake-up: true-showing hidden SVG resumes compositor rendering: true+one wake-up serves the CSS effects: [animation frame pump request]+removing iteration listener leaves no periodic wake-up: frame requests [], armed timers []+showing hidden SVG resumes compositor rendering:+ transform svg#closed+ transform svg#hidden+ transform svg#visible+ timing anchors differdiff --git a/Tests/LibWeb/Text/expected/css/will-change-transform-transition-on-compositor.txt b/Tests/LibWeb/Text/expected/css/will-change-transform-transition-on-compositor.txtindex c18bf2740d6..c387b36d1e8 100644--- a/Tests/LibWeb/Text/expected/css/will-change-transform-transition-on-compositor.txt+++ b/Tests/LibWeb/Text/expected/css/will-change-transform-transition-on-compositor.txt@@ -1,5 +1,8 @@-box owns a transform node before the transition: true+box owns a transform node before the transition: transform=[1,0,0,1,0,0] origin=(18,18)transition is still pending: true-transition starts on the compositor: true+transition starts on the compositor:+ transform div#box+ wakeup timer armedtransition keeps the transform node: true-transition keeps the visual context tree: true+visual context tree updates of the transition:+ update DIRTY-PATHdiff --git a/Tests/LibWeb/Text/expected/focus-in-frame-leaves-settled-embedding-document-alone.txt b/Tests/LibWeb/Text/expected/focus-in-frame-leaves-settled-embedding-document-alone.txtindex aba1c1da41b..6716eb303a1 100644--- a/Tests/LibWeb/Text/expected/focus-in-frame-leaves-settled-embedding-document-alone.txt+++ b/Tests/LibWeb/Text/expected/focus-in-frame-leaves-settled-embedding-document-alone.txt@@ -1,4 +1,5 @@-embedding style updates: 2+style updates of the focus entering the frame: [style stabilization epoch, provisional style pass, style stabilization epoch, provisional style pass, style stabilization epoch x2, style stabilization epoch, provisional style pass]+style updates of later focuses: [style stabilization epoch, provisional style pass, style stabilization epoch, provisional style pass]focused: afocused after narrowing: afocused after widening: narrow-hiddendiff --git a/Tests/LibWeb/Text/expected/focus-in-settled-document-does-not-update-style.txt b/Tests/LibWeb/Text/expected/focus-in-settled-document-does-not-update-style.txtindex bf79da97cfa..5b74ed3ab0d 100644--- a/Tests/LibWeb/Text/expected/focus-in-settled-document-does-not-update-style.txt+++ b/Tests/LibWeb/Text/expected/focus-in-settled-document-does-not-update-style.txt@@ -1,4 +1,6 @@-style updates: 20+style updates of a.focus(): [style stabilization epoch]+style updates of b.focus(): [style stabilization epoch]+style updates of inHidden.focus(): []focused: bfocused after hiding: bfocused after showing: inLaterdiff --git a/Tests/LibWeb/Text/expected/refocusing-active-element-does-not-update-style.txt b/Tests/LibWeb/Text/expected/refocusing-active-element-does-not-update-style.txtindex fd563716449..efe2ab34b1f 100644--- a/Tests/LibWeb/Text/expected/refocusing-active-element-does-not-update-style.txt+++ b/Tests/LibWeb/Text/expected/refocusing-active-element-does-not-update-style.txt@@ -1,2 +1,2 @@active element preserved: true-style updates: 0+style updates: []diff --git a/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-keeps-compositor-animations-of-a-restructured-tree.html b/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-keeps-compositor-animations-of-a-restructured-tree.htmlindex 31ffbe0d61d..dec7ed26fc4 100644--- a/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-keeps-compositor-animations-of-a-restructured-tree.html+++ b/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-keeps-compositor-animations-of-a-restructured-tree.html@@ -21,17 +21,18 @@a.classList.add("moved");await twoFrames();const result = await whileLaneHovers(frameTime => {- const before = internals.presentedCompositorAnimationCount(a);internals.injectHoverPointer(50, 25, frameTime + 16, 1);return {presentedBy: internals.lastFramePresentedBy(document),- animationsOfA: internals.presentedCompositorAnimationCount(a),- animationsOfB: internals.presentedCompositorAnimationCount(b),+ animationsOfB: internals.presentedCompositorAnimations(b),};});println(`last frame presented by: ${result.presentedBy}`);- println(`compositor animations of #a: ${result.animationsOfA}`);- println(`compositor animations of #b: ${result.animationsOfB}`);+ println(`compositor animations of #b: ${JSON.stringify(result.animationsOfB)}`);+ await twoFrames();+ println(`nodes of #b once the host took the hover in: ${internals.dumpVisualContextNodes(b).replace(/^\[s\d+\] /gm, "").trimEnd()}`);+ const compositorAnimations = internals.dumpCompositorAnimations().split("\n").filter(line => line && !line.endsWith("timer armed"));+ println(`compositor animations once the host restructured the tree: ${compositorAnimations.join(", ")}`);done();});</script>diff --git a/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-stops-a-finished-compositor-animation-a-hover-moves.html b/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-stops-a-finished-compositor-animation-a-hover-moves.htmlindex a7672d487ac..e0f3c641b31 100644--- a/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-stops-a-finished-compositor-animation-a-hover-moves.html+++ b/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-stops-a-finished-compositor-animation-a-hover-moves.html@@ -21,7 +21,7 @@const result = await whileLaneHovers(frameTime => {internals.injectHoverPointer(50, 50, frameTime + 200);return {- compositorAnimations: internals.presentedCompositorAnimationCount(box),+ compositorAnimations: JSON.stringify(internals.presentedCompositorAnimations(box)),opacity: internals.presentedOpacity(box),presentedBy: internals.lastFramePresentedBy(document),};diff --git a/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-stops-a-finished-compositor-animation-it-samples-over.html b/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-stops-a-finished-compositor-animation-it-samples-over.htmlindex 6ccf6e08a54..61ddd413ec9 100644--- a/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-stops-a-finished-compositor-animation-it-samples-over.html+++ b/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-stops-a-finished-compositor-animation-it-samples-over.html@@ -21,7 +21,7 @@internals.injectHoverPointer(50, 50, frameTime + 200);internals.injectClockTick(frameTime + 200 + 50000);return {- compositorAnimations: internals.presentedCompositorAnimationCount(box),+ compositorAnimations: JSON.stringify(internals.presentedCompositorAnimations(box)),opacity: internals.presentedOpacity(box),presentedBy: internals.lastFramePresentedBy(document),};diff --git a/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-stops-compositor-animations-of-cancelled-transitions.html b/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-stops-compositor-animations-of-cancelled-transitions.htmlindex 8445fb22908..a79d549433a 100644--- a/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-stops-compositor-animations-of-cancelled-transitions.html+++ b/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-stops-compositor-animations-of-cancelled-transitions.html@@ -23,7 +23,7 @@internals.injectHoverPointer(50, 50, frameTime + 16);internals.injectClockTick(frameTime + 32);return {- compositorAnimations: internals.presentedCompositorAnimationCount(box),+ compositorAnimations: JSON.stringify(internals.presentedCompositorAnimations(box)),presentedBy: internals.lastFramePresentedBy(document),};});diff --git a/Tests/LibWeb/Text/input/HTML/frame-in-flight/style-flight-compositor-animation-wakeup.html b/Tests/LibWeb/Text/input/HTML/frame-in-flight/style-flight-compositor-animation-wakeup.htmlindex d3f44706c9e..cf60186bd49 100644--- a/Tests/LibWeb/Text/input/HTML/frame-in-flight/style-flight-compositor-animation-wakeup.html+++ b/Tests/LibWeb/Text/input/HTML/frame-in-flight/style-flight-compositor-animation-wakeup.html@@ -22,16 +22,20 @@const activeStartTime = transition.startTime + 100001;const result = await whileRecordingInFlight(() => {- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();probe.style.width = "60px";}, state => {internals.fireCompositorAnimationWakeupForTesting(activeStartTime);- const counters = internals.getStyleInvalidationCounters();- return { state, republished: counters.compositorVisualAnimationUpdates, requested: counters.animationFramePumpRequests };+ const trace = internals.takeRenderingTrace().split("\n");+ return {+ state,+ republished: trace.filter(line => line.startsWith("compositor animations updated")),+ requested: trace.filter(line => line.startsWith("animation frame pump request")),+ };});println(`state in the next task: ${result.state}`);- println(`wake-up republishes beside the frame: ${result.republished}`);- println(`wake-up requests a frame: ${result.requested}`);+ println(`wake-up republishes beside the frame: [${result.republished.join(", ")}]`);+ println(`wake-up requests a frame: [${result.requested.join(", ")}]`);await twoFrames();println(`probe box width: ${probe.offsetWidth}`);transition.cancel();diff --git a/Tests/LibWeb/Text/input/HTML/preference-change-requests-rendering.html b/Tests/LibWeb/Text/input/HTML/preference-change-requests-rendering.htmlindex b0d68421e6a..dc35e38a981 100644--- a/Tests/LibWeb/Text/input/HTML/preference-change-requests-rendering.html+++ b/Tests/LibWeb/Text/input/HTML/preference-change-requests-rendering.html@@ -7,9 +7,10 @@internals.updateStyle();const query = matchMedia("(prefers-color-scheme: dark)");const changed = new Promise(resolve => query.onchange = resolve);- internals.resetRenderingSchedulerCounters();+ internals.beginRenderingTrace();internals.setPreferredColorScheme("dark");- println(`preference requested rendering: ${internals.getRenderingSchedulerCounters().updateRequests > 0}`);+ const requests = internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("request"));+ println(`rendering requests of the preference change: [${requests.join(", ")}]`);internals.injectRenderingOpportunity(performance.now());await changed;println(`media query changed: ${query.matches}`);diff --git a/Tests/LibWeb/Text/input/HTML/rendering-opportunity-allows-posted-messages.html b/Tests/LibWeb/Text/input/HTML/rendering-opportunity-allows-posted-messages.htmlindex f65e0d7920c..7829c52c7c7 100644--- a/Tests/LibWeb/Text/input/HTML/rendering-opportunity-allows-posted-messages.html+++ b/Tests/LibWeb/Text/input/HTML/rendering-opportunity-allows-posted-messages.html@@ -9,10 +9,17 @@return promise;}+ function printRenderingSchedule(title, trace) {+ println(title);+ for (const line of trace.split("\n")) {+ if (/^(request|opportunity|update$)/.test(line))+ println(` ${line}`);+ }+ }+asyncTest(async done => {internals.setManualRenderingOpportunities(true);await nextTask();- internals.resetRenderingSchedulerCounters();let animationFrameRan = false;requestAnimationFrame(() => animationFrameRan = true);@@ -30,18 +37,17 @@await messagesFinished.promise;await nextTask();- const beforeOpportunity = internals.getRenderingSchedulerCounters();- const animationFrameStayedPending = !animationFrameRan && beforeOpportunity.updatesRun === 0;+ const animationFrameStayedPending = !animationFrameRan;+ internals.beginRenderingTrace();internals.injectRenderingOpportunity(performance.now());await nextTask();- const afterOpportunity = internals.getRenderingSchedulerCounters();+ const trace = internals.takeRenderingTrace();internals.setManualRenderingOpportunities(false);println(`posted messages before opportunity: ${messageCount}`);println(`animation frame stayed pending: ${animationFrameStayedPending}`);- println(`posted-message tasks progressed: ${beforeOpportunity.postedMessageTasksBetweenUpdates >= 10}`);println(`animation frame ran after opportunity: ${animationFrameRan}`);- println(`one update ran: ${afterOpportunity.updatesRun === 1}`);+ printRenderingSchedule("rendering after the opportunity:", trace);done();});</script>diff --git a/Tests/LibWeb/Text/input/HTML/rendering-opportunity-coalesces-requests.html b/Tests/LibWeb/Text/input/HTML/rendering-opportunity-coalesces-requests.htmlindex e70bd8c037d..7967149c419 100644--- a/Tests/LibWeb/Text/input/HTML/rendering-opportunity-coalesces-requests.html+++ b/Tests/LibWeb/Text/input/HTML/rendering-opportunity-coalesces-requests.html@@ -9,26 +9,30 @@return promise;}+ function printRenderingSchedule(title, trace) {+ println(title);+ for (const line of trace.split("\n")) {+ if (/^(request|opportunity|update$)/.test(line))+ println(` ${line}`);+ }+ }+asyncTest(async done => {internals.setManualRenderingOpportunities(true);await nextTask();- internals.resetRenderingSchedulerCounters();+ internals.beginRenderingTrace();let callbackCount = 0;for (let i = 0; i < 20; ++i)requestAnimationFrame(() => ++callbackCount);- const before = internals.getRenderingSchedulerCounters();internals.injectRenderingOpportunity(performance.now());await nextTask();- const after = internals.getRenderingSchedulerCounters();+ const trace = internals.takeRenderingTrace();internals.setManualRenderingOpportunities(false);- println(`updates before opportunity: ${before.updatesRun}`);println(`callbacks after one opportunity: ${callbackCount}`);- println(`one opportunity received: ${after.opportunitiesReceived === 1}`);- println(`one update ran: ${after.updatesRun === 1}`);- println(`requests were coalesced: ${after.updateRequests >= 20 && after.coalescedUpdateRequests >= 19}`);+ printRenderingSchedule("rendering:", trace);done();});</script>diff --git a/Tests/LibWeb/Text/input/HTML/rendering-opportunity-defers-next-frame.html b/Tests/LibWeb/Text/input/HTML/rendering-opportunity-defers-next-frame.htmlindex cbf77c72491..61c7b0ecdc2 100644--- a/Tests/LibWeb/Text/input/HTML/rendering-opportunity-defers-next-frame.html+++ b/Tests/LibWeb/Text/input/HTML/rendering-opportunity-defers-next-frame.html@@ -12,7 +12,6 @@asyncTest(async done => {internals.setManualRenderingOpportunities(true);await nextTask();- internals.resetRenderingSchedulerCounters();let callbackCount = 0;requestAnimationFrame(() => {@@ -28,13 +27,11 @@internals.injectRenderingOpportunity(performance.now());await nextTask();- const counters = internals.getRenderingSchedulerCounters();internals.setManualRenderingOpportunities(false);println(`callbacks after first opportunity: ${afterFirstOpportunity}`);println(`callbacks after another task: ${afterAnotherTask}`);println(`callbacks after second opportunity: ${callbackCount}`);- println(`two updates ran: ${counters.updatesRun === 2}`);done();});</script>diff --git a/Tests/LibWeb/Text/input/HTML/rendering-opportunity-hidden-document.html b/Tests/LibWeb/Text/input/HTML/rendering-opportunity-hidden-document.htmlindex 82f8c5e8d66..883ec0fc9ec 100644--- a/Tests/LibWeb/Text/input/HTML/rendering-opportunity-hidden-document.html+++ b/Tests/LibWeb/Text/input/HTML/rendering-opportunity-hidden-document.html@@ -9,29 +9,38 @@return promise;}+ function printRenderingSchedule(title, trace) {+ println(title);+ for (const line of trace.split("\n")) {+ if (/^(request|opportunity|update$)/.test(line))+ println(` ${line}`);+ }+ }+asyncTest(async done => {internals.setManualRenderingOpportunities(true);await nextTask();await setSystemVisibilityState("hidden");- internals.resetRenderingSchedulerCounters();+ internals.beginRenderingTrace();let callbackCount = 0;requestAnimationFrame(() => ++callbackCount);internals.injectRenderingOpportunity(performance.now());await nextTask();- const whileHidden = internals.getRenderingSchedulerCounters();+ const whileHidden = internals.takeRenderingTrace();const callbackCountWhileHidden = callbackCount;await setSystemVisibilityState("visible");+ internals.beginRenderingTrace();internals.injectRenderingOpportunity(performance.now());await nextTask();- const afterVisibleOpportunity = internals.getRenderingSchedulerCounters();+ const afterVisibleOpportunity = internals.takeRenderingTrace();internals.setManualRenderingOpportunities(false);println(`callback count while hidden: ${callbackCountWhileHidden}`);- println(`updates while hidden: ${whileHidden.updatesRun}`);+ printRenderingSchedule("rendering while hidden:", whileHidden);println(`callback count after visible opportunity: ${callbackCount}`);- println(`one update ran: ${afterVisibleOpportunity.updatesRun === 1}`);+ printRenderingSchedule("rendering after the visible opportunity:", afterVisibleOpportunity);done();});</script>diff --git a/Tests/LibWeb/Text/input/Internals/internals-object-results-receiver-realm.html b/Tests/LibWeb/Text/input/Internals/internals-object-results-receiver-realm.htmlindex f0f62cb8a89..96b8ae461f4 100644--- a/Tests/LibWeb/Text/input/Internals/internals-object-results-receiver-realm.html+++ b/Tests/LibWeb/Text/input/Internals/internals-object-results-receiver-realm.html@@ -6,10 +6,6 @@document.body.append(iframe);const other = iframe.contentWindow;- const counters = other.internals.getStyleInvalidationCounters.call(internals);- println(`style counters has null prototype: ${Object.getPrototypeOf(counters) === null}`);- println(`style counters has animated overlay builds: ${"animatedStyleOverlayBuilds" in counters}`);-const scrollState = other.internals.compositorScrollState.call(internals);println(`compositor scroll state has null prototype: ${Object.getPrototypeOf(scrollState) === null}`);println(`compositor scroll state scrollNodes uses iframe Array: ${scrollState.scrollNodes instanceof other.Array}`);diff --git a/Tests/LibWeb/Text/input/content-blocker-irrelevant-class-id-change-skips-refresh.html b/Tests/LibWeb/Text/input/content-blocker-irrelevant-class-id-change-skips-refresh.htmlindex 4e2ba1e7282..7088c169d46 100644--- a/Tests/LibWeb/Text/input/content-blocker-irrelevant-class-id-change-skips-refresh.html+++ b/Tests/LibWeb/Text/input/content-blocker-irrelevant-class-id-change-skips-refresh.html@@ -23,8 +23,7 @@println(getComputedStyle(classTarget).display);println(getComputedStyle(idTarget).display);- internals.resetStyleInvalidationCounters();- const styleEnvironmentVersion = internals.getStyleInvalidationCounters().styleEnvironmentVersion;+ internals.beginRenderingTrace();classTarget.className = "irrelevant";idTarget.id = "unrelated";@@ -32,11 +31,8 @@println(getComputedStyle(classTarget).color);println(getComputedStyle(idTarget).color);- const counters = internals.getStyleInvalidationCounters();- if (counters.styleEnvironmentVersion === styleEnvironmentVersion)- println("PASS: irrelevant class/id changes skipped content blocker refresh");- else- println("FAIL: irrelevant class/id changes refreshed content blocker style");+ const environmentChanges = internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("style environment changed"));+ println(`environment changes from irrelevant class/id changes: [${environmentChanges.join(", ")}]`);classTarget.className = "ad";idTarget.id = "sponsor";diff --git a/Tests/LibWeb/Text/input/content-blocker-shadow-cache-survives-class-refresh.html b/Tests/LibWeb/Text/input/content-blocker-shadow-cache-survives-class-refresh.htmlindex 45256fda618..81d80a21ff9 100644--- a/Tests/LibWeb/Text/input/content-blocker-shadow-cache-survives-class-refresh.html+++ b/Tests/LibWeb/Text/input/content-blocker-shadow-cache-survives-class-refresh.html@@ -27,7 +27,6 @@println(getComputedStyle(wrappers[0]).color);println(getComputedStyle(targets[0]).display);- internals.resetStyleInvalidationCounters();for (const target of targets)target.className = "target ad";@@ -35,8 +34,6 @@println(getComputedStyle(wrappers[0]).color);println(getComputedStyle(targets[0]).display);- const counters = internals.getStyleInvalidationCounters();-internals.setContentBlockers("");});</script>diff --git a/Tests/LibWeb/Text/input/css/animated-style-dirty-effects.html b/Tests/LibWeb/Text/input/css/animated-style-dirty-effects.htmlindex d062d7725b9..b6dac89b24f 100644--- a/Tests/LibWeb/Text/input/css/animated-style-dirty-effects.html+++ b/Tests/LibWeb/Text/input/css/animated-style-dirty-effects.html@@ -1,15 +1,27 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><script>function nextFrame() {return new Promise(requestAnimationFrame);}+ function sampledElements() {+ const events = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ return `[${[...new Set(events.map(event => shortStyleName(event.element)))].join(", ")}]`;+ }++ function skipCacheEvents() {+ const lines = internals.takeRenderingTrace().split("\n").map(line => line.replace(/ x\d+$/, ""));+ return `[${[...new Set(lines.filter(line => line.startsWith("animation style skip cache")))].join(", ")}]`;+ }+asyncTest(async done => {internals.updateStyle();const completedTargets = [];for (let i = 0; i < 20; ++i) {const target = document.createElement("div");+ target.id = `completed${i}`;target.style.transformOrigin = "center center 1px";document.body.append(target);const animation = target.animate([@@ -21,6 +33,7 @@}const activeTarget = document.createElement("div");+ activeTarget.id = "active";activeTarget.style.transformOrigin = "center center 1px";document.body.append(activeTarget);// The active animation runs on a timeline only this test moves, so it samples once per step here, however@@ -33,6 +46,7 @@activeAnimation.play();const hiddenTarget = document.createElement("div");+ hiddenTarget.id = "hidden";hiddenTarget.style.visibility = "hidden";hiddenTarget.style.transformOrigin = "center center 1px";document.body.append(hiddenTarget);@@ -43,30 +57,29 @@for (let i = 0; i < 4; ++i)await nextFrame();- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();+ internals.beginRenderingTrace();for (let i = 1; i <= 4; ++i) {activeTimeline.setTime(i * 1000);await nextFrame();}- const steadyCounters = internals.getStyleInvalidationCounters();- println(`completed effects stay out of animated style updates: ${steadyCounters.animatedStyleOverlayBuilds <= 4}`);- println(`stable skip eligibility is cached: ${steadyCounters.animationStyleSkipCacheHits > 0}`);+ println(`steady steps sample only the active effect: ${sampledElements()}`);+ println(`steady steps skip cache: ${skipCacheEvents()}`);const unrelatedTarget = document.createElement("div");document.body.append(unrelatedTarget);- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();for (let i = 0; i < 4; ++i) {unrelatedTarget.style.color = `rgb(${i}, 0, 0)`;await nextFrame();}- const unrelatedStyleCounters = internals.getStyleInvalidationCounters();- println(`unrelated style changes preserve skip eligibility: ${unrelatedStyleCounters.animationStyleSkipCacheHits > 0 && unrelatedStyleCounters.animationStyleSkipCacheMisses === 0}`);+ println(`unrelated style changes keep the skip cache: ${skipCacheEvents()}`);hiddenAnimation.effect.updateTiming({ iterations: 1 });- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();for (let i = 0; i < 4; ++i)await nextFrame();- println(`timing changes invalidate skip eligibility: ${internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds > 0}`);+ println(`timing changes invalidate skip eligibility: ${sampledElements()}`);hiddenAnimation.effect.updateTiming({ iterations: Infinity });await nextFrame();@@ -78,16 +91,15 @@hiddenTimeline.setTime(0);await nextFrame();const visibleChild = document.createElement("div");+ visibleChild.id = "visible-child";visibleChild.style.visibility = "visible";hiddenTarget.append(visibleChild);- let descendantUpdatesEveryStep = true;for (let i = 1; i <= 4; ++i) {- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();hiddenTimeline.setTime(i * 1000);await nextFrame();- descendantUpdatesEveryStep &&= internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds > 0;+ println(`descendant style changes invalidate skip eligibility, step ${i}: ${sampledElements()}`);}- println(`descendant style changes invalidate skip eligibility: ${descendantUpdatesEveryStep}`);const siblingTarget = document.createElement("div");siblingTarget.style.cssText = "opacity: 0; transform-origin: center center 1px";@@ -154,10 +166,10 @@pausedAnimation.pause();await pausedAnimation.ready;await nextFrame();- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();for (let i = 0; i < 4; ++i)await nextFrame();- println(`paused animation builds no overlays: ${internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds === 0}`);+ println(`paused animation samples: ${sampledElements()}`);done();});diff --git a/Tests/LibWeb/Text/input/css/animation-display-none-pseudo-element.html b/Tests/LibWeb/Text/input/css/animation-display-none-pseudo-element.htmlindex f400ac03833..f4f8277a953 100644--- a/Tests/LibWeb/Text/input/css/animation-display-none-pseudo-element.html+++ b/Tests/LibWeb/Text/input/css/animation-display-none-pseudo-element.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>#target::before {content: "";@@ -13,13 +14,14 @@internals.updateStyle();const target = document.querySelector("#target");println(`pseudo-element is hidden: ${getComputedStyle(target, "::before").display === "none"}`);- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();const animation = target.animate({ opacity: [0, 1] }, { duration: 1000, pseudoElement: "::before" });animation.pause();animation.currentTime = 500;await new Promise(requestAnimationFrame);- println(`hidden pseudo-element skips animation sampling: ${internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds === 0}`);+ const sampled = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ println(`hidden pseudo-element samples: [${sampled.map(event => event.element).join(", ")}]`);done();});</script>diff --git a/Tests/LibWeb/Text/input/css/animation-events-of-many-siblings-in-tree-order.html b/Tests/LibWeb/Text/input/css/animation-events-of-many-siblings-in-tree-order.htmlindex 1c970598731..7db38d7161c 100644--- a/Tests/LibWeb/Text/input/css/animation-events-of-many-siblings-in-tree-order.html+++ b/Tests/LibWeb/Text/input/css/animation-events-of-many-siblings-in-tree-order.html@@ -8,6 +8,14 @@</style><div id="host"></div><script>+ function printTreePositionCompares(title) {+ println(title);+ for (const line of internals.takeRenderingTrace().split("\n")) {+ if (line.startsWith("composite order compared by tree position"))+ println(` ${line}`);+ }+ }+// Sorting the events and animations of many siblings by composite order asks where they stand in tree order. That// takes in a walk of their siblings only at first, whatever their number, and follows the tree as it changes.asyncTest(async done => {@@ -37,21 +45,20 @@return targets.every((target, index) => target === host.children[index]);}- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();println(`events in tree order: ${await eventsInTreeOrder("first")}`);println(`after moving the last element first: ${await (async () => {host.prepend(host.lastElementChild);return eventsInTreeOrder("second");})()}`);- const compares = internals.getStyleInvalidationCounters().compositeOrderDocumentPositionCompares;- println(`walks of the tree are bounded: ${compares <= 2000}`);+ printTreePositionCompares("compares before each walk of the tree:");// NB: An attribute moves no element, so the tree positions the sort holds stand.document.getAnimations();host.firstElementChild.setAttribute("data-moved", "no");- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();document.getAnimations();- println(`walks of the tree after an attribute change: ${internals.getStyleInvalidationCounters().compositeOrderDocumentPositionCompares}`);+ printTreePositionCompares("compares after an attribute change:");done();});</script>diff --git a/Tests/LibWeb/Text/input/css/animation-in-display-none-iframe.html b/Tests/LibWeb/Text/input/css/animation-in-display-none-iframe.htmlindex 8490e413bc7..32a61a2d430 100644--- a/Tests/LibWeb/Text/input/css/animation-in-display-none-iframe.html+++ b/Tests/LibWeb/Text/input/css/animation-in-display-none-iframe.html@@ -1,7 +1,18 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><div id="container" style="display: none"></div><script>+function frameRequests() {+ const lines = internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("animation frame pump request"));+ return `[${[...new Set(lines.map(line => line.replace(/ x\d+$/, "")))].join(", ")}]`;+}++function sampledElements(frameInternals) {+ const events = parseStyleTrace(frameInternals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ return `[${[...new Set(events.map(event => event.element))].join(", ")}]`;+}+asyncTest(async done => {internals.updateStyle();const frame = document.createElement("iframe");@@ -26,35 +37,35 @@ asyncTest(async done => {await new Promise(requestAnimationFrame);};await frames();- child.internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();+ child.internals.beginStyleTrace();await frames();- const hidden = child.internals.getStyleInvalidationCounters();- println(`hidden iframe skips animation frame requests: ${hidden.animationFramePumpRequests === 0}`);- println(`hidden iframe skips animated style builds: ${hidden.animatedStyleOverlayBuilds === 0}`);+ println(`hidden iframe frame requests: ${frameRequests()}`);+ println(`hidden iframe samples: ${sampledElements(child.internals)}`);animation.currentTime = 50000;println(`hidden iframe style read samples animation: ${Math.abs(parseFloat(child.getComputedStyle(circle).strokeDashoffset) - 50) < 1}`);await frames();- child.internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();+ child.internals.beginStyleTrace();container.style.display = "block";await new Promise(resolve => setTimeout(resolve, 100));- const shown = child.internals.getStyleInvalidationCounters();- println(`showing iframe resumes animation frame requests: ${shown.animationFramePumpRequests > 0}`);- println(`showing iframe resumes animated style builds: ${shown.animatedStyleOverlayBuilds > 0}`);+ println(`shown iframe frame requests: ${frameRequests()}`);+ println(`shown iframe samples: ${sampledElements(child.internals)}`);container.style.display = "none";await frames();- child.internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();await frames();- println(`hiding iframe stops animation frame requests: ${child.internals.getStyleInvalidationCounters().animationFramePumpRequests === 0}`);+ println(`frame requests after hiding the iframe: ${frameRequests()}`);const listener = () => {};circle.addEventListener("animationiteration", listener);await frames();- child.internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();await frames();- const listening = child.internals.getStyleInvalidationCounters();- println(`hidden iframe iteration listener uses wake-up timer: ${listening.animationFramePumpRequests === 0 && listening.compositorAnimationWakeupTimerActive}`);+ const armedTimers = child.internals.dumpCompositorAnimations().split("\n").filter(line => line.endsWith("timer armed"));+ println(`hidden iframe iteration listener frame requests: ${frameRequests()}, armed timers: [${armedTimers.join(", ")}]`);circle.removeEventListener("animationiteration", listener);const iteration = new Promise(resolve => circle.addEventListener("animationiteration", () => resolve(true), { once: true }));animation.effect.updateTiming({ duration: 100 });@@ -71,12 +82,13 @@ asyncTest(async done => {const nestedCircle = nestedChild.document.querySelector("circle");nestedChild.getComputedStyle(nestedCircle).strokeDashoffset;await frames();- nestedChild.internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();await frames();- println(`hidden ancestor iframe stops nested animation frame requests: ${nestedChild.internals.getStyleInvalidationCounters().animationFramePumpRequests === 0}`);+ println(`nested iframe in a hidden ancestor iframe frame requests: ${frameRequests()}`);+ internals.beginRenderingTrace();container.style.display = "block";await new Promise(resolve => setTimeout(resolve, 100));- println(`showing ancestor iframe resumes nested animation: ${nestedChild.internals.getStyleInvalidationCounters().animationFramePumpRequests > 0}`);+ println(`nested iframe in a shown ancestor iframe frame requests: ${frameRequests()}`);nestedCircle.getAnimations()[0].cancel();container.style.display = "none";await frames();diff --git a/Tests/LibWeb/Text/input/css/animation-observation-timeline.html b/Tests/LibWeb/Text/input/css/animation-observation-timeline.htmlindex 2ac7676a978..0bc60e0d692 100644--- a/Tests/LibWeb/Text/input/css/animation-observation-timeline.html+++ b/Tests/LibWeb/Text/input/css/animation-observation-timeline.html@@ -13,12 +13,20 @@</style><div id="target"></div><script>+ function printTimelineEvents(title) {+ println(title);+ for (const line of internals.takeRenderingTrace().split("\n")) {+ if (line.startsWith("animation timeline"))+ println(` ${line}`);+ }+ }+asyncTest(async done => {for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);await new Promise(resolve => setTimeout(resolve, 0));- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();const animation = document.getAnimations()[0];animation.effect.getComputedTiming();@@ -27,12 +35,12 @@document.timeline.currentTime;animation.currentTime;document.timeline.currentTime;- println(`one synchronization in a task: ${internals.getStyleInvalidationCounters().animationTimelineSynchronizations}`);- println(`getter updates associated animations: ${internals.getStyleInvalidationCounters().animationTimelineAssociatedAnimationUpdates}`);+ printTimelineEvents("getters in one task:");+ internals.beginRenderingTrace();await new Promise(resolve => setTimeout(resolve, 0));animation.currentTime;- println(`next task synchronizes again: ${internals.getStyleInvalidationCounters().animationTimelineSynchronizations}`);+ printTimelineEvents("getter in the next task:");done();});</script>diff --git a/Tests/LibWeb/Text/input/css/compositor-animation-animated-observer-ancestor.html b/Tests/LibWeb/Text/input/css/compositor-animation-animated-observer-ancestor.htmlindex 3c0b5ba77e6..2da7244ad5a 100644--- a/Tests/LibWeb/Text/input/css/compositor-animation-animated-observer-ancestor.html+++ b/Tests/LibWeb/Text/input/css/compositor-animation-animated-observer-ancestor.html@@ -33,6 +33,12 @@</style><div id="root"><div id="rotated-parent"><div id="target"></div></div></div><script>+ function printCompositorAnimations(title) {+ println(title);+ for (const line of internals.dumpCompositorAnimations().split("\n").filter(Boolean))+ println(` ${line}`);+ }+asyncTest(async done => {const ancestorAnimation = document.querySelector("#rotated-parent").getAnimations()[0];ancestorAnimation.currentTime = 0;@@ -45,7 +51,7 @@observer.observe(target);println(`target starts outside root: ${!(await nextObservation).isIntersecting}`);- println(`only ancestor animation uses compositor: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 1}`);+ printCompositorAnimations("compositor animations:");nextObservation = new Promise(resolve => resolveObservation = resolve);ancestorAnimation.currentTime = 100000;diff --git a/Tests/LibWeb/Text/input/css/compositor-animation-forced-effects-frame-removal.html b/Tests/LibWeb/Text/input/css/compositor-animation-forced-effects-frame-removal.htmlindex 2e5e2b9a193..f142074a90c 100644--- a/Tests/LibWeb/Text/input/css/compositor-animation-forced-effects-frame-removal.html+++ b/Tests/LibWeb/Text/input/css/compositor-animation-forced-effects-frame-removal.html@@ -23,6 +23,7 @@document.elementFromPoint(0, 0);const target = stale.children[stale.children.length - 2];+ target.id = "target";target.scrollIntoView();const staleChildren = [...stale.children].filter(child => child !== target && child !== dummy);const staleAnimations = staleChildren.map(child => child.animate([{ opacity: 1 }, { opacity: 0 }], { duration: 100000 }));@@ -34,20 +35,21 @@internals.updateCompositorAnimations();document.elementFromPoint(0, 0);- const staleEffectsFrame = staleChildren.every(child => internals.visualContextNodeIndices(child).effects.length > 0);+ const ownsEffectsNode = child => /^\[e\d+\]/m.test(internals.dumpVisualContextNodes(child));+ const staleEffectsFrame = staleChildren.every(ownsEffectsNode);for (const animation of staleAnimations)animation.cancel();- internals.resetStyleInvalidationCounters();internals.forceVisualContextTreeRebuildOnNextCompositorAnimationUpdateForTesting();internals.updateCompositorAnimations();- const counters = internals.getStyleInvalidationCounters();- const staleEffectsFrameRemoved = staleChildren.every(child => internals.visualContextNodeIndices(child).effects.length === 0);+ const compositorAnimations = internals.dumpCompositorAnimations();+ const staleEffectsFrameRemoved = !staleChildren.some(ownsEffectsNode);println(`stale animation creates an effects frame: ${staleEffectsFrame}`);println(`stale effects frame is removed: ${staleEffectsFrameRemoved}`);- println(`target background-color animation remains published: ${counters.compositorVisualAnimations === 1}`);- println(`published animation targets match the rebuilt visual tree: ${counters.compositorVisualAnimationTargetsAreValid}`);+ println("compositor animations after the rebuild:");+ for (const line of compositorAnimations.split("\n").filter(Boolean))+ println(` ${line}`);for (const animation of document.getAnimations())animation.cancel();diff --git a/Tests/LibWeb/Text/input/css/compositor-animation-hidden-iframe.html b/Tests/LibWeb/Text/input/css/compositor-animation-hidden-iframe.htmlindex 6d53bcb5427..63d5ae7194d 100644--- a/Tests/LibWeb/Text/input/css/compositor-animation-hidden-iframe.html+++ b/Tests/LibWeb/Text/input/css/compositor-animation-hidden-iframe.html@@ -1,7 +1,14 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><div id="target" style="width: 20px; height: 20px; background: red"></div><script>+function printCompositorAnimations(title) {+ println(title);+ for (const line of internals.dumpCompositorAnimations().split("\n").filter(Boolean))+ println(` ${line}`);+}+asyncTest(async done => {internals.updateStyle();const frame = document.createElement("iframe");@@ -22,12 +29,13 @@ asyncTest(async done => {getComputedStyle(target).opacity;for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- println(`opacity uses compositor: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 1}`);- internals.resetStyleInvalidationCounters();+ printCompositorAnimations("compositor animations:");+ internals.beginStyleTrace();timeline.setTime(500);for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- println(`child rendering does not sample parent animations: ${internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds === 0}`);+ const sampled = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ println(`child rendering samples: [${sampled.map(event => event.element).join(", ")}]`);timeline.setTimeForObservation(500);println(`explicit style observation remains current: ${getComputedStyle(target).opacity === "0.5"}`);animation.cancel();diff --git a/Tests/LibWeb/Text/input/css/compositor-animation-implicit-keyframes-over-other-effects.html b/Tests/LibWeb/Text/input/css/compositor-animation-implicit-keyframes-over-other-effects.htmlindex 5729d931aa3..ce02e1d7d01 100644--- a/Tests/LibWeb/Text/input/css/compositor-animation-implicit-keyframes-over-other-effects.html+++ b/Tests/LibWeb/Text/input/css/compositor-animation-implicit-keyframes-over-other-effects.html@@ -7,17 +7,23 @@</style><div id="target"></div><script>+ function printCompositorAnimations(title) {+ println(title);+ for (const line of internals.dumpCompositorAnimations().split("\n").filter(Boolean))+ println(` ${line}`);+ }+asyncTest(async done => {// The 0% and 100% keyframes of the pulse take the output of the fade beneath it, which only the main thread has.target.style.animation = "fade 100s linear infinite, pulse 100s linear infinite";await Promise.all(target.getAnimations().map(animation => animation.ready));internals.updateCompositorAnimations();- println(`over another animation: ${internals.getStyleInvalidationCounters().compositorVisualAnimations}`);+ printCompositorAnimations("over another animation:");target.style.animation = "pulse 100s linear infinite";await Promise.all(target.getAnimations().map(animation => animation.ready));internals.updateCompositorAnimations();- println(`alone: ${internals.getStyleInvalidationCounters().compositorVisualAnimations}`);+ printCompositorAnimations("alone:");done();});</script>diff --git a/Tests/LibWeb/Text/input/css/compositor-animation-implicit-keyframes.html b/Tests/LibWeb/Text/input/css/compositor-animation-implicit-keyframes.htmlindex 8263a90f3f7..838854117d0 100644--- a/Tests/LibWeb/Text/input/css/compositor-animation-implicit-keyframes.html+++ b/Tests/LibWeb/Text/input/css/compositor-animation-implicit-keyframes.html@@ -14,7 +14,7 @@target.style.animation = `${name} 100s linear infinite`;await Promise.all(target.getAnimations().map(animation => animation.ready));internals.updateCompositorAnimations();- println(`${name}: ${internals.getStyleInvalidationCounters().compositorVisualAnimations}`);+ println(`${name}: ${internals.dumpCompositorAnimations().trimEnd()}`);target.style.animation = "none";internals.updateCompositorAnimations();}diff --git a/Tests/LibWeb/Text/input/css/compositor-animation-intersection-observer.html b/Tests/LibWeb/Text/input/css/compositor-animation-intersection-observer.htmlindex 20bbad96e96..8519ea5248b 100644--- a/Tests/LibWeb/Text/input/css/compositor-animation-intersection-observer.html+++ b/Tests/LibWeb/Text/input/css/compositor-animation-intersection-observer.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>@keyframes move {from { transform: translateX(0); }@@ -20,6 +21,12 @@</style><div id="target"></div><script>+ function printCompositorAnimations(title) {+ println(title);+ for (const line of internals.dumpCompositorAnimations().split("\n").filter(Boolean))+ println(` ${line}`);+ }+asyncTest(async done => {internals.updateStyle();const animation = document.getAnimations()[0];@@ -27,7 +34,7 @@for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- println(`animation initially uses compositor: ${internals.getStyleInvalidationCounters().compositorVisualAnimations}`);+ printCompositorAnimations("compositor animations initially:");let resolveNextObservation;let nextObservation = new Promise(resolve => resolveNextObservation = resolve);@@ -35,7 +42,7 @@observer.observe(document.querySelector("#target"));const initialObservation = await nextObservation;- println(`observer keeps transform on compositor: ${internals.getStyleInvalidationCounters().compositorVisualAnimations}`);+ printCompositorAnimations("compositor animations with an observer:");println(`initial position is intersecting: ${initialObservation.isIntersecting}`);nextObservation = new Promise(resolve => resolveNextObservation = resolve);@@ -46,7 +53,7 @@observer.disconnect();for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- println(`disconnect restores compositor animation: ${internals.getStyleInvalidationCounters().compositorVisualAnimations}`);+ printCompositorAnimations("compositor animations after disconnecting:");animation.cancel();for (let i = 0; i < 2; ++i)await new Promise(requestAnimationFrame);@@ -56,6 +63,7 @@const clip = document.createElement("div");clip.style.cssText = "width: 100px; height: 100px; overflow: hidden";const clippedTarget = document.createElement("div");+ clippedTarget.id = "clipped-target";clippedTarget.style.cssText = "width: 20px; height: 20px; animation: move 100s linear infinite";clip.append(clippedTarget);document.body.append(spacer, clip);@@ -69,16 +77,17 @@const clippedObserver = new IntersectionObserver(entries => resolveClippedObservation(entries.at(-1)));clippedObserver.observe(clippedTarget);const initialClippedObservation = await clippedObservation;- println(`offscreen observed clip uses compositor: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 1}`);+ printCompositorAnimations("compositor animations of an offscreen observed clip:");println(`offscreen clipped target is not intersecting: ${!initialClippedObservation.isIntersecting}`);clippedObservation = new Promise(resolve => resolveClippedObservation = resolve);- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();clip.scrollIntoView();const scrolledObservation = await clippedObservation;await new Promise(resolve => setTimeout(resolve, 120));- println(`scrolling observed clip retains compositor: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 1}`);- println(`observed compositor animation requests sample frame: ${internals.getStyleInvalidationCounters().animationFramePumpRequests > 0}`);+ const pumpRequests = internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("animation frame pump request"));+ printCompositorAnimations("compositor animations after scrolling the observed clip:");+ println(`observed compositor animation frame requests: [${[...new Set(pumpRequests.map(line => line.replace(/ x\d+$/, "")))].join(", ")}]`);println(`scrolled clipped target enters viewport: ${scrolledObservation.isIntersecting}`);clippedObservation = new Promise(resolve => resolveClippedObservation = resolve);@@ -112,6 +121,7 @@const observationRoot = document.createElement("div");observationRoot.style.cssText = "width: 20px; height: 20px; overflow: hidden";const leavingTarget = document.createElement("div");+ leavingTarget.id = "leaving-target";leavingTarget.style.cssText = "width: 20px; height: 20px; animation: leave-observation-root 400ms linear infinite";observationRoot.append(leavingTarget);document.body.append(observationRoot);@@ -131,13 +141,14 @@leavingObserver.observe(leavingTarget);println(`leaving target starts inside root: ${(await initialLeavingObservation).isIntersecting}`);await new Promise(requestAnimationFrame);- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();const leftBeforeTimeout = await Promise.race([leftObservation,new Promise(resolve => setTimeout(() => resolve(false), 250)),]);println(`observed compositor motion is sampled within 250ms: ${leftBeforeTimeout}`);- println(`observation timer builds no animation overlays: ${internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds === 0}`);+ const sampled = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ println(`observation timer samples: [${sampled.map(event => event.element).join(", ")}]`);done();});</script>diff --git a/Tests/LibWeb/Text/input/css/compositor-animation-iteration-wakeup.html b/Tests/LibWeb/Text/input/css/compositor-animation-iteration-wakeup.htmlindex 6a9db91afac..b5389c7f1af 100644--- a/Tests/LibWeb/Text/input/css/compositor-animation-iteration-wakeup.html+++ b/Tests/LibWeb/Text/input/css/compositor-animation-iteration-wakeup.html@@ -1,11 +1,22 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }#spinner { width: 16px; height: 16px; animation: spin 1000s linear infinite; }</style><div id="root"><svg id="spinner" viewBox="0 0 16 16"><path d="M15 8A7 7 0 0 0 8 1" /></svg></div><script>+ function printCompositorAnimations(title) {+ println(title);+ for (const line of internals.dumpCompositorAnimations().split("\n").filter(Boolean))+ println(` ${line}`);+ }++ function pumpRequests() {+ return `[${internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("animation frame pump request")).join(", ")}]`;+ }+asyncTest(async done => {internals.updateStyle();const root = document.getElementById("root");@@ -22,52 +33,58 @@timeline.setTimeForObservation(0);for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- println(`animation uses compositor: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 1}`);- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- println(`ancestor listeners do not keep frame pump running: ${internals.getStyleInvalidationCounters().animationFramePumpRequests === 0}`);- println(`iteration wake-up is armed: ${internals.getStyleInvalidationCounters().compositorAnimationWakeupTimerActive}`);+ println(`frame requests with ancestor listeners: ${pumpRequests()}`);+ printCompositorAnimations("compositor animations:");+ internals.beginRenderingTrace();timeline.setTimeForObservation(999999);internals.fireCompositorAnimationWakeupForTesting(999999);- println(`early wake-up requests no frame: ${internals.getStyleInvalidationCounters().animationFramePumpRequests === 0}`);+ println(`early wake-up frame requests: ${pumpRequests()}`);+ internals.beginRenderingTrace();+ internals.beginStyleTrace();timeline.setTimeForObservation(1000000);internals.fireCompositorAnimationWakeupForTesting(1000000);timeline.setTime(1000000);await new Promise(requestAnimationFrame);- println(`iteration requests one frame: ${internals.getStyleInvalidationCounters().animationFramePumpRequests === 1}`);- println(`iteration needs no animated style overlays: ${internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds === 0}`);+ println(`iteration frame requests: ${pumpRequests()}`);+ const sampled = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ println(`iteration samples: [${sampled.map(event => event.element).join(", ")}]`);println(`events: ${events.join(", ")}`);- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();timeline.setTimeForObservation(2000000);internals.fireCompositorAnimationWakeupForTesting(2000000);timeline.setTime(2000000);await new Promise(requestAnimationFrame);- println(`next iteration re-arms the wake-up: ${events.at(-1) === "iteration 2000" && internals.getStyleInvalidationCounters().animationFramePumpRequests === 1}`);+ println(`next iteration re-arms the wake-up: ${events.at(-1)}, frame requests: ${pumpRequests()}`);animation.effect.updateTiming({ delay: -250000, iterationStart: 0.25 });animation.playbackRate = 2;animation.startTime = 2000000;for (let i = 0; i < 2; ++i)await new Promise(requestAnimationFrame);events.length = 0;- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();timeline.setTimeForObservation(2249999);internals.fireCompositorAnimationWakeupForTesting(2249999);- println(`adjusted iteration does not wake early: ${internals.getStyleInvalidationCounters().animationFramePumpRequests === 0}`);+ println(`adjusted iteration early wake-up frame requests: ${pumpRequests()}`);+ internals.beginRenderingTrace();timeline.setTimeForObservation(2250000);internals.fireCompositorAnimationWakeupForTesting(2250000);timeline.setTime(2250000);await new Promise(requestAnimationFrame);- println(`negative delay, iteration start, and playback rate are respected: ${events.join(", ") === "iteration 750" && internals.getStyleInvalidationCounters().animationFramePumpRequests === 1}`);+ println(`negative delay, iteration start, and playback rate are respected: ${events.join(", ")}, frame requests: ${pumpRequests()}`);animation.pause();await new Promise(requestAnimationFrame);- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();timeline.setTimeForObservation(3000000);internals.fireCompositorAnimationWakeupForTesting(3000000);- println(`paused animation does not re-arm iteration wake-up: ${internals.getStyleInvalidationCounters().animationFramePumpRequests === 0 && !internals.getStyleInvalidationCounters().compositorAnimationWakeupTimerActive}`);+ println(`paused animation wake-up frame requests: ${pumpRequests()}`);+ const armedTimers = internals.dumpCompositorAnimations().split("\n").filter(line => line.endsWith("timer armed"));+ println(`paused animation armed timers: [${armedTimers.join(", ")}]`);animation.cancel();await new Promise(requestAnimationFrame);println(`cancellation still dispatches: ${events.at(-1) === "cancel"}`);diff --git a/Tests/LibWeb/Text/input/css/compositor-animation-missing-endpoint.html b/Tests/LibWeb/Text/input/css/compositor-animation-missing-endpoint.htmlindex ab5e17c9ffc..eb07fa5a941 100644--- a/Tests/LibWeb/Text/input/css/compositor-animation-missing-endpoint.html+++ b/Tests/LibWeb/Text/input/css/compositor-animation-missing-endpoint.html@@ -23,24 +23,36 @@<div id="target" class="target"></div><div id="filter-target" class="target"></div><script>+ function compositorAnimationDump() {+ const lines = internals.dumpCompositorAnimations().split("\n").filter(Boolean);+ const animations = lines.filter(line => /^(opacity|background-color|filter|transform) /.test(line)).sort();+ return [...animations, ...lines.filter(line => !animations.includes(line))];+ }++ function printCompositorAnimations(title) {+ println(title);+ for (const line of compositorAnimationDump())+ println(` ${line}`);+ }+asyncTest(async done => {await Promise.all(document.getAnimations().map(animation => animation.ready));internals.updateCompositorAnimations();- println(`missing endpoints take the underlying style on the compositor: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 2}`);+ printCompositorAnimations("missing endpoints take the underlying style on the compositor:");const backgroundAnimation = document.getElementById("target").getAnimations()[0];backgroundAnimation.effect.setKeyframes([{ backgroundColor: "rgb(35, 35, 35)", offset: 0 },{ backgroundColor: "rgb(65, 65, 65)", offset: 1 },]);internals.updateCompositorAnimations();- println(`complete keyframes use the compositor: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 2}`);+ printCompositorAnimations("complete keyframes use the compositor:");backgroundAnimation.effect.setKeyframes([{ backgroundColor: "rgb(35, 35, 35)", offset: 0 },{ backgroundColor: "rgb(65, 65, 65)", offset: 0.7 },]);internals.updateCompositorAnimations();- println(`removing the endpoint stays on the compositor: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 2}`);+ printCompositorAnimations("removing the endpoint stays on the compositor:");for (const animation of document.getAnimations())animation.cancel();done();diff --git a/Tests/LibWeb/Text/input/css/compositor-animation-observe-scoped-flush.html b/Tests/LibWeb/Text/input/css/compositor-animation-observe-scoped-flush.htmlindex 3bb8c1d3ab5..d19db28009d 100644--- a/Tests/LibWeb/Text/input/css/compositor-animation-observe-scoped-flush.html+++ b/Tests/LibWeb/Text/input/css/compositor-animation-observe-scoped-flush.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>@keyframes move {from { transform: translateX(0); }@@ -15,23 +16,34 @@<div id="animated"><div id="descendant"></div></div><div id="unrelated"></div><script>+ function printCompositorAnimations(title) {+ println(title);+ for (const line of internals.dumpCompositorAnimations().split("\n").filter(Boolean))+ println(` ${line}`);+ }++ function sampledElements() {+ const events = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ return `[${[...new Set(events.map(event => event.element))].join(", ")}]`;+ }+asyncTest(async done => {internals.updateStyle();for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- println(`animation uses compositor: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 1}`);+ printCompositorAnimations("compositor animations:");- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();const unrelatedObserver = new IntersectionObserver(() => {});unrelatedObserver.observe(unrelated);await new Promise(requestAnimationFrame);- println(`unrelated observation skips animation sample: ${internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds === 0}`);+ println(`unrelated observation samples: ${sampledElements()}`);- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();const descendantObserver = new IntersectionObserver(() => {});descendantObserver.observe(descendant);await new Promise(requestAnimationFrame);- println(`descendant observation samples ancestor animation: ${internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds > 0}`);+ println(`descendant observation samples: ${sampledElements()}`);done();});</script>diff --git a/Tests/LibWeb/Text/input/css/compositor-animation-pseudo-element-underlying-style.html b/Tests/LibWeb/Text/input/css/compositor-animation-pseudo-element-underlying-style.htmlindex aedc6452870..88a94bda8d9 100644--- a/Tests/LibWeb/Text/input/css/compositor-animation-pseudo-element-underlying-style.html+++ b/Tests/LibWeb/Text/input/css/compositor-animation-pseudo-element-underlying-style.html@@ -7,17 +7,24 @@</style><div id="target"></div><script>+ function printCompositorAnimations(title) {+ println(title);+ for (const line of internals.dumpCompositorAnimations().split("\n").filter(Boolean))+ println(` ${line}`);+ }+asyncTest(async done => {await Promise.all(document.getAnimations().map(animation => animation.ready));internals.updateCompositorAnimations();- println(`compositor animations: ${internals.getStyleInvalidationCounters().compositorVisualAnimations}`);+ printCompositorAnimations("compositor animations:");// A change to the style of the pseudo-element resolves its keyframes again, as they take its opacity.- const resolutions = internals.getStyleInvalidationCounters().compositorKeyframeValueResolutions;+ internals.beginRenderingTrace();target.classList.add("faded");internals.updateStyle();internals.updateCompositorAnimations();- println(`keyframes resolved again: ${internals.getStyleInvalidationCounters().compositorKeyframeValueResolutions > resolutions}`);+ const resolutions = internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("compositor keyframe values resolved"));+ println(`keyframes resolved again: [${resolutions.join(", ")}]`);done();});</script>diff --git a/Tests/LibWeb/Text/input/css/compositor-animation-retained-content.html b/Tests/LibWeb/Text/input/css/compositor-animation-retained-content.htmlindex 4f762b3b659..4e13b63ed5c 100644--- a/Tests/LibWeb/Text/input/css/compositor-animation-retained-content.html+++ b/Tests/LibWeb/Text/input/css/compositor-animation-retained-content.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>@keyframes reveal-opacity {0%, 50% { opacity: 0; }@@ -24,6 +25,18 @@<div id="opacity">opacity</div><div id="transform">transform</div><script>+ function compositorAnimationDump() {+ const lines = internals.dumpCompositorAnimations().split("\n").filter(Boolean);+ const animations = lines.filter(line => /^(opacity|background-color|filter|transform) /.test(line)).sort();+ return [...animations, ...lines.filter(line => !animations.includes(line))];+ }++ function printCompositorAnimations(title) {+ println(title);+ for (const line of compositorAnimationDump())+ println(` ${line}`);+ }+asyncTest(async done => {internals.updateStyle();const animations = document.getAnimations();@@ -32,16 +45,17 @@for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- println(`culled animations move immediately to compositor: ${internals.getStyleInvalidationCounters().compositorVisualAnimations}`);+ printCompositorAnimations("culled animations move immediately to compositor:");const displayList = internals.dumpDisplayList();println(`opacity-zero animation content is retained: ${displayList.includes("rgb(21, 22, 23)")}`);println(`singular-transform animation content is retained: ${displayList.includes("rgb(24, 25, 26)")}`);- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- println(`culled compositor animations build no overlays: ${internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds === 0}`);+ const sampled = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ println(`culled compositor animations sample: [${sampled.map(event => event.element).join(", ")}]`);done();});</script>diff --git a/Tests/LibWeb/Text/input/css/compositor-animation-rotated-observer-ancestor.html b/Tests/LibWeb/Text/input/css/compositor-animation-rotated-observer-ancestor.htmlindex d866d2ab9bf..a01637b8250 100644--- a/Tests/LibWeb/Text/input/css/compositor-animation-rotated-observer-ancestor.html+++ b/Tests/LibWeb/Text/input/css/compositor-animation-rotated-observer-ancestor.html@@ -28,6 +28,12 @@</style><div id="root"><div id="rotated-parent"><div id="target"></div></div></div><script>+ function printCompositorAnimations(title) {+ println(title);+ for (const line of internals.dumpCompositorAnimations().split("\n").filter(Boolean))+ println(` ${line}`);+ }+asyncTest(async done => {const animation = target.getAnimations()[0];animation.currentTime = 0;@@ -38,7 +44,7 @@observer.observe(target);println(`target starts outside root: ${!(await nextObservation).isIntersecting}`);- println(`animation stays on main thread: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 0}`);+ printCompositorAnimations("compositor animations:");nextObservation = new Promise(resolve => resolveObservation = resolve);animation.currentTime = 200;diff --git a/Tests/LibWeb/Text/input/css/compositor-animation-start-delay.html b/Tests/LibWeb/Text/input/css/compositor-animation-start-delay.htmlindex 3bede53f717..62effeec2ca 100644--- a/Tests/LibWeb/Text/input/css/compositor-animation-start-delay.html+++ b/Tests/LibWeb/Text/input/css/compositor-animation-start-delay.html@@ -6,6 +6,18 @@<div id="both-fill" style="opacity: 0.75"></div><div id="sought-negative-delay" style="opacity: 0.75"></div><script>+ function compositorAnimationDump() {+ const lines = internals.dumpCompositorAnimations().split("\n").filter(Boolean);+ const animations = lines.filter(line => /^(opacity|background-color|filter|transform) /.test(line)).sort();+ return [...animations, ...lines.filter(line => !animations.includes(line))];+ }++ function printCompositorAnimations(title) {+ println(title);+ for (const line of compositorAnimationDump())+ println(` ${line}`);+ }+asyncTest(async done => {const noFill = document.getElementById("no-fill");const forwardsFill = document.getElementById("forwards-fill");@@ -35,7 +47,7 @@await new Promise(requestAnimationFrame);await new Promise(requestAnimationFrame);- println(`delayed effects use the compositor before starting: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 4}`);+ printCompositorAnimations("delayed effects use the compositor before starting:");timeline.setTimeForObservation(0);const noBackwardsFillUsesUnderlyingValue = getComputedStyle(noFill).opacity === "0.75"&& getComputedStyle(forwardsFill).opacity === "0.75";@@ -45,15 +57,15 @@soughtNegativeDelayAnimation.currentTime = -50;internals.updateCompositorAnimations();- println(`sought negative delay stays off the compositor before zero: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 4}`);+ printCompositorAnimations("sought negative delay stays off the compositor before zero:");timeline.setTime(150);internals.updateCompositorAnimations();- println(`delayed effects remain on the compositor while active: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 4}`);+ printCompositorAnimations("delayed effects remain on the compositor while active:");timeline.setTime(250);internals.updateCompositorAnimations();- println(`effects are withdrawn after their active interval: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 0}`);+ printCompositorAnimations("effects are withdrawn after their active interval:");done();});</script>diff --git a/Tests/LibWeb/Text/input/css/compositor-animation-starts-on-compositor-with-constant-output.html b/Tests/LibWeb/Text/input/css/compositor-animation-starts-on-compositor-with-constant-output.htmlindex 464f427ca93..4541a7e6709 100644--- a/Tests/LibWeb/Text/input/css/compositor-animation-starts-on-compositor-with-constant-output.html+++ b/Tests/LibWeb/Text/input/css/compositor-animation-starts-on-compositor-with-constant-output.html@@ -27,7 +27,9 @@// The timestamps stay inside the constant phase, so completing pending play must request the frame.println(`animation is no longer pending: ${!animation.pending}`);- println(`compositor animations: ${internals.getStyleInvalidationCounters().compositorVisualAnimations}`);+ println("compositor animations:");+ for (const line of internals.dumpCompositorAnimations().split("\n").filter(Boolean))+ println(` ${line}`);internals.setManualRenderingOpportunities(false);done();});diff --git a/Tests/LibWeb/Text/input/css/compositor-animation-timers-stop-for-inactive-document.html b/Tests/LibWeb/Text/input/css/compositor-animation-timers-stop-for-inactive-document.htmlindex 9977e967de9..1a551642fa5 100644--- a/Tests/LibWeb/Text/input/css/compositor-animation-timers-stop-for-inactive-document.html+++ b/Tests/LibWeb/Text/input/css/compositor-animation-timers-stop-for-inactive-document.html@@ -10,35 +10,27 @@return frame;}- function timersAreArmed(frame) {- const counters = frame.contentWindow.internals.getStyleInvalidationCounters();- return counters.compositorAnimationWakeupTimerActive- && counters.compositorAnimationObservationTimerActive;- }-- function timersAreStopped(oldInternals) {- const counters = oldInternals.getStyleInvalidationCounters();- return !counters.compositorAnimationWakeupTimerActive- && !counters.compositorAnimationObservationTimerActive;+ function armedTimers(frameInternals) {+ return frameInternals.dumpCompositorAnimations().split("\n").filter(line => line.endsWith("timer armed"));}asyncTest(async done => {const navigatedFrame = await createFrameWithArmedTimers();- println(`timers armed before navigation: ${timersAreArmed(navigatedFrame)}`);+ println(`timers armed before navigation: [${armedTimers(navigatedFrame.contentWindow.internals).join(", ")}]`);const navigatedInternals = navigatedFrame.contentWindow.internals;navigatedFrame.srcdoc = "replacement";await new Promise(resolve => navigatedFrame.addEventListener("load", resolve, { once: true }));- println(`timers stopped after navigation: ${timersAreStopped(navigatedInternals)}`);+ println(`timers armed after navigation: [${armedTimers(navigatedInternals).join(", ")}]`);const removedFrame = await createFrameWithArmedTimers();- println(`timers armed before destruction: ${timersAreArmed(removedFrame)}`);+ println(`timers armed before destruction: [${armedTimers(removedFrame.contentWindow.internals).join(", ")}]`);const removedInternals = removedFrame.contentWindow.internals;removedFrame.remove();// Child destruction unloads the document through the UI process, so the timers stop// asynchronously rather than within one task.- while (!timersAreStopped(removedInternals))+ while (armedTimers(removedInternals).length)await new Promise(resolve => setTimeout(resolve, 0));- println(`timers stopped after destruction: ${timersAreStopped(removedInternals)}`);+ println(`timers armed after destruction: [${armedTimers(removedInternals).join(", ")}]`);done();});</script>diff --git a/Tests/LibWeb/Text/input/css/compositor-background-color-animation.html b/Tests/LibWeb/Text/input/css/compositor-background-color-animation.htmlindex 521be2792bf..adcb5c1c39e 100644--- a/Tests/LibWeb/Text/input/css/compositor-background-color-animation.html+++ b/Tests/LibWeb/Text/input/css/compositor-background-color-animation.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>@keyframes legacy-color {from { background-color: rgba(255, 0, 0, 0); }@@ -80,6 +81,24 @@<div id="text-clip" class="target">text</div><div id="blended" class="target"></div><script>+ function compositorAnimationDump() {+ const lines = internals.dumpCompositorAnimations().split("\n").filter(Boolean);+ const animations = lines.filter(line => /^(opacity|background-color|filter|transform) /.test(line)).sort();+ return [...animations, ...lines.filter(line => !animations.includes(line))];+ }++ function visualContextNodes(element) {+ return internals.dumpVisualContextNodes(element).replace(/^\[[sce]\d+\] /gm, "").split("\n").filter(Boolean);+ }++ function ownsCompositorBackgroundColorFrame(element) {+ return visualContextNodes(element).includes("compositor background-color frame");+ }++ function compositorAnimations() {+ return compositorAnimationDump().map(line => ` ${line}`).join("\n");+ }+function nextTask() {const { promise, resolve } = Promise.withResolvers();const channel = new MessageChannel();@@ -90,6 +109,7 @@asyncTest(async done => {internals.updateStyle();+ internals.beginStyleTrace();internals.setManualRenderingOpportunities(true);await nextTask();let frameTime = performance.now();@@ -101,15 +121,15 @@for (let i = 0; i < 4; ++i)await renderNextFrame();- const initialCounters = internals.getStyleInvalidationCounters();- const legacyContext = internals.visualContextNodeIndices(document.querySelector("#legacy"));+ const initialSamples = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ const initialCompositorAnimations = compositorAnimations();+ const legacyNodes = visualContextNodes(document.querySelector("#legacy"));const displayList = internals.dumpDisplayList();const transparentFillIsRetained = displayList.split("\n").some(line =>line.startsWith("FillRectWithRoundedCorners") && line.includes("color=rgba(0, 0, 0, 0)"));- const rootContext = internals.visualContextNodeIndices(document.documentElement);+ const rootNodes = visualContextNodes(document.documentElement);const unsupportedTargets = [document.body, document.querySelector("#text-clip"), document.querySelector("#blended")];- const unsupportedTargetsHaveNoMarker = unsupportedTargets.every(target =>- !internals.visualContextNodeIndices(target).needsCompositorBackgroundColorFrame);+ const unsupportedTargetsHaveNoMarker = !unsupportedTargets.some(ownsCompositorBackgroundColorFrame);const modernTarget = document.querySelector("#modern");const currentcolorTarget = document.querySelector("#currentcolor");const transparentTarget = document.querySelector("#transparent-delay");@@ -119,9 +139,9 @@let unsupportedTimingTargetNeverGetsMarker = true;for (let i = 0; i < 4; ++i) {internals.updateCompositorAnimations();- modernTargetNeverGetsMarker &&= !internals.visualContextNodeIndices(modernTarget).needsCompositorBackgroundColorFrame;- currentcolorTargetNeverGetsMarker &&= !internals.visualContextNodeIndices(currentcolorTarget).needsCompositorBackgroundColorFrame;- unsupportedTimingTargetNeverGetsMarker &&= !internals.visualContextNodeIndices(unsupportedTimingTarget).needsCompositorBackgroundColorFrame;+ modernTargetNeverGetsMarker &&= !ownsCompositorBackgroundColorFrame(modernTarget);+ currentcolorTargetNeverGetsMarker &&= !ownsCompositorBackgroundColorFrame(currentcolorTarget);+ unsupportedTimingTargetNeverGetsMarker &&= !ownsCompositorBackgroundColorFrame(unsupportedTimingTarget);}document.documentElement.getAnimations()[0].cancel();@@ -133,28 +153,33 @@for (let i = 0; i < 2; ++i)await renderNextFrame();- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();+ internals.beginRenderingTrace();for (let i = 0; i < 4; ++i)internals.updateCompositorAnimations();- const stableCounters = internals.getStyleInvalidationCounters();+ const stableSamples = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ const stablePumpRequests = internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("animation frame pump request"));document.querySelector("#legacy").getAnimations()[0].cancel();transparentTarget.getAnimations()[0].cancel();internals.updateCompositorAnimations();- const cancellationCounters = internals.getStyleInvalidationCounters();+ const cancelledCompositorAnimations = compositorAnimations();- println(`background color animations use compositor: ${initialCounters.compositorVisualAnimations === 2}`);- println(`background color marker does not create effects layer: ${legacyContext.needsCompositorBackgroundColorFrame && !legacyContext.needsCompositorEffectsLayer}`);+ println("background color animations use compositor:");+ println(initialCompositorAnimations);+ println(`background color marker does not create effects layer: [${legacyNodes.join(", ")}]`);println(`transparent background color retains animated fill: ${transparentFillIsRetained}`);- println(`root background color stays on main thread: ${!rootContext.needsCompositorBackgroundColorFrame}`);+ println(`root background color stays on main thread: [${rootNodes.join(", ")}]`);println(`complex and propagated backgrounds stay on main thread: ${unsupportedTargetsHaveNoMarker}`);- println(`modern color interpolation stays on main thread: ${initialCounters.animatedStyleOverlayBuilds > 0}`);+ println(`modern color interpolation samples on the main thread: ${initialSamples.some(event => event.element === "div#modern.target")}`);println(`modern color creates no compositor marker: ${modernTargetNeverGetsMarker}`);println(`currentcolor creates no compositor marker: ${currentcolorTargetNeverGetsMarker}`);println(`unsupported timing creates no compositor marker: ${unsupportedTimingTargetNeverGetsMarker}`);- println(`stable background color builds no overlays: ${stableCounters.animatedStyleOverlayBuilds === 0}`);- println(`stable background color requests no animation frames: ${stableCounters.animationFramePumpRequests === 0}`);- println(`cancel removes background color animation: ${cancellationCounters.compositorVisualAnimations === 0}`);+ println(`stable background color samples: [${stableSamples.map(event => event.element).join(", ")}]`);+ println(`stable background color frame requests: [${stablePumpRequests.join(", ")}]`);+ println("cancel removes background color animation:");+ if (cancelledCompositorAnimations)+ println(cancelledCompositorAnimations);internals.setManualRenderingOpportunities(false);done();});diff --git a/Tests/LibWeb/Text/input/css/compositor-competing-replace-effects.html b/Tests/LibWeb/Text/input/css/compositor-competing-replace-effects.htmlindex 8aaa4dfdc3c..e78e218a644 100644--- a/Tests/LibWeb/Text/input/css/compositor-competing-replace-effects.html+++ b/Tests/LibWeb/Text/input/css/compositor-competing-replace-effects.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>@keyframes fade-in {from { opacity: 0; }@@ -51,6 +52,12 @@<div id="target"></div><div id="pseudo"></div><script>+ function compositorAnimationDump() {+ const lines = internals.dumpCompositorAnimations().split("\n").filter(Boolean);+ const animations = lines.filter(line => /^(opacity|background-color|filter|transform) /.test(line)).sort();+ return [...animations, ...lines.filter(line => !animations.includes(line))];+ }+asyncTest(async done => {internals.updateStyle();const target = document.querySelector("#target");@@ -58,7 +65,12 @@for (let i = 0; i < count; ++i)await new Promise(requestAnimationFrame);};- const descriptorCount = () => internals.getStyleInvalidationCounters().compositorVisualAnimations;+ const compositorAnimations = () => `[${compositorAnimationDump().filter(line => !line.endsWith("timer armed")).join(", ")}]`;+ const armedTimers = () => `[${internals.dumpCompositorAnimations().split("\n").filter(line => line.endsWith("timer armed")).join(", ")}]`;+ const renderingTraceEvents = event => {+ const lines = internals.takeRenderingTrace().split("\n").filter(line => line.startsWith(event));+ return `[${[...new Set(lines.map(line => line.replace(/ x\d+$/, "")))].join(", ")}]`;+ };const clearTarget = async () => {for (const animation of target.getAnimations())animation.cancel();@@ -70,15 +82,16 @@target.className = "azure-pair";await nextFrames();- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();await nextFrames(4);- println(`Azure pair publishes opacity and transform: ${descriptorCount() === 2}`);- println(`Azure pair avoids main-thread overlays: ${internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds === 0}`);+ const sampled = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ println(`Azure pair publishes opacity and transform: ${compositorAnimations()}`);+ println(`Azure pair main-thread samples: [${sampled.map(event => event.element).join(", ")}]`);await clearTarget();target.className = "double-fade";await nextFrames();- println(`later duplicate fade wins opacity: ${descriptorCount() === 1}`);+ println(`later duplicate fade wins opacity: ${compositorAnimations()}`);await clearTarget();const loser = target.animate([{ opacity: 0.1 }, { opacity: 0.9 }], { duration: 100000 });@@ -87,44 +100,45 @@winner.currentTime = 500;await nextFrames();const winnerOpacity = parseFloat(getComputedStyle(target).opacity);- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();winner.currentTime = 1001;await nextFrames();const loserOpacity = parseFloat(getComputedStyle(target).opacity);println(`short winner controls the boundary sample: ${Math.abs(winnerOpacity - 0.3) < 0.02}`);- println(`loser is published when winner ends: ${descriptorCount() === 1 && loserOpacity < 0.2}`);- println(`winner change republishes descriptors: ${internals.getStyleInvalidationCounters().compositorVisualAnimationUpdates > 0}`);+ println(`loser is published when winner ends: ${loserOpacity < 0.2}, compositor animations ${compositorAnimations()}`);+ println(`winner change republishes descriptors: ${renderingTraceEvents("compositor animations updated")}`);await clearTarget();target.className = "css-fade";await nextFrames();- const cssAnimationWasPublished = descriptorCount() === 1;+ const cssAnimationCompositorAnimations = compositorAnimations();const scriptWinner = target.animate([{ opacity: 0.25 }, { opacity: 0.75 }], { duration: 100000 });scriptWinner.currentTime = 50000;await nextFrames();- println(`later script animation wins over CSS animation: ${cssAnimationWasPublished && descriptorCount() === 1 && Math.abs(parseFloat(getComputedStyle(target).opacity) - 0.5) < 0.02}`);+ println(`CSS animation on the compositor: ${cssAnimationCompositorAnimations}`);+ println(`later script animation wins over CSS animation: ${Math.abs(parseFloat(getComputedStyle(target).opacity) - 0.5) < 0.02}, compositor animations ${compositorAnimations()}`);scriptWinner.pause();await nextFrames();- println(`paused winner is sampled on the main thread: ${descriptorCount() === 0 && Math.abs(parseFloat(getComputedStyle(target).opacity) - 0.5) < 0.02}`);+ println(`paused winner is sampled on the main thread: ${Math.abs(parseFloat(getComputedStyle(target).opacity) - 0.5) < 0.02}, compositor animations ${compositorAnimations()}`);scriptWinner.cancel();await nextFrames();- println(`cancelling winner republishes CSS animation: ${descriptorCount() === 1}`);+ println(`cancelling winner republishes CSS animation: ${compositorAnimations()}`);await clearTarget();target.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 100000 });target.animate([{ opacity: 0 }, { opacity: 0.5 }], { duration: 100000, composite: "add" });await nextFrames();- println(`add competitor stays on the main thread: ${descriptorCount() === 0}`);+ println(`add competitor stays on the main thread: ${compositorAnimations()}`);await clearTarget();target.className = "split-winners";await nextFrames();- println(`opacity loser still hands off transform: ${descriptorCount() === 2}`);+ println(`opacity loser still hands off transform: ${compositorAnimations()}`);await clearTarget();document.querySelector("#pseudo").className = "enabled";await nextFrames();- println(`pseudo-element pair publishes opacity and transform: ${descriptorCount() === 2}`);+ println(`pseudo-element pair publishes opacity and transform: ${compositorAnimations()}`);for (const animation of document.getAnimations())animation.cancel();@@ -132,7 +146,7 @@target.className = "finite-loser-infinite-winner";await nextFrames(2);const finiteLoser = target.getAnimations().find(animation => animation.animationName === "fade-in");- println(`finite loser receives an end wake-up: ${internals.getStyleInvalidationCounters().compositorAnimationWakeupTimerActive}`);+ println(`finite loser receives an end wake-up: ${armedTimers()}`);finiteLoser.currentTime = 100001;await finiteLoser.finished;println(`finite loser finishes after deterministic advance: ${finiteLoser.playState === "finished"}`);@@ -144,8 +158,7 @@await nextFrames(2);const finiteAnimations = target.getAnimations();const losingFiniteAnimation = finiteAnimations.find(animation => animation.animationName === "fade-in");- internals.resetStyleInvalidationCounters();- println(`competing finite effects register an end wake-up: ${internals.getStyleInvalidationCounters().compositorAnimationWakeupTimerActive}`);+ println(`competing finite effects register an end wake-up: ${armedTimers()}`);for (const animation of finiteAnimations)animation.currentTime = 100001;await losingFiniteAnimation.finished;@@ -166,13 +179,13 @@target.className = "infinite-pair";await nextFrames(2);const losingInfiniteAnimation = target.getAnimations().find(animation => animation.animationName === "fade-in");- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();losingInfiniteAnimation.currentTime = 150000;await nextFrames(2);losingInfiniteAnimation.currentTime = 250000;await losingInfiniteIterationsObserved;println(`losing infinite effect dispatches iteration events: ${losingInfiniteIterations === 2}`);- println(`losing infinite listener uses iteration wake-ups: ${internals.getStyleInvalidationCounters().animationFramePumpRequests === 0 && internals.getStyleInvalidationCounters().compositorAnimationWakeupTimerActive}`);+ println(`losing infinite listener uses iteration wake-ups: frame requests ${renderingTraceEvents("animation frame pump request")}, armed timers ${armedTimers()}`);for (const animation of target.getAnimations())animation.cancel();done();diff --git a/Tests/LibWeb/Text/input/css/compositor-driven-animations.html b/Tests/LibWeb/Text/input/css/compositor-driven-animations.htmlindex f8b49683071..24a86edfed0 100644--- a/Tests/LibWeb/Text/input/css/compositor-driven-animations.html+++ b/Tests/LibWeb/Text/input/css/compositor-driven-animations.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>@keyframes fade {from { opacity: 0.2; }@@ -86,52 +87,78 @@<div id="individual-transform"></div><div id="competing-transform-effects"></div><script>+ function compositorAnimationDump() {+ const lines = internals.dumpCompositorAnimations().split("\n").filter(Boolean);+ const animations = lines.filter(line => /^(opacity|background-color|filter|transform) /.test(line)).sort();+ return [...animations, ...lines.filter(line => !animations.includes(line))];+ }++ function compositorAnimations() {+ return compositorAnimationDump().filter(line => !line.endsWith("timer armed"));+ }++ function renderingTraceEvents(events) {+ return `[${internals.takeRenderingTrace().split("\n").filter(line => events.some(event => line.startsWith(event))).join(", ")}]`;+ }++ function compositorAnimationWork() {+ return renderingTraceEvents(["compositor animations updated", "compositor keyframe values resolved"]);+ }++ function compositorAnimationWorkAndFrameRequests() {+ return renderingTraceEvents(["animation frame pump request", "compositor animations updated", "compositor keyframe values resolved"]);+ }+asyncTest(async done => {internals.updateStyle();for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- const initialCounters = internals.getStyleInvalidationCounters();+ const initialCompositorAnimations = compositorAnimations();for (const animation of document.querySelector("#competing-transform-effects").getAnimations())animation.cancel();for (let i = 0; i < 2; ++i)await new Promise(requestAnimationFrame);- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();document.querySelector("#relative-transform").style.width = "40px";for (let i = 0; i < 2; ++i)await new Promise(requestAnimationFrame);- const resizeCounters = internals.getStyleInvalidationCounters();+ const resizeWork = compositorAnimationWork();- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();document.querySelector("#relative-transform").style.setProperty("--distance", "20px");for (let i = 0; i < 2; ++i)await new Promise(requestAnimationFrame);- const styleChangeCounters = internals.getStyleInvalidationCounters();+ const styleChangeWork = compositorAnimationWork();- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();+ internals.beginRenderingTrace();for (let i = 0; i < 4; ++i)internals.updateCompositorAnimations();- const counters = internals.getStyleInvalidationCounters();+ const stableSamples = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ const stableWork = compositorAnimationWorkAndFrameRequests();- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();const visualNodeAnimation = document.querySelector("#visual-node-churn").getAnimations()[0];for (const currentTime of [0, 750, 0, 750]) {visualNodeAnimation.currentTime = currentTime;await new Promise(requestAnimationFrame);}- const visualNodeCounters = internals.getStyleInvalidationCounters();+ const visualNodeWork = compositorAnimationWork();+ internals.beginRenderingTrace();for (const animation of document.getAnimations())animation.cancel();internals.updateCompositorAnimations();- const cancellationCounters = internals.getStyleInvalidationCounters();+ const cancellationWork = compositorAnimationWork();+ const cancelledCompositorAnimations = compositorAnimations();- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();for (let i = 0; i < 4; ++i)internals.updateCompositorAnimations();- const emptyCounters = internals.getStyleInvalidationCounters();+ const emptyWork = compositorAnimationWorkAndFrameRequests();const finiteTarget = document.createElement("div");finiteTarget.style.width = "20px";@@ -143,29 +170,28 @@await new Promise(requestAnimationFrame);await new Promise(resolve => setTimeout(resolve, 0));const finiteAnimation = finiteTarget.getAnimations()[0];- const finiteUsesCompositor = internals.getStyleInvalidationCounters().compositorVisualAnimations > 0;+ finiteTarget.id = "finite";+ const finiteCompositorAnimations = compositorAnimations();let receivedAnimationEnd = false;finiteTarget.addEventListener("animationend", () => receivedAnimationEnd = true);- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();await finiteAnimation.finished;await new Promise(resolve => setTimeout(resolve, 0));- const finiteCounters = internals.getStyleInvalidationCounters();-- println(`compositor visual animations: ${initialCounters.compositorVisualAnimations}`);- println(`reference box resize updates compositor animation: ${resizeCounters.compositorVisualAnimationUpdates > 0}`);- println(`reference box resize resolves keyframes: ${resizeCounters.compositorKeyframeValueResolutions > 0}`);- println(`style change resolves keyframes: ${styleChangeCounters.compositorKeyframeValueResolutions > 0}`);- println(`style change updates compositor animation: ${styleChangeCounters.compositorVisualAnimationUpdates > 0}`);- println(`main-thread animation overlay builds: ${counters.animatedStyleOverlayBuilds}`);- println(`main-thread animation frame pump requests: ${counters.animationFramePumpRequests}`);- println(`stable compositor animations reuse resolved keyframes: ${counters.compositorKeyframeValueResolutions === 0}`);- println(`stable compositor animation updates: ${counters.compositorVisualAnimationUpdates}`);- println(`stable compositor animation updates with changing visual nodes: ${visualNodeCounters.compositorVisualAnimationUpdates}`);- println(`cancel removes compositor animations: ${cancellationCounters.compositorVisualAnimations}`);- println(`cancel updates compositor animations: ${cancellationCounters.compositorVisualAnimationUpdates > 0}`);- println(`empty compositor animation updates: ${emptyCounters.compositorVisualAnimationUpdates}`);- println(`finite animation uses compositor: ${finiteUsesCompositor}`);- println(`finite animation requests only end frames: ${finiteCounters.animationFramePumpRequests <= 2}`);+ const finiteWork = compositorAnimationWorkAndFrameRequests();++ println("compositor animations:");+ for (const line of initialCompositorAnimations)+ println(` ${line}`);+ println(`reference box resize: ${resizeWork}`);+ println(`style change: ${styleChangeWork}`);+ println(`stable compositor animations: ${stableWork}`);+ println(`stable compositor animations main-thread samples: [${stableSamples.map(event => event.element).join(", ")}]`);+ println(`stable compositor animations with changing visual nodes: ${visualNodeWork}`);+ println(`cancel: ${cancellationWork}`);+ println(`cancel removes compositor animations: [${cancelledCompositorAnimations.join(", ")}]`);+ println(`empty compositor animations: ${emptyWork}`);+ println(`finite animation uses compositor: [${finiteCompositorAnimations.join(", ")}]`);+ println(`finite animation requests only end frames: ${finiteWork}`);println(`finite animation dispatches end event: ${receivedAnimationEnd}`);println(`finite animation reaches end opacity: ${getComputedStyle(finiteTarget).opacity === "0.8"}`);println(`finite animation reaches end style: ${getComputedStyle(finiteTarget).transform.includes("100")}`);diff --git a/Tests/LibWeb/Text/input/css/compositor-filter-animation.html b/Tests/LibWeb/Text/input/css/compositor-filter-animation.htmlindex 7611ab66a9e..70f2b7cad1f 100644--- a/Tests/LibWeb/Text/input/css/compositor-filter-animation.html+++ b/Tests/LibWeb/Text/input/css/compositor-filter-animation.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>@keyframes functions {from { filter: none; }@@ -42,32 +43,47 @@<div id="shadow" class="target"></div><div id="referenced" class="target"></div><script>+ function compositorAnimationDump() {+ const lines = internals.dumpCompositorAnimations().split("\n").filter(Boolean);+ const animations = lines.filter(line => /^(opacity|background-color|filter|transform) /.test(line)).sort();+ return [...animations, ...lines.filter(line => !animations.includes(line))];+ }++ function compositorAnimationLines() {+ return compositorAnimationDump().map(line => ` ${line}`).join("\n");+ }+asyncTest(async done => {internals.updateStyle();for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- const initialCounters = internals.getStyleInvalidationCounters();+ const initialCompositorAnimations = compositorAnimationLines();const initialAnimationCount = document.getAnimations().length;document.querySelector("#referenced").getAnimations()[0].cancel();for (let i = 0; i < 2; ++i)await new Promise(requestAnimationFrame);- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();+ internals.beginRenderingTrace();for (let i = 0; i < 4; ++i)internals.updateCompositorAnimations();- const stableCounters = internals.getStyleInvalidationCounters();+ const sampled = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ const pumpRequests = internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("animation frame pump request"));for (const animation of document.getAnimations())animation.cancel();internals.updateCompositorAnimations();- const cancellationCounters = internals.getStyleInvalidationCounters();+ const cancelledCompositorAnimations = compositorAnimationLines();- println(`CSS filter functions use compositor: ${initialCounters.compositorVisualAnimations >= 2}`);- println(`URL filter stays on main thread: ${initialAnimationCount === 3 && initialCounters.compositorVisualAnimations === 2}`);- println(`stable CSS filters build no overlays: ${stableCounters.animatedStyleOverlayBuilds === 0}`);- println(`stable CSS filters request no animation frames: ${stableCounters.animationFramePumpRequests === 0}`);- println(`cancel removes CSS filter animations: ${cancellationCounters.compositorVisualAnimations === 0}`);+ println(`animations: ${initialAnimationCount}`);+ println("CSS filter functions use compositor, URL filter stays on main thread:");+ println(initialCompositorAnimations);+ println(`stable CSS filters sample: [${sampled.map(event => event.element).join(", ")}]`);+ println(`stable CSS filters frame requests: [${pumpRequests.join(", ")}]`);+ println("cancel removes CSS filter animations:");+ if (cancelledCompositorAnimations)+ println(cancelledCompositorAnimations);done();});</script>diff --git a/Tests/LibWeb/Text/input/css/compositor-opacity-track-visibility.html b/Tests/LibWeb/Text/input/css/compositor-opacity-track-visibility.htmlindex f51bb749c04..578d8691c09 100644--- a/Tests/LibWeb/Text/input/css/compositor-opacity-track-visibility.html+++ b/Tests/LibWeb/Text/input/css/compositor-opacity-track-visibility.html@@ -34,7 +34,9 @@for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- println(`infinite and finite opacity animations stay on main thread: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 0}`);+ println("compositor animations:");+ for (const line of internals.dumpCompositorAnimations().split("\n").filter(Boolean))+ println(` ${line}`);infinite.getAnimations()[0].currentTime = 500;finite.getAnimations()[0].currentTime = 500;diff --git a/Tests/LibWeb/Text/input/css/compositor-svg-internal-transform.html b/Tests/LibWeb/Text/input/css/compositor-svg-internal-transform.htmlindex 8f758be28e0..e49afec7366 100644--- a/Tests/LibWeb/Text/input/css/compositor-svg-internal-transform.html+++ b/Tests/LibWeb/Text/input/css/compositor-svg-internal-transform.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>@keyframes pulse { from { transform: scaleY(0.5); } to { transform: scaleY(1); } }@keyframes fade { from { opacity: 0.5; } to { opacity: 1; } }@@ -13,6 +14,10 @@</style><svg id="cases" viewBox="0 0 24 24"></svg><script>+ function compositorAnimations() {+ return `[${internals.dumpCompositorAnimations().split("\n").filter(Boolean).join(", ")}]`;+ }+function nextTask() {const { promise, resolve } = Promise.withResolvers();const channel = new MessageChannel();@@ -82,9 +87,8 @@for (const [name, markup] of Object.entries(group)) {cases.innerHTML = markup;await renderFrames();- internals.resetStyleInvalidationCounters();internals.updateCompositorAnimations();- println(` ${name}: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 1}`);+ println(` ${name}: ${compositorAnimations()}`);}};await check("runs on the compositor:", onTheCompositor);@@ -93,14 +97,13 @@cases.innerHTML = onTheCompositor["a rect in a group"];await renderFrames();await renderFrames();- internals.resetStyleInvalidationCounters();- internals.resetRenderingSchedulerCounters();+ internals.beginStyleTrace();+ internals.beginRenderingTrace();await renderFrames();- const counters = internals.getStyleInvalidationCounters();- const scheduler = internals.getRenderingSchedulerCounters();- println(`the main thread leaves the animated style alone: ${counters.animatedStyleOverlayBuilds === 0}`);- println(`the main thread asks for no frames: ${counters.animationFramePumpRequests === 0}`);- println(`the main thread runs no rendering updates: ${scheduler.updatesRun === 0}`);+ const sampled = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ const mainThreadWork = internals.takeRenderingTrace().split("\n").filter(line => /^(animation frame pump request|update$)/.test(line));+ println(`the main thread samples: [${sampled.map(event => event.element).join(", ")}]`);+ println(`frame requests and rendering updates of the main thread: [${mainThreadWork.join(", ")}]`);// What a script reads comes from the current transform, while the compositor draws it.cases.innerHTML = `<g><rect width="5" height="10"/></g>`;@@ -112,9 +115,8 @@animation.play();timeline.setTime(0);await renderFrames();- internals.resetStyleInvalidationCounters();internals.updateCompositorAnimations();- println(`the box a script reads runs on the compositor: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 1}`);+ println(`the box a script reads runs on the compositor: ${compositorAnimations()}`);println(`height of its group at the start: ${group.getBBox().height}`);await nextTask();timeline.setTimeForObservation(500);diff --git a/Tests/LibWeb/Text/input/css/compositor-svg-root-transform.html b/Tests/LibWeb/Text/input/css/compositor-svg-root-transform.htmlindex d053968b93e..a43ec5d5b8f 100644--- a/Tests/LibWeb/Text/input/css/compositor-svg-root-transform.html+++ b/Tests/LibWeb/Text/input/css/compositor-svg-root-transform.html@@ -1,11 +1,18 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>body { margin: 0; }#spinner { display: block; width: 40px; height: 20px; transform-origin: 50% 50%; }</style><svg id="spinner" viewBox="0 0 80 40"><path d="M0 0H80V40H0Z" fill="green" /></svg><script>+ function printCompositorAnimations(title) {+ println(title);+ for (const line of internals.dumpCompositorAnimations().split("\n").filter(Boolean))+ println(` ${line}`);+ }+asyncTest(async done => {internals.updateStyle();const timeline = internals.createInternalAnimationTimeline();@@ -21,14 +28,16 @@timeline.setTime(0);for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- println(`outer SVG uses compositor: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 1}`);+ printCompositorAnimations("outer SVG uses compositor:");- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();+ internals.beginRenderingTrace();for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- const counters = internals.getStyleInvalidationCounters();- println(`no animated style overlays: ${counters.animatedStyleOverlayBuilds === 0}`);- println(`no main-thread frame pump: ${counters.animationFramePumpRequests === 0}`);+ const sampled = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ const pumpRequests = internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("animation frame pump request"));+ println(`main-thread samples: [${sampled.map(event => event.element).join(", ")}]`);+ println(`main-thread frame requests: [${pumpRequests.join(", ")}]`);timeline.setTimeForObservation(250);const rect = spinner.getBoundingClientRect();diff --git a/Tests/LibWeb/Text/input/css/compositor-transform-synthesized-endpoint.html b/Tests/LibWeb/Text/input/css/compositor-transform-synthesized-endpoint.htmlindex aae1caeaff5..ecb444c5950 100644--- a/Tests/LibWeb/Text/input/css/compositor-transform-synthesized-endpoint.html+++ b/Tests/LibWeb/Text/input/css/compositor-transform-synthesized-endpoint.html@@ -1,11 +1,18 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>@keyframes spin { to { transform: rotate(360deg); } }svg { width: 16px; height: 16px; animation: spin 1000s linear infinite; }</style><svg id="spinner" viewBox="0 0 16 16"><path d="M15 8A7 7 0 0 0 8 1" fill="none" stroke="black" /></svg><script>+ function printCompositorAnimations(title) {+ println(title);+ for (const line of internals.dumpCompositorAnimations().split("\n").filter(Boolean))+ println(` ${line}`);+ }+asyncTest(async done => {internals.updateStyle();const spinner = document.getElementById("spinner");@@ -17,16 +24,17 @@timeline.setTimeForObservation(0);for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- println(`synthesized transform endpoint uses compositor: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 1}`);- internals.resetStyleInvalidationCounters();+ printCompositorAnimations("synthesized transform endpoint uses compositor:");+ internals.beginStyleTrace();for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- println(`no main-thread animated style work: ${internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds === 0}`);+ const sampled = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ println(`main-thread samples: [${sampled.map(event => event.element).join(", ")}]`);spinner.style.transform = "rotate(90deg)";for (let i = 0; i < 2; ++i)await new Promise(requestAnimationFrame);- println(`underlying style change preserves handoff: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 1}`);+ printCompositorAnimations("underlying style change preserves handoff:");timeline.setTimeForObservation(500000);const matrix = new DOMMatrix(getComputedStyle(spinner).transform);println(`synthesized endpoint follows underlying style: ${Math.abs(matrix.a + Math.SQRT1_2) < 0.001 && Math.abs(matrix.b + Math.SQRT1_2) < 0.001}`);diff --git a/Tests/LibWeb/Text/input/css/compositor-transition-between-functions-of-one-primitive.html b/Tests/LibWeb/Text/input/css/compositor-transition-between-functions-of-one-primitive.htmlindex ac625c85e09..3a8b50f1c55 100644--- a/Tests/LibWeb/Text/input/css/compositor-transition-between-functions-of-one-primitive.html+++ b/Tests/LibWeb/Text/input/css/compositor-transition-between-functions-of-one-primitive.html@@ -23,10 +23,9 @@await nextTask();}- function transitionRunsOnCompositor() {- internals.resetStyleInvalidationCounters();+ function compositorAnimations() {internals.updateCompositorAnimations();- return internals.getStyleInvalidationCounters().compositorVisualAnimations === 1;+ return `[${internals.dumpCompositorAnimations().split("\n").filter(Boolean).join(", ")}]`;}function cancelTransitions() {@@ -35,16 +34,16 @@internals.updateCompositorAnimations();}- function transitionBetweenRunsOnCompositor(from, to) {+ function compositorAnimationsOfTransitionBetween(from, to) {target.style.transition = "none";target.style.transform = from;getComputedStyle(target).transform;target.style.transition = "";target.style.transform = to;getComputedStyle(target).transform;- const runsOnCompositor = transitionRunsOnCompositor();+ const animations = compositorAnimations();cancelTransitions();- return runsOnCompositor;+ return animations;}asyncTest(async done => {@@ -56,7 +55,7 @@["scaleY(2)", "scale(3, 4)"],["translateZ(5px)", "translate3d(0px, 0px, 50px)"],])- println(`${from} to ${to} runs on the compositor: ${transitionBetweenRunsOnCompositor(from, to)}`);+ println(`${from} to ${to} on the compositor: ${compositorAnimationsOfTransitionBetween(from, to)}`);target.style.transition = "none";target.style.transform = "none";@@ -72,7 +71,7 @@target.style.transform = "translateX(200px)";await renderFrameAfter(20);- println(`transition retargeted from its current value runs on the compositor: ${transitionRunsOnCompositor()}`);+ println(`transition retargeted from its current value on the compositor: ${compositorAnimations()}`);internals.setManualRenderingOpportunities(false);done();diff --git a/Tests/LibWeb/Text/input/css/compositor-transition-none-transform.html b/Tests/LibWeb/Text/input/css/compositor-transition-none-transform.htmlindex bd075857d42..14060dfcead 100644--- a/Tests/LibWeb/Text/input/css/compositor-transition-none-transform.html+++ b/Tests/LibWeb/Text/input/css/compositor-transition-none-transform.html@@ -66,6 +66,12 @@<div class="target" id="scale-3d"></div><div class="target" id="rotate-x"></div><script>+ function compositorAnimationDump() {+ const lines = internals.dumpCompositorAnimations().split("\n").filter(Boolean);+ const animations = lines.filter(line => /^(opacity|background-color|filter|transform) /.test(line)).sort();+ return [...animations, ...lines.filter(line => !animations.includes(line))];+ }+function nextTask() {const { promise, resolve } = Promise.withResolvers();const channel = new MessageChannel();@@ -92,7 +98,9 @@await nextTask();const animations = [...document.querySelectorAll(".target")].flatMap(target => target.getAnimations());- println(`none transform transitions use the compositor in 2D and 3D: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 5}`);+ println("none transform transitions use the compositor in 2D and 3D:");+ for (const line of compositorAnimationDump())+ println(` ${line}`);for (const animation of animations)animation.pause();diff --git a/Tests/LibWeb/Text/input/css/compositor-transition-pending-start.html b/Tests/LibWeb/Text/input/css/compositor-transition-pending-start.htmlindex 0c90b27ff78..717a5c1ea25 100644--- a/Tests/LibWeb/Text/input/css/compositor-transition-pending-start.html+++ b/Tests/LibWeb/Text/input/css/compositor-transition-pending-start.html@@ -52,6 +52,31 @@<div class="paired" id="paired-retarget"></div><div id="static-opacity-transitions"></div><script>+ function compositorAnimationDump() {+ const lines = internals.dumpCompositorAnimations().split("\n").filter(Boolean);+ const animations = lines.filter(line => /^(opacity|background-color|filter|transform) /.test(line)).sort();+ return [...animations, ...lines.filter(line => !animations.includes(line))];+ }++ function printCompositorAnimations(title) {+ println(title);+ for (const line of compositorAnimationDump())+ println(` ${line}`);+ }++ function compositorAnimationUpdates() {+ const events = ["compositor animations updated", "compositor animation timing anchor updated"];+ return `[${internals.takeRenderingTrace().split("\n").filter(line => events.some(event => line.startsWith(event))).join(", ")}]`;+ }++ function ownsEffectsNode(element) {+ return /^\[e\d+\]/m.test(internals.dumpVisualContextNodes(element));+ }++ function needsCompositorEffectsLayer(element) {+ return internals.dumpVisualContextNodes(element).split("\n").includes("compositor effects layer");+ }+function nextTask() {const { promise, resolve } = Promise.withResolvers();const channel = new MessageChannel();@@ -78,7 +103,6 @@target.addEventListener("transitionrun", () => events.push("transitionrun"));target.addEventListener("transitionstart", () => events.push("transitionstart"));document.body.classList.add("changed");- internals.resetStyleInvalidationCounters();internals.injectRenderingOpportunity(firstFrameTime + 60);await nextTask();@@ -87,27 +111,26 @@let readyResolved = false;animation.ready.then(() => readyResolved = true);await Promise.resolve();- const firstUpdateCounters = internals.getStyleInvalidationCounters();println(`new transition remains pending: ${animation.pending}`);println(`new transition start time remains unresolved: ${animation.startTime === null}`);println(`new transition ready promise remains pending: ${!readyResolved}`);println(`new transition start event remains pending: ${events.length === 0}`);- println(`new transition starts on compositor: ${firstUpdateCounters.compositorVisualAnimations === 1}`);+ printCompositorAnimations("new transition starts on compositor:");- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();internals.injectRenderingOpportunity(firstFrameTime + 120);await nextTask();await Promise.resolve();internals.updateCompositorAnimations();- const secondUpdateCounters = internals.getStyleInvalidationCounters();+ const secondUpdates = compositorAnimationUpdates();println(`next update resolves pending play: ${!animation.pending}`);println(`next update resolves start time: ${animation.startTime !== null}`);println(`next update resolves ready promise: ${readyResolved}`);println(`next update dispatches transition events: ${events.join(",") === "transitionrun,transitionstart"}`);- println(`transition remains on compositor: ${secondUpdateCounters.compositorVisualAnimations === 1}`);- println(`resolved start retains compositor anchor: ${secondUpdateCounters.compositorVisualAnimationTimingAnchorUpdates === 0}`);+ printCompositorAnimations("transition remains on compositor:");+ println(`compositor updates resolving the start: ${secondUpdates}`);animation.cancel();internals.updateCompositorAnimations();@@ -116,11 +139,10 @@getComputedStyle(currentTimeTarget).opacity;const currentTimeAnimation = currentTimeTarget.getAnimations()[0];internals.updateCompositorAnimations();- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();currentTimeAnimation.currentTime = 300;internals.updateCompositorAnimations();- const currentTimeCounters = internals.getStyleInvalidationCounters();- println(`pending current-time seek re-anchors compositor: ${currentTimeAnimation.pending && currentTimeCounters.compositorVisualAnimationTimingAnchorUpdates === 1 && currentTimeCounters.compositorVisualAnimationLocalTimeAtAnchor === 300}`);+ println(`pending current-time seek re-anchors compositor: ${currentTimeAnimation.pending && currentTimeAnimation.currentTime === 300}, ${compositorAnimationUpdates()}`);currentTimeAnimation.cancel();internals.updateCompositorAnimations();@@ -128,12 +150,10 @@getComputedStyle(startTimeTarget).opacity;const startTimeAnimation = startTimeTarget.getAnimations()[0];internals.updateCompositorAnimations();- internals.resetStyleInvalidationCounters();- const documentTimelineCurrentTime = internals.getStyleInvalidationCounters().documentTimelineCurrentTime;- startTimeAnimation.startTime = documentTimelineCurrentTime - 200;+ internals.beginRenderingTrace();+ startTimeAnimation.startTime = document.timeline.currentTime - 200;internals.updateCompositorAnimations();- const startTimeCounters = internals.getStyleInvalidationCounters();- println(`pending start-time change re-anchors compositor: ${!startTimeAnimation.pending && startTimeCounters.compositorVisualAnimationTimingAnchorUpdates === 1 && Math.abs(startTimeCounters.compositorVisualAnimationLocalTimeAtAnchor - 200) < 1}`);+ println(`pending start-time change re-anchors compositor: ${!startTimeAnimation.pending && Math.abs(startTimeAnimation.currentTime - 200) < 1}, ${compositorAnimationUpdates()}`);startTimeAnimation.cancel();internals.updateCompositorAnimations();@@ -141,13 +161,13 @@getComputedStyle(retargetTarget).opacity;const originalRetargetAnimation = retargetTarget.getAnimations()[0];internals.updateCompositorAnimations();- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();retargetTarget.classList.add("second");getComputedStyle(retargetTarget).opacity;const retargetAnimations = retargetTarget.getAnimations();internals.updateCompositorAnimations();- const retargetCounters = internals.getStyleInvalidationCounters();- println(`pending transition retarget replaces descriptor: ${originalRetargetAnimation.playState === "idle" && retargetAnimations.length === 1 && retargetAnimations[0] !== originalRetargetAnimation && retargetCounters.compositorVisualAnimations === 1 && retargetCounters.compositorVisualAnimationUpdates === 1}`);+ println(`pending transition retarget replaces descriptor: ${originalRetargetAnimation.playState === "idle" && retargetAnimations.length === 1 && retargetAnimations[0] !== originalRetargetAnimation}, ${compositorAnimationUpdates()}`);+ printCompositorAnimations("compositor animations after the retarget:");for (const activeAnimation of document.getAnimations())activeAnimation.cancel();@@ -158,22 +178,17 @@for (const child of staticOpacityTransitions.children)child.className = "static-opacity-transition";document.elementFromPoint(0, 0);- const staticTransitionEffectsFrameCount = [...staticOpacityTransitions.children]- .filter(element => internals.visualContextNodeIndices(element).needsCompositorEffectsLayer).length;- println(`static opacity transition declarations do not create effects frames: ${staticTransitionEffectsFrameCount === 0}`);+ println(`static opacity transition declarations do not create effects frames: ${![...staticOpacityTransitions.children].some(needsCompositorEffectsLayer)}`);- const pairedNeedsEffectsFrameBefore = internals.visualContextNodeIndices(pairedTarget).effects.length > 0;+ const pairedNeedsEffectsFrameBefore = ownsEffectsNode(pairedTarget);pairedTarget.classList.add("changed");- internals.resetStyleInvalidationCounters();internals.injectRenderingOpportunity(firstFrameTime + 180);await nextTask();internals.updateCompositorAnimations();const pairedAnimations = pairedTarget.getAnimations();- const pairedCounters = internals.getStyleInvalidationCounters();- const pairedNeedsEffectsFrameAfter = internals.visualContextNodeIndices(pairedTarget).effects.length > 0;- println(`paired opacity and translate transitions start on compositor: ${pairedAnimations.length === 2 && pairedCounters.compositorVisualAnimations === 2}`);- println(`paired transitions share their provisional timing anchor: ${pairedCounters.compositorVisualAnimationsShareTimingAnchor}`);- println(`pending fade-out creates an effects frame: ${!pairedNeedsEffectsFrameBefore && pairedNeedsEffectsFrameAfter}`);+ println(`paired transitions: ${pairedAnimations.length}`);+ printCompositorAnimations("paired opacity and translate transitions start on compositor and share their provisional timing anchor:");+ println(`pending fade-out creates an effects frame: ${!pairedNeedsEffectsFrameBefore && ownsEffectsNode(pairedTarget)}`);for (const pairedAnimation of pairedAnimations)pairedAnimation.cancel();@@ -181,24 +196,21 @@pairedTarget.classList.remove("changed");document.elementFromPoint(0, 0);internals.updateCompositorAnimations();- println(`withdrawn fade-out removes its effects frame: ${internals.visualContextNodeIndices(pairedTarget).effects.length === 0}`);+ println(`withdrawn fade-out removes its effects frame: ${!ownsEffectsNode(pairedTarget)}`);const mixedAnimation = pairedTarget.animate([{ opacity: 1 }, { opacity: 0 }], { duration: 400, fill: "backwards" });internals.injectRenderingOpportunity(firstFrameTime + 200);await nextTask();internals.updateCompositorAnimations();- const mixedOpacityNeedsEffectsFrame = internals.visualContextNodeIndices(pairedTarget).effects.length > 0;+ const mixedOpacityNeedsEffectsFrame = ownsEffectsNode(pairedTarget);mixedAnimation.effect.setKeyframes([{ opacity: 1, filter: "none" },{ opacity: 0, filter: "blur(1px)" },]);- internals.resetStyleInvalidationCounters();internals.updateCompositorAnimations();- const mixedEffectCounters = internals.getStyleInvalidationCounters();- const mixedEffectNeedsEffectsFrame = internals.visualContextNodeIndices(pairedTarget).effects.length > 0;println(`adding an opacity animation creates an effects frame: ${mixedOpacityNeedsEffectsFrame}`);- println(`adding a filter keeps mixed effect on compositor: ${mixedEffectCounters.compositorVisualAnimations === 2}`);- println(`adding a filter retains the effects frame: ${mixedEffectNeedsEffectsFrame}`);+ printCompositorAnimations("adding a filter keeps mixed effect on compositor:");+ println(`adding a filter retains the effects frame: ${ownsEffectsNode(pairedTarget)}`);mixedAnimation.cancel();pairedRetargetTarget.classList.add("first");@@ -208,14 +220,12 @@await nextTask();const originalPairedRetargetAnimation = pairedRetargetTarget.getAnimations()[0];pairedRetargetTarget.classList.replace("first", "second");- internals.resetStyleInvalidationCounters();internals.injectRenderingOpportunity(firstFrameTime + 360);await nextTask();internals.updateCompositorAnimations();const pairedRetargetAnimations = pairedRetargetTarget.getAnimations();- const pairedRetargetCounters = internals.getStyleInvalidationCounters();- println(`retargeted opacity starts with paired translate on compositor: ${originalPairedRetargetAnimation.playState === "idle" && pairedRetargetAnimations.length === 2 && pairedRetargetCounters.compositorVisualAnimations === 2}`);- println(`retargeted paired transitions share their provisional timing anchor: ${pairedRetargetCounters.compositorVisualAnimationsShareTimingAnchor}`);+ println(`retargeted opacity replaces its transition: ${originalPairedRetargetAnimation.playState === "idle" && pairedRetargetAnimations.length === 2}`);+ printCompositorAnimations("retargeted opacity starts with paired translate on compositor and shares its provisional timing anchor:");internals.setManualRenderingOpportunities(false);done();diff --git a/Tests/LibWeb/Text/input/css/delayed-script-animation-start-wakeup.html b/Tests/LibWeb/Text/input/css/delayed-script-animation-start-wakeup.htmlindex 8dfac1a77c0..c86741aa345 100644--- a/Tests/LibWeb/Text/input/css/delayed-script-animation-start-wakeup.html+++ b/Tests/LibWeb/Text/input/css/delayed-script-animation-start-wakeup.html@@ -45,21 +45,24 @@const transition = target.getAnimations()[0];await transition.ready;- println(`delayed transition uses the compositor before start: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 1}`);+ println("delayed transition uses the compositor before start:");+ for (const line of internals.dumpCompositorAnimations().split("\n").filter(Boolean))+ println(` ${line}`);const activeStartTime = transition.startTime + 501;- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();internals.fireCompositorAnimationWakeupForTesting(activeStartTime);- const counters = internals.getStyleInvalidationCounters();+ const wakeupTrace = internals.takeRenderingTrace().split("\n");transition.currentTime = 501;await renderAt(performance.now());- println(`delayed compositor effect requests one start frame: ${counters.animationFramePumpRequests === 1}`);- println(`delayed compositor effect republishes at active start: ${counters.compositorVisualAnimationUpdates === 1}`);+ println(`delayed compositor effect requests one start frame: [${wakeupTrace.filter(line => line.startsWith("animation frame pump request")).join(", ")}]`);+ println(`delayed compositor effect republishes at active start: [${wakeupTrace.filter(line => line.startsWith("compositor animations updated")).join(", ")}]`);println(`seeking reaches the delayed transition's active phase: ${transition.currentTime >= 500}`);println(`transitionstart fires after seeking and rendering: ${receivedTransitionStart}`);- println(`active compositor effect retains an end wake-up: ${internals.getStyleInvalidationCounters().compositorAnimationWakeupTimerActive}`);+ const armedTimers = internals.dumpCompositorAnimations().split("\n").filter(line => line.endsWith("timer armed"));+ println(`active compositor effect retains an end wake-up: [${armedTimers.join(", ")}]`);transition.cancel();internals.setManualRenderingOpportunities(false);diff --git a/Tests/LibWeb/Text/input/css/display-none-subtree-animation-throttling.html b/Tests/LibWeb/Text/input/css/display-none-subtree-animation-throttling.htmlindex 7501a851a6e..1591fdbee6e 100644--- a/Tests/LibWeb/Text/input/css/display-none-subtree-animation-throttling.html+++ b/Tests/LibWeb/Text/input/css/display-none-subtree-animation-throttling.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><div id="custom-display" style="--display: none; display: var(--display)"></div><div id="hidden" style="display: none"><svg id="plain"><circle></circle></svg>@@ -11,13 +12,19 @@return new Promise(resolve => requestAnimationFrame(resolve));}- async function animationOverlayBuildsOverFrames(frameCount) {+ async function traceFrames(frameCount) {for (let i = 0; i < 2; ++i)await nextFrame();- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();+ internals.beginRenderingTrace();for (let i = 0; i < frameCount; ++i)await nextFrame();- return internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds;+ const sampled = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ const pumpRequests = internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("animation frame pump request"));+ return {+ sampled: `[${[...new Set(sampled.map(event => shortStyleName(event.element)))].join(", ")}]`,+ pumpRequests: `[${[...new Set(pumpRequests.map(line => line.replace(/ x\d+$/, "")))].join(", ")}]`,+ };}function animate(element, keyframes) {@@ -28,24 +35,24 @@const plainCircle = document.querySelector("#plain circle");const dashes = { strokeDashoffset: ["0px", "100px"] };const animation = animate(plainCircle, dashes);- println(`animation with no box builds overlays: ${(await animationOverlayBuildsOverFrames(2)) > 0}`);- println(`animation with no box requests frames: ${internals.getStyleInvalidationCounters().animationFramePumpRequests > 0}`);+ const noBox = await traceFrames(2);+ println(`animation with no box samples: ${noBox.sampled}`);+ println(`animation with no box frame requests: ${noBox.pumpRequests}`);animation.currentTime = 50000;println(`computed style samples animation: ${getComputedStyle(plainCircle).strokeDashoffset}`);document.getElementById("named-circle").id = "referenced-circle";const referenceable = animate(document.getElementById("referenced-circle"), dashes);- println(`referenceable geometry builds overlays: ${(await animationOverlayBuildsOverFrames(2)) > 0}`);+ println(`referenceable geometry samples: ${(await traceFrames(2)).sampled}`);referenceable.cancel();const resource = animate(document.getElementById("stop"), { stopOpacity: [0, 1] });- println(`SVG resource builds overlays: ${(await animationOverlayBuildsOverFrames(2)) > 0}`);+ println(`SVG resource samples: ${(await traceFrames(2)).sampled}`);resource.cancel();const customDisplay = animate(document.getElementById("custom-display"), { "--display": ["none", "block"] });- await animationOverlayBuildsOverFrames(2);- println(`custom property animation requests frames: ${internals.getStyleInvalidationCounters().animationFramePumpRequests > 0}`);+ println(`custom property animation frame requests: ${(await traceFrames(2)).pumpRequests}`);customDisplay.cancel();const reversed = animate(plainCircle, dashes);@@ -61,7 +68,7 @@finiteEnd.cancel();document.getElementById("hidden").style.display = "block";- println(`revealed animation builds overlays: ${(await animationOverlayBuildsOverFrames(2)) > 0}`);+ println(`revealed animation samples: ${(await traceFrames(2)).sampled}`);println(`revealed computed style: ${getComputedStyle(plainCircle).strokeDashoffset === "50px" ? "stale" : "advanced"}`);done();});diff --git a/Tests/LibWeb/Text/input/css/element-scoped-animation-sampling.html b/Tests/LibWeb/Text/input/css/element-scoped-animation-sampling.htmlindex 80578ba30ba..658ce5abe0a 100644--- a/Tests/LibWeb/Text/input/css/element-scoped-animation-sampling.html+++ b/Tests/LibWeb/Text/input/css/element-scoped-animation-sampling.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>@keyframes move {from { transform: translateX(0px); }@@ -28,6 +29,11 @@<div id="unrelated"></div><div id="overflow-container"><div id="overflow-animated"></div></div><script>+ function samples() {+ const events = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ return `[${events.map(event => shortStyleName(event.element)).join(", ")}]`;+ }+asyncTest(async done => {internals.updateStyle();const overflowAnimated = document.getElementById("overflow-animated");@@ -36,20 +42,22 @@await new Promise(requestAnimationFrame);await new Promise(resolve => setTimeout(resolve, 0));unrelated.getBoundingClientRect();- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();for (let i = 0; i < 100; ++i) {unrelated.getBoundingClientRect();getComputedStyle(unrelated).width;}- println(`unrelated reads do not sample animation: ${internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds === 0}`);+ println(`unrelated reads sample: ${samples()}`);+ internals.beginStyleTrace();descendant.getBoundingClientRect();descendant.getBoundingClientRect();- println(`related reads sample once per task: ${internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds === 1}`);+ println(`related reads in one task sample: ${samples()}`);+ internals.beginStyleTrace();await new Promise(requestAnimationFrame);descendant.getBoundingClientRect();- println(`related read samples in a later task: ${internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds === 2}`);+ println(`related read in a later task samples: ${samples()}`);const timeline = internals.createInternalAnimationTimeline();const overflowAnimation = new Animation(new KeyframeEffect(overflowAnimated, [@@ -61,12 +69,13 @@await new Promise(requestAnimationFrame);await new Promise(requestAnimationFrame);timeline.setTimeForObservation(50);- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();getComputedStyle(overflowContainer).width;- println(`ancestor style reads sample descendant animations: ${internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds > 0}`);+ println(`ancestor style read samples: ${samples()}`);+ internals.beginStyleTrace();const scrollWidth = overflowContainer.scrollWidth;- const counters = internals.getStyleInvalidationCounters();- println(`ancestor reads sample descendant animations: ${counters.animatedStyleOverlayBuilds > 0 && scrollWidth > 20}`);+ println(`ancestor geometry read samples: ${samples()}`);+ println(`ancestor geometry read sees the sampled transform: ${scrollWidth > 20}`);done();});</script>diff --git a/Tests/LibWeb/Text/input/css/finished-compositor-animation-content-culling.html b/Tests/LibWeb/Text/input/css/finished-compositor-animation-content-culling.htmlindex 212c80cfe63..30646d71f65 100644--- a/Tests/LibWeb/Text/input/css/finished-compositor-animation-content-culling.html+++ b/Tests/LibWeb/Text/input/css/finished-compositor-animation-content-culling.html@@ -71,6 +71,18 @@<div id="main-thread-under" class="under"></div><div id="main-thread" class="target"></div><script>+ function compositorAnimationDump() {+ const lines = internals.dumpCompositorAnimations().split("\n").filter(Boolean);+ const animations = lines.filter(line => /^(opacity|background-color|filter|transform) /.test(line)).sort();+ return [...animations, ...lines.filter(line => !animations.includes(line))];+ }++ function printCompositorAnimations(title) {+ println(title);+ for (const line of compositorAnimationDump())+ println(` ${line}`);+ }+asyncTest(async done => {const finiteAnimations = document.getAnimations();finiteAnimations.forEach(animation => animation.currentTime = 0);@@ -85,7 +97,7 @@for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- println(`animations start on the compositor: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 2}`);+ printCompositorAnimations("animations start on the compositor:");const activeDisplayList = internals.dumpDisplayList();println(`active animation content is retained: ${activeDisplayList.includes("rgb(1, 2, 3)") && activeDisplayList.includes("rgb(4, 5, 6)")}`);println(`paused opacity-zero content is culled: ${!activeDisplayList.includes("rgb(10, 11, 12)")}`);diff --git a/Tests/LibWeb/Text/input/css/finite-compositor-animation-completion.html b/Tests/LibWeb/Text/input/css/finite-compositor-animation-completion.htmlindex 414737bd179..1b5f1bd1ee2 100644--- a/Tests/LibWeb/Text/input/css/finite-compositor-animation-completion.html+++ b/Tests/LibWeb/Text/input/css/finite-compositor-animation-completion.html@@ -30,15 +30,37 @@<div id="transform"></div><div id="opacity-without-fill"></div><script>+ function compositorAnimationDump() {+ const lines = internals.dumpCompositorAnimations().split("\n").filter(Boolean);+ const animations = lines.filter(line => /^(opacity|background-color|filter|transform) /.test(line)).sort();+ return [...animations, ...lines.filter(line => !animations.includes(line))];+ }++ function animationUpdatesOutsideRenderingUpdates(trace) {+ const outside = [];+ let updatesRun = 0;+ for (const line of trace.split("\n")) {+ const [, event, times] = line.match(/^(.*?)(?: x(\d+))?$/);+ if (event === "update")+ updatesRun += Number(times ?? 1);+ if (event === "animation timeline updated its animations") {+ updatesRun -= Number(times ?? 1);+ if (updatesRun < 0)+ outside.push(line);+ updatesRun = 0;+ }+ }+ return outside;+ }+asyncTest(async done => {let animationEndEvents = 0;let eventHandlerSawTerminalStyle = false;- let animationUpdatesAtEndEvent = 0;- let renderingUpdatesAtEndEvent = 0;+ let traceUntilEndEvent = "";opacity.addEventListener("animationend", () => {++animationEndEvents;- animationUpdatesAtEndEvent = internals.getStyleInvalidationCounters().animationTimelineAssociatedAnimationUpdates;- renderingUpdatesAtEndEvent = internals.getRenderingSchedulerCounters().updatesRun;+ traceUntilEndEvent = internals.takeRenderingTrace();+ internals.beginRenderingTrace();eventHandlerSawTerminalStyle = getComputedStyle(opacity).opacity === "0.8";});transform.addEventListener("animationend", () => ++animationEndEvents);@@ -47,19 +69,21 @@await new Promise(requestAnimationFrame);const opacityWithoutFill = document.querySelector("#opacity-without-fill");const animations = [...opacity.getAnimations(), ...transform.getAnimations(), ...opacityWithoutFill.getAnimations()];- println(`finite effects use the compositor: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 3}`);+ println("finite effects use the compositor:");+ for (const line of compositorAnimationDump())+ println(` ${line}`);- internals.resetStyleInvalidationCounters();- internals.resetRenderingSchedulerCounters();+ internals.beginRenderingTrace();let finishedPromises = 0;await Promise.all(animations.map(animation => animation.finished.then(() => ++finishedPromises)));await new Promise(requestAnimationFrame);+ const trace = traceUntilEndEvent + internals.takeRenderingTrace();println(`finished promises resolve: ${finishedPromises === 3}`);println(`animationend events fire: ${animationEndEvents === 2}`);println(`animationend sees terminal style: ${eventHandlerSawTerminalStyle}`);- println(`finite effects request one end frame: ${internals.getStyleInvalidationCounters().animationFramePumpRequests === 1}`);- println(`wake-up timer leaves animation updates to frames: ${animationUpdatesAtEndEvent === renderingUpdatesAtEndEvent}`);+ println(`finite effects request one end frame: [${trace.split("\n").filter(line => line.startsWith("animation frame pump request")).join(", ")}]`);+ println(`animation updates outside rendering updates before the end event: [${animationUpdatesOutsideRenderingUpdates(traceUntilEndEvent).join(", ")}]`);println(`forwards fill retains opacity: ${getComputedStyle(opacity).opacity === "0.8"}`);println(`no fill restores transform: ${getComputedStyle(transform).transform === "matrix(1, 0, 0, 1, 7, 0)"}`);println(`no fill restores opacity: ${getComputedStyle(opacityWithoutFill).opacity === "0.3"}`);diff --git a/Tests/LibWeb/Text/input/css/finite-compositor-targeted-wakeup.html b/Tests/LibWeb/Text/input/css/finite-compositor-targeted-wakeup.htmlindex 2915a885d8c..96a510cd1bb 100644--- a/Tests/LibWeb/Text/input/css/finite-compositor-targeted-wakeup.html+++ b/Tests/LibWeb/Text/input/css/finite-compositor-targeted-wakeup.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>@keyframes pulse {from { opacity: 0.2; }@@ -25,6 +26,27 @@<div class="infinite"></div><div id="finite"></div><script>+ function compositorAnimationDump() {+ const lines = internals.dumpCompositorAnimations().split("\n").filter(Boolean);+ const animations = lines.filter(line => /^(opacity|background-color|filter|transform) /.test(line)).sort();+ return [...animations, ...lines.filter(line => !animations.includes(line))];+ }++ function printCompositorAnimations(title) {+ println(title);+ for (const line of compositorAnimationDump())+ println(` ${line}`);+ }++ function samples() {+ const events = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ return `[${events.map(event => event.element).join(", ")}]`;+ }++ function frameRequests() {+ return `[${internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("animation frame pump request")).join(", ")}]`;+ }+asyncTest(async done => {// Hold the animation clock still while the compositor publishes the effects.const timeline = internals.createInternalAnimationTimeline();@@ -37,25 +59,25 @@timeline.setTimeForObservation(0);await new Promise(requestAnimationFrame);await new Promise(requestAnimationFrame);- println(`all effects use the compositor: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 6}`);+ printCompositorAnimations("all effects use the compositor:");let receivedAnimationEnd = false;finite.addEventListener("animationend", () => receivedAnimationEnd = true, { once: true });- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();+ internals.beginRenderingTrace();timeline.setTimeForObservation(299);internals.fireCompositorAnimationWakeupForTesting(299);- const earlyCounters = internals.getStyleInvalidationCounters();- println(`early wake-up does no work: ${earlyCounters.animatedStyleOverlayBuilds === 0 && earlyCounters.animationFramePumpRequests === 0}`);+ println(`early wake-up samples: ${samples()}, frame requests: ${frameRequests()}`);+ internals.beginStyleTrace();+ internals.beginRenderingTrace();timeline.setTimeForObservation(301);internals.fireCompositorAnimationWakeupForTesting(301);timeline.setTime(301);await new Promise(requestAnimationFrame);- const counters = internals.getStyleInvalidationCounters();-- println(`finite end samples only its target: ${counters.animatedStyleOverlayBuilds === 1}`);- println(`finite end requests one frame: ${counters.animationFramePumpRequests === 1}`);- println(`infinite effects remain on the compositor: ${counters.compositorVisualAnimations === 5}`);+ println(`finite end samples: ${samples()}`);+ println(`finite end frame requests: ${frameRequests()}`);+ printCompositorAnimations("infinite effects remain on the compositor:");println(`finite animation dispatches its end event: ${receivedAnimationEnd}`);for (const animation of animations)animation.cancel();diff --git a/Tests/LibWeb/Text/input/css/font-face-css-connected-registration-invalidation.html b/Tests/LibWeb/Text/input/css/font-face-css-connected-registration-invalidation.htmlindex 44ab2241b63..dee5241d39e 100644--- a/Tests/LibWeb/Text/input/css/font-face-css-connected-registration-invalidation.html+++ b/Tests/LibWeb/Text/input/css/font-face-css-connected-registration-invalidation.html@@ -5,22 +5,21 @@return [...document.fonts].filter(face => face.family === family).length;}- function styleEnvironmentVersion() {- return internals.getStyleInvalidationCounters().styleEnvironmentVersion;+ function environmentChanges() {+ return `[${internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("style environment changed")).join(", ")}]`;}- function printVersionDelta(label, callback) {+ function printEnvironmentChanges(label, callback) {internals.updateStyle();- const before = styleEnvironmentVersion();+ internals.beginRenderingTrace();callback();- const after = styleEnvironmentVersion();- println(`${label}: ${after - before}`);+ println(`${label}: ${environmentChanges()}`);}promiseTest(async () => {let style = document.createElement("style");- printVersionDelta("append unloaded CSS-connected face", () => {+ printEnvironmentChanges("append unloaded CSS-connected face", () => {style.textContent = '@font-face { font-family: "UnloadedSheetFace"; src: url("unloaded-sheet-face.woff"); }';document.head.appendChild(style);});@@ -28,19 +27,18 @@internals.updateStyle();const cssConnectedFace = [...document.fonts].find(face => face.family === "UnloadedSheetFace");- const beforePublicDelete = styleEnvironmentVersion();+ internals.beginRenderingTrace();println(`public delete CSS-connected face: ${document.fonts.delete(cssConnectedFace)}`);- const afterPublicDelete = styleEnvironmentVersion();- println(`public delete CSS-connected face delta: ${afterPublicDelete - beforePublicDelete}`);+ println(`public delete CSS-connected face environment changes: ${environmentChanges()}`);println(`UnloadedSheetFace count after public delete: ${countFaces("UnloadedSheetFace")}`);- printVersionDelta("remove unloaded CSS-connected face", () => {+ printEnvironmentChanges("remove unloaded CSS-connected face", () => {style.remove();});println(`UnloadedSheetFace count after removal: ${countFaces("UnloadedSheetFace")}`);const scriptFace = new FontFace("ScriptFace", 'url("../../../Assets/HashSans.woff")');- printVersionDelta("add unloaded script-created face", () => {+ printEnvironmentChanges("add unloaded script-created face", () => {document.fonts.add(scriptFace);});println(`ScriptFace count after add: ${countFaces("ScriptFace")}`);@@ -49,7 +47,7 @@await document.fonts.ready;println(`ScriptFace status before removal: ${scriptFace.status}`);- printVersionDelta("delete loaded script-created face", () => {+ printEnvironmentChanges("delete loaded script-created face", () => {document.fonts.delete(scriptFace);});println(`ScriptFace count after delete: ${countFaces("ScriptFace")}`);@@ -66,7 +64,7 @@await document.fonts.ready;println(`LoadedSheetFace status before removal: ${[...document.fonts].find(face => face.family === "LoadedSheetFace").status}`);- printVersionDelta("remove loaded CSS-connected face", () => {+ printEnvironmentChanges("remove loaded CSS-connected face", () => {loadedStyle.remove();});println(`LoadedSheetFace count after removal: ${countFaces("LoadedSheetFace")}`);@@ -79,7 +77,7 @@}`);- printVersionDelta("adopt constructed CSS-connected face", () => {+ printEnvironmentChanges("adopt constructed CSS-connected face", () => {document.adoptedStyleSheets = [constructedSheet];});println(`ConstructedSheetFace count after adoption: ${countFaces("ConstructedSheetFace")}`);@@ -88,7 +86,7 @@await document.fonts.ready;println(`ConstructedSheetFace status before removal: ${[...document.fonts].find(face => face.family === "ConstructedSheetFace").status}`);- printVersionDelta("unadopt constructed CSS-connected face", () => {+ printEnvironmentChanges("unadopt constructed CSS-connected face", () => {document.adoptedStyleSheets = [];});println(`ConstructedSheetFace count after removal: ${countFaces("ConstructedSheetFace")}`);diff --git a/Tests/LibWeb/Text/input/css/font-face-sheet-invalidation-batching.html b/Tests/LibWeb/Text/input/css/font-face-sheet-invalidation-batching.htmlindex 646315f8027..6ecac4484dc 100644--- a/Tests/LibWeb/Text/input/css/font-face-sheet-invalidation-batching.html+++ b/Tests/LibWeb/Text/input/css/font-face-sheet-invalidation-batching.html@@ -7,16 +7,15 @@return [...document.fonts].filter(face => face.family.startsWith(familyPrefix)).length;}- function styleEnvironmentVersion() {- return internals.getStyleInvalidationCounters().styleEnvironmentVersion;+ function environmentChanges() {+ return `[${internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("style environment changed")).join(", ")}]`;}- function printVersionDelta(label, callback) {+ function printEnvironmentChanges(label, callback) {internals.updateStyle();- const before = styleEnvironmentVersion();+ internals.beginRenderingTrace();callback();- const after = styleEnvironmentVersion();- println(`${label}: ${after - before}`);+ println(`${label}: ${environmentChanges()}`);}function makeStyle(source) {@@ -41,7 +40,7 @@getComputedStyle(document.getElementById("document-target")).fontFamily;const style = makeStyle(multiFaceSheet);- printVersionDelta("append sheet with multiple CSS-connected faces", () => {+ printEnvironmentChanges("append sheet with multiple CSS-connected faces", () => {document.head.appendChild(style);});println(`Batch face count after append: ${countFaces("Batch")}`);@@ -49,7 +48,7 @@document.body.offsetWidth;println(`Document target width after BatchFamilyA loads: ${Math.round(document.getElementById("document-target").getBoundingClientRect().width)}`);- printVersionDelta("remove sheet with multiple CSS-connected faces", () => {+ printEnvironmentChanges("remove sheet with multiple CSS-connected faces", () => {style.remove();});println(`Batch face count after removal: ${countFaces("Batch")}`);@@ -60,22 +59,22 @@`);const repeatedSheetB = makeStyle(repeatedSheetA.textContent);- printVersionDelta("append first repeated sheet", () => {+ printEnvironmentChanges("append first repeated sheet", () => {document.head.appendChild(repeatedSheetA);});println(`RepeatedBatch face count after first append: ${countFaces("RepeatedBatch")}`);- printVersionDelta("append second repeated sheet", () => {+ printEnvironmentChanges("append second repeated sheet", () => {document.head.appendChild(repeatedSheetB);});println(`RepeatedBatch face count after second append: ${countFaces("RepeatedBatch")}`);- printVersionDelta("remove first repeated sheet", () => {+ printEnvironmentChanges("remove first repeated sheet", () => {repeatedSheetA.remove();});println(`RepeatedBatch face count after first removal: ${countFaces("RepeatedBatch")}`);- printVersionDelta("remove second repeated sheet", () => {+ printEnvironmentChanges("remove second repeated sheet", () => {repeatedSheetB.remove();});println(`RepeatedBatch face count after second removal: ${countFaces("RepeatedBatch")}`);@@ -88,7 +87,7 @@@font-face { font-family: ShadowBatchA; src: url("../../../Ref/data/fonts/Ahem.ttf"); }@font-face { font-family: ShadowBatchB; src: url("shadow-b.woff"); }`);- printVersionDelta("append shadow sheet with shadow-only font faces", () => {+ printEnvironmentChanges("append shadow sheet with shadow-only font faces", () => {shadowRoot.appendChild(shadowStyle);});println(`ShadowBatch face count after append: ${countFaces("ShadowBatch")}`);@@ -96,23 +95,22 @@document.body.offsetWidth;println(`Shadow target ignores shadow-only font face: ${Math.round(shadowRoot.getElementById("shadow-target").getBoundingClientRect().width) !== 100}`);- printVersionDelta("remove shadow sheet with shadow-only font faces", () => {+ printEnvironmentChanges("remove shadow sheet with shadow-only font faces", () => {shadowStyle.remove();});println(`ShadowBatch face count after removal: ${countFaces("ShadowBatch")}`);const scriptFace = new FontFace("ScriptBatch", 'url("../../../Assets/HashSans.woff")');- printVersionDelta("add unloaded script-created face", () => {+ printEnvironmentChanges("add unloaded script-created face", () => {document.fonts.add(scriptFace);});internals.updateStyle();- const beforeLoad = styleEnvironmentVersion();+ internals.beginRenderingTrace();await scriptFace.load();- const afterLoad = styleEnvironmentVersion();- println(`load script-created face: ${afterLoad - beforeLoad}`);+ println(`load script-created face: ${environmentChanges()}`);- printVersionDelta("delete loaded script-created face", () => {+ printEnvironmentChanges("delete loaded script-created face", () => {document.fonts.delete(scriptFace);});});diff --git a/Tests/LibWeb/Text/input/css/force-dark-keeps-background-color-animations-on-the-main-thread.html b/Tests/LibWeb/Text/input/css/force-dark-keeps-background-color-animations-on-the-main-thread.htmlindex fcd5563b496..218fc7b2e70 100644--- a/Tests/LibWeb/Text/input/css/force-dark-keeps-background-color-animations-on-the-main-thread.html+++ b/Tests/LibWeb/Text/input/css/force-dark-keeps-background-color-animations-on-the-main-thread.html@@ -37,54 +37,58 @@await nextTask();}}+ function ownsCompositorBackgroundColorFrame() {+ return internals.dumpVisualContextNodes(target).split("\n").includes("compositor background-color frame");+ }function compositorMarkerEverAppears() {let appears = false;for (let i = 0; i < 4; ++i) {internals.updateCompositorAnimations();- appears ||= internals.visualContextNodeIndices(target).needsCompositorBackgroundColorFrame;+ appears ||= ownsCompositorBackgroundColorFrame();}return appears;}- function compositorVisualAnimations() {- return internals.getStyleInvalidationCounters().compositorVisualAnimations;+ function compositorAnimations() {+ return `[${internals.dumpCompositorAnimations().split("\n").filter(line => line && !line.endsWith("timer armed")).join(", ")}]`;}// A main-thread animation asks for a tick every frame; one the compositor drives asks for none.async function mainThreadTicks() {- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();await renderFrames(2);- return internals.getStyleInvalidationCounters().animationFramePumpRequests;+ const lines = internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("animation frame pump request"));+ return `[${[...new Set(lines.map(line => line.replace(/ x\d+$/, "")))].join(", ")}]`;}// On from the first frame: the compositor never gets the animation, and the main thread keeps animating it.internals.setForceDarkEnabled(true);await renderFrames(4);const markerWhileOnFromTheStart = compositorMarkerEverAppears();- const compositorAnimationsWhileOnFromTheStart = compositorVisualAnimations();+ const compositorAnimationsWhileOnFromTheStart = compositorAnimations();const ticksWhileOnFromTheStart = await mainThreadTicks();// Off again: the same animation is handed to the compositor, so it's force-dark alone holding it back.internals.setForceDarkEnabled(false);await renderFrames(4);- const markerWhileOff = internals.visualContextNodeIndices(target).needsCompositorBackgroundColorFrame;- const compositorAnimationsWhileOff = compositorVisualAnimations();+ const markerWhileOff = ownsCompositorBackgroundColorFrame();+ const compositorAnimationsWhileOff = compositorAnimations();const ticksWhileOff = await mainThreadTicks();// On while the compositor has it: the frame it was given is dropped, and the animation comes back.internals.setForceDarkEnabled(true);await renderFrames(4);const markerAfterTurningOn = compositorMarkerEverAppears();- const compositorAnimationsAfterTurningOn = compositorVisualAnimations();+ const compositorAnimationsAfterTurningOn = compositorAnimations();const ticksAfterTurningOn = await mainThreadTicks();println(`force-dark on from the start: no compositor marker: ${!markerWhileOnFromTheStart}`);- println(`force-dark on from the start: no compositor animation: ${compositorAnimationsWhileOnFromTheStart === 0}`);- println(`force-dark on from the start: the main thread keeps ticking: ${ticksWhileOnFromTheStart > 0}`);+ println(`force-dark on from the start: compositor animations: ${compositorAnimationsWhileOnFromTheStart}`);+ println(`force-dark on from the start: main thread frame requests: ${ticksWhileOnFromTheStart}`);println(`force-dark off: compositor marker: ${markerWhileOff}`);- println(`force-dark off: compositor animation: ${compositorAnimationsWhileOff === 1}`);- println(`force-dark off: the main thread stops ticking: ${ticksWhileOff === 0}`);+ println(`force-dark off: compositor animations: ${compositorAnimationsWhileOff}`);+ println(`force-dark off: main thread frame requests: ${ticksWhileOff}`);println(`force-dark turned on mid-animation: no compositor marker: ${!markerAfterTurningOn}`);- println(`force-dark turned on mid-animation: no compositor animation: ${compositorAnimationsAfterTurningOn === 0}`);- println(`force-dark turned on mid-animation: the main thread ticks again: ${ticksAfterTurningOn > 0}`);+ println(`force-dark turned on mid-animation: compositor animations: ${compositorAnimationsAfterTurningOn}`);+ println(`force-dark turned on mid-animation: main thread frame requests: ${ticksAfterTurningOn}`);internals.setForceDarkEnabled(false);internals.setManualRenderingOpportunities(false);done();diff --git a/Tests/LibWeb/Text/input/css/interrupted-css-transitions.html b/Tests/LibWeb/Text/input/css/interrupted-css-transitions.htmlindex 4a57254b90d..dcd6692ca99 100644--- a/Tests/LibWeb/Text/input/css/interrupted-css-transitions.html+++ b/Tests/LibWeb/Text/input/css/interrupted-css-transitions.html@@ -15,8 +15,11 @@}</style><script>+ function documentAnimations() {+ return `[${document.getAnimations().map(animation => animation.transitionProperty ?? animation.animationName).sort().join(", ")}]`;+ }+asyncTest(async done => {- const initialCount = internals.getStyleInvalidationCounters().associatedAnimations;const interrupted = document.createElement("div");interrupted.className = "transitioner";@@ -30,7 +33,7 @@}await new Promise(requestAnimationFrame);- println(`interrupted transitions do not accumulate: ${internals.getStyleInvalidationCounters().associatedAnimations === initialCount + 1}`);+ println(`interrupted transitions do not accumulate: ${documentAnimations()}`);println(`the replacement transition is still running: ${interrupted.getAnimations().length === 1}`);const removed = document.createElement("div");@@ -44,19 +47,19 @@await new Promise(requestAnimationFrame);await new Promise(requestAnimationFrame);- println(`a transition dropped by transition-property is disassociated: ${internals.getStyleInvalidationCounters().associatedAnimations === initialCount + 1}`);+ println(`a transition dropped by transition-property is disassociated: ${documentAnimations()}`);println(`the dropped transition is no longer relevant: ${removedTransition.playState === "idle" || removed.getAnimations().length === 0}`);const spinner = document.createElement("div");spinner.className = "spinner";document.body.append(spinner);await new Promise(requestAnimationFrame);- println(`a CSS animation is associated while its name applies: ${internals.getStyleInvalidationCounters().associatedAnimations === initialCount + 2}`);+ println(`a CSS animation is associated while its name applies: ${documentAnimations()}`);spinner.style.animationName = "none";await new Promise(requestAnimationFrame);await new Promise(requestAnimationFrame);- println(`a CSS animation dropped by animation-name is disassociated: ${internals.getStyleInvalidationCounters().associatedAnimations === initialCount + 1}`);+ println(`a CSS animation dropped by animation-name is disassociated: ${documentAnimations()}`);done();});</script>diff --git a/Tests/LibWeb/Text/input/css/invisible-animation-style-throttling.html b/Tests/LibWeb/Text/input/css/invisible-animation-style-throttling.htmlindex 53c686f4fc4..50fb7524535 100644--- a/Tests/LibWeb/Text/input/css/invisible-animation-style-throttling.html+++ b/Tests/LibWeb/Text/input/css/invisible-animation-style-throttling.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>@keyframes spin {from { transform: translateX(0%); }@@ -16,65 +17,76 @@return new Promise(resolve => requestAnimationFrame(resolve));}- async function animationOverlayBuildsOverFrames(frameCount) {- const before = internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds;+ function sampledElements() {+ const events = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ return `[${[...new Set(events.map(event => event.element))].join(", ")}]`;+ }++ function frameRequests() {+ const lines = internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("animation frame pump request"));+ return `[${[...new Set(lines.map(line => line.replace(/ x\d+$/, "")))].join(", ")}]`;+ }++ async function traceOverFrames(frameCount) {+ internals.beginStyleTrace();+ internals.beginRenderingTrace();for (let i = 0; i < frameCount; ++i)await nextFrame();- return internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds - before;+ return { sampled: sampledElements(), frameRequests: frameRequests() };}asyncTest(async done => {internals.updateStyle();const hidden = document.createElement("div");+ hidden.id = "hidden";hidden.className = "animated";hidden.style.visibility = "hidden";document.body.append(hidden);for (let i = 0; i < 4; ++i)await nextFrame();- internals.resetStyleInvalidationCounters();- println(`hidden animation overlay builds: ${await animationOverlayBuildsOverFrames(4)}`);- println(`hidden animation frame pump requests: ${internals.getStyleInvalidationCounters().animationFramePumpRequests}`);+ let trace = await traceOverFrames(4);+ println(`hidden animation samples: ${trace.sampled}`);+ println(`hidden animation frame requests: ${trace.frameRequests}`);hidden.getAnimations()[0].currentTime = 250000;let animationIterationEvents = 0;const animationIterationListener = () => ++animationIterationEvents;hidden.addEventListener("animationiteration", animationIterationListener);internals.updateLayoutForTesting();- internals.resetStyleInvalidationCounters();- await animationOverlayBuildsOverFrames(4);- println(`animation event listener uses iteration wake-ups: ${internals.getStyleInvalidationCounters().animationFramePumpRequests === 0 && internals.getStyleInvalidationCounters().compositorAnimationWakeupTimerActive}`);+ trace = await traceOverFrames(4);+ const armedTimers = internals.dumpCompositorAnimations().split("\n").filter(line => line.endsWith("timer armed"));+ println(`animation event listener uses iteration wake-ups: frame requests ${trace.frameRequests}, armed timers [${armedTimers.join(", ")}]`);println(`animation event listener skips past events: ${animationIterationEvents}`);hidden.removeEventListener("animationiteration", animationIterationListener);// The lines printed above left layout dirty, and a hidden animation can't skip its tick until layout is// redone. So redo it before counting, as the listener phase above does.internals.updateLayoutForTesting();- internals.resetStyleInvalidationCounters();- await animationOverlayBuildsOverFrames(4);- println(`removing animation event listener stops frame pump: ${internals.getStyleInvalidationCounters().animationFramePumpRequests}`);+ trace = await traceOverFrames(4);+ println(`frame requests after removing the animation event listener: ${trace.frameRequests}`);- const beforeComputedStyle = internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds;+ internals.beginStyleTrace();getComputedStyle(hidden).transform;- const afterComputedStyle = internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds;- println(`computed style samples hidden animation: ${afterComputedStyle > beforeComputedStyle}`);+ println(`computed style samples: ${sampledElements()}`);const offscreenClip = document.createElement("div");offscreenClip.style.cssText = "position: absolute; top: 200vh; width: 100px; height: 100px; overflow: hidden";const offscreenAnimation = document.createElement("div");+ offscreenAnimation.id = "offscreen";offscreenAnimation.className = "animated";offscreenClip.append(offscreenAnimation);document.body.append(offscreenClip);for (let i = 0; i < 4; ++i)await nextFrame();- internals.resetStyleInvalidationCounters();- println(`offscreen clipped animation overlay builds: ${await animationOverlayBuildsOverFrames(4)}`);- println(`offscreen clipped animation frame pump requests: ${internals.getStyleInvalidationCounters().animationFramePumpRequests}`);- internals.resetStyleInvalidationCounters();+ trace = await traceOverFrames(4);+ println(`offscreen clipped animation samples: ${trace.sampled}`);+ println(`offscreen clipped animation frame requests: ${trace.frameRequests}`);+ internals.beginStyleTrace();+ internals.beginRenderingTrace();offscreenClip.scrollIntoView();await new Promise(resolve => setTimeout(() => setTimeout(resolve, 0), 0));- const revealedCounters = internals.getStyleInvalidationCounters();- println(`revealed clipped animation resumes: ${revealedCounters.animatedStyleOverlayBuilds > 0}`);- println(`revealed clipped animation requests frame: ${revealedCounters.animationFramePumpRequests > 0}`);+ println(`revealed clipped animation samples: ${sampledElements()}`);+ println(`revealed clipped animation frame requests: ${frameRequests()}`);offscreenAnimation.getAnimations()[0].cancel();offscreenClip.remove();scrollTo(0, 0);@@ -107,6 +119,7 @@sampled.remove();const visibilityTarget = document.createElement("div");+ visibilityTarget.id = "visibility-target";visibilityTarget.style.cssText = "visibility: hidden; transform-origin: center center 1px";document.body.append(visibilityTarget);const visibilityTimeline = internals.createInternalAnimationTimeline();@@ -122,11 +135,11 @@await new Promise(resolve => setTimeout(resolve, 0));await setSystemVisibilityState("hidden");visibilityTimeline.setTimeForObservation(50);- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();await setSystemVisibilityState("visible");await new Promise(resolve => setTimeout(resolve, 0));internals.updateStyle();- println(`becoming visible flushes throttled animations: ${internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds > 0}`);+ println(`becoming visible flushes throttled animations: ${sampledElements()}`);visibilityAnimation.cancel();visibilityTarget.remove();@@ -143,34 +156,35 @@for (let i = 0; i < 4; ++i)await nextFrame();const detachedTimeBeforeWait = detachedAnimation.currentTime;- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();await new Promise(resolve => setTimeout(resolve, 120));- println(`detached animation stops frame pump: ${internals.getStyleInvalidationCounters().animationFramePumpRequests}`);+ println(`detached animation frame requests: ${frameRequests()}`);println(`detached animation current time advances: ${detachedAnimation.currentTime > detachedTimeBeforeWait}`);const visible = document.createElement("div");+ visible.id = "visible";visible.className = "animated";document.body.append(visible);for (let i = 0; i < 4; ++i)await nextFrame();- println(`visible animation builds while hidden stays throttled: ${await animationOverlayBuildsOverFrames(4) > 0}`);+ println(`visible animation beside a throttled hidden one samples: ${(await traceOverFrames(4)).sampled}`);- const beforeMixedComputedStyle = internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds;+ internals.beginStyleTrace();getComputedStyle(hidden).transform;- const afterMixedComputedStyle = internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds;- println(`computed style samples hidden animation alongside visible animation: ${afterMixedComputedStyle > beforeMixedComputedStyle}`);+ println(`computed style beside a visible animation samples: ${sampledElements()}`);visible.remove();const styleOnlyVisibilityChange = document.createElement("div");+ styleOnlyVisibilityChange.id = "style-only-visibility-change";styleOnlyVisibilityChange.className = "animated";styleOnlyVisibilityChange.style.visibility = "hidden";document.body.append(styleOnlyVisibilityChange);for (let i = 0; i < 4; ++i)await nextFrame();- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();styleOnlyVisibilityChange.style.visibility = "visible";await new Promise(resolve => setTimeout(resolve, 0));- println(`style-only visibility change samples animation: ${internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds > 0}`);+ println(`style-only visibility change samples: ${sampledElements()}`);styleOnlyVisibilityChange.remove();const visibleChild = document.createElement("div");@@ -178,8 +192,7 @@hidden.append(visibleChild);await nextFrame();- const visibleDescendantBuilds = await animationOverlayBuildsOverFrames(4);- println(`visible descendant keeps animation updating: ${visibleDescendantBuilds > 0}`);+ println(`visible descendant keeps animation updating: ${(await traceOverFrames(4)).sampled}`);hidden.remove();done();diff --git a/Tests/LibWeb/Text/input/css/offscreen-animation-fixed-descendant.html b/Tests/LibWeb/Text/input/css/offscreen-animation-fixed-descendant.htmlindex f21bd60c95e..3a866b30db6 100644--- a/Tests/LibWeb/Text/input/css/offscreen-animation-fixed-descendant.html+++ b/Tests/LibWeb/Text/input/css/offscreen-animation-fixed-descendant.html@@ -35,13 +35,15 @@for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- const counters = internals.getStyleInvalidationCounters();- println(`animation stays on main thread: ${counters.compositorVisualAnimations === 0}`);- println(`animation is not offscreen throttled: ${counters.animationFramePumpRequests > 0}`);+ const pumpRequests = internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("animation frame pump request"));+ println("compositor animations:");+ for (const line of internals.dumpCompositorAnimations().split("\n").filter(Boolean))+ println(` ${line}`);+ println(`frame requests: [${[...new Set(pumpRequests.map(line => line.replace(/ x\d+$/, "")))].join(", ")}]`);println(`fixed descendant is intersecting: ${(await observation).isIntersecting}`);done();});diff --git a/Tests/LibWeb/Text/input/css/offscreen-paint-only-animation-events.html b/Tests/LibWeb/Text/input/css/offscreen-paint-only-animation-events.htmlindex 4c734adc28e..ef4fad625d2 100644--- a/Tests/LibWeb/Text/input/css/offscreen-paint-only-animation-events.html+++ b/Tests/LibWeb/Text/input/css/offscreen-paint-only-animation-events.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>@keyframes loading {0%, 40%, 90% { background-color: rgb(35, 35, 35); }@@ -18,6 +19,21 @@<div id="finite" class="target"></div><div id="repeated" class="target"></div><script>+ function printCompositorAnimations(title) {+ println(title);+ for (const line of internals.dumpCompositorAnimations().split("\n").filter(Boolean))+ println(` ${line}`);+ }++ function samples() {+ const events = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ return `[${events.map(event => event.element).join(", ")}]`;+ }++ function frameRequests() {+ return `[${internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("animation frame pump request")).join(", ")}]`;+ }+asyncTest(async done => {internals.updateStyle();const events = [];@@ -35,24 +51,25 @@const nextFrame = () => new Promise(requestAnimationFrame);for (let i = 0; i < 4; ++i)await nextFrame();- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();+ internals.beginRenderingTrace();for (let i = 0; i < 4; ++i)await nextFrame();- let counters = internals.getStyleInvalidationCounters();- println(`finite and infinite offscreen paint animations build no overlays: ${counters.animatedStyleOverlayBuilds === 0}`);- println(`animation listeners do not keep the frame pump running: ${counters.animationFramePumpRequests === 0}`);- println(`offscreen paint animations publish no compositor descriptors: ${counters.compositorVisualAnimations === 0}`);- println(`animation event wake-up is armed: ${counters.compositorAnimationWakeupTimerActive}`);+ println(`finite and infinite offscreen paint animations sample: ${samples()}`);+ println(`frame requests with animation listeners: ${frameRequests()}`);+ printCompositorAnimations("offscreen paint animations on the compositor:");+ internals.beginStyleTrace();+ internals.beginRenderingTrace();timeline.setTimeForObservation(999);internals.fireCompositorAnimationWakeupForTesting(999);- println(`early wake-up requests no frame: ${internals.getStyleInvalidationCounters().animationFramePumpRequests === 0}`);+ println(`early wake-up frame requests: ${frameRequests()}`);timeline.setTimeForObservation(1000);internals.fireCompositorAnimationWakeupForTesting(1000);timeline.setTime(1000);await nextFrame();println(`finite and infinite offscreen animations dispatch iteration: ${events.filter(event => event === "iteration 1").length === 2}`);- println(`iteration needs no animated style overlays: ${internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds === 0}`);+ println(`iteration samples: ${samples()}`);timeline.setTimeForObservation(3001);internals.fireCompositorAnimationWakeupForTesting(3001);diff --git a/Tests/LibWeb/Text/input/css/offscreen-paint-only-animation.html b/Tests/LibWeb/Text/input/css/offscreen-paint-only-animation.htmlindex 67e7a964753..aa25b27f897 100644--- a/Tests/LibWeb/Text/input/css/offscreen-paint-only-animation.html+++ b/Tests/LibWeb/Text/input/css/offscreen-paint-only-animation.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>@keyframes label-sweep {from { background-position: calc(-1 * var(--offset)) 50%, 0 50%; }@@ -16,10 +17,16 @@for (let i = 0; i < 4; ++i)await nextFrame();}- async function countersOverFrames() {- internals.resetStyleInvalidationCounters();+ async function traceOverFrames() {+ internals.beginStyleTrace();+ internals.beginRenderingTrace();await settle();- return internals.getStyleInvalidationCounters();+ const sampled = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ const pumpRequests = internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("animation frame pump request"));+ return {+ sampled: `[${[...new Set(sampled.map(event => event.element))].join(", ")}]`,+ pumpRequests: `[${[...new Set(pumpRequests.map(line => line.replace(/ x\d+$/, "")))].join(", ")}]`,+ };}const timeline = internals.createInternalAnimationTimeline();timeline.setTime(0);@@ -34,9 +41,9 @@animation.play();animation.startTime = 0;await settle();- let counters = await countersOverFrames();- println(`offscreen background builds no overlays: ${counters.animatedStyleOverlayBuilds === 0}`);- println(`offscreen background stops the frame pump: ${counters.animationFramePumpRequests === 0}`);+ let trace = await traceOverFrames();+ println(`offscreen background samples: ${trace.sampled}`);+ println(`offscreen background frame requests: ${trace.pumpRequests}`);timeline.setTimeForObservation(400);println(`computed style samples the current color: ${getComputedStyle(target).borderTopColor === "rgb(100, 0, 0)"}`);@@ -45,13 +52,13 @@target.scrollIntoView();await settle();println(`scrolling into view samples the current color: ${getComputedStyle(target).borderTopColor === "rgb(150, 0, 0)"}`);- counters = await countersOverFrames();- println(`visible background resumes the frame pump: ${counters.animationFramePumpRequests > 0}`);+ trace = await traceOverFrames();+ println(`visible background frame requests: ${trace.pumpRequests}`);scrollTo(0, 0);await settle();- counters = await countersOverFrames();- println(`scrolling out of view stops the frame pump again: ${counters.animationFramePumpRequests === 0}`);+ trace = await traceOverFrames();+ println(`frame requests after scrolling out of view: ${trace.pumpRequests}`);const scroller = document.createElement("div");scroller.style.cssText = "width: 100px; height: 20px; overflow: auto";@@ -59,12 +66,12 @@scroller.append(target);target.style.cssText = "position: relative; top: 40px";await settle();- counters = await countersOverFrames();- println(`paint outside a nested scrollport stops the frame pump: ${counters.animationFramePumpRequests === 0}`);+ trace = await traceOverFrames();+ println(`paint outside a nested scrollport frame requests: ${trace.pumpRequests}`);scroller.scrollTop = 40;await settle();- counters = await countersOverFrames();- println(`scrolling a nested scrollport resumes visible paint: ${counters.animationFramePumpRequests > 0}`);+ trace = await traceOverFrames();+ println(`frame requests after scrolling a nested scrollport to the paint: ${trace.pumpRequests}`);scroller.replaceWith(target);target.style.cssText = "";@@ -72,8 +79,8 @@child.style.cssText = "position: fixed; top: 0; width: 20px; height: 20px; border-top: 1px solid; border-top-color: inherit";target.append(child);await settle();- counters = await countersOverFrames();- println(`visible fixed descendant keeps inherited paint updating: ${counters.animationFramePumpRequests > 0}`);+ trace = await traceOverFrames();+ println(`visible fixed descendant inheriting the paint frame requests: ${trace.pumpRequests}`);child.remove();const wrapper = document.createElement("div");@@ -86,8 +93,8 @@filterAnimation.play();filterAnimation.startTime = 600;await settle();- counters = await countersOverFrames();- println(`ancestor filter animation keeps paint updating even before it expands: ${counters.animationFramePumpRequests > 0}`);+ trace = await traceOverFrames();+ println(`ancestor filter animation before it expands frame requests: ${trace.pumpRequests}`);filterAnimation.cancel();wrapper.replaceWith(target);@@ -96,8 +103,8 @@{ backgroundColor: "rgb(200, 0, 0)", width: "200px" },]);await settle();- counters = await countersOverFrames();- println(`mixed layout and paint animation keeps updating: ${counters.animationFramePumpRequests > 0}`);+ trace = await traceOverFrames();+ println(`mixed layout and paint animation frame requests: ${trace.pumpRequests}`);animation.cancel();target.remove();@@ -115,20 +122,20 @@shadowAnimation.play();shadowAnimation.startTime = 0;await settle();- counters = await countersOverFrames();- println(`offscreen clipped shadow stops the frame pump: ${counters.animationFramePumpRequests === 0}`);+ trace = await traceOverFrames();+ println(`offscreen clipped shadow frame requests: ${trace.pumpRequests}`);clip.style.cssText += "; overflow: clip; overflow-clip-margin: 300vh";await settle();- counters = await countersOverFrames();- println(`expanded overflow clip keeps potentially visible shadow updating: ${counters.animationFramePumpRequests > 0}`);+ trace = await traceOverFrames();+ println(`potentially visible shadow in an expanded overflow clip frame requests: ${trace.pumpRequests}`);clip.style.cssText += "; overflow-clip-margin: 0px; overflow-x: clip; overflow-y: visible";await settle();- counters = await countersOverFrames();- println(`horizontal clip does not hide vertical shadow overflow: ${counters.animationFramePumpRequests > 0}`);+ trace = await traceOverFrames();+ println(`vertical shadow overflow past a horizontal clip frame requests: ${trace.pumpRequests}`);clip.style.overflow = "visible";await settle();- counters = await countersOverFrames();- println(`unclipped shadow that can reach the viewport keeps updating: ${counters.animationFramePumpRequests > 0}`);+ trace = await traceOverFrames();+ println(`unclipped shadow that can reach the viewport frame requests: ${trace.pumpRequests}`);shadowAnimation.cancel();clip.style.overflow = "hidden";const label = document.createElement("div");@@ -139,13 +146,13 @@labelAnimation.timeline = timeline;labelAnimation.startTime = 0;await settle();- counters = await countersOverFrames();- println(`offscreen shorthand with variable substitution stops the frame pump: ${counters.animationFramePumpRequests === 0}`);- println(`offscreen shorthand with variable substitution builds no overlays: ${counters.animatedStyleOverlayBuilds === 0}`);+ trace = await traceOverFrames();+ println(`offscreen shorthand with variable substitution frame requests: ${trace.pumpRequests}`);+ println(`offscreen shorthand with variable substitution samples: ${trace.sampled}`);clip.scrollIntoView();await settle();- counters = await countersOverFrames();- println(`visible shorthand with variable substitution resumes the frame pump: ${counters.animationFramePumpRequests > 0}`);+ trace = await traceOverFrames();+ println(`visible shorthand with variable substitution frame requests: ${trace.pumpRequests}`);labelAnimation.cancel();scrollTo(0, 0);label.style.cssText = "transform: translateY(10px)";@@ -157,9 +164,9 @@fadeAnimation.play();fadeAnimation.startTime = 0;await settle();- counters = await countersOverFrames();- println(`offscreen clipped fade and blur stops the frame pump: ${counters.animationFramePumpRequests === 0}`);- println(`offscreen clipped fade and blur builds no overlays: ${counters.animatedStyleOverlayBuilds === 0}`);+ trace = await traceOverFrames();+ println(`offscreen clipped fade and blur frame requests: ${trace.pumpRequests}`);+ println(`offscreen clipped fade and blur samples: ${trace.sampled}`);timeline.setTimeForObservation(1001);internals.fireCompositorAnimationWakeupForTesting(1001);timeline.setTime(1001);diff --git a/Tests/LibWeb/Text/input/css/offscreen-pseudo-element-paint-animation.html b/Tests/LibWeb/Text/input/css/offscreen-pseudo-element-paint-animation.htmlindex 8cd399d7ed4..9084905ff01 100644--- a/Tests/LibWeb/Text/input/css/offscreen-pseudo-element-paint-animation.html+++ b/Tests/LibWeb/Text/input/css/offscreen-pseudo-element-paint-animation.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>body { margin: 0; }#clip { position: absolute; top: 200vh; width: 100px; height: 100px; overflow: hidden; }@@ -16,10 +17,16 @@for (let i = 0; i < 4; ++i)await nextFrame();}- async function countersOverFrames() {- internals.resetStyleInvalidationCounters();+ async function traceOverFrames() {+ internals.beginStyleTrace();+ internals.beginRenderingTrace();await settle();- return internals.getStyleInvalidationCounters();+ const sampled = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ const pumpRequests = internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("animation frame pump request"));+ return {+ sampled: `[${[...new Set(sampled.map(event => event.element))].join(", ")}]`,+ pumpRequests: `[${[...new Set(pumpRequests.map(line => line.replace(/ x\d+$/, "")))].join(", ")}]`,+ };}const timeline = internals.createInternalAnimationTimeline();timeline.setTime(0);@@ -31,9 +38,9 @@animation.play();animation.startTime = 0;await settle();- let counters = await countersOverFrames();- println(`offscreen pseudo-element builds no overlays: ${counters.animatedStyleOverlayBuilds === 0}`);- println(`offscreen pseudo-element stops the frame pump: ${counters.animationFramePumpRequests === 0}`);+ let trace = await traceOverFrames();+ println(`offscreen pseudo-element samples: ${trace.sampled}`);+ println(`offscreen pseudo-element frame requests: ${trace.pumpRequests}`);timeline.setTimeForObservation(400);println(`pseudo-element style observes the current time: ${Math.abs(parseFloat(getComputedStyle(target, "::after").backgroundPositionX) - 40) < 0.0001}`);@@ -42,17 +49,17 @@clip.scrollIntoView();await settle();println(`scrolling into view samples the pseudo-element: ${Math.abs(parseFloat(getComputedStyle(target, "::after").backgroundPositionX) - 60) < 0.0001}`);- counters = await countersOverFrames();- println(`visible pseudo-element resumes the frame pump: ${counters.animationFramePumpRequests > 0}`);+ trace = await traceOverFrames();+ println(`visible pseudo-element frame requests: ${trace.pumpRequests}`);scrollTo(0, 0);await settle();- counters = await countersOverFrames();- println(`scrolling out of view stops the frame pump again: ${counters.animationFramePumpRequests === 0}`);+ trace = await traceOverFrames();+ println(`frame requests after scrolling out of view: ${trace.pumpRequests}`);target.className = "fixed";await settle();- counters = await countersOverFrames();- println(`fixed pseudo-element escaping its host's clip keeps updating: ${counters.animationFramePumpRequests > 0}`);+ trace = await traceOverFrames();+ println(`fixed pseudo-element escaping its host's clip frame requests: ${trace.pumpRequests}`);animation.cancel();done();});diff --git a/Tests/LibWeb/Text/input/css/offscreen-svg-and-pseudo-animation-events.html b/Tests/LibWeb/Text/input/css/offscreen-svg-and-pseudo-animation-events.htmlindex 372ee7933cd..cf0eff58590 100644--- a/Tests/LibWeb/Text/input/css/offscreen-svg-and-pseudo-animation-events.html+++ b/Tests/LibWeb/Text/input/css/offscreen-svg-and-pseudo-animation-events.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>@keyframes fade { from { opacity: 0; } to { opacity: 1; } }@keyframes sweep { from { background-position-x: 0px; } to { background-position-x: 100px; } }@@ -9,6 +10,21 @@</style><div id="clip"><svg><circle cx="10" cy="10" r="5" /></svg><div id="target"></div></div><script>+ function printCompositorAnimations(title) {+ println(title);+ for (const line of internals.dumpCompositorAnimations().split("\n").filter(Boolean))+ println(` ${line}`);+ }++ function samples() {+ const events = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ return `[${events.map(event => event.element).join(", ")}]`;+ }++ function frameRequests() {+ return `[${internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("animation frame pump request")).join(", ")}]`;+ }+asyncTest(async done => {internals.updateStyle();const events = [];@@ -25,13 +41,13 @@const nextFrame = () => new Promise(requestAnimationFrame);for (let i = 0; i < 4; ++i)await nextFrame();- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();+ internals.beginRenderingTrace();for (let i = 0; i < 4; ++i)await nextFrame();- let counters = internals.getStyleInvalidationCounters();- println(`offscreen SVG and pseudo-element event listeners do not keep the frame pump running: ${counters.animationFramePumpRequests === 0}`);- println(`offscreen SVG and pseudo-element animations build no overlays: ${counters.animatedStyleOverlayBuilds === 0}`);- println(`animation event wake-up is armed: ${counters.compositorAnimationWakeupTimerActive}`);+ println(`frame requests with offscreen SVG and pseudo-element event listeners: ${frameRequests()}`);+ println(`offscreen SVG and pseudo-element animations sample: ${samples()}`);+ printCompositorAnimations("compositor animations:");timeline.setTimeForObservation(1000);internals.fireCompositorAnimationWakeupForTesting(1000);diff --git a/Tests/LibWeb/Text/input/css/offscreen-svg-opacity-animation.html b/Tests/LibWeb/Text/input/css/offscreen-svg-opacity-animation.htmlindex 44fdce3eb5d..fb992ab4fb5 100644--- a/Tests/LibWeb/Text/input/css/offscreen-svg-opacity-animation.html+++ b/Tests/LibWeb/Text/input/css/offscreen-svg-opacity-animation.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>body { margin: 0; }#clip { position: absolute; top: 200vh; width: 100px; height: 100px; overflow: hidden; }@@ -16,14 +17,18 @@for (let i = 0; i < 4; ++i)await nextFrame();}- async function countersOverFrames() {- internals.resetStyleInvalidationCounters();- await settle();- return internals.getStyleInvalidationCounters();- }// Visible SVG opacity updates beside the main thread if it can, or through frames of the main thread if not.- function updates(counters) {- return counters.animationFramePumpRequests > 0 || counters.compositorVisualAnimations > 0;+ async function updatesOverFrames() {+ internals.beginStyleTrace();+ internals.beginRenderingTrace();+ await settle();+ const sampled = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ const pumpRequests = internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("animation frame pump request"));+ const compositorAnimations = internals.dumpCompositorAnimations().split("\n").filter(line => line && !line.endsWith("timer armed"));+ return {+ sampled: `[${[...new Set(sampled.map(event => event.element))].join(", ")}]`,+ updates: `frame requests [${[...new Set(pumpRequests.map(line => line.replace(/ x\d+$/, "")))].join(", ")}], compositor animations [${compositorAnimations.join(", ")}]`,+ };}const timeline = internals.createInternalAnimationTimeline();timeline.setTime(0);@@ -35,9 +40,9 @@animation.play();animation.startTime = 0;await settle();- let counters = await countersOverFrames();- println(`offscreen SVG opacity builds no overlays: ${counters.animatedStyleOverlayBuilds === 0}`);- println(`an outer clip stops updates around transformed and filtered SVG: ${!updates(counters)}`);+ let trace = await updatesOverFrames();+ println(`offscreen SVG opacity samples: ${trace.sampled}`);+ println(`updates of transformed and filtered SVG in an outer clip: ${trace.updates}`);timeline.setTimeForObservation(400);println(`SVG style observes the current opacity: ${getComputedStyle(target).opacity === "0.4"}`);@@ -46,22 +51,22 @@clip.scrollIntoView();await settle();println(`scrolling into view samples SVG opacity: ${getComputedStyle(target).opacity === "0.6"}`);- counters = await countersOverFrames();- println(`visible SVG opacity resumes updating: ${updates(counters)}`);+ trace = await updatesOverFrames();+ println(`updates of visible SVG opacity: ${trace.updates}`);scrollTo(0, 0);await settle();- counters = await countersOverFrames();- println(`scrolling out of view stops updating again: ${!updates(counters)}`);+ trace = await updatesOverFrames();+ println(`updates after scrolling out of view: ${trace.updates}`);clip.style.transform = "translateX(0px)";await settle();- counters = await countersOverFrames();- println(`a transform outside the clip keeps SVG opacity updating: ${updates(counters)}`);+ trace = await updatesOverFrames();+ println(`updates with a transform outside the clip: ${trace.updates}`);clip.style.transform = "";clip.style.filter = "blur(100px)";await settle();- counters = await countersOverFrames();- println(`a filter outside the clip keeps SVG opacity updating: ${updates(counters)}`);+ trace = await updatesOverFrames();+ println(`updates with a filter outside the clip: ${trace.updates}`);clip.style.filter = "";target.id = "referenced";@@ -71,8 +76,8 @@visibleSVG.append(use);document.body.append(visibleSVG);await settle();- counters = await countersOverFrames();- println(`potentially referenced SVG keeps updating: ${updates(counters)}`);+ trace = await updatesOverFrames();+ println(`updates of potentially referenced SVG: ${trace.updates}`);visibleSVG.remove();target.removeAttribute("id");@@ -80,14 +85,14 @@target.replaceWith(pattern);pattern.append(target);await settle();- counters = await countersOverFrames();- println(`SVG paint resources are not throttled by their DOM position: ${updates(counters)}`);+ trace = await updatesOverFrames();+ println(`updates of an SVG paint resource: ${trace.updates}`);pattern.replaceWith(target);animation.effect.setKeyframes([{ opacity: 0, r: "20px" }, { opacity: 1, r: "40px" }]);await settle();- counters = await countersOverFrames();- println(`mixed SVG geometry and opacity animation keeps updating: ${updates(counters)}`);+ trace = await updatesOverFrames();+ println(`updates of a mixed SVG geometry and opacity animation: ${trace.updates}`);animation.cancel();done();});diff --git a/Tests/LibWeb/Text/input/css/reentrant-animation-style-flush.html b/Tests/LibWeb/Text/input/css/reentrant-animation-style-flush.htmlindex 48932e993cd..57fdaf6fb23 100644--- a/Tests/LibWeb/Text/input/css/reentrant-animation-style-flush.html+++ b/Tests/LibWeb/Text/input/css/reentrant-animation-style-flush.html@@ -1,5 +1,6 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><div id="target"></div><script>asyncTest(async done => {@@ -8,11 +9,12 @@for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();internals.requestReentrantAnimationStyleFlushForTesting(target);await new Promise(requestAnimationFrame);- println(`reentrant style read queues a follow-up sample: ${internals.getStyleInvalidationCounters().animatedStyleOverlayBuilds === 1}`);+ const sampled = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ println(`reentrant style read queues a follow-up sample: [${sampled.map(event => event.element).join(", ")}]`);done();});</script>diff --git a/Tests/LibWeb/Text/input/css/removed-css-animations.html b/Tests/LibWeb/Text/input/css/removed-css-animations.htmlindex 01c7f2b0f4e..41efc98446c 100644--- a/Tests/LibWeb/Text/input/css/removed-css-animations.html+++ b/Tests/LibWeb/Text/input/css/removed-css-animations.html@@ -17,6 +17,10 @@}</style><script>+ function documentAnimations() {+ return `[${document.getAnimations().map(animation => animation.transitionProperty ?? animation.animationName).sort().join(", ")}]`;+ }+asyncTest(async done => {const animationFreeContainer = document.createElement("div");for (let i = 0; i < 10_000; ++i)@@ -25,7 +29,6 @@animationFreeContainer.remove();println(`large animation-free subtree is removed: ${animationFreeContainer.childElementCount === 10_000 && !animationFreeContainer.isConnected}`);- const initialCount = internals.getStyleInvalidationCounters().associatedAnimations;const container = document.createElement("div");for (let i = 0; i < 5; ++i) {const spinner = document.createElement("div");@@ -43,13 +46,13 @@const spinner = container.firstElementChild;const removedAnimation = spinner.getAnimations()[0];const removedTransition = transitioner.getAnimations()[0];- println(`animations are associated after insertion: ${internals.getStyleInvalidationCounters().associatedAnimations === initialCount + 6}`);+ println(`animations are associated after insertion: ${documentAnimations()}`);container.remove();println(`removed CSS animations are cancelled: ${removedAnimation.playState === "idle"}`);println(`removed CSS transitions are cancelled: ${removedTransition.playState === "idle"}`);await new Promise(requestAnimationFrame);- println(`removed CSS animations are disassociated: ${internals.getStyleInvalidationCounters().associatedAnimations === initialCount}`);+ println(`removed CSS animations are disassociated: ${documentAnimations()}`);let starts = 0;spinner.addEventListener("animationstart", () => ++starts);diff --git a/Tests/LibWeb/Text/input/css/revived-cancelled-animations.html b/Tests/LibWeb/Text/input/css/revived-cancelled-animations.htmlindex 91b2e9a8e5c..ed0ba2ab0a5 100644--- a/Tests/LibWeb/Text/input/css/revived-cancelled-animations.html+++ b/Tests/LibWeb/Text/input/css/revived-cancelled-animations.html@@ -21,8 +21,8 @@await new Promise(requestAnimationFrame);}- function associatedAnimations() {- return internals.getStyleInvalidationCounters().associatedAnimations;+ function documentAnimations() {+ return `[${document.getAnimations().map(animation => animation.transitionProperty ?? animation.animationName ?? "script").sort().join(", ")}]`;}async function cancelledCSSAnimation() {@@ -37,8 +37,6 @@}asyncTest(async done => {- const initialCount = associatedAnimations();-{const { element, animation } = await cancelledCSSAnimation();animation.currentTime = 50000;@@ -48,7 +46,7 @@println(`a seeked cancelled animation survives a style change: ${getComputedStyle(element).marginLeft === "150px"}`);animation.cancel();await frames(2);- println(`cancelling it again disassociates it: ${associatedAnimations() === initialCount}`);+ println(`cancelling it again disassociates it: ${documentAnimations()}`);element.remove();}@@ -96,7 +94,7 @@animation.finish();await frames(2);println(`finishing a cancelled animation dispatches its events: ${events.join() === "start,end"}`);- println(`a finished cancelled animation is disassociated again: ${associatedAnimations() === initialCount}`);+ println(`a finished cancelled animation is disassociated again: ${documentAnimations()}`);element.remove();}@@ -141,7 +139,7 @@// A completed transition is removed once the property no longer transitions.element.style.transitionProperty = "none";await frames(2);- println(`a removed completed transition is disassociated: ${associatedAnimations() === initialCount}`);+ println(`a removed completed transition is disassociated: ${documentAnimations()}`);transition.currentTime = 50000;await frames(2);println(`seeking a removed completed transition makes it relevant again: ${element.getAnimations().length === 1}`);@@ -156,7 +154,7 @@await frames(2);animation.cancel();await frames(2);- println(`a cancelled script animation is disassociated: ${associatedAnimations() === initialCount}`);+ println(`a cancelled script animation is disassociated: ${documentAnimations()}`);animation.currentTime = 50000;await frames(2);element.style.paddingLeft = "1px";@@ -171,12 +169,12 @@document.body.append(element);const animation = element.animate({ opacity: [0, 1] }, 100000);await frames(4);- const compositorDriven = internals.getStyleInvalidationCounters().compositorVisualAnimations > 0;+ println(`compositor animations before cancelling: [${internals.dumpCompositorAnimations().split("\n").filter(line => line && !line.endsWith("timer armed")).join(", ")}]`);animation.cancel();await frames(2);animation.currentTime = 50000;await frames(2);- println(`a revived compositor animation is sampled again: ${compositorDriven && element.getAnimations().length === 1 && getComputedStyle(element).opacity === "0.5"}`);+ println(`a revived compositor animation is sampled again: ${element.getAnimations().length === 1 && getComputedStyle(element).opacity === "0.5"}`);animation.cancel();element.remove();}@@ -191,10 +189,10 @@await frames(2);animation.effect = new KeyframeEffect(otherElement, { marginLeft: ["100px", "200px"] }, 100000);await frames(2);- println(`replacing the effect of a disassociated animation keeps it disassociated: ${associatedAnimations() === initialCount}`);+ println(`replacing the effect of a disassociated animation keeps it disassociated: ${documentAnimations()}`);animation.effect.target = element;await frames(2);- println(`retargeting a disassociated animation keeps it disassociated: ${associatedAnimations() === initialCount}`);+ println(`retargeting a disassociated animation keeps it disassociated: ${documentAnimations()}`);animation.currentTime = 50000;await frames(2);println(`reviving a retargeted animation associates it with its new target: ${element.getAnimations().length === 1 && otherElement.getAnimations().length === 0}`);@@ -209,7 +207,7 @@const animation = element.animate({ marginLeft: ["100px", "200px"] }, 10);await animation.finished;await frames(2);- println(`a finished animation without a fill is disassociated: ${associatedAnimations() === initialCount}`);+ println(`a finished animation without a fill is disassociated: ${documentAnimations()}`);element.remove();}@@ -228,17 +226,17 @@// Changing the value again removes the completed transition and starts a new one.element.style.marginLeft = "2000px";await frames(2);- println(`a removed completed transition that is still filling stays associated: ${associatedAnimations() === initialCount + 2}`);+ println(`a removed completed transition that is still filling stays associated: ${documentAnimations()}`);transition.effect.updateTiming({ fill: "none" });await frames(2);- println(`a removed completed transition is disassociated once it becomes inert: ${associatedAnimations() === initialCount + 1}`);+ println(`a removed completed transition is disassociated once it becomes inert: ${documentAnimations()}`);for (const animation of element.getAnimations())animation.cancel();element.remove();}await frames(2);- println(`no animations remain associated: ${associatedAnimations() === initialCount}`);+ println(`no animations remain associated: ${documentAnimations()}`);done();});</script>diff --git a/Tests/LibWeb/Text/input/css/style-engine/animated-element-pseudo-element-composition.html b/Tests/LibWeb/Text/input/css/style-engine/animated-element-pseudo-element-composition.htmlindex bfca67629d0..b8137624339 100644--- a/Tests/LibWeb/Text/input/css/style-engine/animated-element-pseudo-element-composition.html+++ b/Tests/LibWeb/Text/input/css/style-engine/animated-element-pseudo-element-composition.html@@ -20,11 +20,17 @@animation.currentTime = currentTime;getComputedStyle(target).color;}- const guardHitsBefore = internals.getStyleInvalidationCounters().styleUpdatePassGuardHits;+ internals.beginStyleTrace();registrations.sheet.insertRule("@property --pseudo-query { syntax: '<length>'; inherits: false; initial-value: 10px; }");internals.updateStyle();- const guardHits = internals.getStyleInvalidationCounters().styleUpdatePassGuardHits - guardHitsBefore;- println(`style update pass guard hits: ${guardHits}`);+ println("style passes of the update:");+ let inStylePass = false;+ for (const line of internals.takeStyleTrace().split("\n")) {+ if (line.startsWith("style "))+ inStylePass = /^style (FULL|PARTIAL|COLD)$/.test(line);+ if (inStylePass && line.trim())+ println(` ${line}`);+ }println(`${getComputedStyle(target).color} ${getComputedStyle(target, "::before").color} ${getComputedStyle(target, "::before").backgroundColor}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-engine/gc-aba-style-input-keys.html b/Tests/LibWeb/Text/input/css/style-engine/gc-aba-style-input-keys.htmlindex 695ee2d73f9..aa157146421 100644--- a/Tests/LibWeb/Text/input/css/style-engine/gc-aba-style-input-keys.html+++ b/Tests/LibWeb/Text/input/css/style-engine/gc-aba-style-input-keys.html@@ -13,16 +13,15 @@internals.updateStyle();println(`initial: ${getComputedStyle(target).color}`);- let version = internals.getStyleInvalidationCounters().styleEnvironmentVersion;+ const environmentChanges = () => `[${internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("style environment changed")).join(", ")}]`;+ internals.beginRenderingTrace();sheet.deleteRule(0);- let nextVersion = internals.getStyleInvalidationCounters().styleEnvironmentVersion;- println(`deletion advances the environment: ${nextVersion > version}`);+ println(`deletion environment changes: ${environmentChanges()}`);internals.gc();- version = nextVersion;+ internals.beginRenderingTrace();sheet.insertRule(".target { color: rgb(0, 0, 255) }", 0);- nextVersion = internals.getStyleInvalidationCounters().styleEnvironmentVersion;- println(`insertion advances the environment: ${nextVersion > version}`);+ println(`insertion environment changes: ${environmentChanges()}`);internals.updateStyle();println(`replacement: ${getComputedStyle(target).color}`);diff --git a/Tests/LibWeb/Text/input/css/style-engine/geometry-read-defers-paint-only-style.html b/Tests/LibWeb/Text/input/css/style-engine/geometry-read-defers-paint-only-style.htmlindex 244952561a0..c31760640cc 100644--- a/Tests/LibWeb/Text/input/css/style-engine/geometry-read-defers-paint-only-style.html+++ b/Tests/LibWeb/Text/input/css/style-engine/geometry-read-defers-paint-only-style.html@@ -21,47 +21,49 @@</style><div id="target"></div><script>+ function styleUpdates() {+ return `[${internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("style stabilization epoch")).join(", ")}]`;+ }+test(() => {target.getBoundingClientRect();target.style.outlineColor = "blue";getComputedStyle(target).outlineColor;- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();target.className = "paint-only";const paintOnlyRect = target.getBoundingClientRect();const paintOnlyOffsetWidth = target.offsetWidth;const paintOnlyClientHeight = target.clientHeight;- let counters = internals.getStyleInvalidationCounters();+ const paintOnlyStyleUpdates = styleUpdates();println(`paint-only geometry: ${paintOnlyRect.width}`);println(`paint-only offset width: ${paintOnlyOffsetWidth}`);println(`paint-only client height: ${paintOnlyClientHeight}`);- println(`inline style setup preserves geometry deferral: ${counters.styleStabilizationEpochs === 0}`);- println(`paint-only style deferred: ${counters.styleStabilizationEpochs === 0}`);+ println(`paint-only style updates after inline style setup: ${paintOnlyStyleUpdates}`);println(`deferred style is observable: ${getComputedStyle(target).backgroundColor}`);target.className = "";target.getBoundingClientRect();- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();target.className = "layout";const layoutOffsetWidth = target.offsetWidth;const layoutOffsetHeight = target.offsetHeight;- counters = internals.getStyleInvalidationCounters();+ const layoutStyleUpdates = styleUpdates();println(`layout offset size: ${layoutOffsetWidth}x${layoutOffsetHeight}`);- println(`layout style settled: ${counters.styleStabilizationEpochs === 1}`);+ println(`layout style updates: ${layoutStyleUpdates}`);target.className = "";target.getBoundingClientRect();- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();target.className = "transformed";const transformedRect = target.getBoundingClientRect();- counters = internals.getStyleInvalidationCounters();+ const transformedStyleUpdates = styleUpdates();println(`transformed geometry: ${transformedRect.x}`);- println(`visual geometry style settled: ${counters.styleStabilizationEpochs === 1}`);+ println(`visual geometry style updates: ${transformedStyleUpdates}`);target.className = "";target.getBoundingClientRect();- internals.resetStyleInvalidationCounters();target.className = "paint-only";target.getBoundingClientRect();target.className = "paint-only-next";diff --git a/Tests/LibWeb/Text/input/css/style-engine/stabilization-epoch.html b/Tests/LibWeb/Text/input/css/style-engine/stabilization-epoch.htmlindex 2c99d455fba..2ba9835d100 100644--- a/Tests/LibWeb/Text/input/css/style-engine/stabilization-epoch.html+++ b/Tests/LibWeb/Text/input/css/style-engine/stabilization-epoch.html@@ -15,26 +15,26 @@<div id="container"><div id="target"></div></div><div id="ordinary"></div><script>+ function printStabilization(title) {+ println(title);+ for (const line of internals.takeRenderingTrace().split("\n")) {+ if (/^(style stabilization|provisional style pass)/.test(line))+ println(` ${line}`);+ }+ }+test(() => {target.getBoundingClientRect();- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();ordinary.className = "changed";internals.updateStyle();+ printStabilization("feedback-free change:");- let counters = internals.getStyleInvalidationCounters();- println(`feedback-free epoch: ${counters.styleStabilizationEpochs === 1}`);- println(`feedback-free pass: ${counters.provisionalStylePasses === 1}`);- println(`feedback-free state: ${counters.styleStabilizationFeedbackEpochs === 0}`);-- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();container.style.width = "300px";target.getBoundingClientRect();-- counters = internals.getStyleInvalidationCounters();- println(`feedback shares one epoch: ${counters.styleStabilizationEpochs === 1}`);- println(`feedback uses multiple passes: ${counters.provisionalStylePasses > 1}`);- println(`feedback state is visible: ${counters.styleStabilizationFeedbackEpochs === 1}`);+ printStabilization("change with container query feedback:");println(`stable query result: ${getComputedStyle(target).color}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-engine/stabilization-round-guard.html b/Tests/LibWeb/Text/input/css/style-engine/stabilization-round-guard.htmlindex 98668d685a9..0c66bf18e1f 100644--- a/Tests/LibWeb/Text/input/css/style-engine/stabilization-round-guard.html+++ b/Tests/LibWeb/Text/input/css/style-engine/stabilization-round-guard.html@@ -14,6 +14,14 @@</style><div id="root" class="container"></div><script>+ function printStabilization(title) {+ println(title);+ for (const line of internals.takeRenderingTrace().split("\n")) {+ if (/^(style stabilization|provisional style pass|exact stabilization pass)/.test(line))+ println(` ${line}`);+ }+ }+test(() => {let parent = root;for (let i = 0; i < 30; ++i) {@@ -27,14 +35,9 @@target.id = "target";parent.appendChild(target);- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();target.getBoundingClientRect();-- const counters = internals.getStyleInvalidationCounters();- println(`continuation adds passes: ${counters.provisionalStylePasses > 8}`);- println(`round guard reached: ${counters.styleStabilizationRoundGuardHits === 1}`);- println(`exact continuation ran: ${counters.exactStabilizationPasses > 0}`);- println(`exact continuation stabilized: ${counters.styleStabilizationBoundFailures === 0}`);+ printStabilization("nested container query feedback:");println(`stable nested query result: ${getComputedStyle(target).color}`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-engine/stabilization-transition-events.html b/Tests/LibWeb/Text/input/css/style-engine/stabilization-transition-events.htmlindex 19f7f652404..95ad0ec60de 100644--- a/Tests/LibWeb/Text/input/css/style-engine/stabilization-transition-events.html+++ b/Tests/LibWeb/Text/input/css/style-engine/stabilization-transition-events.html@@ -2,6 +2,14 @@<script src="../../include.js"></script><div id="root"></div><script>+ function printStabilization(title) {+ println(title);+ for (const line of internals.takeRenderingTrace().split("\n")) {+ if (/^(style stabilization|provisional|exact stabilization pass|transition|animation events)/.test(line))+ println(` ${line}`);+ }+ }+test(() => {const depth = 12;const rules = [@@ -42,18 +50,10 @@document.head.appendChild(style);target.getBoundingClientRect();- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();document.getElementById("c0").style.width = "300px";target.getBoundingClientRect();-- const counters = internals.getStyleInvalidationCounters();- println(`feedback used provisional passes: ${counters.provisionalStylePasses > 1}`);- println(`transition decisions were provisional: ${counters.provisionalTransitionDecisions > counters.committedTransitionActions}`);- println(`intermediate decisions were superseded: ${counters.supersededProvisionalTransitionDecisions > 0}`);- println(`two transition actions committed: ${counters.committedTransitionActions === 2}`);- println(`two transitions started: ${counters.committedTransitionsStarted === 2}`);- println(`intermediate transition events were not created: ${counters.provisionalAnimationEvents === 0}`);- println(`no provisional events committed: ${counters.committedAnimationEvents === 0}`);+ printStabilization("container query feedback with transitions:");println(`one stable transition remains: ${target.getAnimations().length === 1}`);println(`discarded transition was not published: ${discarded.getAnimations().length === 0}`);println(`late transition used the committed baseline: ${late.getAnimations().length === 1}`);diff --git a/Tests/LibWeb/Text/input/css/style-engine/transition-baseline-without-size-query.html b/Tests/LibWeb/Text/input/css/style-engine/transition-baseline-without-size-query.htmlindex 39ede3e5db2..2cfa36165df 100644--- a/Tests/LibWeb/Text/input/css/style-engine/transition-baseline-without-size-query.html+++ b/Tests/LibWeb/Text/input/css/style-engine/transition-baseline-without-size-query.html@@ -35,15 +35,15 @@animation.pause();animation.currentTime = 1000;- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();root.className = "changed";internals.updateStyle();- const counters = internals.getStyleInvalidationCounters();+ const provisionalPasses = internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("provisional style pass"));const transition = target.getAnimations().find(animation => animation instanceof CSSTransition);animation.cancel();transition.currentTime = 500000;- println(`feedback used provisional passes: ${counters.provisionalStylePasses > 1}`);+ println(`provisional passes: [${provisionalPasses.join(", ")}]`);println(`one transition started: ${transition !== undefined}`);println(`transition midpoint width: ${getComputedStyle(target).width}`);});diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/match-media-does-not-evaluate-rules.html b/Tests/LibWeb/Text/input/css/style-invalidation/match-media-does-not-evaluate-rules.htmlindex f62e7bdde8f..6dd76d79fb3 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/match-media-does-not-evaluate-rules.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/match-media-does-not-evaluate-rules.html@@ -12,7 +12,7 @@document.head.appendChild(style);document.body.offsetWidth;- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();for (let i = 0; i < 100; ++i) {const mediaQueryList = matchMedia("(min-width: 1px)");@@ -21,7 +21,7 @@internals.updateStyle();}- const counters = internals.getStyleInvalidationCounters();- println(`media rule evaluations after matchMedia: ${counters.mediaRuleEvaluations}`);+ const evaluations = internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("media rules evaluated"));+ println(`media rule evaluations after matchMedia: [${evaluations.join(", ")}]`);});</script>diff --git a/Tests/LibWeb/Text/input/css/style-invalidation/registered-properties-cache-rebuilds.html b/Tests/LibWeb/Text/input/css/style-invalidation/registered-properties-cache-rebuilds.htmlindex a5d6f02fc76..f9293b465fc 100644--- a/Tests/LibWeb/Text/input/css/style-invalidation/registered-properties-cache-rebuilds.html+++ b/Tests/LibWeb/Text/input/css/style-invalidation/registered-properties-cache-rebuilds.html@@ -19,9 +19,13 @@<div id="target">target</div><div id="other">other</div><script>+ function cacheRebuilds() {+ return `[${internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("registered properties cache rebuilt")).join(", ")}]`;+ }+test(() => {internals.updateStyle();- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();// Style updates that don't change the active stylesheet set should not// rebuild the registered custom properties cache.@@ -30,8 +34,7 @@other.classList.toggle("red");internals.updateStyle();}- let counters = internals.getStyleInvalidationCounters();- println(`rebuilds after class churn: ${counters.registeredPropertiesCacheRebuilds}`);+ println(`rebuilds after class churn: ${cacheRebuilds()}`);// Adding a stylesheet with a new @property rule must rebuild the cache// so the new registration takes effect.@@ -44,10 +47,10 @@}#other { color: var(--late-color); }`;+ internals.beginRenderingTrace();document.head.appendChild(style);internals.updateStyle();- counters = internals.getStyleInvalidationCounters();- println(`cache rebuilt after sheet insertion: ${counters.registeredPropertiesCacheRebuilds >= 1}`);+ println(`rebuilds after sheet insertion: ${cacheRebuilds()}`);println(`late registration works: ${getComputedStyle(other).color}`);println(`early registration works: ${getComputedStyle(document.getElementById("target")).color}`);});diff --git a/Tests/LibWeb/Text/input/css/throttled-animation-late-iteration-listener.html b/Tests/LibWeb/Text/input/css/throttled-animation-late-iteration-listener.htmlindex 465e76325d2..f6b26514ef5 100644--- a/Tests/LibWeb/Text/input/css/throttled-animation-late-iteration-listener.html+++ b/Tests/LibWeb/Text/input/css/throttled-animation-late-iteration-listener.html@@ -1,11 +1,37 @@<!DOCTYPE html><script src="../include.js"></script>+<script src="../work-test.js"></script><style>@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }svg { width: 16px; height: 16px; animation: spin 1000s linear infinite; }</style><div id="root"><svg id="visible" viewBox="0 0 16 16"><path d="M15 8A7 7 0 0 0 8 1" /></svg><div style="display: none"><svg id="hidden" viewBox="0 0 16 16"><path d="M15 8A7 7 0 0 0 8 1" /></svg></div><details id="details"><summary>Details</summary><svg id="closed" viewBox="0 0 16 16"><path d="M15 8A7 7 0 0 0 8 1" /></svg></details></div><script>+ function compositorAnimationDump() {+ const lines = internals.dumpCompositorAnimations().split("\n").filter(Boolean);+ const animations = lines.filter(line => /^(opacity|background-color|filter|transform) /.test(line)).sort();+ return [...animations, ...lines.filter(line => !animations.includes(line))];+ }++ function printCompositorAnimations(title) {+ println(title);+ for (const line of compositorAnimationDump())+ println(` ${line}`);+ }++ function samples() {+ const events = parseStyleTrace(internals.takeStyleTrace()).filter(event => event.outcome?.startsWith("sampled"));+ return `[${events.map(event => event.element).join(", ")}]`;+ }++ function frameRequests() {+ return `[${internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("animation frame pump request")).join(", ")}]`;+ }++ function armedTimers() {+ return `[${internals.dumpCompositorAnimations().split("\n").filter(line => line.endsWith("timer armed")).join(", ")}]`;+ }+asyncTest(async done => {const root = document.getElementById("root");const timeline = internals.createInternalAnimationTimeline();@@ -22,12 +48,12 @@timeline.setTimeForObservation(0);for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- internals.resetStyleInvalidationCounters();+ internals.beginStyleTrace();+ internals.beginRenderingTrace();for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- const idle = internals.getStyleInvalidationCounters();- println(`visible, display-none, and closed-details rotations skip per-frame work: ${idle.animationFramePumpRequests === 0 && idle.animatedStyleOverlayBuilds === 0}`);- println(`unobserved rotations need no wake-up timer: ${!idle.compositorAnimationWakeupTimerActive}`);+ println(`visible, display-none, and closed-details rotations per-frame work: frame requests ${frameRequests()}, samples ${samples()}`);+ println(`unobserved rotations armed timers: ${armedTimers()}`);const events = [];const listener = event => events.push(`${event.target.id} ${event.elapsedTime}`);@@ -37,31 +63,30 @@timeline.setTime(2500000);await new Promise(requestAnimationFrame);println(`late listener receives no past events: ${events.length === 0}`);- println(`late ancestor listener arms wake-up: ${internals.getStyleInvalidationCounters().compositorAnimationWakeupTimerActive}`);+ println(`late ancestor listener armed timers: ${armedTimers()}`);- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();timeline.setTimeForObservation(3000000);internals.fireCompositorAnimationWakeupForTesting(3000000);timeline.setTime(3000000);await new Promise(requestAnimationFrame);println(`next iteration reaches late listener: ${events.sort().join(", ")}`);- println(`one wake-up serves the CSS effects: ${internals.getStyleInvalidationCounters().animationFramePumpRequests === 1}`);+ println(`one wake-up serves the CSS effects: ${frameRequests()}`);root.removeEventListener("animationiteration", listener);root.addEventListener("animationstart", () => {});root.addEventListener("animationcancel", () => {});await new Promise(requestAnimationFrame);- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();timeline.setTimeForObservation(4000000);internals.fireCompositorAnimationWakeupForTesting(4000000);- const removed = internals.getStyleInvalidationCounters();- println(`removing iteration listener leaves no periodic wake-up: ${removed.animationFramePumpRequests === 0 && !removed.compositorAnimationWakeupTimerActive}`);+ println(`removing iteration listener leaves no periodic wake-up: frame requests ${frameRequests()}, armed timers ${armedTimers()}`);document.getElementById("hidden").parentElement.style.display = "block";document.getElementById("details").open = true;timeline.setTime(4000000);for (let i = 0; i < 4; ++i)await new Promise(requestAnimationFrame);- println(`showing hidden SVG resumes compositor rendering: ${internals.getStyleInvalidationCounters().compositorVisualAnimations === 3}`);+ printCompositorAnimations("showing hidden SVG resumes compositor rendering:");for (const animation of animations)animation.cancel();done();diff --git a/Tests/LibWeb/Text/input/css/will-change-transform-transition-on-compositor.html b/Tests/LibWeb/Text/input/css/will-change-transform-transition-on-compositor.htmlindex 7a6d531089a..7a11bfceb49 100644--- a/Tests/LibWeb/Text/input/css/will-change-transform-transition-on-compositor.html+++ b/Tests/LibWeb/Text/input/css/will-change-transform-transition-on-compositor.html@@ -32,23 +32,26 @@const firstFrameTime = performance.now();internals.injectRenderingOpportunity(firstFrameTime);await nextTask();- const transformNodeBefore = internals.visualContextNodeIndices(box).spatial[0];- const buildCountBefore = internals.accumulatedVisualContextTreeBuildCount();+ const nodesBefore = internals.dumpVisualContextNodes(box);document.body.classList.add("changed");- internals.resetStyleInvalidationCounters();+ internals.beginVisualContextTrace();internals.injectRenderingOpportunity(firstFrameTime + 60);await nextTask();internals.updateCompositorAnimations();- const counters = internals.getStyleInvalidationCounters();+ const visualContextUpdates = internals.takeVisualContextTrace();+ const compositorAnimations = internals.dumpCompositorAnimations();const animation = box.getAnimations()[0];- const transformNodeAfter = internals.visualContextNodeIndices(box).spatial[0];-- println(`box owns a transform node before the transition: ${typeof transformNodeBefore === "number"}`);+ const nodesAfter = internals.dumpVisualContextNodes(box);+ println(`box owns a transform node before the transition: ${nodesBefore.replace(/^\[s\d+\] /, "").trimEnd()}`);println(`transition is still pending: ${animation.pending}`);- println(`transition starts on the compositor: ${counters.compositorVisualAnimations === 1}`);- println(`transition keeps the transform node: ${transformNodeAfter === transformNodeBefore}`);- println(`transition keeps the visual context tree: ${internals.accumulatedVisualContextTreeBuildCount() === buildCountBefore}`);+ println("transition starts on the compositor:");+ for (const line of compositorAnimations.split("\n").filter(Boolean))+ println(` ${line}`);+ println(`transition keeps the transform node: ${nodesAfter === nodesBefore}`);+ println("visual context tree updates of the transition:");+ for (const line of visualContextUpdates.split("\n").filter(Boolean))+ println(` ${line}`);animation.cancel();internals.setManualRenderingOpportunities(false);diff --git a/Tests/LibWeb/Text/input/focus-in-frame-leaves-settled-embedding-document-alone.html b/Tests/LibWeb/Text/input/focus-in-frame-leaves-settled-embedding-document-alone.htmlindex 9f0819a5508..da53a368e73 100644--- a/Tests/LibWeb/Text/input/focus-in-frame-leaves-settled-embedding-document-alone.html+++ b/Tests/LibWeb/Text/input/focus-in-frame-leaves-settled-embedding-document-alone.html@@ -23,12 +23,16 @@// Focusing an element in a frame brings the style of its embedding document up to date first. When that// document has nothing pending, it starts no style update of its own.document.body.offsetWidth;- internals.resetStyleInvalidationCounters();+ const styleUpdatesOfFocus = [];for (let i = 0; i < 10; ++i) {label.textContent = `label ${i}`;+ internals.beginRenderingTrace();frameDocument.getElementById(i % 2 ? "a" : "b").focus();+ const updates = internals.takeRenderingTrace().split("\n").filter(line => /^(style stabilization epoch|provisional style pass)/.test(line));+ styleUpdatesOfFocus.push(`[${updates.join(", ")}]`);}- println(`embedding style updates: ${internals.getStyleInvalidationCounters().styleStabilizationEpochs}`);+ println(`style updates of the focus entering the frame: ${styleUpdatesOfFocus[0]}`);+ println(`style updates of later focuses: ${[...new Set(styleUpdatesOfFocus.slice(1))].join(" or ")}`);println(`focused: ${frameDocument.activeElement.id}`);// An embedding document that has changed the frame's size is brought up to date, so the frame's media queriesdiff --git a/Tests/LibWeb/Text/input/focus-in-settled-document-does-not-update-style.html b/Tests/LibWeb/Text/input/focus-in-settled-document-does-not-update-style.htmlindex f7f0bf3edb3..2c213e9cf44 100644--- a/Tests/LibWeb/Text/input/focus-in-settled-document-does-not-update-style.html+++ b/Tests/LibWeb/Text/input/focus-in-settled-document-does-not-update-style.html@@ -7,17 +7,24 @@<div class="hidden"><input id="inHidden"></div><div id="later"><input id="inLater"></div><script>+ function styleUpdates() {+ return `[${internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("style stabilization epoch")).join(", ")}]`;+ }+test(() => {// Focusing asks whether the element is being rendered. In a document with no pending style work, every// element on the way already has its style, so that is answered without a style update.document.body.offsetWidth;- internals.resetStyleInvalidationCounters();+ const styleUpdatesOfFocus = new Map();for (let i = 0; i < 10; ++i) {- a.focus();- b.focus();- inHidden.focus();+ for (const element of [a, b, inHidden]) {+ internals.beginRenderingTrace();+ element.focus();+ styleUpdatesOfFocus.set(element.id, new Set([...(styleUpdatesOfFocus.get(element.id) ?? []), styleUpdates()]));+ }}- println(`style updates: ${internals.getStyleInvalidationCounters().styleStabilizationEpochs}`);+ for (const [id, updates] of styleUpdatesOfFocus)+ println(`style updates of ${id}.focus(): ${[...updates].join(" or ")}`);println(`focused: ${document.activeElement.id}`);// A display:none ancestor that is still pending is seen by the focus that follows it.diff --git a/Tests/LibWeb/Text/input/refocusing-active-element-does-not-update-style.html b/Tests/LibWeb/Text/input/refocusing-active-element-does-not-update-style.htmlindex d710f84dabe..b3a9601c8f4 100644--- a/Tests/LibWeb/Text/input/refocusing-active-element-does-not-update-style.html+++ b/Tests/LibWeb/Text/input/refocusing-active-element-does-not-update-style.html@@ -5,13 +5,13 @@test(() => {internals.updateStyle();target.focus();- internals.resetStyleInvalidationCounters();+ internals.beginRenderingTrace();document.body.classList.add("pending-style-change");target.focus();- const counters = internals.getStyleInvalidationCounters();+ const styleUpdates = internals.takeRenderingTrace().split("\n").filter(line => line.startsWith("style stabilization epoch"));println(`active element preserved: ${document.activeElement === target}`);- println(`style updates: ${counters.styleStabilizationEpochs}`);+ println(`style updates: [${styleUpdates.join(", ")}]`);});</script>