mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
CanGc changes from fontfaceset.rs (#33920)
* CanGc changes from fontfaceset.rs Signed-off-by: L Ashwin B <lashwinib@gmail.com> * Update components/script/dom/bindings/codegen/Bindings.conf Co-authored-by: Josh Matthews <josh@joshmatthews.net> Signed-off-by: chickenleaf <lashwinib@gmail.com> --------- Signed-off-by: L Ashwin B <lashwinib@gmail.com> Signed-off-by: chickenleaf <lashwinib@gmail.com> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
66695d2f7e
commit
9acb25521e
32 changed files with 425 additions and 274 deletions
|
@ -1727,12 +1727,12 @@ impl ScriptThread {
|
|||
// https://html.spec.whatwg.org/multipage/#context-lost-steps.
|
||||
|
||||
// Run the animation frame callbacks.
|
||||
document.tick_all_animations(should_run_rafs);
|
||||
document.tick_all_animations(should_run_rafs, can_gc);
|
||||
|
||||
// Run the resize observer steps.
|
||||
let _realm = enter_realm(&*document);
|
||||
let mut depth = Default::default();
|
||||
while document.gather_active_resize_observations_at_depth(&depth) {
|
||||
while document.gather_active_resize_observations_at_depth(&depth, can_gc) {
|
||||
// Note: this will reflow the doc.
|
||||
depth = document.broadcast_active_resize_observations(can_gc);
|
||||
}
|
||||
|
@ -1889,7 +1889,7 @@ impl ScriptThread {
|
|||
},
|
||||
FromConstellation(ConstellationControlMsg::Viewport(id, rect)) => self
|
||||
.profile_event(ScriptThreadEventCategory::SetViewport, Some(id), || {
|
||||
self.handle_viewport(id, rect);
|
||||
self.handle_viewport(id, rect, can_gc);
|
||||
}),
|
||||
FromConstellation(ConstellationControlMsg::TickAllAnimations(
|
||||
pipeline_id,
|
||||
|
@ -2067,13 +2067,17 @@ impl ScriptThread {
|
|||
|
||||
let pending_reflows = window.get_pending_reflow_count();
|
||||
if pending_reflows > 0 {
|
||||
window.reflow(ReflowGoal::Full, ReflowReason::PendingReflow);
|
||||
window.reflow(ReflowGoal::Full, ReflowReason::PendingReflow, can_gc);
|
||||
} else {
|
||||
// Reflow currently happens when explicitly invoked by code that
|
||||
// knows the document could have been modified. This should really
|
||||
// be driven by the compositor on an as-needed basis instead, to
|
||||
// minimize unnecessary work.
|
||||
window.reflow(ReflowGoal::Full, ReflowReason::MissingExplicitReflow);
|
||||
window.reflow(
|
||||
ReflowGoal::Full,
|
||||
ReflowReason::MissingExplicitReflow,
|
||||
can_gc,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2554,7 +2558,7 @@ impl ScriptThread {
|
|||
self.collect_reports(chan)
|
||||
},
|
||||
MainThreadScriptMsg::WorkletLoaded(pipeline_id) => {
|
||||
self.handle_worklet_loaded(pipeline_id)
|
||||
self.handle_worklet_loaded(pipeline_id, CanGc::note())
|
||||
},
|
||||
MainThreadScriptMsg::RegisterPaintWorklet {
|
||||
pipeline_id,
|
||||
|
@ -2840,7 +2844,7 @@ impl ScriptThread {
|
|||
webdriver_handlers::handle_get_css(&documents, pipeline_id, node_id, name, reply)
|
||||
},
|
||||
WebDriverScriptCommand::GetElementRect(node_id, reply) => {
|
||||
webdriver_handlers::handle_get_rect(&documents, pipeline_id, node_id, reply)
|
||||
webdriver_handlers::handle_get_rect(&documents, pipeline_id, node_id, reply, can_gc)
|
||||
},
|
||||
WebDriverScriptCommand::GetBoundingClientRect(node_id, reply) => {
|
||||
webdriver_handlers::handle_get_bounding_client_rect(
|
||||
|
@ -2918,11 +2922,11 @@ impl ScriptThread {
|
|||
}
|
||||
}
|
||||
|
||||
fn handle_viewport(&self, id: PipelineId, rect: Rect<f32>) {
|
||||
fn handle_viewport(&self, id: PipelineId, rect: Rect<f32>, can_gc: CanGc) {
|
||||
let document = self.documents.borrow().find_document(id);
|
||||
if let Some(document) = document {
|
||||
if document.window().set_page_clip_rect_with_new_viewport(rect) {
|
||||
self.rebuild_and_force_reflow(&document, ReflowReason::Viewport);
|
||||
self.rebuild_and_force_reflow(&document, ReflowReason::Viewport, can_gc);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -3028,7 +3032,7 @@ impl ScriptThread {
|
|||
);
|
||||
let document = self.documents.borrow().find_document(id);
|
||||
if let Some(document) = document {
|
||||
document.set_activity(activity);
|
||||
document.set_activity(activity, CanGc::note());
|
||||
return;
|
||||
}
|
||||
let mut loads = self.incomplete_loads.borrow_mut();
|
||||
|
@ -3443,10 +3447,10 @@ impl ScriptThread {
|
|||
}
|
||||
|
||||
/// Handles a worklet being loaded. Does nothing if the page no longer exists.
|
||||
fn handle_worklet_loaded(&self, pipeline_id: PipelineId) {
|
||||
fn handle_worklet_loaded(&self, pipeline_id: PipelineId, can_gc: CanGc) {
|
||||
let document = self.documents.borrow().find_document(pipeline_id);
|
||||
if let Some(document) = document {
|
||||
self.rebuild_and_force_reflow(&document, ReflowReason::WorkletLoaded);
|
||||
self.rebuild_and_force_reflow(&document, ReflowReason::WorkletLoaded, can_gc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3904,10 +3908,10 @@ impl ScriptThread {
|
|||
}
|
||||
|
||||
/// Reflows non-incrementally, rebuilding the entire layout tree in the process.
|
||||
fn rebuild_and_force_reflow(&self, document: &Document, reason: ReflowReason) {
|
||||
fn rebuild_and_force_reflow(&self, document: &Document, reason: ReflowReason, can_gc: CanGc) {
|
||||
let window = window_from_node(document);
|
||||
document.dirty_all_nodes();
|
||||
window.reflow(ReflowGoal::Full, reason);
|
||||
window.reflow(ReflowGoal::Full, reason, can_gc);
|
||||
}
|
||||
|
||||
/// Queue compositor events for later dispatching as part of a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue