Auto merge of #6230 - frewsxcv:getters-get, r=nox

Part of #6224

I certainly didn't remove all of them; I avoided `unsafe` areas and also `components/script`

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6230)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-06-02 08:17:03 -05:00
commit f6fe195334
21 changed files with 62 additions and 70 deletions

View file

@ -885,7 +885,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
let url = Url::parse(&url_string).unwrap();
self.window.set_page_url(url.clone());
let msg = match self.scene.root {
Some(ref layer) => ConstellationMsg::LoadUrl(layer.get_pipeline_id(), LoadData::new(url)),
Some(ref layer) => ConstellationMsg::LoadUrl(layer.pipeline_id(), LoadData::new(url)),
None => ConstellationMsg::InitLoadUrl(url)
};
@ -1117,7 +1117,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
let mut results: HashMap<PipelineId, Vec<PaintRequest>> = HashMap::new();
for (layer, mut layer_requests) in requests.into_iter() {
let pipeline_id = layer.get_pipeline_id();
let pipeline_id = layer.pipeline_id();
let current_epoch = self.pipeline_details.get(&pipeline_id).unwrap().current_epoch;
layer.extra_data.borrow_mut().requested_epoch = current_epoch;
let vec = match results.entry(pipeline_id) {
@ -1151,7 +1151,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
Vec<Box<LayerBuffer>>)>) {
for (layer, buffers) in unused_buffers.into_iter() {
if !buffers.is_empty() {
let pipeline = self.get_pipeline(layer.get_pipeline_id());
let pipeline = self.get_pipeline(layer.pipeline_id());
let _ = pipeline.paint_chan.send_opt(PaintMsg::UnusedBuffer(buffers));
}
}
@ -1161,7 +1161,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
if layer.extra_data.borrow().id == LayerId::null() {
let layer_rect = Rect(-layer.extra_data.borrow().scroll_offset.to_untyped(),
layer.bounds.borrow().size.to_untyped());
let pipeline = self.get_pipeline(layer.get_pipeline_id());
let pipeline = self.get_pipeline(layer.pipeline_id());
let ScriptControlChan(ref chan) = pipeline.script_chan;
chan.send(ConstellationControlMsg::Viewport(pipeline.id.clone(), layer_rect)).unwrap();
}

View file

@ -141,7 +141,7 @@ pub trait CompositorLayer {
fn wants_scroll_events(&self) -> WantsScrollEventsFlag;
/// Return the pipeline id associated with this layer.
fn get_pipeline_id(&self) -> PipelineId;
fn pipeline_id(&self) -> PipelineId;
}
#[derive(Copy, PartialEq, Clone)]
@ -225,7 +225,7 @@ impl CompositorLayer for Layer<CompositorData> {
let unused_buffers = self.collect_unused_buffers();
if !unused_buffers.is_empty() { // send back unused buffers
let pipeline = compositor.get_pipeline(self.get_pipeline_id());
let pipeline = compositor.get_pipeline(self.pipeline_id());
let _ = pipeline.paint_chan.send(PaintMsg::UnusedBuffer(unused_buffers));
}
}
@ -241,7 +241,7 @@ impl CompositorLayer for Layer<CompositorData> {
buffer.mark_wont_leak()
}
let pipeline = compositor.get_pipeline(self.get_pipeline_id());
let pipeline = compositor.get_pipeline(self.pipeline_id());
let _ = pipeline.paint_chan.send(PaintMsg::UnusedBuffer(buffers));
}
}
@ -370,7 +370,7 @@ impl CompositorLayer for Layer<CompositorData> {
MouseUpEvent(button, event_point),
};
let pipeline = compositor.get_pipeline(self.get_pipeline_id());
let pipeline = compositor.get_pipeline(self.pipeline_id());
let ScriptControlChan(ref chan) = pipeline.script_chan;
let _ = chan.send(ConstellationControlMsg::SendEvent(pipeline.id.clone(), message));
}
@ -380,7 +380,7 @@ impl CompositorLayer for Layer<CompositorData> {
cursor: TypedPoint2D<LayerPixel, f32>)
where Window: WindowMethods {
let message = MouseMoveEvent(cursor.to_untyped());
let pipeline = compositor.get_pipeline(self.get_pipeline_id());
let pipeline = compositor.get_pipeline(self.pipeline_id());
let ScriptControlChan(ref chan) = pipeline.script_chan;
let _ = chan.send(ConstellationControlMsg::SendEvent(pipeline.id.clone(), message));
}
@ -409,7 +409,7 @@ impl CompositorLayer for Layer<CompositorData> {
self.extra_data.borrow().wants_scroll_events
}
fn get_pipeline_id(&self) -> PipelineId {
fn pipeline_id(&self) -> PipelineId {
self.extra_data.borrow().pipeline_id
}
}

View file

@ -91,7 +91,7 @@ impl ScriptListener for Box<CompositorProxy+'static+Send> {
/// Implementation of the abstract `PaintListener` interface.
impl PaintListener for Box<CompositorProxy+'static+Send> {
fn get_graphics_metadata(&mut self) -> Option<NativeGraphicsMetadata> {
fn graphics_metadata(&mut self) -> Option<NativeGraphicsMetadata> {
let (chan, port) = channel();
self.send(Msg::GetGraphicsMetadata(chan));
// If the compositor is shutting down when a paint task