Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
gterzian committed Apr 12, 2024
1 parent 9097be9 commit e008939
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions components/script/script_thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,10 @@ pub struct Documents {
#[derive(JSTraceable)]
#[crown::unrooted_must_root_lint::must_root]
struct DocumentInfo {
/// The document associated with this pipeline.
document: Dom<Document>,
/// The index of the last mouse move event in the pending compositor events queue.
mouse_move_event_index: DomRefCell<Option<usize>>,
document: Dom<Document>,
/// Pending animation ticks, to be handled at the next rendering opportunity.
#[no_trace]
pending_animation_ticks: DomRefCell<AnimationTickType>,
Expand All @@ -450,8 +451,8 @@ struct DocumentInfo {
impl DocumentInfo {
fn new(doc: &Document) -> DocumentInfo {
DocumentInfo {
mouse_move_event_index: Default::default(),
document: Dom::from_ref(doc),
mouse_move_event_index: Default::default(),
pending_animation_ticks: Default::default(),
pending_compositor_events: Default::default(),
}
Expand Down Expand Up @@ -502,6 +503,7 @@ impl Documents {
CompositorEvent::MouseMoveEvent { .. } => {
let mut index = doc_info.mouse_move_event_index.borrow_mut();
if let Some(index) = *index {
// Replace the pending mouse move event.
let mut pending_events = doc_info.pending_compositor_events.borrow_mut();
let mouse_move_event =
pending_events.get_mut(index).expect("index is valid");
Expand Down Expand Up @@ -1859,7 +1861,7 @@ impl ScriptThread {
FromConstellation, FromDevtools, FromImageCache, FromScript, FromWebGPUServer,
};

// Store new resizes, and gather all other events.
// Proritize rendering tasks and others, and gather all other events as `sequential`.
let mut sequential = vec![];

// Notify the background-hang-monitor we are waiting for an event.
Expand Down Expand Up @@ -2056,6 +2058,7 @@ impl ScriptThread {
}

// https://html.spec.whatwg.org/multipage/#event-loop-processing-model step 6
// TODO: only run after running a task(#32003).
self.perform_a_microtask_checkpoint();
}

Expand Down

0 comments on commit e008939

Please sign in to comment.