mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
More work
This commit is contained in:
parent
4b8a25afab
commit
e340087b0c
4 changed files with 38 additions and 27 deletions
|
@ -3673,7 +3673,6 @@ impl Document {
|
|||
if self.has_resize_observers() {
|
||||
return true;
|
||||
}
|
||||
|
||||
if self.window().has_unhandled_resize_event() {
|
||||
return true;
|
||||
}
|
||||
|
@ -3723,7 +3722,9 @@ impl Document {
|
|||
receiver.recv().unwrap();
|
||||
}
|
||||
|
||||
self.window().reflow(ReflowGoal::UpdateTheRendering)
|
||||
let result = self.window().reflow(ReflowGoal::UpdateTheRendering);
|
||||
self.maybe_send_document_fonts_ready_message(CanGc::note());
|
||||
result
|
||||
}
|
||||
|
||||
/// From https://drafts.csswg.org/css-font-loading/#font-face-set-ready:
|
||||
|
@ -3754,9 +3755,11 @@ impl Document {
|
|||
if self.ReadyState() != DocumentReadyState::Complete {
|
||||
return;
|
||||
}
|
||||
if self.needs_rendering_update() {
|
||||
if !self.restyle_reason().is_empty() {
|
||||
return;
|
||||
}
|
||||
|
||||
//eprintln!("fullfilling promise");
|
||||
fonts.fulfill_ready_promise_if_needed(can_gc);
|
||||
}
|
||||
|
||||
|
|
|
@ -100,8 +100,6 @@ impl MicrotaskQueue {
|
|||
// Step 1
|
||||
self.performing_a_microtask_checkpoint.set(true);
|
||||
|
||||
debug!("Now performing a microtask checkpoint");
|
||||
|
||||
// Steps 2
|
||||
while !self.microtask_queue.borrow().is_empty() {
|
||||
rooted_vec!(let mut pending_queue);
|
||||
|
|
|
@ -1247,6 +1247,8 @@ impl ScriptThread {
|
|||
pub(crate) fn update_the_rendering(&self, can_gc: CanGc) {
|
||||
self.last_render_opportunity_time.set(Some(Instant::now()));
|
||||
self.cancel_scheduled_update_the_rendering();
|
||||
self.has_pending_animation_tick
|
||||
.store(false, Ordering::Relaxed);
|
||||
|
||||
if !self.can_continue_running_inner() {
|
||||
return;
|
||||
|
@ -1401,11 +1403,6 @@ impl ScriptThread {
|
|||
}
|
||||
|
||||
fn maybe_schedule_rendering_opportunity_after_ipc_message(&self, can_gc: CanGc) {
|
||||
if self.has_pending_animation_tick.load(Ordering::Relaxed) {
|
||||
self.update_the_rendering(can_gc);
|
||||
return;
|
||||
}
|
||||
|
||||
// If no document needs a rendering update, exit early to avoid doing more work.
|
||||
if !self
|
||||
.documents
|
||||
|
@ -1423,14 +1420,17 @@ impl ScriptThread {
|
|||
.last_render_opportunity_time
|
||||
.get()
|
||||
.map(|last_render_opportunity_time| Instant::now() - last_render_opportunity_time)
|
||||
.unwrap_or(Duration::MAX);
|
||||
.unwrap_or(Duration::MAX)
|
||||
.min(SCRIPT_THREAD_ANIMATION_TICK_DELAY);
|
||||
|
||||
// If it's been more than the time of a single frame the last rendering opportunity,
|
||||
// just run it now.
|
||||
if time_since_last_rendering_opportunity > SCRIPT_THREAD_ANIMATION_TICK_DELAY {
|
||||
self.update_the_rendering(can_gc);
|
||||
return;
|
||||
}
|
||||
//eprintln!(" - scheduling update\n");
|
||||
//// If it's been more than the time of a single frame the last rendering opportunity,
|
||||
//// just run it now.
|
||||
//if time_since_last_rendering_opportunity > SCRIPT_THREAD_ANIMATION_TICK_DELAY {
|
||||
// println!(" - running immediately");
|
||||
// self.update_the_rendering(can_gc);
|
||||
// return;
|
||||
//}
|
||||
|
||||
self.schedule_update_the_rendering_timer_if_necessary(
|
||||
SCRIPT_THREAD_ANIMATION_TICK_DELAY - time_since_last_rendering_opportunity,
|
||||
|
@ -1438,14 +1438,13 @@ impl ScriptThread {
|
|||
}
|
||||
|
||||
fn maybe_send_document_state_messages(&self, can_gc: CanGc) {
|
||||
let waiting_for_stable_image = opts::get().wait_for_stable_image;
|
||||
if !opts::get().wait_for_stable_image {
|
||||
return;
|
||||
}
|
||||
for (_, document) in self.documents.borrow().iter() {
|
||||
if waiting_for_stable_image {
|
||||
document
|
||||
.window()
|
||||
.maybe_send_idle_document_state_to_constellation();
|
||||
}
|
||||
document.maybe_send_document_fonts_ready_message(can_gc);
|
||||
document
|
||||
.window()
|
||||
.maybe_send_idle_document_state_to_constellation();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1658,9 +1657,17 @@ impl ScriptThread {
|
|||
docs.clear();
|
||||
}
|
||||
|
||||
self.maybe_schedule_rendering_opportunity_after_ipc_message(can_gc);
|
||||
self.maybe_send_document_state_messages(can_gc);
|
||||
if self.has_pending_animation_tick.load(Ordering::Relaxed) {
|
||||
self.update_the_rendering(can_gc);
|
||||
}
|
||||
|
||||
self.maybe_send_document_state_messages(can_gc);
|
||||
for (_, document) in self.documents.borrow().iter() {
|
||||
document.maybe_send_document_fonts_ready_message(can_gc);
|
||||
}
|
||||
self.perform_a_microtask_checkpoint(can_gc);
|
||||
|
||||
self.maybe_schedule_rendering_opportunity_after_ipc_message(can_gc);
|
||||
true
|
||||
}
|
||||
|
||||
|
|
|
@ -173,7 +173,10 @@ class ServoTestharnessExecutor(ServoExecutor):
|
|||
prefix = "ALERT: RESULT: "
|
||||
decoded_line = line.decode("utf8", "replace")
|
||||
if decoded_line.startswith(prefix):
|
||||
self.result_data = json.loads(decoded_line[len(prefix):])
|
||||
try:
|
||||
self.result_data = json.loads(decoded_line[len(prefix):])
|
||||
except json.JSONDecodeError as error:
|
||||
self.logger.error(f"Could not process test output JSON: {error}")
|
||||
self.result_flag.set()
|
||||
else:
|
||||
ServoExecutor.on_output(self, line)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue