add handling for favicon link elements

fixes #6166
This commit is contained in:
Mike Blumenkrantz 2015-05-29 14:34:41 -04:00
parent 05212b702d
commit 12f20f1ecc
10 changed files with 69 additions and 1 deletions

View file

@ -454,6 +454,10 @@ impl<Window: WindowMethods> IOCompositor<Window> {
self.composite_if_necessary(CompositingReason::Headless);
}
(Msg::NewFavicon(url), ShutdownState::NotShuttingDown) => {
self.window.set_favicon(url);
}
// When we are shutting_down, we need to avoid performing operations
// such as Paint that may crash because we have begun tearing down
// the rest of our resources.

View file

@ -180,6 +180,8 @@ pub enum Msg {
ViewportConstrained(PipelineId, ViewportConstraints),
/// A reply to the compositor asking if the output image is stable.
IsReadyToSaveImageReply(bool),
/// A favicon was detected
NewFavicon(Url),
}
impl Debug for Msg {
@ -206,6 +208,7 @@ impl Debug for Msg {
Msg::PaintTaskExited(..) => write!(f, "PaintTaskExited"),
Msg::ViewportConstrained(..) => write!(f, "ViewportConstrained"),
Msg::IsReadyToSaveImageReply(..) => write!(f, "IsReadyToSaveImageReply"),
Msg::NewFavicon(..) => write!(f, "NewFavicon"),
}
}
}

View file

@ -468,6 +468,10 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
debug!("constellation got remove iframe message");
self.handle_remove_iframe_msg(containing_pipeline_id, subpage_id);
}
ConstellationMsg::NewFavicon(url) => {
debug!("constellation got new favicon message");
self.compositor_proxy.send(CompositorMsg::NewFavicon(url));
}
}
true
}

View file

@ -109,6 +109,7 @@ impl CompositorEventListener for NullCompositor {
Msg::CreatePng(..) |
Msg::PaintTaskExited(..) |
Msg::IsReadyToSaveImageReply(..) => {}
Msg::NewFavicon(..) => {}
}
true
}

View file

@ -138,4 +138,7 @@ pub trait WindowMethods {
/// Does this window support a clipboard
fn supports_clipboard(&self) -> bool;
/// Add a favicon
fn set_favicon(&self, url: Url);
}