mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +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() {
|
if self.has_resize_observers() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.window().has_unhandled_resize_event() {
|
if self.window().has_unhandled_resize_event() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -3723,7 +3722,9 @@ impl Document {
|
||||||
receiver.recv().unwrap();
|
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:
|
/// From https://drafts.csswg.org/css-font-loading/#font-face-set-ready:
|
||||||
|
@ -3754,9 +3755,11 @@ impl Document {
|
||||||
if self.ReadyState() != DocumentReadyState::Complete {
|
if self.ReadyState() != DocumentReadyState::Complete {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if self.needs_rendering_update() {
|
if !self.restyle_reason().is_empty() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//eprintln!("fullfilling promise");
|
||||||
fonts.fulfill_ready_promise_if_needed(can_gc);
|
fonts.fulfill_ready_promise_if_needed(can_gc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,8 +100,6 @@ impl MicrotaskQueue {
|
||||||
// Step 1
|
// Step 1
|
||||||
self.performing_a_microtask_checkpoint.set(true);
|
self.performing_a_microtask_checkpoint.set(true);
|
||||||
|
|
||||||
debug!("Now performing a microtask checkpoint");
|
|
||||||
|
|
||||||
// Steps 2
|
// Steps 2
|
||||||
while !self.microtask_queue.borrow().is_empty() {
|
while !self.microtask_queue.borrow().is_empty() {
|
||||||
rooted_vec!(let mut pending_queue);
|
rooted_vec!(let mut pending_queue);
|
||||||
|
|
|
@ -1247,6 +1247,8 @@ impl ScriptThread {
|
||||||
pub(crate) fn update_the_rendering(&self, can_gc: CanGc) {
|
pub(crate) fn update_the_rendering(&self, can_gc: CanGc) {
|
||||||
self.last_render_opportunity_time.set(Some(Instant::now()));
|
self.last_render_opportunity_time.set(Some(Instant::now()));
|
||||||
self.cancel_scheduled_update_the_rendering();
|
self.cancel_scheduled_update_the_rendering();
|
||||||
|
self.has_pending_animation_tick
|
||||||
|
.store(false, Ordering::Relaxed);
|
||||||
|
|
||||||
if !self.can_continue_running_inner() {
|
if !self.can_continue_running_inner() {
|
||||||
return;
|
return;
|
||||||
|
@ -1401,11 +1403,6 @@ impl ScriptThread {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn maybe_schedule_rendering_opportunity_after_ipc_message(&self, can_gc: CanGc) {
|
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 no document needs a rendering update, exit early to avoid doing more work.
|
||||||
if !self
|
if !self
|
||||||
.documents
|
.documents
|
||||||
|
@ -1423,14 +1420,17 @@ impl ScriptThread {
|
||||||
.last_render_opportunity_time
|
.last_render_opportunity_time
|
||||||
.get()
|
.get()
|
||||||
.map(|last_render_opportunity_time| Instant::now() - last_render_opportunity_time)
|
.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,
|
//eprintln!(" - scheduling update\n");
|
||||||
// just run it now.
|
//// If it's been more than the time of a single frame the last rendering opportunity,
|
||||||
if time_since_last_rendering_opportunity > SCRIPT_THREAD_ANIMATION_TICK_DELAY {
|
//// just run it now.
|
||||||
self.update_the_rendering(can_gc);
|
//if time_since_last_rendering_opportunity > SCRIPT_THREAD_ANIMATION_TICK_DELAY {
|
||||||
return;
|
// println!(" - running immediately");
|
||||||
}
|
// self.update_the_rendering(can_gc);
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
|
||||||
self.schedule_update_the_rendering_timer_if_necessary(
|
self.schedule_update_the_rendering_timer_if_necessary(
|
||||||
SCRIPT_THREAD_ANIMATION_TICK_DELAY - time_since_last_rendering_opportunity,
|
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) {
|
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() {
|
for (_, document) in self.documents.borrow().iter() {
|
||||||
if waiting_for_stable_image {
|
document
|
||||||
document
|
.window()
|
||||||
.window()
|
.maybe_send_idle_document_state_to_constellation();
|
||||||
.maybe_send_idle_document_state_to_constellation();
|
|
||||||
}
|
|
||||||
document.maybe_send_document_fonts_ready_message(can_gc);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1658,9 +1657,17 @@ impl ScriptThread {
|
||||||
docs.clear();
|
docs.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
self.maybe_schedule_rendering_opportunity_after_ipc_message(can_gc);
|
if self.has_pending_animation_tick.load(Ordering::Relaxed) {
|
||||||
self.maybe_send_document_state_messages(can_gc);
|
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
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,10 @@ class ServoTestharnessExecutor(ServoExecutor):
|
||||||
prefix = "ALERT: RESULT: "
|
prefix = "ALERT: RESULT: "
|
||||||
decoded_line = line.decode("utf8", "replace")
|
decoded_line = line.decode("utf8", "replace")
|
||||||
if decoded_line.startswith(prefix):
|
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()
|
self.result_flag.set()
|
||||||
else:
|
else:
|
||||||
ServoExecutor.on_output(self, line)
|
ServoExecutor.on_output(self, line)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue