Remove get_ prefix on getters

Part of #6224

I certainly didn't remove all of them; I avoided `unsafe` areas and also `components/script`
This commit is contained in:
Corey Farwell 2015-05-31 12:45:04 -04:00
parent c63fc4dc13
commit 435e551753
21 changed files with 62 additions and 70 deletions

View file

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

View file

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

View file

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

View file

@ -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 },
];

View file

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

View file

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

View file

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