mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #6219 - zmike:favicons_and_stringlOWWW-MY-HEAD, r=pcwalton
Getting these down to the embedding API level required that I redo the bindings generator again, so this is more commits than anticipated. @mbrubeck @Manishearth @pcwalton but NOT @larsbergstrom so don't even look at this. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6219) <!-- Reviewable:end -->
This commit is contained in:
commit
b0f3417cff
26 changed files with 182 additions and 62 deletions
|
@ -454,6 +454,14 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
self.composite_if_necessary(CompositingReason::Headless);
|
||||
}
|
||||
|
||||
(Msg::NewFavicon(url), ShutdownState::NotShuttingDown) => {
|
||||
self.window.set_favicon(url);
|
||||
}
|
||||
|
||||
(Msg::HeadParsed, ShutdownState::NotShuttingDown) => {
|
||||
self.window.head_parsed();
|
||||
}
|
||||
|
||||
// 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.
|
||||
|
|
|
@ -180,6 +180,10 @@ 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),
|
||||
/// <head> tag finished parsing
|
||||
HeadParsed,
|
||||
}
|
||||
|
||||
impl Debug for Msg {
|
||||
|
@ -206,6 +210,8 @@ impl Debug for Msg {
|
|||
Msg::PaintTaskExited(..) => write!(f, "PaintTaskExited"),
|
||||
Msg::ViewportConstrained(..) => write!(f, "ViewportConstrained"),
|
||||
Msg::IsReadyToSaveImageReply(..) => write!(f, "IsReadyToSaveImageReply"),
|
||||
Msg::NewFavicon(..) => write!(f, "NewFavicon"),
|
||||
Msg::HeadParsed => write!(f, "HeadParsed"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -468,6 +468,14 @@ 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));
|
||||
}
|
||||
ConstellationMsg::HeadParsed => {
|
||||
debug!("constellation got head parsed message");
|
||||
self.compositor_proxy.send(CompositorMsg::HeadParsed);
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
|
|
|
@ -109,6 +109,8 @@ impl CompositorEventListener for NullCompositor {
|
|||
Msg::CreatePng(..) |
|
||||
Msg::PaintTaskExited(..) |
|
||||
Msg::IsReadyToSaveImageReply(..) => {}
|
||||
Msg::NewFavicon(..) => {}
|
||||
Msg::HeadParsed => {}
|
||||
}
|
||||
true
|
||||
}
|
||||
|
|
|
@ -110,6 +110,8 @@ pub trait WindowMethods {
|
|||
fn load_end(&self, back: bool, forward: bool);
|
||||
/// Called when the browser encounters an error while loading a URL
|
||||
fn load_error(&self, code: NetError, url: String);
|
||||
/// Called when the <head> tag has finished parsing
|
||||
fn head_parsed(&self);
|
||||
|
||||
/// Returns the hidpi factor of the monitor.
|
||||
fn hidpi_factor(&self) -> ScaleFactor<ScreenPx, DevicePixel, f32>;
|
||||
|
@ -138,4 +140,7 @@ pub trait WindowMethods {
|
|||
|
||||
/// Does this window support a clipboard
|
||||
fn supports_clipboard(&self) -> bool;
|
||||
|
||||
/// Add a favicon
|
||||
fn set_favicon(&self, url: Url);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue