aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2015-05-05 18:23:29 +0200
committerSimon Sapin <simon.sapin@exyr.org>2015-05-05 18:23:29 +0200
commit8b522f2e7d08aaf73429207cbbfd9da915f6d9a5 (patch)
treec4c7e7247ac5685aa4ec5048187132492b8eb6b9
parent32d5e24922e47322bf67c100fa4c178bc9b430f4 (diff)
downloadservo-8b522f2e7d08aaf73429207cbbfd9da915f6d9a5.tar.gz
servo-8b522f2e7d08aaf73429207cbbfd9da915f6d9a5.zip
Rename Au methods with f32/f64 instead of frac32/frac/subpx
-rw-r--r--components/gfx/display_list/mod.rs6
-rw-r--r--components/gfx/filters.rs2
-rw-r--r--components/gfx/font_context.rs4
-rw-r--r--components/gfx/paint_context.rs30
-rw-r--r--components/gfx/paint_task.rs4
-rw-r--r--components/gfx/platform/freetype/font.rs6
-rw-r--r--components/gfx/platform/macos/font.rs8
-rw-r--r--components/gfx/text/glyph.rs2
-rw-r--r--components/gfx/text/shaping/harfbuzz.rs12
-rw-r--r--components/layout/display_list_builder.rs36
-rw-r--r--components/layout/fragment.rs10
-rw-r--r--components/layout/inline.rs2
-rw-r--r--components/layout/layout_task.rs8
-rw-r--r--components/layout/model.rs6
-rw-r--r--components/layout/table.rs4
-rw-r--r--components/layout/table_wrapper.rs10
-rw-r--r--components/script/dom/htmlanchorelement.rs4
-rw-r--r--components/script/dom/window.rs8
-rw-r--r--components/script/script_task.rs2
-rw-r--r--components/style/media_queries.rs4
-rw-r--r--components/style/properties.mako.rs4
-rw-r--r--components/style/values.rs8
-rw-r--r--components/util/geometry.rs18
23 files changed, 99 insertions, 99 deletions
diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs
index f3cf053daa8..40416ed9e8d 100644
--- a/components/gfx/display_list/mod.rs
+++ b/components/gfx/display_list/mod.rs
@@ -489,9 +489,9 @@ impl StackingContext {
point = point - self.bounds.origin;
debug_assert!(!topmost_only || result.is_empty());
- let frac_point = self.transform.transform_point(&Point2D(point.x.to_frac32_px(),
- point.y.to_frac32_px()));
- point = Point2D(Au::from_frac32_px(frac_point.x), Au::from_frac32_px(frac_point.y));
+ let frac_point = self.transform.transform_point(&Point2D(point.x.to_f32_px(),
+ point.y.to_f32_px()));
+ point = Point2D(Au::from_f32_px(frac_point.x), Au::from_f32_px(frac_point.y));
// Iterate through display items in reverse stacking order. Steps here refer to the
// painting steps in CSS 2.1 Appendix E.
diff --git a/components/gfx/filters.rs b/components/gfx/filters.rs
index 2882adfb323..38db24ec318 100644
--- a/components/gfx/filters.rs
+++ b/components/gfx/filters.rs
@@ -95,7 +95,7 @@ pub fn create_filters(draw_target: &DrawTarget,
}
filter::Filter::Blur(amount) => {
*accumulated_blur_radius = accumulated_blur_radius.clone() + amount;
- let amount = amount.to_frac32_px();
+ let amount = amount.to_f32_px();
let blur = draw_target.create_filter(FilterType::GaussianBlur);
blur.set_attribute(GaussianBlurAttribute::StdDeviation(amount));
blur.set_input(GaussianBlurInput, &filter);
diff --git a/components/gfx/font_context.rs b/components/gfx/font_context.rs
index b10a90c0fac..d02d798ca2c 100644
--- a/components/gfx/font_context.rs
+++ b/components/gfx/font_context.rs
@@ -36,13 +36,13 @@ use azure::scaled_font::FontInfo;
#[cfg(any(target_os="linux", target_os = "android"))]
fn create_scaled_font(template: &Arc<FontTemplateData>, pt_size: Au) -> ScaledFont {
ScaledFont::new(BackendType::Skia, FontInfo::FontData(&template.bytes),
- pt_size.to_subpx() as AzFloat)
+ pt_size.to_f64_px() as AzFloat)
}
#[cfg(target_os="macos")]
fn create_scaled_font(template: &Arc<FontTemplateData>, pt_size: Au) -> ScaledFont {
let cgfont = template.ctfont.as_ref().unwrap().copy_to_CGFont();
- ScaledFont::new(BackendType::Skia, &cgfont, pt_size.to_subpx() as AzFloat)
+ ScaledFont::new(BackendType::Skia, &cgfont, pt_size.to_f64_px() as AzFloat)
}
static SMALL_CAPS_SCALE_FACTOR: f32 = 0.8; // Matches FireFox (see gfxFont.h)
diff --git a/components/gfx/paint_context.rs b/components/gfx/paint_context.rs
index 6130cc7a1f7..0aadd9c16b4 100644
--- a/components/gfx/paint_context.rs
+++ b/components/gfx/paint_context.rs
@@ -826,16 +826,16 @@ impl<'a> PaintContext<'a> {
let baseline_origin = match text.orientation {
Upright => text.baseline_origin,
SidewaysLeft => {
- let x = text.baseline_origin.x.to_subpx() as AzFloat;
- let y = text.baseline_origin.y.to_subpx() as AzFloat;
+ let x = text.baseline_origin.x.to_f64_px() as AzFloat;
+ let y = text.baseline_origin.y.to_f64_px() as AzFloat;
self.draw_target.set_transform(&draw_target_transform.mul(&Matrix2D::new(0., -1.,
1., 0.,
x, y)));
Point2D::zero()
}
SidewaysRight => {
- let x = text.baseline_origin.x.to_subpx() as AzFloat;
- let y = text.baseline_origin.y.to_subpx() as AzFloat;
+ let x = text.baseline_origin.x.to_f64_px() as AzFloat;
+ let y = text.baseline_origin.y.to_f64_px() as AzFloat;
self.draw_target.set_transform(&draw_target_transform.mul(&Matrix2D::new(0., 1.,
-1., 0.,
x, y)));
@@ -1060,7 +1060,7 @@ impl<'a> PaintContext<'a> {
}
let blur_filter = self.draw_target.create_filter(FilterType::GaussianBlur);
- blur_filter.set_attribute(GaussianBlurAttribute::StdDeviation(blur_radius.to_subpx() as
+ blur_filter.set_attribute(GaussianBlurAttribute::StdDeviation(blur_radius.to_f64_px() as
AzFloat));
blur_filter.set_input(GaussianBlurInput, &temporary_draw_target.draw_target.snapshot());
temporary_draw_target.draw_filter(&self.draw_target, blur_filter);
@@ -1104,21 +1104,21 @@ impl<'a> PaintContext<'a> {
pub trait ToAzurePoint {
fn to_azure_point(&self) -> Point2D<AzFloat>;
- fn to_subpx_azure_point(&self) -> Point2D<AzFloat>;
+ fn to_f64_px_azure_point(&self) -> Point2D<AzFloat>;
}
impl ToAzurePoint for Point2D<Au> {
fn to_azure_point(&self) -> Point2D<AzFloat> {
Point2D(self.x.to_nearest_px() as AzFloat, self.y.to_nearest_px() as AzFloat)
}
- fn to_subpx_azure_point(&self) -> Point2D<AzFloat> {
- Point2D(self.x.to_subpx() as AzFloat, self.y.to_subpx() as AzFloat)
+ fn to_f64_px_azure_point(&self) -> Point2D<AzFloat> {
+ Point2D(self.x.to_f64_px() as AzFloat, self.y.to_f64_px() as AzFloat)
}
}
pub trait ToAzureRect {
fn to_azure_rect(&self) -> Rect<AzFloat>;
- fn to_subpx_azure_rect(&self) -> Rect<AzFloat>;
+ fn to_f64_px_azure_rect(&self) -> Rect<AzFloat>;
}
impl ToAzureRect for Rect<Au> {
@@ -1127,9 +1127,9 @@ impl ToAzureRect for Rect<Au> {
self.size.height.to_nearest_px() as AzFloat))
}
- fn to_subpx_azure_rect(&self) -> Rect<AzFloat> {
- Rect(self.origin.to_subpx_azure_point(), Size2D(self.size.width.to_subpx() as AzFloat,
- self.size.height.to_subpx() as AzFloat))
+ fn to_f64_px_azure_rect(&self) -> Rect<AzFloat> {
+ Rect(self.origin.to_f64_px_azure_point(), Size2D(self.size.width.to_f64_px() as AzFloat,
+ self.size.height.to_f64_px() as AzFloat))
}
}
@@ -1241,8 +1241,8 @@ impl ScaledFontExtensionMethods for ScaledFont {
let azglyph = struct__AzGlyph {
mIndex: glyph.id() as uint32_t,
mPosition: struct__AzPoint {
- x: (origin.x + glyph_offset.x).to_subpx() as AzFloat,
- y: (origin.y + glyph_offset.y).to_subpx() as AzFloat
+ x: (origin.x + glyph_offset.x).to_f64_px() as AzFloat,
+ y: (origin.y + glyph_offset.y).to_f64_px() as AzFloat
}
};
origin = Point2D(origin.x + glyph_advance, origin.y);
@@ -1385,7 +1385,7 @@ impl TemporaryDrawTarget {
fn from_bounds(main_draw_target: &DrawTarget, bounds: &Rect<Au>) -> TemporaryDrawTarget {
let draw_target_transform = main_draw_target.get_transform();
let temporary_draw_target_bounds =
- draw_target_transform.transform_rect(&bounds.to_subpx_azure_rect());
+ draw_target_transform.transform_rect(&bounds.to_f64_px_azure_rect());
let temporary_draw_target_size =
Size2D(temporary_draw_target_bounds.size.width.ceil() as i32,
temporary_draw_target_bounds.size.height.ceil() as i32);
diff --git a/components/gfx/paint_task.rs b/components/gfx/paint_task.rs
index fbdfbe82d5d..77adfc3c15b 100644
--- a/components/gfx/paint_task.rs
+++ b/components/gfx/paint_task.rs
@@ -546,8 +546,8 @@ impl WorkerThread {
// Apply a translation to start at the boundaries of the stacking context, since the
// layer's origin starts at its overflow rect's origin.
let tile_bounds = tile.page_rect.translate(
- &Point2D(stacking_context.overflow.origin.x.to_subpx() as AzFloat,
- stacking_context.overflow.origin.y.to_subpx() as AzFloat));
+ &Point2D(stacking_context.overflow.origin.x.to_f64_px() as AzFloat,
+ stacking_context.overflow.origin.y.to_f64_px() as AzFloat));
// Apply the translation to paint the tile we want.
let matrix: Matrix2D<AzFloat> = Matrix2D::identity();
diff --git a/components/gfx/platform/freetype/font.rs b/components/gfx/platform/freetype/font.rs
index 00b0e1f6c02..f65104aa649 100644
--- a/components/gfx/platform/freetype/font.rs
+++ b/components/gfx/platform/freetype/font.rs
@@ -257,7 +257,7 @@ impl FontHandleMethods for FontHandle {
line_gap: height,
};
- debug!("Font metrics (@{}px): {:?}", em_size.to_frac32_px(), metrics);
+ debug!("Font metrics (@{}px): {:?}", em_size.to_f32_px(), metrics);
return metrics;
}
@@ -268,7 +268,7 @@ impl FontHandleMethods for FontHandle {
impl<'a> FontHandle {
fn set_char_size(face: FT_Face, pt_size: Au) -> Result<(), ()>{
- let char_width = float_to_fixed_ft((0.5f64 + pt_size.to_subpx()).floor()) as FT_F26Dot6;
+ let char_width = float_to_fixed_ft((0.5f64 + pt_size.to_f64_px()).floor()) as FT_F26Dot6;
unsafe {
let result = FT_Set_Char_Size(face, char_width, 0, 0, 0);
@@ -296,6 +296,6 @@ impl<'a> FontHandle {
// If this isn't true then we're scaling one of the axes wrong
assert!(metrics.x_ppem == metrics.y_ppem);
- return Au::from_frac_px(value * x_scale);
+ return Au::from_f64_px(value * x_scale);
}
}
diff --git a/components/gfx/platform/macos/font.rs b/components/gfx/platform/macos/font.rs
index 8f74f99dfbe..f05bad2788f 100644
--- a/components/gfx/platform/macos/font.rs
+++ b/components/gfx/platform/macos/font.rs
@@ -62,7 +62,7 @@ impl FontHandleMethods for FontHandle {
pt_size: Option<Au>)
-> Result<FontHandle, ()> {
let size = match pt_size {
- Some(s) => s.to_subpx(),
+ Some(s) => s.to_f64_px(),
None => 0.0
};
match template.ctfont {
@@ -162,7 +162,7 @@ impl FontHandleMethods for FontHandle {
let bounding_rect: CGRect = self.ctfont.bounding_box();
let ascent = self.ctfont.ascent() as f64;
let descent = self.ctfont.descent() as f64;
- let em_size = Au::from_frac_px(self.ctfont.pt_size() as f64);
+ let em_size = Au::from_f64_px(self.ctfont.pt_size() as f64);
let leading = self.ctfont.leading() as f64;
let scale = px_to_pt(self.ctfont.pt_size() as f64) / (ascent + descent);
@@ -171,7 +171,7 @@ impl FontHandleMethods for FontHandle {
let max_advance_width = Au::from_pt(bounding_rect.size.width as f64);
let average_advance = self.glyph_index('0')
.and_then(|idx| self.glyph_h_advance(idx))
- .map(|advance| Au::from_frac_px(advance))
+ .map(|advance| Au::from_f64_px(advance))
.unwrap_or(max_advance_width);
let metrics = FontMetrics {
@@ -191,7 +191,7 @@ impl FontHandleMethods for FontHandle {
descent: Au::from_pt(descent * scale),
max_advance: max_advance_width,
average_advance: average_advance,
- line_gap: Au::from_frac_px(line_gap),
+ line_gap: Au::from_f64_px(line_gap),
};
debug!("Font metrics (@{} pt): {:?}", self.ctfont.pt_size() as f64, metrics);
return metrics;
diff --git a/components/gfx/text/glyph.rs b/components/gfx/text/glyph.rs
index 131ac03d309..0edddf87459 100644
--- a/components/gfx/text/glyph.rs
+++ b/components/gfx/text/glyph.rs
@@ -728,7 +728,7 @@ impl<'a> GlyphStore {
// FIXME(pcwalton): This can overflow for very large font-sizes.
let advance =
((entry.value & GLYPH_ADVANCE_MASK) >> GLYPH_ADVANCE_SHIFT) +
- Au::from_frac_px(space).0 as u32;
+ Au::from_f64_px(space).0 as u32;
entry.value = (entry.value & !GLYPH_ADVANCE_MASK) |
(advance << GLYPH_ADVANCE_SHIFT);
}
diff --git a/components/gfx/text/shaping/harfbuzz.rs b/components/gfx/text/shaping/harfbuzz.rs
index 37b20af17ec..6ff6987e752 100644
--- a/components/gfx/text/shaping/harfbuzz.rs
+++ b/components/gfx/text/shaping/harfbuzz.rs
@@ -117,10 +117,10 @@ impl ShapedGlyphData {
let x_advance = Shaper::fixed_to_float((*pos_info_i).x_advance);
let y_advance = Shaper::fixed_to_float((*pos_info_i).y_advance);
- let x_offset = Au::from_frac_px(x_offset);
- let y_offset = Au::from_frac_px(y_offset);
- let x_advance = Au::from_frac_px(x_advance);
- let y_advance = Au::from_frac_px(y_advance);
+ let x_offset = Au::from_f64_px(x_offset);
+ let y_offset = Au::from_f64_px(y_offset);
+ let x_advance = Au::from_f64_px(x_advance);
+ let y_advance = Au::from_f64_px(y_advance);
let offset = if x_offset == Au(0) && y_offset == Au(0) && y_advance == Au(0) {
None
@@ -185,7 +185,7 @@ impl Shaper {
let hb_font: *mut hb_font_t = RUST_hb_font_create(hb_face);
// Set points-per-em. if zero, performs no hinting in that direction.
- let pt_size = font.actual_pt_size.to_subpx();
+ let pt_size = font.actual_pt_size.to_f64_px();
RUST_hb_font_set_ppem(hb_font, pt_size as c_uint, pt_size as c_uint);
// Set scaling. Note that this takes 16.16 fixed point.
@@ -518,7 +518,7 @@ impl Shaper {
advance = advance + options.word_spacing
} else if character == '\t' {
let tab_size = 8f64;
- advance = Au::from_frac_px(tab_size * glyph_space_advance(self.font_and_shaping_options.font));
+ advance = Au::from_f64_px(tab_size * glyph_space_advance(self.font_and_shaping_options.font));
}
advance
diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs
index 67ee428fd72..2794563fd46 100644
--- a/components/layout/display_list_builder.rs
+++ b/components/layout/display_list_builder.rs
@@ -251,7 +251,7 @@ fn handle_overlapping_radii(size: &Size2D<Au>, radii: &BorderRadii<Au>) -> Borde
if required <= edge_length {
1.0
} else {
- edge_length.to_frac32_px() / required.to_frac32_px()
+ edge_length.to_f32_px() / required.to_f32_px()
}
}
@@ -352,18 +352,18 @@ impl FragmentDisplayListBuilding for Fragment {
// If `image_aspect_ratio` < `bounds_aspect_ratio`, the image is tall; otherwise, it is
// wide.
let image_aspect_ratio = (image.width as f64) / (image.height as f64);
- let bounds_aspect_ratio = bounds.size.width.to_subpx() / bounds.size.height.to_subpx();
+ let bounds_aspect_ratio = bounds.size.width.to_f64_px() / bounds.size.height.to_f64_px();
let intrinsic_size = Size2D(Au::from_px(image.width as isize),
Au::from_px(image.height as isize));
match (style.get_background().background_size.clone(),
image_aspect_ratio < bounds_aspect_ratio) {
(background_size::T::Contain, false) | (background_size::T::Cover, true) => {
Size2D(bounds.size.width,
- Au::from_frac_px(bounds.size.width.to_subpx() / image_aspect_ratio))
+ Au::from_f64_px(bounds.size.width.to_f64_px() / image_aspect_ratio))
}
(background_size::T::Contain, true) | (background_size::T::Cover, false) => {
- Size2D(Au::from_frac_px(bounds.size.height.to_subpx() * image_aspect_ratio),
+ Size2D(Au::from_f64_px(bounds.size.height.to_f64_px() * image_aspect_ratio),
bounds.size.height)
}
@@ -373,7 +373,7 @@ impl FragmentDisplayListBuilding for Fragment {
}), _) => {
let width = MaybeAuto::from_style(width, bounds.size.width)
.specified_or_default(intrinsic_size.width);
- Size2D(width, Au::from_frac_px(width.to_subpx() / image_aspect_ratio))
+ Size2D(width, Au::from_f64_px(width.to_f64_px() / image_aspect_ratio))
}
(background_size::T::Explicit(background_size::ExplicitSize {
@@ -382,7 +382,7 @@ impl FragmentDisplayListBuilding for Fragment {
}), _) => {
let height = MaybeAuto::from_style(height, bounds.size.height)
.specified_or_default(intrinsic_size.height);
- Size2D(Au::from_frac_px(height.to_subpx() * image_aspect_ratio), height)
+ Size2D(Au::from_f64_px(height.to_f64_px() * image_aspect_ratio), height)
}
(background_size::T::Explicit(background_size::ExplicitSize {
@@ -501,10 +501,10 @@ impl FragmentDisplayListBuilding for Fragment {
// between the starting point and the ending point.
let delta = match gradient.angle_or_corner {
AngleOrCorner::Angle(angle) => {
- Point2D(Au::from_frac32_px(angle.radians().sin() *
- absolute_bounds.size.width.to_frac32_px() / 2.0),
- Au::from_frac32_px(-angle.radians().cos() *
- absolute_bounds.size.height.to_frac32_px() / 2.0))
+ Point2D(Au::from_f32_px(angle.radians().sin() *
+ absolute_bounds.size.width.to_f32_px() / 2.0),
+ Au::from_f32_px(-angle.radians().cos() *
+ absolute_bounds.size.height.to_f32_px() / 2.0))
}
AngleOrCorner::Corner(horizontal, vertical) => {
let x_factor = match horizontal {
@@ -521,8 +521,8 @@ impl FragmentDisplayListBuilding for Fragment {
};
// This is the length of the gradient line.
- let length = Au::from_frac32_px(
- (delta.x.to_frac32_px() * 2.0).hypot(delta.y.to_frac32_px() * 2.0));
+ let length = Au::from_f32_px(
+ (delta.x.to_f32_px() * 2.0).hypot(delta.y.to_f32_px() * 2.0));
// Determine the position of each stop per CSS-IMAGES § 3.4.
//
@@ -1080,9 +1080,9 @@ impl FragmentDisplayListBuilding for Fragment {
let transform_origin = self.style().get_effects().transform_origin;
let transform_origin =
Point2D(model::specified(transform_origin.horizontal,
- border_box.size.width).to_frac32_px(),
+ border_box.size.width).to_f32_px(),
model::specified(transform_origin.vertical,
- border_box.size.height).to_frac32_px());
+ border_box.size.height).to_f32_px());
let transform = self.style().get_effects().transform
.unwrap_or(ComputedMatrix::identity()).to_gfx_matrix(&border_box.size);
@@ -1117,10 +1117,10 @@ impl FragmentDisplayListBuilding for Fragment {
layout_context: &LayoutContext) {
let border_padding = (self.border_padding).to_physical(self.style.writing_mode);
let content_size = self.content_box().size.to_physical(self.style.writing_mode);
- let iframe_rect = Rect(Point2D((offset.x + border_padding.left).to_frac32_px(),
- (offset.y + border_padding.top).to_frac32_px()),
- Size2D(content_size.width.to_frac32_px(),
- content_size.height.to_frac32_px()));
+ let iframe_rect = Rect(Point2D((offset.x + border_padding.left).to_f32_px(),
+ (offset.y + border_padding.top).to_f32_px()),
+ Size2D(content_size.width.to_f32_px(),
+ content_size.height.to_f32_px()));
debug!("finalizing position and size of iframe for {:?},{:?}",
iframe_fragment.pipeline_id,
diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs
index 9063bc652d2..13c602b6d41 100644
--- a/components/layout/fragment.rs
+++ b/components/layout/fragment.rs
@@ -451,8 +451,8 @@ impl ReplacedImageFragmentInfo {
if intrinsic_height == Au(0) {
intrinsic_width
} else {
- let ratio = intrinsic_width.to_frac32_px() /
- intrinsic_height.to_frac32_px();
+ let ratio = intrinsic_width.to_f32_px() /
+ intrinsic_height.to_f32_px();
let specified_height = ReplacedImageFragmentInfo::style_length(
style_block_size,
@@ -466,7 +466,7 @@ impl ReplacedImageFragmentInfo {
style_min_block_size,
style_max_block_size,
Au(0));
- Au::from_frac32_px(specified_height.to_frac32_px() * ratio)
+ Au::from_f32_px(specified_height.to_f32_px() * ratio)
}
},
MaybeAuto::Specified(w) => w,
@@ -503,8 +503,8 @@ impl ReplacedImageFragmentInfo {
MaybeAuto::Auto => {
let intrinsic_width = fragment_inline_size;
let intrinsic_height = fragment_block_size;
- let scale = intrinsic_width.to_frac32_px() / inline_size.to_frac32_px();
- Au::from_frac32_px(intrinsic_height.to_frac32_px() / scale)
+ let scale = intrinsic_width.to_f32_px() / inline_size.to_f32_px();
+ Au::from_f32_px(intrinsic_height.to_f32_px() / scale)
},
MaybeAuto::Specified(h) => {
h
diff --git a/components/layout/inline.rs b/components/layout/inline.rs
index 17741e4eadd..321a0868469 100644
--- a/components/layout/inline.rs
+++ b/components/layout/inline.rs
@@ -966,7 +966,7 @@ impl InlineFlow {
}
// Then distribute all the space across the expansion opportunities.
- let space_per_expansion_opportunity = slack_inline_size.to_subpx() /
+ let space_per_expansion_opportunity = slack_inline_size.to_f64_px() /
(expansion_opportunities as f64);
for fragment_index in line.range.each_index() {
let fragment = fragments.get_mut(fragment_index.to_usize());
diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs
index 6557b6c26c7..b98c7f99957 100644
--- a/components/layout/layout_task.rs
+++ b/components/layout/layout_task.rs
@@ -851,8 +851,8 @@ impl LayoutTask {
// http://www.w3.org/TR/css-device-adapt/#actual-viewport
let viewport_size = data.window_size.initial_viewport;
let old_screen_size = rw_data.screen_size;
- let current_screen_size = Size2D(Au::from_frac32_px(viewport_size.width.get()),
- Au::from_frac32_px(viewport_size.height.get()));
+ let current_screen_size = Size2D(Au::from_f32_px(viewport_size.width.get()),
+ Au::from_f32_px(viewport_size.height.get()));
rw_data.screen_size = current_screen_size;
// Handle conditions where the entire flow tree is invalid.
@@ -1096,7 +1096,7 @@ impl LayoutRPC for LayoutRPCImpl {
/// Requests the node containing the point of interest.
fn hit_test(&self, _: TrustedNodeAddress, point: Point2D<f32>) -> Result<HitTestResponse, ()> {
- let point = Point2D(Au::from_frac32_px(point.x), Au::from_frac32_px(point.y));
+ let point = Point2D(Au::from_f32_px(point.x), Au::from_f32_px(point.y));
let resp = {
let &LayoutRPCImpl(ref rw_data) = self;
let rw_data = rw_data.lock().unwrap();
@@ -1123,7 +1123,7 @@ impl LayoutRPC for LayoutRPCImpl {
fn mouse_over(&self, _: TrustedNodeAddress, point: Point2D<f32>)
-> Result<MouseOverResponse, ()> {
let mut mouse_over_list: Vec<DisplayItemMetadata> = vec!();
- let point = Point2D(Au::from_frac32_px(point.x), Au::from_frac32_px(point.y));
+ let point = Point2D(Au::from_f32_px(point.x), Au::from_f32_px(point.y));
{
let &LayoutRPCImpl(ref rw_data) = self;
let rw_data = rw_data.lock().unwrap();
diff --git a/components/layout/model.rs b/components/layout/model.rs
index b4498ff3079..8b4da87cd45 100644
--- a/components/layout/model.rs
+++ b/components/layout/model.rs
@@ -434,8 +434,8 @@ impl ToGfxMatrix for ComputedMatrix {
self.m12 as f32,
self.m21 as f32,
self.m22 as f32,
- self.m31.to_au(containing_size.width).to_frac32_px(),
- self.m32.to_au(containing_size.height).to_frac32_px())
+ self.m31.to_au(containing_size.width).to_f32_px(),
+ self.m32.to_au(containing_size.height).to_f32_px())
}
}
@@ -446,7 +446,7 @@ trait ToAu {
impl ToAu for LengthAndPercentage {
#[inline]
fn to_au(&self, containing_size: Au) -> Au {
- self.length + Au::from_frac32_px(self.percentage * containing_size.to_frac32_px())
+ self.length + Au::from_f32_px(self.percentage * containing_size.to_f32_px())
}
}
diff --git a/components/layout/table.rs b/components/layout/table.rs
index 76b0ad99a6b..72af04817f2 100644
--- a/components/layout/table.rs
+++ b/components/layout/table.rs
@@ -430,8 +430,8 @@ impl Flow for TableFlow {
// if there are any, or among all the columns if all are specified.
self.column_computed_inline_sizes.clear();
if num_unspecified_inline_sizes == 0 {
- let ratio = content_inline_size.to_frac32_px() /
- total_column_inline_size.to_frac32_px();
+ let ratio = content_inline_size.to_f32_px() /
+ total_column_inline_size.to_f32_px();
for column_inline_size in self.column_intrinsic_inline_sizes.iter() {
self.column_computed_inline_sizes.push(ColumnComputedInlineSize {
size: column_inline_size.minimum_length.scale_by(ratio),
diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs
index e7e2fd3e37f..8a3e368d140 100644
--- a/components/layout/table_wrapper.rs
+++ b/components/layout/table_wrapper.rs
@@ -590,7 +590,7 @@ impl SelectedAutoLayoutCandidateGuess {
/// Computes the weight needed to linearly interpolate `middle` between two guesses `low` and
/// `high` as specified by INTRINSIC § 4.3.
fn weight(low: Au, middle: Au, high: Au) -> CSSFloat {
- (middle - low).to_frac32_px() / (high - low).to_frac32_px()
+ (middle - low).to_f32_px() / (high - low).to_f32_px()
}
/// Linearly interpolates between two guesses, as specified by INTRINSIC § 4.3.
@@ -653,9 +653,9 @@ impl ExcessInlineSizeDistributionInfo {
// do?
if !column_intrinsic_inline_size.constrained &&
column_intrinsic_inline_size.percentage == 0.0 {
- column_intrinsic_inline_size.preferred.to_frac32_px() /
+ column_intrinsic_inline_size.preferred.to_f32_px() /
self.preferred_inline_size_of_nonconstrained_columns_with_no_percentage
- .to_frac32_px()
+ .to_f32_px()
} else {
0.0
}
@@ -663,8 +663,8 @@ impl ExcessInlineSizeDistributionInfo {
1.0 / (self.count_of_nonconstrained_columns_with_no_percentage as CSSFloat)
} else if self.preferred_inline_size_of_constrained_columns_with_no_percentage >
Au(0) {
- column_intrinsic_inline_size.preferred.to_frac32_px() /
- self.preferred_inline_size_of_constrained_columns_with_no_percentage.to_frac32_px()
+ column_intrinsic_inline_size.preferred.to_f32_px() /
+ self.preferred_inline_size_of_constrained_columns_with_no_percentage.to_f32_px()
} else if self.total_percentage > 0.0 {
column_intrinsic_inline_size.percentage / self.total_percentage
} else {
diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs
index 4a46235756e..9ed6b5df5c7 100644
--- a/components/script/dom/htmlanchorelement.rs
+++ b/components/script/dom/htmlanchorelement.rs
@@ -135,8 +135,8 @@ impl<'a> Activatable for JSRef<'a, HTMLAnchorElement> {
let target_node = NodeCast::to_ref(target).unwrap();
let rect = window_from_node(target_node).root().r().content_box_query(target_node.to_trusted_node_address());
ismap_suffix = Some(
- format!("?{},{}", mouse_event.ClientX().to_f32().unwrap() - rect.origin.x.to_frac32_px(),
- mouse_event.ClientY().to_f32().unwrap() - rect.origin.y.to_frac32_px())
+ format!("?{},{}", mouse_event.ClientX().to_f32().unwrap() - rect.origin.x.to_f32_px(),
+ mouse_event.ClientY().to_f32().unwrap() - rect.origin.y.to_f32_px())
)
}
}
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index e49f6a1a50e..5256b975172 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -917,10 +917,10 @@ impl Window {
}
fn should_move_clip_rect(clip_rect: Rect<Au>, new_viewport: Rect<f32>) -> bool{
- let clip_rect = Rect(Point2D(clip_rect.origin.x.to_frac32_px(),
- clip_rect.origin.y.to_frac32_px()),
- Size2D(clip_rect.size.width.to_frac32_px(),
- clip_rect.size.height.to_frac32_px()));
+ let clip_rect = Rect(Point2D(clip_rect.origin.x.to_f32_px(),
+ clip_rect.origin.y.to_f32_px()),
+ Size2D(clip_rect.size.width.to_f32_px(),
+ clip_rect.size.height.to_f32_px()));
// We only need to move the clip rect if the viewport is getting near the edge of
// our preexisting clip rect. We use half of the size of the viewport as a heuristic
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index 355b9d01210..0b703d8f7bd 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -1180,7 +1180,7 @@ impl ScriptTask {
fn scroll_fragment_point(&self, pipeline_id: PipelineId, node: JSRef<Element>) {
let node: JSRef<Node> = NodeCast::from_ref(node);
let rect = node.get_bounding_content_box();
- let point = Point2D(rect.origin.x.to_frac32_px(), rect.origin.y.to_frac32_px());
+ let point = Point2D(rect.origin.x.to_f32_px(), rect.origin.y.to_f32_px());
// FIXME(#2003, pcwalton): This is pretty bogus when multiple layers are involved.
// 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
diff --git a/components/style/media_queries.rs b/components/style/media_queries.rs
index 7f71d1602a2..8472347721c 100644
--- a/components/style/media_queries.rs
+++ b/components/style/media_queries.rs
@@ -203,8 +203,8 @@ pub fn parse_media_query_list(input: &mut Parser) -> MediaQueryList {
impl MediaQueryList {
pub fn evaluate(&self, device: &Device) -> bool {
- let viewport_size = Size2D(Au::from_frac32_px(device.viewport_size.width.get()),
- Au::from_frac32_px(device.viewport_size.height.get()));
+ let viewport_size = Size2D(Au::from_f32_px(device.viewport_size.width.get()),
+ Au::from_f32_px(device.viewport_size.height.get()));
// Check if any queries match (OR condition)
self.media_queries.iter().any(|mq| {
diff --git a/components/style/properties.mako.rs b/components/style/properties.mako.rs
index ccf5095c0e8..ef577d083d1 100644
--- a/components/style/properties.mako.rs
+++ b/components/style/properties.mako.rs
@@ -3313,8 +3313,8 @@ pub mod longhands {
return Err(())
}
let (tx, ty) =
- (specified::Length::Absolute(Au::from_frac32_px(values[4])),
- specified::Length::Absolute(Au::from_frac32_px(values[5])));
+ (specified::Length::Absolute(Au::from_f32_px(values[4])),
+ specified::Length::Absolute(Au::from_f32_px(values[5])));
let (tx, ty) =
(specified::LengthAndPercentage::from_length(tx),
specified::LengthAndPercentage::from_length(ty));
diff --git a/components/style/values.rs b/components/style/values.rs
index 185bfd7280a..88ae4b0417c 100644
--- a/components/style/values.rs
+++ b/components/style/values.rs
@@ -187,7 +187,7 @@ pub mod specified {
pub fn to_computed_value(&self, viewport_size: Size2D<Au>) -> Au {
macro_rules! to_unit {
($viewport_dimension:expr) => {
- $viewport_dimension.to_frac32_px() / 100.0
+ $viewport_dimension.to_f32_px() / 100.0
}
}
@@ -201,7 +201,7 @@ pub mod specified {
&ViewportPercentageLength::Vmax(length) =>
length * to_unit!(cmp::max(viewport_size.width, viewport_size.height)),
};
- Au::from_frac32_px(value)
+ Au::from_f32_px(value)
}
}
@@ -236,7 +236,7 @@ pub mod specified {
impl ToCss for Length {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
match self {
- &Length::Absolute(length) => write!(dest, "{}px", length.to_frac32_px()),
+ &Length::Absolute(length) => write!(dest, "{}px", length.to_f32_px()),
&Length::FontRelative(length) => length.to_css(dest),
&Length::ViewportPercentage(length) => length.to_css(dest),
&Length::ServoCharacterWidth(_)
@@ -1114,7 +1114,7 @@ pub mod computed {
fn mul(self, scalar: CSSFloat) -> LengthAndPercentage {
LengthAndPercentage {
- length: Au::from_frac32_px(self.length.to_frac32_px() * scalar),
+ length: Au::from_f32_px(self.length.to_f32_px() * scalar),
percentage: self.percentage * scalar,
}
}
diff --git a/components/util/geometry.rs b/components/util/geometry.rs
index 515529ad2f7..684b06183f8 100644
--- a/components/util/geometry.rs
+++ b/components/util/geometry.rs
@@ -115,13 +115,13 @@ pub const MAX_AU: Au = Au(i32::MAX);
impl Encodable for Au {
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
- e.emit_f64(self.to_subpx())
+ e.emit_f64(self.to_f64_px())
}
}
impl fmt::Debug for Au {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "{}px", self.to_subpx())
+ write!(f, "{}px", self.to_f64_px())
}}
impl Add for Au {
@@ -238,13 +238,13 @@ impl Au {
}
#[inline]
- pub fn to_frac32_px(&self) -> f32 {
+ pub fn to_f32_px(&self) -> f32 {
let Au(s) = *self;
(s as f32) / 60f32
}
#[inline]
- pub fn to_subpx(&self) -> f64 {
+ pub fn to_f64_px(&self) -> f64 {
let Au(s) = *self;
(s as f64) / 60f64
}
@@ -258,17 +258,17 @@ impl Au {
}
#[inline]
- pub fn from_frac32_px(px: f32) -> Au {
+ pub fn from_f32_px(px: f32) -> Au {
Au((px * 60f32) as i32)
}
#[inline]
pub fn from_pt(pt: f64) -> Au {
- Au::from_frac_px(pt_to_px(pt))
+ Au::from_f64_px(pt_to_px(pt))
}
#[inline]
- pub fn from_frac_px(px: f64) -> Au {
+ pub fn from_f64_px(px: f64) -> Au {
Au((px * 60.) as i32)
}
}
@@ -293,7 +293,7 @@ pub fn rect_contains_point<T:PartialOrd + Add<T, Output=T>>(rect: Rect<T>, point
/// A helper function to convert a rect of `f32` pixels to a rect of app units.
pub fn f32_rect_to_au_rect(rect: Rect<f32>) -> Rect<Au> {
- Rect(Point2D(Au::from_frac32_px(rect.origin.x), Au::from_frac32_px(rect.origin.y)),
- Size2D(Au::from_frac32_px(rect.size.width), Au::from_frac32_px(rect.size.height)))
+ Rect(Point2D(Au::from_f32_px(rect.origin.x), Au::from_f32_px(rect.origin.y)),
+ Size2D(Au::from_f32_px(rect.size.width), Au::from_f32_px(rect.size.height)))
}