mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
script: Remove note_rendering_opportunity
and rendering_opportunity
(#34575)
A rendering opportunity is now unconditionally triggered by handling IPC messages in the `ScriptThread`, unless animations are running in which case it's driven by the compositor. We can now remove calls to `note_rendering_opportunity` and `rendering_opportunity`. There is one tricky case, which is when a promise completion during a microtask checkpoint dirties the page again. In this case we need to trigger a new rendering opportunity, unless animations are running. In a followup change, when not driven by the compositor, rendering opportunities will be driven by a timed task, meaning we can remove this workaround. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
7fcde1f7a3
commit
2bcee38e52
6 changed files with 63 additions and 66 deletions
|
@ -2064,6 +2064,12 @@ impl Document {
|
|||
}
|
||||
}
|
||||
|
||||
/// Whether or not this `Document` has any active requestAnimationFrame callbacks
|
||||
/// registered.
|
||||
pub(crate) fn has_active_request_animation_frame_callbacks(&self) -> bool {
|
||||
!self.animation_frame_list.borrow().is_empty()
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-window-requestanimationframe>
|
||||
pub(crate) fn request_animation_frame(&self, callback: AnimationFrameCallback) -> u32 {
|
||||
let ident = self.animation_frame_ident.get() + 1;
|
||||
|
|
|
@ -2129,8 +2129,6 @@ impl Node {
|
|||
MutationObserver::queue_a_mutation_record(parent, mutation);
|
||||
}
|
||||
node.owner_doc().remove_script_and_layout_blocker();
|
||||
|
||||
ScriptThread::note_rendering_opportunity(window_from_node(parent).pipeline_id());
|
||||
}
|
||||
|
||||
/// <https://dom.spec.whatwg.org/#concept-node-replace-all>
|
||||
|
@ -2254,7 +2252,6 @@ impl Node {
|
|||
MutationObserver::queue_a_mutation_record(parent, mutation);
|
||||
}
|
||||
parent.owner_doc().remove_script_and_layout_blocker();
|
||||
ScriptThread::note_rendering_opportunity(window_from_node(parent).pipeline_id());
|
||||
}
|
||||
|
||||
/// <https://dom.spec.whatwg.org/#concept-node-clone>
|
||||
|
|
|
@ -26,7 +26,6 @@ use crate::dom::resizeobserverentry::ResizeObserverEntry;
|
|||
use crate::dom::resizeobserversize::{ResizeObserverSize, ResizeObserverSizeImpl};
|
||||
use crate::dom::window::Window;
|
||||
use crate::script_runtime::CanGc;
|
||||
use crate::script_thread::ScriptThread;
|
||||
|
||||
/// <https://drafts.csswg.org/resize-observer/#calculate-depth-for-node>
|
||||
#[derive(Debug, Default, PartialEq, PartialOrd)]
|
||||
|
@ -191,10 +190,6 @@ impl ResizeObserverMethods<crate::DomTypeHolder> for ResizeObserver {
|
|||
self.observation_targets
|
||||
.borrow_mut()
|
||||
.push((resize_observation, Dom::from_ref(target)));
|
||||
|
||||
// Note: noting a rendering opportunity here is necessary
|
||||
// to make /resize-observer/iframe-same-origin.html PASS.
|
||||
ScriptThread::note_rendering_opportunity(window_from_node(target).pipeline_id());
|
||||
}
|
||||
|
||||
/// <https://drafts.csswg.org/resize-observer/#dom-resizeobserver-unobserve>
|
||||
|
|
|
@ -1809,6 +1809,10 @@ impl Window {
|
|||
ScriptThread::handle_tick_all_animations_for_testing(pipeline_id);
|
||||
}
|
||||
|
||||
pub(crate) fn reflows_suppressed(&self) -> bool {
|
||||
self.suppress_reflow.get()
|
||||
}
|
||||
|
||||
/// Reflows the page unconditionally if possible and not suppressed. This method will wait for
|
||||
/// the layout to complete. If there is no window size yet, the page is presumed invisible and
|
||||
/// no reflow is performed. If reflow is suppressed, no reflow will be performed for ForDisplay
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue