add navigation state data to LoadComplete messages, finish cef load state cbs

This commit is contained in:
Mike Blumenkrantz 2015-05-22 16:57:47 -04:00
parent 3481c752cd
commit 0d46a3b89a
10 changed files with 27 additions and 16 deletions

View file

@ -388,7 +388,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
self.window.load_start(back, forward);
}
(Msg::LoadComplete, ShutdownState::NotShuttingDown) => {
(Msg::LoadComplete(back, forward), ShutdownState::NotShuttingDown) => {
self.got_load_complete_message = true;
// If we're painting in headless mode, schedule a recomposite.
@ -399,7 +399,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
// Inform the embedder that the load has finished.
//
// TODO(pcwalton): Specify which frame's load completed.
self.window.load_end();
self.window.load_end(back, forward);
}
(Msg::ScrollTimeout(timestamp), ShutdownState::NotShuttingDown) => {

View file

@ -162,8 +162,8 @@ pub enum Msg {
SetFrameTree(SendableFrameTree, Sender<()>, ConstellationChan),
/// The load of a page has begun: (can go back, can go forward).
LoadStart(bool, bool),
/// The load of a page has completed.
LoadComplete,
/// The load of a page has completed: (can go back, can go forward).
LoadComplete(bool, bool),
/// Indicates that the scrolling timeout with the given starting timestamp has happened and a
/// composite should happen. (See the `scrolling` module.)
ScrollTimeout(u64),
@ -196,7 +196,7 @@ impl Debug for Msg {
Msg::ChangePageTitle(..) => write!(f, "ChangePageTitle"),
Msg::ChangePageUrl(..) => write!(f, "ChangePageUrl"),
Msg::SetFrameTree(..) => write!(f, "SetFrameTree"),
Msg::LoadComplete => write!(f, "LoadComplete"),
Msg::LoadComplete(..) => write!(f, "LoadComplete"),
Msg::LoadStart(..) => write!(f, "LoadStart"),
Msg::ScrollTimeout(..) => write!(f, "ScrollTimeout"),
Msg::RecompositeAfterScroll => write!(f, "RecompositeAfterScroll"),

View file

@ -391,9 +391,9 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
}
// A page loaded through one of several methods above has completed all parsing,
// script, and reflow messages have been sent.
ConstellationMsg::LoadComplete => {
ConstellationMsg::LoadComplete(pipeline_id) => {
debug!("constellation got load complete message");
self.handle_load_complete_msg()
self.handle_load_complete_msg(&pipeline_id)
}
// Handle a forward or back request
ConstellationMsg::Navigate(pipeline_info, direction) => {
@ -681,8 +681,12 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
self.compositor_proxy.send(CompositorMsg::LoadStart(back, forward));
}
fn handle_load_complete_msg(&mut self) {
self.compositor_proxy.send(CompositorMsg::LoadComplete);
fn handle_load_complete_msg(&mut self, pipeline_id: &PipelineId) {
let frame_id = *self.pipeline_to_frame_map.get(pipeline_id).unwrap();
let forward = !self.mut_frame(frame_id).next.is_empty();
let back = !self.mut_frame(frame_id).prev.is_empty();
self.compositor_proxy.send(CompositorMsg::LoadComplete(back, forward));
if let Some(ref reply_chan) = self.webdriver.load_channel {
reply_chan.send(webdriver_traits::LoadComplete).unwrap();
}

View file

@ -98,7 +98,7 @@ impl CompositorEventListener for NullCompositor {
Msg::ChangeRunningAnimationsState(..) |
Msg::ScrollFragmentPoint(..) |
Msg::LoadStart(..) |
Msg::LoadComplete |
Msg::LoadComplete(..) |
Msg::ScrollTimeout(..) |
Msg::RecompositeAfterScroll |
Msg::ChangePageTitle(..) |

View file

@ -106,7 +106,7 @@ pub trait WindowMethods {
/// Called when the browser has started loading a frame.
fn load_start(&self, back: bool, forward: bool);
/// Called when the browser is done loading a frame.
fn load_end(&self);
fn load_end(&self, back: bool, forward: bool);
/// Returns the hidpi factor of the monitor.
fn hidpi_factor(&self) -> ScaleFactor<ScreenPx, DevicePixel, f32>;