diff options
-rw-r--r-- | components/compositing/compositor.rs | 4 | ||||
-rw-r--r-- | components/compositing/compositor_layer.rs | 8 | ||||
-rw-r--r-- | components/compositing/constellation.rs | 14 | ||||
-rw-r--r-- | components/compositing/pipeline.rs | 12 | ||||
-rw-r--r-- | components/layout/layout_task.rs | 6 | ||||
-rw-r--r-- | components/script/script_task.rs | 40 | ||||
-rw-r--r-- | components/script_traits/lib.rs | 18 |
7 files changed, 49 insertions, 53 deletions
diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index bec2d3a009c..b4dd37a2915 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -28,7 +28,7 @@ use layers::scene::Scene; use png; use gleam::gl::types::{GLint, GLsizei}; use gleam::gl; -use script_traits::{ViewportMsg, ScriptControlChan}; +use script_traits::{ConstellationControlMsg, ScriptControlChan}; use servo_msg::compositor_msg::{Blank, Epoch, FinishedLoading, LayerId}; use servo_msg::compositor_msg::{ReadyState, PaintState, Scrollable}; use servo_msg::constellation_msg::{mod, ConstellationChan}; @@ -977,7 +977,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { layer.bounds.borrow().size.to_untyped()); let pipeline = &layer.extra_data.borrow().pipeline; let ScriptControlChan(ref chan) = pipeline.script_chan; - chan.send(ViewportMsg(pipeline.id.clone(), layer_rect)); + chan.send(ConstellationControlMsg::Viewport(pipeline.id.clone(), layer_rect)); } for kid in layer.children().iter() { diff --git a/components/compositing/compositor_layer.rs b/components/compositing/compositor_layer.rs index 9830d66381b..4c13d7fb8a0 100644 --- a/components/compositing/compositor_layer.rs +++ b/components/compositing/compositor_layer.rs @@ -17,8 +17,8 @@ use layers::color::Color; use layers::geometry::LayerPixel; use layers::layers::{Layer, LayerBufferSet}; use layers::platform::surface::NativeSurfaceMethods; -use script_traits::{ClickEvent, MouseDownEvent, MouseMoveEvent, MouseUpEvent, SendEventMsg}; -use script_traits::{ScriptControlChan}; +use script_traits::{ClickEvent, MouseDownEvent, MouseMoveEvent, MouseUpEvent}; +use script_traits::{ScriptControlChan, ConstellationControlMsg}; use servo_msg::compositor_msg::{Epoch, FixedPosition, LayerId, ScrollPolicy}; use std::num::Float; use std::num::FloatMath; @@ -328,7 +328,7 @@ impl CompositorLayer for Layer<CompositorData> { }; let pipeline = &self.extra_data.borrow().pipeline; let ScriptControlChan(ref chan) = pipeline.script_chan; - let _ = chan.send_opt(SendEventMsg(pipeline.id.clone(), message)); + let _ = chan.send_opt(ConstellationControlMsg::SendEvent(pipeline.id.clone(), message)); } fn send_mouse_move_event(&self, @@ -336,7 +336,7 @@ impl CompositorLayer for Layer<CompositorData> { let message = MouseMoveEvent(cursor.to_untyped()); let pipeline = &self.extra_data.borrow().pipeline; let ScriptControlChan(ref chan) = pipeline.script_chan; - let _ = chan.send_opt(SendEventMsg(pipeline.id.clone(), message)); + let _ = chan.send_opt(ConstellationControlMsg::SendEvent(pipeline.id.clone(), message)); } fn scroll_layer_and_all_child_layers(&self, diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index 44f87cce401..9ec8fb9aaa6 100644 --- a/components/compositing/constellation.rs +++ b/components/compositing/constellation.rs @@ -14,7 +14,7 @@ use gfx::font_cache_task::FontCacheTask; use layers::geometry::DevicePixel; use layout_traits::LayoutTaskFactory; use libc; -use script_traits::{mod, GetTitleMsg, ResizeMsg, ResizeInactiveMsg, SendEventMsg}; +use script_traits::{mod, ConstellationControlMsg}; use script_traits::{ScriptControlChan, ScriptTaskFactory}; use servo_msg::compositor_msg::LayerId; use servo_msg::constellation_msg::{mod, ConstellationChan, Failure}; @@ -672,7 +672,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { if !already_sent.contains(&pipeline.id) { if is_active { let ScriptControlChan(ref script_chan) = pipeline.script_chan; - script_chan.send(ResizeMsg(pipeline.id, WindowSizeData { + script_chan.send(ConstellationControlMsg::Resize(pipeline.id, WindowSizeData { visible_viewport: rect.size, initial_viewport: rect.size * ScaleFactor(1.0), device_pixel_ratio: device_pixel_ratio, @@ -838,7 +838,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { fn handle_key_msg(&self, key: Key, state: KeyState, mods: KeyModifiers) { self.current_frame().as_ref().map(|frame| { let ScriptControlChan(ref chan) = frame.pipeline.script_chan; - chan.send(SendEventMsg(frame.pipeline.id, script_traits::KeyEvent(key, state, mods))); + chan.send(ConstellationControlMsg::SendEvent(frame.pipeline.id, script_traits::KeyEvent(key, state, mods))); }); } @@ -847,7 +847,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { None => self.compositor_proxy.send(CompositorMsg::ChangePageTitle(pipeline_id, None)), Some(pipeline) => { let ScriptControlChan(ref script_channel) = pipeline.script_chan; - script_channel.send(GetTitleMsg(pipeline_id)); + script_channel.send(ConstellationControlMsg::GetTitle(pipeline_id)); } } } @@ -945,7 +945,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { debug!("constellation sending resize message to active frame"); let pipeline = &frame_tree.pipeline; let ScriptControlChan(ref chan) = pipeline.script_chan; - let _ = chan.send_opt(ResizeMsg(pipeline.id, new_size)); + let _ = chan.send_opt(ConstellationControlMsg::Resize(pipeline.id, new_size)); already_seen.insert(pipeline.id); } for frame_tree in self.navigation_context.previous.iter() @@ -954,7 +954,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { if !already_seen.contains(&pipeline.id) { debug!("constellation sending resize message to inactive frame"); let ScriptControlChan(ref chan) = pipeline.script_chan; - let _ = chan.send_opt(ResizeInactiveMsg(pipeline.id, new_size)); + let _ = chan.send_opt(ConstellationControlMsg::ResizeInactive(pipeline.id, new_size)); already_seen.insert(pipeline.id); } } @@ -967,7 +967,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> { debug!("constellation sending resize message to pending outer frame ({})", frame_tree.pipeline.id); let ScriptControlChan(ref chan) = frame_tree.pipeline.script_chan; - let _ = chan.send_opt(ResizeMsg(frame_tree.pipeline.id, new_size)); + let _ = chan.send_opt(ConstellationControlMsg::Resize(frame_tree.pipeline.id, new_size)); } } diff --git a/components/compositing/pipeline.rs b/components/compositing/pipeline.rs index a8096894257..8c22d7c9ea4 100644 --- a/components/compositing/pipeline.rs +++ b/components/compositing/pipeline.rs @@ -5,7 +5,7 @@ use CompositorProxy; use layout_traits::{ExitNowMsg, LayoutTaskFactory, LayoutControlChan}; use script_traits::{ScriptControlChan, ScriptTaskFactory}; -use script_traits::{AttachLayoutMsg, LoadMsg, NewLayoutInfo, ExitPipelineMsg}; +use script_traits::{NewLayoutInfo, ConstellationControlMsg}; use devtools_traits::DevtoolsControlChan; use gfx::paint_task::Msg as PaintMsg; @@ -100,7 +100,7 @@ impl Pipeline { }; let ScriptControlChan(ref chan) = spipe.script_chan; - chan.send(AttachLayoutMsg(new_layout_info)); + chan.send(ConstellationControlMsg::AttachLayout(new_layout_info)); spipe.script_chan.clone() } }; @@ -162,7 +162,7 @@ impl Pipeline { pub fn load(&self) { let ScriptControlChan(ref chan) = self.script_chan; - chan.send(LoadMsg(self.id, self.load_data.clone())); + chan.send(ConstellationControlMsg::Load(self.id, self.load_data.clone())); } pub fn grant_paint_permission(&self) { @@ -180,7 +180,7 @@ impl Pipeline { // Script task handles shutting down layout, and layout handles shutting down the painter. // For now, if the script task has failed, we give up on clean shutdown. let ScriptControlChan(ref chan) = self.script_chan; - if chan.send_opt(ExitPipelineMsg(self.id, exit_type)).is_ok() { + if chan.send_opt(ConstellationControlMsg::ExitPipeline(self.id, exit_type)).is_ok() { // Wait until all slave tasks have terminated and run destructors // NOTE: We don't wait for script task as we don't always own it let _ = self.paint_shutdown_port.recv_opt(); @@ -191,7 +191,9 @@ impl Pipeline { pub fn force_exit(&self) { let ScriptControlChan(ref script_channel) = self.script_chan; - let _ = script_channel.send_opt( ExitPipelineMsg(self.id, PipelineExitType::PipelineOnly)); + let _ = script_channel.send_opt( + ConstellationControlMsg::ExitPipeline(self.id, + PipelineExitType::PipelineOnly)); let _ = self.paint_chan.send_opt(PaintMsg::Exit(None, PipelineExitType::PipelineOnly)); let LayoutControlChan(ref layout_channel) = self.layout_chan; let _ = layout_channel.send_opt(ExitNowMsg(PipelineExitType::PipelineOnly)); diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index c9ca8a27a8d..70bab117358 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -40,7 +40,7 @@ use script::layout_interface::{ContentBoxesQuery, ContentBoxQuery}; use script::layout_interface::{HitTestResponse, LayoutChan, LayoutRPC}; use script::layout_interface::{MouseOverResponse, Msg, NoQuery}; use script::layout_interface::{Reflow, ReflowGoal, ScriptLayoutChan, TrustedNodeAddress}; -use script_traits::{SendEventMsg, ReflowEvent, ReflowCompleteMsg, OpaqueScriptLayoutChannel}; +use script_traits::{ConstellationControlMsg, ReflowEvent, OpaqueScriptLayoutChannel}; use script_traits::{ScriptControlChan, UntrustedNodeAddress}; use servo_msg::compositor_msg::Scrollable; use servo_msg::constellation_msg::Msg as ConstellationMsg; @@ -160,7 +160,7 @@ impl ImageResponder<UntrustedNodeAddress> for LayoutImageResponder { debug!("Dirtying {:x}", node_address as uint); let mut nodes = SmallVec1::new(); nodes.vec_push(node_address); - drop(chan.send_opt(SendEventMsg(id.clone(), ReflowEvent(nodes)))) + drop(chan.send_opt(ConstellationControlMsg::SendEvent(id.clone(), ReflowEvent(nodes)))) }; f } @@ -871,7 +871,7 @@ impl LayoutTask { // either select or a filtered recv() that only looks for messages of a given type. data.script_join_chan.send(()); let ScriptControlChan(ref chan) = data.script_chan; - chan.send(ReflowCompleteMsg(self.id, data.id)); + chan.send(ConstellationControlMsg::ReflowComplete(self.id, data.id)); } unsafe fn dirty_all_nodes(node: &mut LayoutNode) { diff --git a/components/script/script_task.rs b/components/script/script_task.rs index af1611f0787..bc0889970fc 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -42,11 +42,6 @@ use script_traits::CompositorEvent; use script_traits::CompositorEvent::{ResizeEvent, ReflowEvent, ClickEvent}; use script_traits::CompositorEvent::{MouseDownEvent, MouseUpEvent}; use script_traits::CompositorEvent::{MouseMoveEvent, KeyEvent}; -use script_traits::ConstellationControlMsg::{LoadMsg, AttachLayoutMsg}; -use script_traits::ConstellationControlMsg::{ResizeMsg, ResizeInactiveMsg}; -use script_traits::ConstellationControlMsg::{ExitPipelineMsg, SendEventMsg}; -use script_traits::ConstellationControlMsg::{ReflowCompleteMsg, ViewportMsg}; -use script_traits::ConstellationControlMsg::GetTitleMsg; use script_traits::{NewLayoutInfo, OpaqueScriptLayoutChannel}; use script_traits::{ConstellationControlMsg, ScriptControlChan}; use script_traits::ScriptTaskFactory; @@ -513,15 +508,15 @@ impl ScriptTask { // This has to be handled before the ResizeMsg below, // otherwise the page may not have been added to the // child list yet, causing the find() to fail. - MixedMessage::FromConstellation(AttachLayoutMsg(new_layout_info)) => { + MixedMessage::FromConstellation(ConstellationControlMsg::AttachLayout(new_layout_info)) => { self.handle_new_layout(new_layout_info); } - MixedMessage::FromConstellation(ResizeMsg(id, size)) => { + MixedMessage::FromConstellation(ConstellationControlMsg::Resize(id, size)) => { let page = self.page.borrow_mut(); let page = page.find(id).expect("resize sent to nonexistent pipeline"); page.resize_event.set(Some(size)); } - MixedMessage::FromConstellation(ViewportMsg(id, rect)) => { + MixedMessage::FromConstellation(ConstellationControlMsg::Viewport(id, rect)) => { let page = self.page.borrow_mut(); let inner_page = page.find(id).expect("Page rect message sent to nonexistent pipeline"); if inner_page.set_page_clip_rect_with_new_viewport(rect) { @@ -552,7 +547,7 @@ impl ScriptTask { // Process the gathered events. for msg in sequential.into_iter() { match msg { - MixedMessage::FromConstellation(ExitPipelineMsg(id, exit_type)) => { + MixedMessage::FromConstellation(ConstellationControlMsg::ExitPipeline(id, exit_type)) => { if self.handle_exit_pipeline_msg(id, exit_type) { return false } @@ -568,24 +563,23 @@ impl ScriptTask { fn handle_msg_from_constellation(&self, msg: ConstellationControlMsg) { match msg { - // TODO(tkuehn) need to handle auxiliary layouts for iframes - AttachLayoutMsg(_) => - panic!("should have handled AttachLayoutMsg already"), - LoadMsg(id, load_data) => + ConstellationControlMsg::AttachLayout(_) => + panic!("should have handled AttachLayout already"), + ConstellationControlMsg::Load(id, load_data) => self.load(id, load_data), - SendEventMsg(id, event) => + ConstellationControlMsg::SendEvent(id, event) => self.handle_event(id, event), - ReflowCompleteMsg(id, reflow_id) => + ConstellationControlMsg::ReflowComplete(id, reflow_id) => self.handle_reflow_complete_msg(id, reflow_id), - ResizeInactiveMsg(id, new_size) => + ConstellationControlMsg::ResizeInactive(id, new_size) => self.handle_resize_inactive_msg(id, new_size), - ViewportMsg(..) => - panic!("should have handled ViewportMsg already"), - ResizeMsg(..) => - panic!("should have handled ResizeMsg already"), - ExitPipelineMsg(..) => - panic!("should have handled ExitPipelineMsg already"), - GetTitleMsg(pipeline_id) => + ConstellationControlMsg::Viewport(..) => + panic!("should have handled Viewport already"), + ConstellationControlMsg::Resize(..) => + panic!("should have handled Resize already"), + ConstellationControlMsg::ExitPipeline(..) => + panic!("should have handled ExitPipeline already"), + ConstellationControlMsg::GetTitle(pipeline_id) => self.handle_get_title_msg(pipeline_id), } } diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index 15cbf36027d..f53ce386aad 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -50,23 +50,23 @@ pub struct NewLayoutInfo { /// Messages sent from the constellation to the script task pub enum ConstellationControlMsg { /// Loads a new URL on the specified pipeline. - LoadMsg(PipelineId, LoadData), + Load(PipelineId, LoadData), /// Gives a channel and ID to a layout task, as well as the ID of that layout's parent - AttachLayoutMsg(NewLayoutInfo), + AttachLayout(NewLayoutInfo), /// Window resized. Sends a DOM event eventually, but first we combine events. - ResizeMsg(PipelineId, WindowSizeData), + Resize(PipelineId, WindowSizeData), /// Notifies script that window has been resized but to not take immediate action. - ResizeInactiveMsg(PipelineId, WindowSizeData), + ResizeInactive(PipelineId, WindowSizeData), /// Notifies the script that a pipeline should be closed. - ExitPipelineMsg(PipelineId, PipelineExitType), + ExitPipeline(PipelineId, PipelineExitType), /// Sends a DOM event. - SendEventMsg(PipelineId, CompositorEvent), + SendEvent(PipelineId, CompositorEvent), /// Notifies script that reflow is finished. - ReflowCompleteMsg(PipelineId, uint), + ReflowComplete(PipelineId, uint), /// Notifies script of the viewport. - ViewportMsg(PipelineId, Rect<f32>), + Viewport(PipelineId, Rect<f32>), /// Requests that the script task immediately send the constellation the title of a pipeline. - GetTitleMsg(PipelineId), + GetTitle(PipelineId), } /// Events from the compositor that the script task needs to know about |