Auto merge of #7559 - ddrmanxbxfr:RFC-0344-Work, r=nox

Remove 'get_*' on getters as per RFC 0344 on canevas, compositing, devtools, gfx, layout, net, profile, servo and webdriver_server

Hi guys,

I just gave a big pass of RFC-0344 as per issue #6224 .

Pretty much renamed all the get_* fn that were used to fetch values. 

I hope I didn't rename too much. 

As said in the issue discussion, I didn't touch at the scripts folder so we keep the unsafe ones pretty explicit.

I've ran the whole pass of test, everything seems to be still working right :).

Please give feedback on this PR.

Thanks for looking into it.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7559)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-09-12 18:29:56 -06:00
commit b05f4aa3aa
30 changed files with 167 additions and 168 deletions

View file

@ -373,12 +373,12 @@ impl<Window: WindowMethods> IOCompositor<Window> {
ShutdownState::NotShuttingDown) => {
self.set_frame_tree(&frame_tree, response_chan, new_constellation_chan);
self.send_viewport_rects_for_all_layers();
self.get_title_for_main_frame();
self.title_for_main_frame();
}
(Msg::InitializeLayersForPipeline(pipeline_id, epoch, properties),
ShutdownState::NotShuttingDown) => {
self.get_or_create_pipeline_details(pipeline_id).current_epoch = epoch;
self.pipeline_details(pipeline_id).current_epoch = epoch;
self.collect_old_layers(pipeline_id, &properties);
for (index, layer_properties) in properties.iter().enumerate() {
if index == 0 {
@ -553,28 +553,28 @@ impl<Window: WindowMethods> IOCompositor<Window> {
animation_state: AnimationState) {
match animation_state {
AnimationState::AnimationsPresent => {
self.get_or_create_pipeline_details(pipeline_id).animations_running = true;
self.pipeline_details(pipeline_id).animations_running = true;
self.composite_if_necessary(CompositingReason::Animation);
}
AnimationState::AnimationCallbacksPresent => {
if self.get_or_create_pipeline_details(pipeline_id).animation_callbacks_running {
if self.pipeline_details(pipeline_id).animation_callbacks_running {
return
}
self.get_or_create_pipeline_details(pipeline_id).animation_callbacks_running =
self.pipeline_details(pipeline_id).animation_callbacks_running =
true;
self.tick_animations_for_pipeline(pipeline_id);
self.composite_if_necessary(CompositingReason::Animation);
}
AnimationState::NoAnimationsPresent => {
self.get_or_create_pipeline_details(pipeline_id).animations_running = false;
self.pipeline_details(pipeline_id).animations_running = false;
}
AnimationState::NoAnimationCallbacksPresent => {
self.get_or_create_pipeline_details(pipeline_id).animation_callbacks_running = false;
self.pipeline_details(pipeline_id).animation_callbacks_running = false;
}
}
}
pub fn get_or_create_pipeline_details<'a>(&'a mut self,
pub fn pipeline_details<'a>(&'a mut self,
pipeline_id: PipelineId)
-> &'a mut PipelineDetails {
if !self.pipeline_details.contains_key(&pipeline_id) {
@ -583,7 +583,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
return self.pipeline_details.get_mut(&pipeline_id).unwrap();
}
pub fn get_pipeline<'a>(&'a self, pipeline_id: PipelineId) -> &'a CompositionPipeline {
pub fn pipeline<'a>(&'a self, pipeline_id: PipelineId) -> &'a CompositionPipeline {
match self.pipeline_details.get(&pipeline_id) {
Some(ref details) => {
match details.pipeline {
@ -656,7 +656,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
WantsScrollEventsFlag::WantsScrollEvents,
opts::get().tile_size);
self.get_or_create_pipeline_details(pipeline.id).pipeline = Some(pipeline.clone());
self.pipeline_details(pipeline.id).pipeline = Some(pipeline.clone());
// All root layers mask to bounds.
*root_layer.masks_to_bounds.borrow_mut() = true;
@ -1306,7 +1306,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
if layer.extra_data.borrow().id == LayerId::null() {
let layer_rect = Rect::new(-layer.extra_data.borrow().scroll_offset.to_untyped(),
layer.bounds.borrow().size.to_untyped());
let pipeline = self.get_pipeline(layer.pipeline_id());
let pipeline = self.pipeline(layer.pipeline_id());
pipeline.script_chan.send(ConstellationControlMsg::Viewport(pipeline.id.clone(), layer_rect)).unwrap();
}
@ -1348,7 +1348,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
for (pipeline_id, requests) in pipeline_requests {
let msg = ChromeToPaintMsg::Paint(requests, self.frame_tree_id);
let _ = self.get_pipeline(pipeline_id).chrome_to_paint_chan.send(msg);
let _ = self.pipeline(pipeline_id).chrome_to_paint_chan.send(msg);
}
true
@ -1790,7 +1790,7 @@ impl<Window> CompositorEventListener for IOCompositor<Window> where Window: Wind
self.viewport_zoom.get() as f32
}
fn get_title_for_main_frame(&self) {
fn title_for_main_frame(&self) {
let root_pipeline_id = match self.root_pipeline {
None => return,
Some(ref root_pipeline) => root_pipeline.id,

View file

@ -404,7 +404,7 @@ impl CompositorLayer for Layer<CompositorData> {
MouseUpEvent(button, event_point),
};
let pipeline = compositor.get_pipeline(self.pipeline_id());
let pipeline = compositor.pipeline(self.pipeline_id());
let _ = pipeline.script_chan.send(ConstellationControlMsg::SendEvent(pipeline.id.clone(), message));
}
@ -413,7 +413,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.pipeline_id());
let pipeline = compositor.pipeline(self.pipeline_id());
let _ = pipeline.script_chan.send(ConstellationControlMsg::SendEvent(pipeline.id.clone(), message));
}

View file

@ -294,5 +294,5 @@ pub trait CompositorEventListener {
fn shutdown(&mut self);
fn pinch_zoom_level(&self) -> f32;
/// Requests that the compositor send the title for the main frame as soon as possible.
fn get_title_for_main_frame(&self);
fn title_for_main_frame(&self);
}

View file

@ -152,5 +152,5 @@ impl CompositorEventListener for NullCompositor {
1.0
}
fn get_title_for_main_frame(&self) {}
fn title_for_main_frame(&self) {}
}