servo: Merge #6230 - Remove `get_` prefix on getters (from frewsxcv:getters-get); r=nox

Part of #6224

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

Source-Repo: https://github.com/servo/servo
Source-Revision: f6fe1953343a417b62fb310a380af7c6973849b0
This commit is contained in:
Corey Farwell 2015-06-02 08:17:03 -05:00
Родитель 5e7bef5cd5
Коммит 2196fc505a
21 изменённых файлов: 62 добавлений и 70 удалений

Просмотреть файл

@ -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();
}

Просмотреть файл

@ -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
}
}

Просмотреть файл

@ -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

Просмотреть файл

@ -120,7 +120,7 @@ impl ActorRegistry {
}
/// Get start stamp when registry was started
pub fn get_start_stamp(&self) -> PreciseTime {
pub fn start_stamp(&self) -> PreciseTime {
self.start_stamp.clone()
}

Просмотреть файл

@ -138,7 +138,7 @@ impl NetworkEventActor {
self.response.body = body.clone();
}
pub fn get_event_actor(&self) -> EventActor {
pub fn event_actor(&self) -> EventActor {
// TODO: Send the correct values for startedDateTime, isXHR, private
EventActor {
actor: self.name(),
@ -150,7 +150,7 @@ impl NetworkEventActor {
}
}
pub fn get_response_start(&self) -> ResponseStartMsg {
pub fn response_start(&self) -> ResponseStartMsg {
// TODO: Send the correct values for all these fields.
// This is a fake message.
ResponseStartMsg {

Просмотреть файл

@ -264,7 +264,7 @@ impl Actor for TimelineActor {
}
let emitter = Emitter::new(self.name(), registry.get_shareable(),
registry.get_start_stamp(),
registry.start_stamp(),
stream.try_clone().unwrap(),
self.memory_actor.borrow().clone(),
self.framerate_actor.borrow().clone());
@ -273,8 +273,7 @@ impl Actor for TimelineActor {
let msg = StartReply {
from: self.name(),
value: HighResolutionStamp::new(registry.get_start_stamp(),
PreciseTime::now()),
value: HighResolutionStamp::new(registry.start_stamp(), PreciseTime::now()),
};
stream.write_json_packet(&msg);
true
@ -283,8 +282,7 @@ impl Actor for TimelineActor {
"stop" => {
let msg = StopReply {
from: self.name(),
value: HighResolutionStamp::new(registry.get_start_stamp(),
PreciseTime::now()),
value: HighResolutionStamp::new(registry.start_stamp(), PreciseTime::now()),
};
stream.write_json_packet(&msg);

Просмотреть файл

@ -306,7 +306,7 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
let msg = NetworkEventMsg {
from: console_actor_name,
__type__: "networkEvent".to_string(),
eventActor: actor.get_event_actor(),
eventActor: actor.event_actor(),
};
for stream in connections.iter_mut() {
stream.write_json_packet(&msg);
@ -321,7 +321,7 @@ fn run_server(sender: Sender<DevtoolsControlMsg>,
from: netevent_actor_name,
__type__: "networkEventUpdate".to_string(),
updateType: "responseStart".to_string(),
response: actor.get_response_start()
response: actor.response_start()
};
for stream in connections.iter_mut() {

Просмотреть файл

@ -31,7 +31,7 @@ use platform::font_template::FontTemplateData;
pub trait FontHandleMethods {
fn new_from_template(fctx: &FontContextHandle, template: Arc<FontTemplateData>, pt_size: Option<Au>)
-> Result<Self,()>;
fn get_template(&self) -> Arc<FontTemplateData>;
fn template(&self) -> Arc<FontTemplateData>;
fn family_name(&self) -> String;
fn face_name(&self) -> String;
fn is_italic(&self) -> bool;
@ -41,7 +41,7 @@ pub trait FontHandleMethods {
fn glyph_index(&self, codepoint: char) -> Option<GlyphId>;
fn glyph_h_advance(&self, GlyphId) -> Option<FractionalPixel>;
fn glyph_h_kerning(&self, GlyphId, GlyphId) -> FractionalPixel;
fn get_metrics(&self) -> FontMetrics;
fn metrics(&self) -> FontMetrics;
fn get_table_for_tag(&self, FontTableTag) -> Option<FontTable>;
}

Просмотреть файл

@ -113,7 +113,7 @@ impl FontContext {
Some(actual_pt_size));
handle.map(|handle| {
let metrics = handle.get_metrics();
let metrics = handle.metrics();
Font {
handle: handle,
@ -314,4 +314,3 @@ impl borrow::Borrow<usize> for LayoutFontGroupCacheKey {
&self.address
}
}

Просмотреть файл

@ -71,7 +71,7 @@ enum DashSize {
}
impl<'a> PaintContext<'a> {
pub fn get_draw_target(&self) -> &DrawTarget {
pub fn draw_target(&self) -> &DrawTarget {
&self.draw_target
}
@ -675,10 +675,10 @@ impl<'a> PaintContext<'a> {
self.draw_border_path(&rect, direction, border, radius, color);
}
fn get_scaled_bounds(&self,
bounds: &Rect<Au>,
border: &SideOffsets2D<f32>,
shrink_factor: f32) -> Rect<f32> {
fn compute_scaled_bounds(&self,
bounds: &Rect<Au>,
border: &SideOffsets2D<f32>,
shrink_factor: f32) -> Rect<f32> {
let rect = bounds.to_nearest_azure_rect();
let scaled_border = SideOffsets2D::new(shrink_factor * border.top,
shrink_factor * border.right,
@ -709,7 +709,7 @@ impl<'a> PaintContext<'a> {
(1.0/3.0) * border.right,
(1.0/3.0) * border.bottom,
(1.0/3.0) * border.left);
let inner_scaled_bounds = self.get_scaled_bounds(bounds, border, 2.0/3.0);
let inner_scaled_bounds = self.compute_scaled_bounds(bounds, border, 2.0/3.0);
// draw the outer portion of the double border.
self.draw_solid_border_segment(direction, bounds, &scaled_border, radius, color);
// draw the inner portion of the double border.
@ -724,9 +724,9 @@ impl<'a> PaintContext<'a> {
color: Color,
style: border_style::T) {
// original bounds as a Rect<f32>, with no scaling.
let original_bounds = self.get_scaled_bounds(bounds, border, 0.0);
let original_bounds = self.compute_scaled_bounds(bounds, border, 0.0);
// shrink the bounds by 1/2 of the border, leaving the innermost 1/2 of the border
let inner_scaled_bounds = self.get_scaled_bounds(bounds, border, 0.5);
let inner_scaled_bounds = self.compute_scaled_bounds(bounds, border, 0.5);
let scaled_border = SideOffsets2D::new(0.5 * border.top,
0.5 * border.right,
0.5 * border.bottom,
@ -779,7 +779,7 @@ impl<'a> PaintContext<'a> {
_ => panic!("invalid border style")
};
// original bounds as a Rect<f32>
let original_bounds = self.get_scaled_bounds(bounds, border, 0.0);
let original_bounds = self.compute_scaled_bounds(bounds, border, 0.0);
// You can't scale black color (i.e. 'scaled = 0 * scale', equals black).
let mut scaled_color = color::black();
@ -1419,4 +1419,3 @@ impl TemporaryDrawTarget {
}
}

Просмотреть файл

@ -177,9 +177,9 @@ impl<C> PaintTask<C> where C: PaintListener + Send + 'static {
// Ensures that the paint task and graphics context are destroyed before the
// shutdown message.
let mut compositor = compositor;
let native_graphics_context = compositor.get_graphics_metadata().map(
let native_graphics_context = compositor.graphics_metadata().map(
|md| NativePaintingGraphicsContext::from_metadata(&md));
let worker_threads = WorkerThreadProxy::spawn(compositor.get_graphics_metadata(),
let worker_threads = WorkerThreadProxy::spawn(compositor.graphics_metadata(),
font_cache_task,
time_profiler_chan.clone());
@ -724,4 +724,3 @@ pub static THREAD_TINT_COLORS: [Color; 8] = [
Color { r: 255.0/255.0, g: 249.0/255.0, b: 201.0/255.0, a: 0.7 },
Color { r: 137.0/255.0, g: 196.0/255.0, b: 78.0/255.0, a: 0.7 },
];

Просмотреть файл

@ -113,7 +113,7 @@ impl FontHandleMethods for FontHandle {
}
}
}
fn get_template(&self) -> Arc<FontTemplateData> {
fn template(&self) -> Arc<FontTemplateData> {
self.font_data.clone()
}
fn family_name(&self) -> String {
@ -204,9 +204,9 @@ impl FontHandleMethods for FontHandle {
}
}
fn get_metrics(&self) -> FontMetrics {
fn metrics(&self) -> FontMetrics {
/* TODO(Issue #76): complete me */
let face = self.get_face_rec();
let face = self.face_rec_mut();
let underline_size = self.font_units_to_au(face.underline_thickness as f64);
let underline_offset = self.font_units_to_au(face.underline_position as f64);
@ -276,14 +276,14 @@ impl<'a> FontHandle {
}
}
fn get_face_rec(&'a self) -> &'a mut FT_FaceRec {
fn face_rec_mut(&'a self) -> &'a mut FT_FaceRec {
unsafe {
&mut (*self.face)
}
}
fn font_units_to_au(&self, value: f64) -> Au {
let face = self.get_face_rec();
let face = self.face_rec_mut();
// face.size is a *c_void in the bindings, presumably to avoid
// recursive structural types

Просмотреть файл

@ -77,7 +77,7 @@ impl FontHandleMethods for FontHandle {
}
}
fn get_template(&self) -> Arc<FontTemplateData> {
fn template(&self) -> Arc<FontTemplateData> {
self.font_data.clone()
}
@ -157,7 +157,7 @@ impl FontHandleMethods for FontHandle {
Some(advance as FractionalPixel)
}
fn get_metrics(&self) -> FontMetrics {
fn metrics(&self) -> FontMetrics {
let bounding_rect: CGRect = self.ctfont.bounding_box();
let ascent = self.ctfont.ascent() as f64;
let descent = self.ctfont.descent() as f64;
@ -203,4 +203,3 @@ impl FontHandleMethods for FontHandle {
})
}
}

Просмотреть файл

@ -191,7 +191,7 @@ impl<'a> TextRun {
let run = TextRun {
text: Arc::new(text),
font_metrics: font.metrics.clone(),
font_template: font.handle.get_template(),
font_template: font.handle.template(),
actual_pt_size: font.actual_pt_size,
glyphs: Arc::new(glyphs),
};

Просмотреть файл

@ -297,7 +297,7 @@ impl<'a> FlowConstructor<'a> {
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
HTMLElementTypeId::HTMLObjectElement))) => {
let image_info = box ImageFragmentInfo::new(node,
node.get_object_data(),
node.object_data(),
&self.layout_context);
SpecificFragmentInfo::Image(image_info)
}
@ -1254,7 +1254,7 @@ impl<'a> FlowConstructor<'a> {
let layout_data = layout_data_ref.as_mut().expect("no layout data");
let style = (*node.get_style(&layout_data)).clone();
let damage = layout_data.data.restyle_damage;
match node.get_construction_result(layout_data) {
match node.construction_result_mut(layout_data) {
&mut ConstructionResult::None => true,
&mut ConstructionResult::Flow(ref mut flow, _) => {
// The node's flow is of the same type and has the same set of children and can
@ -1474,7 +1474,7 @@ trait NodeUtils {
/// Returns true if this node doesn't render its kids and false otherwise.
fn is_replaced_content(&self) -> bool;
fn get_construction_result<'a>(self, layout_data: &'a mut LayoutDataWrapper)
fn construction_result_mut<'a>(self, layout_data: &'a mut LayoutDataWrapper)
-> &'a mut ConstructionResult;
/// Sets the construction result of a flow.
@ -1505,7 +1505,7 @@ impl<'ln> NodeUtils for ThreadSafeLayoutNode<'ln> {
}
}
fn get_construction_result<'a>(self, layout_data: &'a mut LayoutDataWrapper) -> &'a mut ConstructionResult {
fn construction_result_mut<'a>(self, layout_data: &'a mut LayoutDataWrapper) -> &'a mut ConstructionResult {
match self.get_pseudo_element_type() {
PseudoElementType::Before(_) => &mut layout_data.data.before_flow_construction_result,
PseudoElementType::After (_) => &mut layout_data.data.after_flow_construction_result,
@ -1518,7 +1518,7 @@ impl<'ln> NodeUtils for ThreadSafeLayoutNode<'ln> {
let mut layout_data_ref = self.mutate_layout_data();
let layout_data = layout_data_ref.as_mut().expect("no layout data");
let dst = self.get_construction_result(layout_data);
let dst = self.construction_result_mut(layout_data);
*dst = result;
}
@ -1528,7 +1528,7 @@ impl<'ln> NodeUtils for ThreadSafeLayoutNode<'ln> {
let mut layout_data_ref = self.mutate_layout_data();
let layout_data = layout_data_ref.as_mut().expect("no layout data");
self.get_construction_result(layout_data).swap_out()
self.construction_result_mut(layout_data).swap_out()
}
}
@ -1541,7 +1541,7 @@ trait ObjectElement<'a> {
fn has_object_data(&self) -> bool;
/// Returns the "data" attribute value parsed as a URL
fn get_object_data(&self) -> Option<Url>;
fn object_data(&self) -> Option<Url>;
}
impl<'ln> ObjectElement<'ln> for ThreadSafeLayoutNode<'ln> {
@ -1557,7 +1557,7 @@ impl<'ln> ObjectElement<'ln> for ThreadSafeLayoutNode<'ln> {
}
}
fn get_object_data(&self) -> Option<Url> {
fn object_data(&self) -> Option<Url> {
match self.get_type_and_data() {
(None, Some(uri)) if is_image_data(uri) => Url::parse(uri).ok(),
_ => None
@ -1632,4 +1632,3 @@ pub fn strip_ignorable_whitespace_from_end(this: &mut LinkedList<Fragment>) {
drop(this.pop_back());
}
}

Просмотреть файл

@ -294,9 +294,9 @@ impl CanvasFragmentInfo {
pub fn new(node: &ThreadSafeLayoutNode) -> CanvasFragmentInfo {
CanvasFragmentInfo {
replaced_image_fragment_info: ReplacedImageFragmentInfo::new(node,
Some(Au::from_px(node.get_canvas_width() as i32)),
Some(Au::from_px(node.get_canvas_height() as i32))),
renderer: node.get_renderer().map(|rec| Arc::new(Mutex::new(rec))),
Some(Au::from_px(node.canvas_width() as i32)),
Some(Au::from_px(node.canvas_height() as i32))),
renderer: node.renderer().map(|rec| Arc::new(Mutex::new(rec))),
}
}
@ -2208,4 +2208,3 @@ impl<'a> InlineStyleIterator<'a> {
}
}
}

Просмотреть файл

@ -123,7 +123,7 @@ pub trait TLayoutNode {
}
}
fn get_renderer(&self) -> Option<Sender<CanvasMsg>> {
fn renderer(&self) -> Option<Sender<CanvasMsg>> {
unsafe {
let canvas_element: Option<LayoutJS<HTMLCanvasElement>> =
HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged());
@ -131,7 +131,7 @@ pub trait TLayoutNode {
}
}
fn get_canvas_width(&self) -> u32 {
fn canvas_width(&self) -> u32 {
unsafe {
let canvas_element: Option<LayoutJS<HTMLCanvasElement>> =
HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged());
@ -139,7 +139,7 @@ pub trait TLayoutNode {
}
}
fn get_canvas_height(&self) -> u32 {
fn canvas_height(&self) -> u32 {
unsafe {
let canvas_element: Option<LayoutJS<HTMLCanvasElement>> =
HTMLCanvasElementCast::to_layout_js(self.get_jsmanaged());

Просмотреть файл

@ -77,7 +77,7 @@ pub struct LayerProperties {
/// The interface used by the painter to acquire draw targets for each paint frame and
/// submit them to be drawn to the display.
pub trait PaintListener {
fn get_graphics_metadata(&mut self) -> Option<NativeGraphicsMetadata>;
fn graphics_metadata(&mut self) -> Option<NativeGraphicsMetadata>;
/// Informs the compositor of the layers for the given pipeline. The compositor responds by
/// creating and/or destroying paint layers as necessary.

Просмотреть файл

@ -263,7 +263,7 @@ impl CORSCache for CORSCacheSender {
/// ```ignore
/// let task = CORSCacheTask::new();
/// let builder = TaskBuilder::new().named("XHRTask");
/// let mut sender = task.get_sender();
/// let mut sender = task.sender();
/// builder.spawn(move || { task.run() });
/// sender.insert(CORSCacheEntry::new(/* parameters here */));
/// ```
@ -284,7 +284,7 @@ impl CORSCacheTask {
}
/// Provides a sender to the cache task
pub fn get_sender(&self) -> CORSCacheSender {
pub fn sender(&self) -> CORSCacheSender {
self.sender.clone()
}

Просмотреть файл

@ -10,13 +10,13 @@ use std::sync::mpsc::channel;
pub trait ClipboardProvider {
// blocking method to get the clipboard contents
fn get_clipboard_contents(&mut self) -> String;
fn clipboard_contents(&mut self) -> String;
// blocking method to set the clipboard contents
fn set_clipboard_contents(&mut self, &str);
}
impl ClipboardProvider for ConstellationChan {
fn get_clipboard_contents(&mut self) -> String {
fn clipboard_contents(&mut self) -> String {
let (tx, rx) = channel();
self.0.send(ConstellationMsg::GetClipboardContents(tx)).unwrap();
rx.recv().unwrap()
@ -39,7 +39,7 @@ impl DummyClipboardContext {
}
impl ClipboardProvider for DummyClipboardContext {
fn get_clipboard_contents(&mut self) -> String {
fn clipboard_contents(&mut self) -> String {
self.content.clone()
}
fn set_clipboard_contents(&mut self, s: &str) {

Просмотреть файл

@ -315,7 +315,7 @@ impl<T: ClipboardProvider> TextInput<T> {
KeyReaction::Nothing
},
Key::V if is_control_key(mods) => {
let contents = self.clipboard_provider.get_clipboard_contents();
let contents = self.clipboard_provider.clipboard_contents();
self.insert_string(&contents);
KeyReaction::DispatchInput
},