Perform reflow if load events dirty any nodes.

This fixes some test failures that begin occurring when other events (such as resize) are fixed to only occur when needed.
This commit is contained in:
Glenn Watson 2015-03-11 08:43:47 +10:00
parent e8f1a046c6
commit 33829c0254
2 changed files with 8 additions and 2 deletions

View file

@ -1387,6 +1387,8 @@ impl DocumentProgressHandler {
EventCancelable::NotCancelable).root();
let doctarget: JSRef<EventTarget> = EventTargetCast::from_ref(document.r());
let _ = doctarget.DispatchEvent(event.r());
window.r().reflow(ReflowGoal::ForDisplay, ReflowQueryType::NoQuery, ReflowReason::DOMContentLoaded);
}
fn set_ready_state_complete(&self) {
@ -1418,6 +1420,8 @@ impl DocumentProgressHandler {
let target: JSRef<EventTarget> = EventTargetCast::from_ref(frame_element.r());
event.r().fire(target);
});
window_ref.reflow(ReflowGoal::ForDisplay, ReflowQueryType::NoQuery, ReflowReason::DocumentLoaded);
}
}

View file

@ -75,6 +75,8 @@ pub enum ReflowReason {
Timer,
Viewport,
WindowResize,
DOMContentLoaded,
DocumentLoaded,
}
#[dom_struct]
@ -510,8 +512,6 @@ impl<'a> WindowHelpers for JSRef<'a, Window> {
return
}
debug!("script: performing reflow for goal {:?}", goal);
// Layout will let us know when it's done.
let (join_chan, join_port) = channel();
@ -840,6 +840,8 @@ fn debug_reflow_events(goal: &ReflowGoal, query_type: &ReflowQueryType, reason:
ReflowReason::Timer => debug_msg.push_str("\tTimer"),
ReflowReason::Viewport => debug_msg.push_str("\tViewport"),
ReflowReason::WindowResize => debug_msg.push_str("\tWindowResize"),
ReflowReason::DOMContentLoaded => debug_msg.push_str("\tDOMContentLoaded"),
ReflowReason::DocumentLoaded => debug_msg.push_str("\tDocumentLoaded"),
}
println!("{}", debug_msg);