mirror of
https://github.com/servo/servo.git
synced 2025-06-08 00:23:30 +00:00
parent
7c63c7d7c1
commit
14ac1ef75a
7 changed files with 24 additions and 70 deletions
|
@ -62,7 +62,7 @@ use script_traits::{CompositorEvent, MouseButton};
|
|||
use script_traits::ConstellationControlMsg;
|
||||
use script_traits::{NewLayoutInfo, OpaqueScriptLayoutChannel};
|
||||
use script_traits::{ScriptState, ScriptTaskFactory};
|
||||
use msg::compositor_msg::{LayerId, ScriptListener};
|
||||
use msg::compositor_msg::{LayerId, ScriptToCompositorMsg};
|
||||
use msg::constellation_msg::{ConstellationChan, FocusType};
|
||||
use msg::constellation_msg::{LoadData, PipelineId, SubpageId, MozBrowserEvent, WorkerId};
|
||||
use msg::constellation_msg::{Failure, WindowSizeData, PipelineExitType};
|
||||
|
@ -97,7 +97,7 @@ use url::{Url, UrlParser};
|
|||
use libc;
|
||||
use std::any::Any;
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::cell::{Cell, RefCell, RefMut};
|
||||
use std::collections::HashSet;
|
||||
use std::io::{stdout, Write};
|
||||
use std::mem as std_mem;
|
||||
|
@ -361,7 +361,7 @@ pub struct ScriptTask {
|
|||
constellation_chan: ConstellationChan,
|
||||
|
||||
/// A handle to the compositor for communicating ready state messages.
|
||||
compositor: DOMRefCell<ScriptListener>,
|
||||
compositor: DOMRefCell<IpcSender<ScriptToCompositorMsg>>,
|
||||
|
||||
/// The port on which we receive messages from the image cache
|
||||
image_cache_port: Receiver<ImageCacheResult>,
|
||||
|
@ -443,7 +443,7 @@ impl ScriptTaskFactory for ScriptTask {
|
|||
fn create(_phantom: Option<&mut ScriptTask>,
|
||||
id: PipelineId,
|
||||
parent_info: Option<(PipelineId, SubpageId)>,
|
||||
compositor: ScriptListener,
|
||||
compositor: IpcSender<ScriptToCompositorMsg>,
|
||||
layout_chan: &OpaqueScriptLayoutChannel,
|
||||
control_chan: Sender<ConstellationControlMsg>,
|
||||
control_port: Receiver<ConstellationControlMsg>,
|
||||
|
@ -579,7 +579,7 @@ impl ScriptTask {
|
|||
}
|
||||
|
||||
/// Creates a new script task.
|
||||
pub fn new(compositor: ScriptListener,
|
||||
pub fn new(compositor: IpcSender<ScriptToCompositorMsg>,
|
||||
port: Receiver<MainThreadScriptMsg>,
|
||||
chan: MainThreadScriptChan,
|
||||
control_chan: Sender<ConstellationControlMsg>,
|
||||
|
@ -1329,7 +1329,7 @@ impl ScriptTask {
|
|||
// TODO(tkuehn): currently there is only one window,
|
||||
// so this can afford to be naive and just shut down the
|
||||
// compositor. In the future it'll need to be smarter.
|
||||
self.compositor.borrow_mut().close();
|
||||
(*(RefMut::map(self.compositor.borrow_mut(), |t| t))).send(ScriptToCompositorMsg::Exit).unwrap();
|
||||
}
|
||||
|
||||
/// We have received notification that the response associated with a load has completed.
|
||||
|
@ -1506,7 +1506,7 @@ impl ScriptTask {
|
|||
MainThreadScriptChan(sender.clone()),
|
||||
self.image_cache_channel.clone(),
|
||||
self.control_chan.clone(),
|
||||
self.compositor.borrow_mut().dup(),
|
||||
(*(RefMut::map(self.compositor.borrow_mut(), |t| t))).clone(),
|
||||
self.image_cache_task.clone(),
|
||||
self.resource_task.clone(),
|
||||
self.storage_task.clone(),
|
||||
|
@ -1601,7 +1601,8 @@ impl ScriptTask {
|
|||
// Really what needs to happen is that this needs to go through layout to ask which
|
||||
// layer the element belongs to, and have it send the scroll message to the
|
||||
// compositor.
|
||||
self.compositor.borrow_mut().scroll_fragment_point(pipeline_id, LayerId::null(), point);
|
||||
(*(RefMut::map(self.compositor.borrow_mut(), |t| t))).send(
|
||||
ScriptToCompositorMsg::ScrollFragmentPoint(pipeline_id, LayerId::null(), point)).unwrap();
|
||||
}
|
||||
|
||||
/// Reflows non-incrementally, rebuilding the entire layout tree in the process.
|
||||
|
@ -1699,7 +1700,7 @@ impl ScriptTask {
|
|||
let page = get_page(&self.root_page(), pipeline_id);
|
||||
let document = page.document();
|
||||
document.r().dispatch_key_event(
|
||||
key, state, modifiers, &mut *self.compositor.borrow_mut());
|
||||
key, state, modifiers, &mut *(RefMut::map(self.compositor.borrow_mut(), |t| t)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue