| diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs | |
| index 18f6618..56db74d 100644 | |
| --- a/components/compositing/compositor.rs | |
| +++ b/components/compositing/compositor.rs | |
| @@ -384,6 +384,10 @@ impl<Window: WindowMethods> IOCompositor<Window> { | |
| self.scroll_fragment_to_point(pipeline_id, layer_id, point); | |
| } | |
| + (Msg::Status(message), ShutdownState::NotShuttingDown) => { | |
| + self.window.status(message); | |
| + } | |
| + | |
| (Msg::LoadStart(back, forward), ShutdownState::NotShuttingDown) => { | |
| self.window.load_start(back, forward); | |
| } | |
| diff --git a/components/compositing/compositor_task.rs b/components/compositing/compositor_task.rs | |
| index 9a47fce..f588c49 100644 | |
| --- a/components/compositing/compositor_task.rs | |
| +++ b/components/compositing/compositor_task.rs | |
| @@ -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 status message to be displayed by the browser chrome | |
| + Status(Option<String>), | |
| } | |
| 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::Status(..) => write!(f, "Status"), | |
| } | |
| } | |
| } | |
| diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs | |
| index cecaacb..8438f9a 100644 | |
| --- a/components/compositing/constellation.rs | |
| +++ b/components/compositing/constellation.rs | |
| @@ -459,6 +459,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::NodeStatus(message) => { | |
| + debug!("constellation got NodeStatus message"); | |
| + self.compositor_proxy.send(CompositorMsg::Status(message)); | |
| + } | |
| } | |
| true | |
| } | |
| diff --git a/components/compositing/headless.rs b/components/compositing/headless.rs | |
| index c58532e..ae0304d 100644 | |
| --- a/components/compositing/headless.rs | |
| +++ b/components/compositing/headless.rs | |
| @@ -97,6 +97,7 @@ impl CompositorEventListener for NullCompositor { | |
| Msg::AssignPaintedBuffers(..) | | |
| Msg::ChangeRunningAnimationsState(..) | | |
| Msg::ScrollFragmentPoint(..) | | |
| + Msg::Status(..) | | |
| Msg::LoadStart(..) | | |
| Msg::LoadComplete(..) | | |
| Msg::ScrollTimeout(..) | | |
| diff --git a/components/compositing/windowing.rs b/components/compositing/windowing.rs | |
| index 51a97ec..c391a3b 100644 | |
| --- a/components/compositing/windowing.rs | |
| +++ b/components/compositing/windowing.rs | |
| @@ -103,6 +103,8 @@ pub trait WindowMethods { | |
| fn set_page_title(&self, title: Option<String>); | |
| /// Sets the load data for the current page. | |
| fn set_page_url(&self, url: Url); | |
| + /// Called when the browser chrome should display a status message. | |
| + fn status(&self, Option<String>); | |
| /// 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. | |
| diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs | |
| index 8706a80..6fb89e5 100644 | |
| --- a/components/msg/constellation_msg.rs | |
| +++ b/components/msg/constellation_msg.rs | |
| @@ -244,6 +244,8 @@ pub enum Msg { | |
| IsReadyToSaveImage(HashMap<PipelineId, Epoch>), | |
| /// Notification that this iframe should be removed. | |
| RemoveIFrame(PipelineId, SubpageId), | |
| + /// Status message to be displayed in the chrome, eg. a link URL on mouseover | |
| + NodeStatus(Option<String>), | |
| } | |
| #[derive(Clone, Eq, PartialEq)] | |
| diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs | |
| index 13f035f..626932c 100644 | |
| --- a/components/script/dom/document.rs | |
| +++ b/components/script/dom/document.rs | |
| @@ -85,7 +85,7 @@ use geom::point::Point2D; | |
| use html5ever::tree_builder::{QuirksMode, NoQuirks, LimitedQuirks, Quirks}; | |
| use layout_interface::{LayoutChan, Msg}; | |
| use string_cache::{Atom, QualName}; | |
| -use url::Url; | |
| +use url::{Url, UrlParser}; | |
| use js::jsapi::{JSContext, JSObject, JSRuntime}; | |
| use num::ToPrimitive; | |
| @@ -647,9 +647,17 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> { | |
| // Remove hover from any elements in the previous list that are no longer | |
| // under the mouse. | |
| + let mut did_status = false; | |
| for target in prev_mouse_over_targets.iter() { | |
| if !mouse_over_targets.contains(target) { | |
| target.root().r().set_hover_state(false); | |
| + if did_status == false && target.root().r().is_anchor_element() { | |
| + let window = self.window.root(); | |
| + let ConstellationChan(ref chan) = window.r().constellation_chan(); | |
| + let event = ConstellationMsg::NodeStatus(None); | |
| + chan.send(event).unwrap(); | |
| + did_status = true; | |
| + } | |
| } | |
| } | |
| @@ -686,6 +694,37 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> { | |
| let event: JSRef<Event> = EventCast::from_ref(mouse_event.r()); | |
| let target: JSRef<EventTarget> = EventTargetCast::from_ref(top_most_node.r()); | |
| + for addr in mouse_over_addresses.iter() { | |
| + let node = node::from_untrusted_node_address(js_runtime, *addr); | |
| + let anchor = node.root(); | |
| + if anchor.r().is_anchor_element() { | |
| + let window = self.window.root(); | |
| + let element = ElementCast::from_ref(HTMLAnchorElementCast::to_ref(anchor.r()).unwrap()); | |
| + let mut ismap_suffix = None; | |
| + if target.is_htmlimageelement() && element.has_attribute(&atom!("ismap")) { | |
| + | |
| + let rect = window.r().content_box_query(top_most_node.r().to_trusted_node_address()); | |
| + ismap_suffix = Some( | |
| + format!("?{},{}", x as f32 - rect.origin.x.to_f32_px(), | |
| + y as f32 - rect.origin.y.to_f32_px()) | |
| + ) | |
| + } | |
| + | |
| + let attr = element.get_attribute(&ns!(""), &atom!("href")).root(); | |
| + let status = match attr { | |
| + Some(href) => { | |
| + let value = href.r().Value() + ismap_suffix.as_ref().map(|s| &**s).unwrap_or(""); | |
| + let base_url = window.r().get_url(); | |
| + let url = UrlParser::new().base_url(&base_url).parse(&value); | |
| + }, | |
| + None => "" | |
| + }; | |
| + let ConstellationChan(ref chan) = window.r().constellation_chan(); | |
| + let event = ConstellationMsg::NodeStatus(status); | |
| + chan.send(event).unwrap(); | |
| + break; | |
| + } | |
| + } | |
| event.fire(target); | |
| } | |
| diff --git a/ports/cef/window.rs b/ports/cef/window.rs | |
| index 8f08d28..259d79c 100644 | |
| --- a/ports/cef/window.rs | |
| +++ b/ports/cef/window.rs | |
| @@ -315,6 +315,9 @@ impl WindowMethods for Window { | |
| } | |
| } | |
| + fn status(&self, _: Option<String>) { | |
| + } | |
| + | |
| fn load_start(&self, back: bool, forward: bool) { | |
| // FIXME(pcwalton): The status code 200 is a lie. | |
| let browser = self.cef_browser.borrow(); | |
| diff --git a/ports/glutin/window.rs b/ports/glutin/window.rs | |
| index 16d8c50..347b61e 100644 | |
| --- a/ports/glutin/window.rs | |
| +++ b/ports/glutin/window.rs | |
| @@ -505,6 +505,9 @@ impl WindowMethods for Window { | |
| fn set_page_url(&self, _: Url) { | |
| } | |
| + fn status(&self, _: Option<String>) { | |
| + } | |
| + | |
| fn load_start(&self, _: bool, _: bool) { | |
| } | |
| diff --git a/ports/gonk/src/window.rs b/ports/gonk/src/window.rs | |
| index f751d23..1b9795d 100644 | |
| --- a/ports/gonk/src/window.rs | |
| +++ b/ports/gonk/src/window.rs | |
| @@ -802,6 +802,9 @@ impl WindowMethods for Window { | |
| fn set_page_url(&self, _: Url) { | |
| } | |
| + fn status(&self, _: Option<String>) { | |
| + } | |
| + | |
| fn load_start(&self, _: bool, _: bool) { | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment