servo: Merge #6349 - rust-geom API changes (from frewsxcv:geom-api-changes); r=pcwalton
authorCorey Farwell <coreyf@rwell.org>
Sat, 13 Jun 2015 13:52:07 -0600
changeset 383179 d70837d5150f00c1534f60d6ca265952259c90a3
parent 383178 8bcf904cc5b4db9a50dfd44da00fe461b9804cdf
child 383180 2d3278fb18131f8c8978b8b333a0f258db1af548
push id7198
push userjlorenzo@mozilla.com
push dateTue, 18 Apr 2017 12:07:49 +0000
treeherdermozilla-beta@d57aa49c3948 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspcwalton
servo: Merge #6349 - rust-geom API changes (from frewsxcv:geom-api-changes); r=pcwalton Shouldn't be merged until these have merged: https://github.com/servo/rust-geom/pull/81 https://github.com/ecoal95/rust-offscreen-rendering-context/pull/13 https://github.com/servo/rust-layers/pull/178 ~~I'll also need to update the Cargo lock files once they merge~~ Source-Repo: https://github.com/servo/servo Source-Revision: cfcd8589d06935f83b903f76477ea03e4d4652d0
servo/components/canvas/canvas_paint_task.rs
servo/components/canvas_traits/lib.rs
servo/components/compositing/compositor.rs
servo/components/compositing/compositor_layer.rs
servo/components/compositing/constellation.rs
servo/components/compositing/headless.rs
servo/components/gfx/display_list/mod.rs
servo/components/gfx/font.rs
servo/components/gfx/paint_context.rs
servo/components/gfx/paint_task.rs
servo/components/gfx/text/shaping/harfbuzz.rs
servo/components/layout/block.rs
servo/components/layout/display_list_builder.rs
servo/components/layout/flow.rs
servo/components/layout/fragment.rs
servo/components/layout/inline.rs
servo/components/layout/layout_task.rs
servo/components/layout/table_cell.rs
servo/components/script/dom/canvasrenderingcontext2d.rs
servo/components/script/dom/htmlcanvaselement.rs
servo/components/script/dom/imagedata.rs
servo/components/script/dom/window.rs
servo/components/script/script_task.rs
servo/components/servo/Cargo.lock
servo/components/style/media_queries.rs
servo/components/style/properties.mako.rs
servo/components/style/viewport.rs
servo/components/util/geometry.rs
servo/components/util/opts.rs
servo/ports/cef/Cargo.lock
servo/ports/cef/browser_host.rs
servo/ports/cef/window.rs
servo/ports/glutin/window.rs
servo/ports/gonk/Cargo.lock
servo/ports/gonk/src/input.rs
servo/ports/gonk/src/window.rs
servo/tests/unit/style/media_queries.rs
servo/tests/unit/style/viewport.rs
servo/tests/unit/util/logical_geometry.rs
--- a/servo/components/canvas/canvas_paint_task.rs
+++ b/servo/components/canvas/canvas_paint_task.rs
@@ -24,17 +24,17 @@ use std::sync::mpsc::{channel, Sender};
 
 impl<'a> CanvasPaintTask<'a> {
     /// It reads image data from the canvas
     /// canvas_size: The size of the canvas we're reading from
     /// read_rect: The area of the canvas we want to read from
     fn read_pixels(&self, read_rect: Rect<f64>, canvas_size: Size2D<f64>) -> Vec<u8>{
         let read_rect = read_rect.to_i32();
         let canvas_size = canvas_size.to_i32();
-        let canvas_rect = Rect(Point2D(0i32, 0i32), canvas_size);
+        let canvas_rect = Rect::new(Point2D::new(0i32, 0i32), canvas_size);
         let src_read_rect = canvas_rect.intersection(&read_rect).unwrap_or(Rect::zero());
 
         let mut image_data = Vec::new();
         if src_read_rect.is_empty() || canvas_size.width <= 0 && canvas_size.height <= 0 {
           return image_data;
         }
 
         let data_surface = self.drawtarget.snapshot().get_data_surface();
@@ -142,17 +142,17 @@ impl<'a> CanvasPaintTask<'a> {
     /// image_size: The size of the image to be written
     /// dest_rect: Area of the destination canvas where the pixels will be copied
     /// smoothing_enabled: It determines if smoothing is applied to the image result
     fn write_image(&self, mut imagedata: Vec<u8>,
                    image_size: Size2D<f64>, dest_rect: Rect<f64>, smoothing_enabled: bool) {
         if imagedata.len() == 0 {
             return
         }
-        let image_rect = Rect(Point2D(0f64, 0f64), image_size);
+        let image_rect = Rect::new(Point2D::new(0f64, 0f64), image_size);
         // rgba -> bgra
         byte_swap(&mut imagedata);
         self.write_pixels(&imagedata, image_size, image_rect, dest_rect, smoothing_enabled);
     }
 
 }
 
 pub struct CanvasPaintTask<'a> {
@@ -296,25 +296,25 @@ impl<'a> CanvasPaintTask<'a> {
         if let Some(state) = self.saved_states.pop() {
             mem::replace(&mut self.state, state);
             self.drawtarget.set_transform(&self.state.transform);
             self.drawtarget.pop_clip();
         }
     }
 
     fn fill_rect(&self, rect: &Rect<f32>) {
-        let draw_rect = Rect(rect.origin,
+        let draw_rect = Rect::new(rect.origin,
             match self.state.fill_style {
                 Pattern::Surface(ref surface) => {
                     let surface_size = surface.size();
                     match (surface.repeat_x, surface.repeat_y) {
                         (true, true) => rect.size,
-                        (true, false) => Size2D(rect.size.width, surface_size.height as f32),
-                        (false, true) => Size2D(surface_size.width as f32, rect.size.height),
-                        (false, false) => Size2D(surface_size.width as f32, surface_size.height as f32),
+                        (true, false) => Size2D::new(rect.size.width, surface_size.height as f32),
+                        (false, true) => Size2D::new(surface_size.width as f32, rect.size.height),
+                        (false, false) => Size2D::new(surface_size.width as f32, surface_size.height as f32),
                     }
                 },
                 _ => rect.size,
             }
         );
 
         self.drawtarget.fill_rect(&draw_rect, self.state.fill_style.to_pattern_ref(),
                                   Some(&self.state.draw_options));
@@ -393,21 +393,21 @@ impl<'a> CanvasPaintTask<'a> {
         self.path_builder.move_to(*point)
     }
 
     fn line_to(&self, point: &Point2D<AzFloat>) {
         self.path_builder.line_to(*point)
     }
 
     fn rect(&self, rect: &Rect<f32>) {
-        self.path_builder.move_to(Point2D(rect.origin.x, rect.origin.y));
-        self.path_builder.line_to(Point2D(rect.origin.x + rect.size.width, rect.origin.y));
-        self.path_builder.line_to(Point2D(rect.origin.x + rect.size.width,
-                                          rect.origin.y + rect.size.height));
-        self.path_builder.line_to(Point2D(rect.origin.x, rect.origin.y + rect.size.height));
+        self.path_builder.move_to(Point2D::new(rect.origin.x, rect.origin.y));
+        self.path_builder.line_to(Point2D::new(rect.origin.x + rect.size.width, rect.origin.y));
+        self.path_builder.line_to(Point2D::new(rect.origin.x + rect.size.width,
+                                               rect.origin.y + rect.size.height));
+        self.path_builder.line_to(Point2D::new(rect.origin.x, rect.origin.y + rect.size.height));
         self.path_builder.close();
     }
 
     fn quadratic_curve_to(&self,
                           cp: &Point2D<AzFloat>,
                           endpoint: &Point2D<AzFloat>) {
         self.path_builder.quadratic_curve_to(cp, endpoint)
     }
@@ -457,33 +457,33 @@ impl<'a> CanvasPaintTask<'a> {
             let cosx = (a2 + b2 - c2) / (2.0 * (a2 * b2).sqrt());
             let sinx = (1.0 - cosx.powi(2)).sqrt();
             radius / ((1.0 - cosx) / sinx)
         };
 
         // first tangent point
         let anx = (cp1.x - cp0.x) / a2.sqrt();
         let any = (cp1.y - cp0.y) / a2.sqrt();
-        let tp1 = Point2D::<AzFloat>(cp1.x - anx * d, cp1.y - any * d);
+        let tp1 = Point2D::new(cp1.x - anx * d, cp1.y - any * d);
 
         // second tangent point
         let bnx = (cp1.x - cp2.x) / b2.sqrt();
         let bny = (cp1.y - cp2.y) / b2.sqrt();
-        let tp2 = Point2D::<AzFloat>(cp1.x - bnx * d, cp1.y - bny * d);
+        let tp2 = Point2D::new(cp1.x - bnx * d, cp1.y - bny * d);
 
         // arc center and angles
         let anticlockwise = direction < 0.0;
         let cx = tp1.x + any * radius * if anticlockwise { 1.0 } else { -1.0 };
         let cy = tp1.y - anx * radius * if anticlockwise { 1.0 } else { -1.0 };
         let angle_start = (tp1.y - cy).atan2(tp1.x - cx);
         let angle_end = (tp2.y - cy).atan2(tp2.x - cx);
 
         self.line_to(&tp1);
         if [cx, cy, angle_start, angle_end].iter().all(|x| x.is_finite()) {
-            self.arc(&Point2D::<AzFloat>(cx, cy), radius,
+            self.arc(&Point2D::new(cx, cy), radius,
                      angle_start, angle_end, anticlockwise);
         }
     }
 
     fn set_fill_style(&mut self, style: FillOrStrokeStyle) {
         self.state.fill_style = style.to_azure_pattern(&self.drawtarget)
     }
 
@@ -572,18 +572,18 @@ impl<'a> CanvasPaintTask<'a> {
         if image_data_rect.size.width <= 0.0 || image_data_rect.size.height <= 0.0 {
             return
         }
 
         assert!(image_data_rect.size.width * image_data_rect.size.height * 4.0 == imagedata.len() as f64);
         // rgba -> bgra
         byte_swap(&mut imagedata);
 
-        let image_rect = Rect(Point2D(0f64, 0f64),
-                               Size2D(image_data_rect.size.width, image_data_rect.size.height));
+        let image_rect = Rect::new(Point2D::new(0f64, 0f64),
+                                   Size2D::new(image_data_rect.size.width, image_data_rect.size.height));
 
         // Dirty rectangle defines the area of the source image to be copied
         // on the destination canvas
         let source_rect = match dirty_rect {
             Some(dirty_rect) =>
                 self.calculate_dirty_rect(dirty_rect, image_data_rect),
             // If no dirty area is provided we consider the whole source image
             // as the area to be copied to the canvas
@@ -597,20 +597,20 @@ impl<'a> CanvasPaintTask<'a> {
         }
 
         // 6) For all integer values of x and y where dirtyX ≤ x < dirty
         // X+dirtyWidth and dirtyY ≤ y < dirtyY+dirtyHeight, copy the
         // four channels of the pixel with coordinate (x, y) in the imagedata
         // data structure's Canvas Pixel ArrayBuffer to the pixel with coordinate
         // (dx+x, dy+y) in the rendering context's scratch bitmap.
         // It also clips the destination rectangle to the canvas area
-        let dest_rect = Rect(
-            Point2D(image_data_rect.origin.x + source_rect.origin.x,
-                    image_data_rect.origin.y + source_rect.origin.y),
-            Size2D(source_rect.size.width, source_rect.size.height));
+        let dest_rect = Rect::new(
+            Point2D::new(image_data_rect.origin.x + source_rect.origin.x,
+                         image_data_rect.origin.y + source_rect.origin.y),
+            Size2D::new(source_rect.size.width, source_rect.size.height));
 
         self.write_pixels(&imagedata, image_data_rect.size, source_rect, dest_rect, true)
     }
 
     fn set_shadow_offset_x(&mut self, value: f64) {
         self.state.shadow_offset_x = value;
     }
 
@@ -659,45 +659,45 @@ fn crop_image(image_data: Vec<u8>,
 }
 
 pub trait SizeToi32 {
     fn to_i32(&self) -> Size2D<i32>;
 }
 
 impl SizeToi32 for Size2D<f64> {
     fn to_i32(&self) -> Size2D<i32> {
-        Size2D(self.width.to_i32().unwrap(),
-               self.height.to_i32().unwrap())
+        Size2D::new(self.width.to_i32().unwrap(),
+                    self.height.to_i32().unwrap())
     }
 }
 
 pub trait RectToi32 {
     fn to_i32(&self) -> Rect<i32>;
     fn ceil(&self) -> Rect<f64>;
 }
 
 impl RectToi32 for Rect<f64> {
     fn to_i32(&self) -> Rect<i32> {
-        Rect(Point2D(self.origin.x.to_i32().unwrap(),
-                     self.origin.y.to_i32().unwrap()),
-             Size2D(self.size.width.to_i32().unwrap(),
-                    self.size.height.to_i32().unwrap()))
+        Rect::new(Point2D::new(self.origin.x.to_i32().unwrap(),
+                               self.origin.y.to_i32().unwrap()),
+                  Size2D::new(self.size.width.to_i32().unwrap(),
+                              self.size.height.to_i32().unwrap()))
     }
 
     fn ceil(&self) -> Rect<f64> {
-        Rect(Point2D(self.origin.x.ceil(),
-                     self.origin.y.ceil()),
-             Size2D(self.size.width.ceil(),
-                    self.size.height.ceil()))
+        Rect::new(Point2D::new(self.origin.x.ceil(),
+                               self.origin.y.ceil()),
+                  Size2D::new(self.size.width.ceil(),
+                              self.size.height.ceil()))
     }
 
 }
 
 pub trait ToAzFloat {
     fn to_azfloat(&self) -> Rect<AzFloat>;
 }
 
 impl ToAzFloat for Rect<f64> {
     fn to_azfloat(&self) -> Rect<AzFloat> {
-        Rect(Point2D(self.origin.x as AzFloat, self.origin.y as AzFloat),
-             Size2D(self.size.width as AzFloat, self.size.height as AzFloat))
+        Rect::new(Point2D::new(self.origin.x as AzFloat, self.origin.y as AzFloat),
+                  Size2D::new(self.size.width as AzFloat, self.size.height as AzFloat))
     }
 }
--- a/servo/components/canvas_traits/lib.rs
+++ b/servo/components/canvas_traits/lib.rs
@@ -219,32 +219,32 @@ impl FillOrStrokeStyle {
                 let gradient_stops: Vec<GradientStop> = linear_gradient_style.stops.iter().map(|s| {
                     GradientStop {
                         offset: s.offset as AzFloat,
                         color: color::new(s.color.red, s.color.green, s.color.blue, s.color.alpha)
                     }
                 }).collect();
 
                 Pattern::LinearGradient(LinearGradientPattern::new(
-                    &Point2D(linear_gradient_style.x0 as AzFloat, linear_gradient_style.y0 as AzFloat),
-                    &Point2D(linear_gradient_style.x1 as AzFloat, linear_gradient_style.y1 as AzFloat),
+                    &Point2D::new(linear_gradient_style.x0 as AzFloat, linear_gradient_style.y0 as AzFloat),
+                    &Point2D::new(linear_gradient_style.x1 as AzFloat, linear_gradient_style.y1 as AzFloat),
                     drawtarget.create_gradient_stops(&gradient_stops, ExtendMode::Clamp),
                     &Matrix2D::identity()))
             },
             FillOrStrokeStyle::RadialGradient(ref radial_gradient_style) => {
                 let gradient_stops: Vec<GradientStop> = radial_gradient_style.stops.iter().map(|s| {
                     GradientStop {
                         offset: s.offset as AzFloat,
                         color: color::new(s.color.red, s.color.green, s.color.blue, s.color.alpha)
                     }
                 }).collect();
 
                 Pattern::RadialGradient(RadialGradientPattern::new(
-                    &Point2D(radial_gradient_style.x0 as AzFloat, radial_gradient_style.y0 as AzFloat),
-                    &Point2D(radial_gradient_style.x1 as AzFloat, radial_gradient_style.y1 as AzFloat),
+                    &Point2D::new(radial_gradient_style.x0 as AzFloat, radial_gradient_style.y0 as AzFloat),
+                    &Point2D::new(radial_gradient_style.x1 as AzFloat, radial_gradient_style.y1 as AzFloat),
                     radial_gradient_style.r0 as AzFloat, radial_gradient_style.r1 as AzFloat,
                     drawtarget.create_gradient_stops(&gradient_stops, ExtendMode::Clamp),
                     &Matrix2D::identity()))
             },
             FillOrStrokeStyle::Surface(ref surface_style) => {
                 let source_surface = drawtarget.create_source_surface_from_data(
                     &surface_style.surface_data,
                     surface_style.surface_size,
--- a/servo/components/compositing/compositor.rs
+++ b/servo/components/compositing/compositor.rs
@@ -694,17 +694,17 @@ impl<Window: WindowMethods> IOCompositor
     pub fn move_layer(&self,
                       pipeline_id: PipelineId,
                       layer_id: LayerId,
                       origin: TypedPoint2D<LayerPixel, f32>)
                       -> bool {
         match self.find_layer_with_pipeline_and_layer_id(pipeline_id, layer_id) {
             Some(ref layer) => {
                 if layer.wants_scroll_events() == WantsScrollEventsFlag::WantsScrollEvents {
-                    layer.clamp_scroll_offset_and_scroll_layer(TypedPoint2D(0f32, 0f32) - origin);
+                    layer.clamp_scroll_offset_and_scroll_layer(Point2D::typed(0f32, 0f32) - origin);
                 }
                 true
             }
             None => false,
         }
     }
 
     fn scroll_layer_to_fragment_point_if_necessary(&mut self,
@@ -952,24 +952,24 @@ impl<Window: WindowMethods> IOCompositor
 
     /// Computes new display ports for each layer, taking the scroll position into account, and
     /// sends them to layout as necessary. This ultimately triggers a rerender of the content.
     fn send_updated_display_ports_to_layout(&mut self) {
         fn process_layer(layer: &Layer<CompositorData>,
                          window_size: &TypedSize2D<LayerPixel, f32>,
                          new_display_ports: &mut HashMap<PipelineId, Vec<(LayerId, Rect<Au>)>>) {
             let visible_rect =
-                Rect(Point2D::zero(), *window_size).translate(&-*layer.content_offset.borrow())
-                                                   .intersection(&*layer.bounds.borrow())
-                                                   .unwrap_or(Rect::zero())
-                                                   .to_untyped();
-            let visible_rect = Rect(Point2D(Au::from_f32_px(visible_rect.origin.x),
-                                            Au::from_f32_px(visible_rect.origin.y)),
-                                    Size2D(Au::from_f32_px(visible_rect.size.width),
-                                           Au::from_f32_px(visible_rect.size.height)));
+                Rect::new(Point2D::zero(), *window_size).translate(&-*layer.content_offset.borrow())
+                                                        .intersection(&*layer.bounds.borrow())
+                                                        .unwrap_or(Rect::zero())
+                                                        .to_untyped();
+            let visible_rect = Rect::new(Point2D::new(Au::from_f32_px(visible_rect.origin.x),
+                                                      Au::from_f32_px(visible_rect.origin.y)),
+                                         Size2D::new(Au::from_f32_px(visible_rect.size.width),
+                                                     Au::from_f32_px(visible_rect.size.height)));
 
             let extra_layer_data = layer.extra_data.borrow();
             if !new_display_ports.contains_key(&extra_layer_data.pipeline_id) {
                 new_display_ports.insert(extra_layer_data.pipeline_id, Vec::new());
             }
             new_display_ports.get_mut(&extra_layer_data.pipeline_id)
                              .unwrap()
                              .push((extra_layer_data.id, visible_rect));
@@ -1082,21 +1082,21 @@ impl<Window: WindowMethods> IOCompositor
                                 .min(viewport_zoom);
         let viewport_zoom = ScaleFactor::new(viewport_zoom);
         self.viewport_zoom = viewport_zoom;
 
         self.update_zoom_transform();
 
         // Scroll as needed
         let window_size = self.window_size.as_f32();
-        let page_delta: TypedPoint2D<LayerPixel, f32> = TypedPoint2D(
+        let page_delta: TypedPoint2D<LayerPixel, f32> = Point2D::typed(
             window_size.width.get() * (viewport_zoom.inv() - old_viewport_zoom.inv()).get() * 0.5,
             window_size.height.get() * (viewport_zoom.inv() - old_viewport_zoom.inv()).get() * 0.5);
 
-        let cursor = TypedPoint2D(-1f32, -1f32);  // Make sure this hits the base layer.
+        let cursor = Point2D::typed(-1f32, -1f32);  // Make sure this hits the base layer.
         match self.scene.root {
             Some(ref mut layer) => {
                 layer.handle_scroll_event(page_delta, cursor);
             }
             None => { }
         }
 
         self.send_viewport_rects_for_all_layers();
@@ -1162,18 +1162,18 @@ impl<Window: WindowMethods> IOCompositor
                 let pipeline = self.get_pipeline(layer.pipeline_id());
                 let _ = pipeline.paint_chan.send_opt(PaintMsg::UnusedBuffer(buffers));
             }
         }
     }
 
     fn send_viewport_rect_for_layer(&self, layer: Rc<Layer<CompositorData>>) {
         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 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 ScriptControlChan(ref chan) = pipeline.script_chan;
             chan.send(ConstellationControlMsg::Viewport(pipeline.id.clone(), layer_rect)).unwrap();
         }
 
         for kid in layer.children().iter() {
             self.send_viewport_rect_for_layer(kid.clone());
         }
@@ -1432,17 +1432,17 @@ impl<Window: WindowMethods> IOCompositor
         }
 
         let clipped_layer_bounds = match clip_rect.intersection(&layer_bounds) {
             Some(rect) => rect,
             None => return None,
         };
 
         let clip_rect_for_children = if masks_to_bounds {
-            Rect(Point2D::zero(), clipped_layer_bounds.size)
+            Rect::new(Point2D::zero(), clipped_layer_bounds.size)
         } else {
             clipped_layer_bounds.translate(&clip_rect.origin)
         };
 
         let child_point = point - layer_bounds.origin;
         for child in layer.children().iter().rev() {
             // Translate the clip rect into the child's coordinate system.
             let clip_rect_for_child =
--- a/servo/components/compositing/compositor_layer.rs
+++ b/servo/components/compositing/compositor_layer.rs
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use compositor::IOCompositor;
 use windowing::{MouseWindowEvent, WindowMethods};
 
 use azure::azure_hl;
 use geom::length::Length;
-use geom::matrix::identity;
+use geom::matrix::Matrix4;
 use geom::point::{Point2D, TypedPoint2D};
 use geom::size::TypedSize2D;
 use geom::rect::Rect;
 use gfx::paint_task::Msg as PaintMsg;
 use layers::color::Color;
 use layers::geometry::LayerPixel;
 use layers::layers::{Layer, LayerBufferSet};
 use script_traits::CompositorEvent::{ClickEvent, MouseDownEvent, MouseMoveEvent, MouseUpEvent};
@@ -54,17 +54,17 @@ impl CompositorData {
                      -> Rc<Layer<CompositorData>> {
         let new_compositor_data = CompositorData {
             pipeline_id: pipeline_id,
             id: layer_properties.id,
             wants_scroll_events: wants_scroll_events,
             scroll_policy: layer_properties.scroll_policy,
             requested_epoch: Epoch(0),
             painted_epoch: Epoch(0),
-            scroll_offset: TypedPoint2D(0., 0.),
+            scroll_offset: Point2D::typed(0., 0.),
         };
 
         Rc::new(Layer::new(Rect::from_untyped(&layer_properties.rect),
                            tile_size,
                            to_layers_color(&layer_properties.background_color),
                            1.0,
                            new_compositor_data))
     }
@@ -196,17 +196,17 @@ impl CompositorLayer for Layer<Composito
         self.contents_changed();
     }
 
     fn update_layer(&self, layer_properties: LayerProperties) {
         *self.bounds.borrow_mut() = Rect::from_untyped(&layer_properties.rect);
 
         // Call scroll for bounds checking if the page shrunk. Use (-1, -1) as the
         // cursor position to make sure the scroll isn't propagated downwards.
-        self.handle_scroll_event(TypedPoint2D(0f32, 0f32), TypedPoint2D(-1f32, -1f32));
+        self.handle_scroll_event(Point2D::typed(0f32, 0f32), Point2D::typed(-1f32, -1f32));
         self.update_layer_except_bounds(layer_properties);
     }
 
     // Add LayerBuffers to the specified layer. Returns the layer buffer set back if the layer that
     // matches the given pipeline ID was not found; otherwise returns None and consumes the layer
     // buffer set.
     //
     // If the epoch of the message does not match the layer's epoch, the message is ignored, the
@@ -327,18 +327,18 @@ impl CompositorLayer for Layer<Composito
 
     fn clamp_scroll_offset_and_scroll_layer(&self, new_offset: TypedPoint2D<LayerPixel, f32>)
                                             -> ScrollEventResult {
         let layer_size = self.bounds.borrow().size;
         let content_size = calculate_content_size_for_layer(self);
         let min_x = (layer_size.width - content_size.width).get().min(0.0);
         let min_y = (layer_size.height - content_size.height).get().min(0.0);
         let new_offset : TypedPoint2D<LayerPixel, f32> =
-            Point2D(Length::new(new_offset.x.get().clamp(&min_x, &0.0)),
-                    Length::new(new_offset.y.get().clamp(&min_y, &0.0)));
+            Point2D::new(Length::new(new_offset.x.get().clamp(&min_x, &0.0)),
+                         Length::new(new_offset.y.get().clamp(&min_y, &0.0)));
 
         if self.extra_data.borrow().scroll_offset == new_offset {
             return ScrollEventResult::ScrollPositionUnchanged;
         }
 
         // The scroll offset is just a record of the scroll position of this scrolling root,
         // but scroll_layer_and_all_child_layers actually moves the child layers.
         self.extra_data.borrow_mut().scroll_offset = new_offset;
@@ -387,17 +387,17 @@ impl CompositorLayer for Layer<Composito
 
     fn scroll_layer_and_all_child_layers(&self, new_offset: TypedPoint2D<LayerPixel, f32>)
                                          -> bool {
         let mut result = false;
 
         // Only scroll this layer if it's not fixed-positioned.
         if self.extra_data.borrow().scroll_policy != ScrollPolicy::FixedPosition {
             let new_offset = new_offset.to_untyped();
-            *self.transform.borrow_mut() = identity().translate(new_offset.x, new_offset.y, 0.0);
+            *self.transform.borrow_mut() = Matrix4::identity().translate(new_offset.x, new_offset.y, 0.0);
             *self.content_offset.borrow_mut() = Point2D::from_untyped(&new_offset);
             result = true
         }
 
         let offset_for_children = new_offset + self.extra_data.borrow().scroll_offset;
         for child in self.children().iter() {
             result |= child.scroll_layer_and_all_child_layers(offset_for_children);
         }
--- a/servo/components/compositing/constellation.rs
+++ b/servo/components/compositing/constellation.rs
@@ -529,17 +529,17 @@ impl<LTF: LayoutTaskFactory, STF: Script
                               window_rect,
                               None,
                               LoadData::new(Url::parse("about:failure").unwrap()));
 
         self.push_pending_frame(new_pipeline_id, Some(pipeline_id));
     }
 
     fn handle_init_load(&mut self, url: Url) {
-        let window_rect = Rect(Point2D::zero(), self.window_size.visible_viewport);
+        let window_rect = Rect::new(Point2D::zero(), self.window_size.visible_viewport);
         let root_pipeline_id =
             self.new_pipeline(None, Some(window_rect), None, LoadData::new(url.clone()));
         self.handle_load_start_msg(&root_pipeline_id);
         self.push_pending_frame(root_pipeline_id, None);
         self.compositor_proxy.send(CompositorMsg::ChangePageUrl(root_pipeline_id, url));
     }
 
     fn handle_frame_rect_msg(&mut self, containing_pipeline_id: PipelineId, subpage_id: SubpageId,
--- a/servo/components/compositing/headless.rs
+++ b/servo/components/compositing/headless.rs
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use compositor_task::{CompositorEventListener, CompositorReceiver, Msg};
 use windowing::WindowEvent;
 
 use geom::scale_factor::ScaleFactor;
-use geom::size::TypedSize2D;
+use geom::size::Size2D;
 use msg::constellation_msg::Msg as ConstellationMsg;
 use msg::constellation_msg::{ConstellationChan, WindowSizeData};
 use profile_traits::mem;
 use profile_traits::time;
 
 /// Starts the compositor, which listens for messages on the specified port.
 ///
 /// This is the null compositor which doesn't draw anything to the screen.
@@ -50,18 +50,18 @@ impl NullCompositor {
                                              constellation_chan,
                                              time_profiler_chan,
                                              mem_profiler_chan);
 
         // Tell the constellation about the initial fake size.
         {
             let ConstellationChan(ref chan) = compositor.constellation_chan;
             chan.send(ConstellationMsg::ResizedWindow(WindowSizeData {
-                initial_viewport: TypedSize2D(640_f32, 480_f32),
-                visible_viewport: TypedSize2D(640_f32, 480_f32),
+                initial_viewport: Size2D::typed(640_f32, 480_f32),
+                visible_viewport: Size2D::typed(640_f32, 480_f32),
                 device_pixel_ratio: ScaleFactor::new(1.0),
             })).unwrap();
         }
 
         compositor
     }
 }
 
--- a/servo/components/gfx/display_list/mod.rs
+++ b/servo/components/gfx/display_list/mod.rs
@@ -467,24 +467,23 @@ impl StackingContext {
                 if item.base().metadata.pointing.is_none() {
                     // `pointer-events` is `none`. Ignore this item.
                     continue
                 }
                 match *item {
                     DisplayItem::BorderClass(ref border) => {
                         // If the point is inside the border, it didn't hit the border!
                         let interior_rect =
-                            Rect(Point2D(border.base.bounds.origin.x + border.border_widths.left,
-                                         border.base.bounds.origin.y + border.border_widths.top),
-                                 Size2D(border.base.bounds.size.width -
-                                            (border.border_widths.left +
-                                             border.border_widths.right),
-                                        border.base.bounds.size.height -
-                                            (border.border_widths.top +
-                                             border.border_widths.bottom)));
+                            Rect::new(
+                                Point2D::new(border.base.bounds.origin.x + border.border_widths.left,
+                                             border.base.bounds.origin.y + border.border_widths.top),
+                                Size2D::new(border.base.bounds.size.width -
+                                                (border.border_widths.left + border.border_widths.right),
+                                            border.base.bounds.size.height -
+                                                (border.border_widths.top + border.border_widths.bottom)));
                         if geometry::rect_contains_point(interior_rect, point) {
                             continue
                         }
                     }
                     _ => {}
                 }
 
                 // We found a hit!
@@ -494,19 +493,19 @@ impl StackingContext {
                 }
             }
         }
 
         // Convert the point into stacking context local space
         point = point - self.bounds.origin;
 
         debug_assert!(!topmost_only || result.is_empty());
-        let frac_point = self.transform.transform_point(&Point2D(point.x.to_f32_px(),
+        let frac_point = self.transform.transform_point(&Point2D::new(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));
+        point = Point2D::new(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.
         //
         // Step 10: Outlines.
         hit_test_in_list(point, result, topmost_only, self.display_list.outlines.iter().rev());
         if topmost_only && !result.is_empty() {
             return
--- a/servo/components/gfx/font.rs
+++ b/servo/components/gfx/font.rs
@@ -223,18 +223,18 @@ pub struct RunMetrics {
     pub descent: Au, // nonzero
     // this bounding box is relative to the left origin baseline.
     // so, bounding_box.position.y = -ascent
     pub bounding_box: Rect<Au>
 }
 
 impl RunMetrics {
     pub fn new(advance: Au, ascent: Au, descent: Au) -> RunMetrics {
-        let bounds = Rect(Point2D(Au(0), -ascent),
-                          Size2D(advance, ascent + descent));
+        let bounds = Rect::new(Point2D::new(Au(0), -ascent),
+                               Size2D::new(advance, ascent + descent));
 
         // TODO(Issue #125): support loose and tight bounding boxes; using the
         // ascent+descent and advance is sometimes too generous and
         // looking at actual glyph extents can yield a tighter box.
 
         RunMetrics {
             advance_width: advance,
             bounding_box: bounds,
--- a/servo/components/gfx/paint_context.rs
+++ b/servo/components/gfx/paint_context.rs
@@ -102,21 +102,21 @@ impl<'a> PaintContext<'a> {
 
         self.draw_line_segment(bounds, &Default::default(), color, style);
     }
 
     pub fn draw_push_clip(&self, bounds: &Rect<Au>) {
         let rect = bounds.to_nearest_azure_rect();
         let path_builder = self.draw_target.create_path_builder();
 
-        let left_top = Point2D(rect.origin.x, rect.origin.y);
-        let right_top = Point2D(rect.origin.x + rect.size.width, rect.origin.y);
-        let left_bottom = Point2D(rect.origin.x, rect.origin.y + rect.size.height);
-        let right_bottom = Point2D(rect.origin.x + rect.size.width,
-                                   rect.origin.y + rect.size.height);
+        let left_top = Point2D::new(rect.origin.x, rect.origin.y);
+        let right_top = Point2D::new(rect.origin.x + rect.size.width, rect.origin.y);
+        let left_bottom = Point2D::new(rect.origin.x, rect.origin.y + rect.size.height);
+        let right_bottom = Point2D::new(rect.origin.x + rect.size.width,
+                                        rect.origin.y + rect.size.height);
 
         path_builder.move_to(left_top);
         path_builder.line_to(right_top);
         path_builder.line_to(right_bottom);
         path_builder.line_to(left_bottom);
 
         let path = path_builder.finish();
         self.draw_target.push_clip(&path);
@@ -125,33 +125,33 @@ impl<'a> PaintContext<'a> {
     pub fn draw_pop_clip(&self) {
         self.draw_target.pop_clip();
     }
 
     pub fn draw_image(&self,
                       bounds: &Rect<Au>,
                       image: Arc<Image>,
                       image_rendering: image_rendering::T) {
-        let size = Size2D(image.width as i32, image.height as i32);
+        let size = Size2D::new(image.width as i32, image.height as i32);
         let (pixel_width, pixels, source_format) = match image.pixels {
             PixelsByColorType::RGBA8(ref pixels) => (4, pixels, SurfaceFormat::B8G8R8A8),
             PixelsByColorType::K8(ref pixels) => (1, pixels, SurfaceFormat::A8),
             PixelsByColorType::RGB8(_) => panic!("RGB8 color type not supported"),
             PixelsByColorType::KA8(_) => panic!("KA8 color type not supported"),
         };
         let stride = image.width * pixel_width;
 
         self.draw_target.make_current();
         let draw_target_ref = &self.draw_target;
         let azure_surface = draw_target_ref.create_source_surface_from_data(pixels,
                                                                             size,
                                                                             stride as i32,
                                                                             source_format);
-        let source_rect = Rect(Point2D(0.0, 0.0),
-                               Size2D(image.width as AzFloat, image.height as AzFloat));
+        let source_rect = Rect::new(Point2D::new(0.0, 0.0),
+                                    Size2D::new(image.width as AzFloat, image.height as AzFloat));
         let dest_rect = bounds.to_nearest_azure_rect();
 
         // TODO(pcwalton): According to CSS-IMAGES-3 § 5.3, nearest-neighbor interpolation is a
         // conforming implementation of `crisp-edges`, but it is not the best we could do.
         // Something like Scale2x would be ideal.
         let draw_surface_options = match image_rendering {
             image_rendering::T::Auto => DrawSurfaceOptions::new(Filter::Linear, true),
             image_rendering::T::CrispEdges | image_rendering::T::Pixelated => {
@@ -164,20 +164,20 @@ impl<'a> PaintContext<'a> {
                                      dest_rect,
                                      source_rect,
                                      draw_surface_options,
                                      draw_options);
     }
 
     pub fn clear(&self) {
         let pattern = ColorPattern::new(color::transparent());
-        let rect = Rect(Point2D(self.page_rect.origin.x as AzFloat,
-                                self.page_rect.origin.y as AzFloat),
-                        Size2D(self.screen_rect.size.width as AzFloat,
-                               self.screen_rect.size.height as AzFloat));
+        let rect = Rect::new(Point2D::new(self.page_rect.origin.x as AzFloat,
+                                          self.page_rect.origin.y as AzFloat),
+                             Size2D::new(self.screen_rect.size.width as AzFloat,
+                                         self.screen_rect.size.height as AzFloat));
         let mut draw_options = DrawOptions::new(1.0, CompositionOp::Over, AntialiasMode::None);
         draw_options.set_composition_op(CompositionOp::Source);
         self.draw_target.make_current();
         self.draw_target.fill_rect(&rect, PatternRef::Color(&pattern), Some(&draw_options));
     }
 
     fn draw_border_segment(&self,
                            direction: Direction,
@@ -385,43 +385,43 @@ impl<'a> PaintContext<'a> {
                                   path_builder: &mut PathBuilder,
                                   bounds: &Rect<f32>,
                                   direction: Direction,
                                   border: &SideOffsets2D<f32>,
                                   radius: &BorderRadii<AzFloat>) {
         // T = top, B = bottom, L = left, R = right
 
         let box_TL = bounds.origin;
-        let box_TR = box_TL + Point2D(bounds.size.width, 0.0);
-        let box_BL = box_TL + Point2D(0.0, bounds.size.height);
-        let box_BR = box_TL + Point2D(bounds.size.width, bounds.size.height);
+        let box_TR = box_TL + Point2D::new(bounds.size.width, 0.0);
+        let box_BL = box_TL + Point2D::new(0.0, bounds.size.height);
+        let box_BR = box_TL + Point2D::new(bounds.size.width, bounds.size.height);
 
         let rad_R: AzFloat = 0.;
         let rad_BR = rad_R  + f32::consts::FRAC_PI_4;
         let rad_B  = rad_BR + f32::consts::FRAC_PI_4;
         let rad_BL = rad_B  + f32::consts::FRAC_PI_4;
         let rad_L  = rad_BL + f32::consts::FRAC_PI_4;
         let rad_TL = rad_L  + f32::consts::FRAC_PI_4;
         let rad_T  = rad_TL + f32::consts::FRAC_PI_4;
         let rad_TR = rad_T  + f32::consts::FRAC_PI_4;
 
         fn dx(x: AzFloat) -> Point2D<AzFloat> {
-            Point2D(x, 0.)
+            Point2D::new(x, 0.)
         }
 
         fn dy(y: AzFloat) -> Point2D<AzFloat> {
-            Point2D(0., y)
+            Point2D::new(0., y)
         }
 
         fn dx_if(cond: bool, dx: AzFloat) -> Point2D<AzFloat> {
-            Point2D(if cond { dx } else { 0. }, 0.)
+            Point2D::new(if cond { dx } else { 0. }, 0.)
         }
 
         fn dy_if(cond: bool, dy: AzFloat) -> Point2D<AzFloat> {
-            Point2D(0., if cond { dy } else { 0. })
+            Point2D::new(0., if cond { dy } else { 0. })
         }
 
         match direction {
             Direction::Top => {
                 let edge_TL = box_TL + dx(radius.top_left.max(border.left));
                 let edge_TR = box_TR + dx(-radius.top_right.max(border.right));
                 let edge_BR = edge_TR + dy(border.top);
                 let edge_BL = edge_TL + dy(border.top);
@@ -429,30 +429,30 @@ impl<'a> PaintContext<'a> {
                 let corner_TL = edge_TL + dx_if(radius.top_left == 0., -border.left);
                 let corner_TR = edge_TR + dx_if(radius.top_right == 0., border.right);
 
                 path_builder.move_to(corner_TL);
                 path_builder.line_to(corner_TR);
 
                 if radius.top_right != 0. {
                     // the origin is the center of the arcs we're about to draw.
-                    let origin = edge_TR + Point2D((border.right - radius.top_right).max(0.),
-                                                   radius.top_right);
+                    let origin = edge_TR + Point2D::new((border.right - radius.top_right).max(0.),
+                                                        radius.top_right);
                     // the elbow is the inside of the border's curve.
                     let distance_to_elbow = (radius.top_right - border.top).max(0.);
 
                     path_builder.arc(origin, radius.top_right,  rad_T, rad_TR, false);
                     path_builder.arc(origin, distance_to_elbow, rad_TR, rad_T, true);
                 }
 
                 path_builder.line_to(edge_BR);
                 path_builder.line_to(edge_BL);
 
                 if radius.top_left != 0. {
-                    let origin = edge_TL + Point2D(-(border.left - radius.top_left).max(0.),
+                    let origin = edge_TL + Point2D::new(-(border.left - radius.top_left).max(0.),
                                                    radius.top_left);
                     let distance_to_elbow = (radius.top_left - border.top).max(0.);
 
                     path_builder.arc(origin, distance_to_elbow, rad_T, rad_TL, true);
                     path_builder.arc(origin, radius.top_left,   rad_TL, rad_T, false);
                 }
             }
             Direction::Left => {
@@ -463,30 +463,30 @@ impl<'a> PaintContext<'a> {
 
                 let corner_TL = edge_TL + dy_if(radius.top_left == 0., -border.top);
                 let corner_BL = edge_BL + dy_if(radius.bottom_left == 0., border.bottom);
 
                 path_builder.move_to(corner_BL);
                 path_builder.line_to(corner_TL);
 
                 if radius.top_left != 0. {
-                    let origin = edge_TL + Point2D(radius.top_left,
+                    let origin = edge_TL + Point2D::new(radius.top_left,
                                                    -(border.top - radius.top_left).max(0.));
                     let distance_to_elbow = (radius.top_left - border.left).max(0.);
 
                     path_builder.arc(origin, radius.top_left,   rad_L, rad_TL, false);
                     path_builder.arc(origin, distance_to_elbow, rad_TL, rad_L, true);
                 }
 
                 path_builder.line_to(edge_TR);
                 path_builder.line_to(edge_BR);
 
                 if radius.bottom_left != 0. {
                     let origin = edge_BL +
-                        Point2D(radius.bottom_left,
+                        Point2D::new(radius.bottom_left,
                                 (border.bottom - radius.bottom_left).max(0.));
                     let distance_to_elbow = (radius.bottom_left - border.left).max(0.);
 
                     path_builder.arc(origin, distance_to_elbow,  rad_L, rad_BL, true);
                     path_builder.arc(origin, radius.bottom_left, rad_BL, rad_L, false);
                 }
             }
             Direction::Right => {
@@ -497,30 +497,30 @@ impl<'a> PaintContext<'a> {
 
                 let corner_TR = edge_TR + dy_if(radius.top_right == 0., -border.top);
                 let corner_BR = edge_BR + dy_if(radius.bottom_right == 0., border.bottom);
 
                 path_builder.move_to(edge_BL);
                 path_builder.line_to(edge_TL);
 
                 if radius.top_right != 0. {
-                    let origin = edge_TR + Point2D(-radius.top_right,
-                                                   -(border.top - radius.top_right).max(0.));
+                    let origin = edge_TR + Point2D::new(-radius.top_right,
+                                                        -(border.top - radius.top_right).max(0.));
                     let distance_to_elbow = (radius.top_right - border.right).max(0.);
 
                     path_builder.arc(origin, distance_to_elbow, rad_R, rad_TR, true);
                     path_builder.arc(origin, radius.top_right,  rad_TR, rad_R, false);
                 }
 
                 path_builder.line_to(corner_TR);
                 path_builder.line_to(corner_BR);
 
                 if radius.bottom_right != 0. {
                     let origin = edge_BR +
-                        Point2D(-radius.bottom_right,
+                        Point2D::new(-radius.bottom_right,
                                 (border.bottom - radius.bottom_right).max(0.));
                     let distance_to_elbow = (radius.bottom_right - border.right).max(0.);
 
                     path_builder.arc(origin, radius.bottom_right, rad_R, rad_BR, false);
                     path_builder.arc(origin, distance_to_elbow,   rad_BR, rad_R, true);
                 }
             }
             Direction::Bottom => {
@@ -531,29 +531,29 @@ impl<'a> PaintContext<'a> {
 
                 let corner_BR = edge_BR + dx_if(radius.bottom_right == 0., border.right);
                 let corner_BL = edge_BL + dx_if(radius.bottom_left == 0., -border.left);
 
                 path_builder.move_to(edge_TL);
                 path_builder.line_to(edge_TR);
 
                 if radius.bottom_right != 0. {
-                    let origin = edge_BR + Point2D((border.right - radius.bottom_right).max(0.),
-                                                   -radius.bottom_right);
+                    let origin = edge_BR + Point2D::new((border.right - radius.bottom_right).max(0.),
+                                                        -radius.bottom_right);
                     let distance_to_elbow = (radius.bottom_right - border.bottom).max(0.);
 
                     path_builder.arc(origin, distance_to_elbow,   rad_B, rad_BR, true);
                     path_builder.arc(origin, radius.bottom_right, rad_BR, rad_B, false);
                 }
 
                 path_builder.line_to(corner_BR);
                 path_builder.line_to(corner_BL);
 
                 if radius.bottom_left != 0. {
-                    let origin = edge_BL - Point2D((border.left - radius.bottom_left).max(0.),
+                    let origin = edge_BL - Point2D::new((border.left - radius.bottom_left).max(0.),
                                                    radius.bottom_left);
                     let distance_to_elbow = (radius.bottom_left - border.bottom).max(0.);
 
                     path_builder.arc(origin, radius.bottom_left, rad_B, rad_BL, false);
                     path_builder.arc(origin, distance_to_elbow,  rad_BL, rad_B, true);
                 }
             }
         }
@@ -574,45 +574,45 @@ impl<'a> PaintContext<'a> {
         //    +----------+
         //   / 1        2 \
         //  + 8          3 +
         //  |              |
         //  + 7          4 +
         //   \ 6        5 /
         //    +----------+
 
-        path_builder.move_to(Point2D(bounds.origin.x + radii.top_left, bounds.origin.y));   // 1
-        path_builder.line_to(Point2D(bounds.max_x() - radii.top_right, bounds.origin.y));   // 2
-        path_builder.arc(Point2D(bounds.max_x() - radii.top_right,
-                                 bounds.origin.y + radii.top_right),
+        path_builder.move_to(Point2D::new(bounds.origin.x + radii.top_left, bounds.origin.y));   // 1
+        path_builder.line_to(Point2D::new(bounds.max_x() - radii.top_right, bounds.origin.y));   // 2
+        path_builder.arc(Point2D::new(bounds.max_x() - radii.top_right,
+                                      bounds.origin.y + radii.top_right),
                          radii.top_right,
                          1.5f32 * f32::consts::FRAC_PI_2,
                          f32::consts::PI_2,
-                         false);                                                            // 3
-        path_builder.line_to(Point2D(bounds.max_x(), bounds.max_y() - radii.bottom_right)); // 4
-        path_builder.arc(Point2D(bounds.max_x() - radii.bottom_right,
-                                 bounds.max_y() - radii.bottom_right),
+                         false);                                                                 // 3
+        path_builder.line_to(Point2D::new(bounds.max_x(), bounds.max_y() - radii.bottom_right)); // 4
+        path_builder.arc(Point2D::new(bounds.max_x() - radii.bottom_right,
+                                      bounds.max_y() - radii.bottom_right),
                          radii.bottom_right,
                          0.0,
                          f32::consts::FRAC_PI_2,
-                         false);                                                            // 5
-        path_builder.line_to(Point2D(bounds.origin.x + radii.bottom_left, bounds.max_y())); // 6
-        path_builder.arc(Point2D(bounds.origin.x + radii.bottom_left,
+                         false);                                                                 // 5
+        path_builder.line_to(Point2D::new(bounds.origin.x + radii.bottom_left, bounds.max_y())); // 6
+        path_builder.arc(Point2D::new(bounds.origin.x + radii.bottom_left,
                                  bounds.max_y() - radii.bottom_left),
                          radii.bottom_left,
                          f32::consts::FRAC_PI_2,
                          f32::consts::PI,
-                         false);                                                            // 7
-        path_builder.line_to(Point2D(bounds.origin.x, bounds.origin.y + radii.top_left));   // 8
-        path_builder.arc(Point2D(bounds.origin.x + radii.top_left,
-                                 bounds.origin.y + radii.top_left),
+                         false);                                                                 // 7
+        path_builder.line_to(Point2D::new(bounds.origin.x, bounds.origin.y + radii.top_left));   // 8
+        path_builder.arc(Point2D::new(bounds.origin.x + radii.top_left,
+                                      bounds.origin.y + radii.top_left),
                          radii.top_left,
                          f32::consts::PI,
                          1.5f32 * f32::consts::FRAC_PI_2,
-                         false);                                                            // 1
+                         false);                                                                 // 1
     }
 
     fn draw_dashed_border_segment(&self,
                                   direction: Direction,
                                   bounds: &Rect<Au>,
                                   border: &SideOffsets2D<f32>,
                                   color: Color,
                                   dash_size: DashSize) {
@@ -629,36 +629,36 @@ impl<'a> PaintContext<'a> {
         let stroke_opts = StrokeOptions::new(border_width as AzFloat,
                                              JoinStyle::MiterOrBevel,
                                              CapStyle::Butt,
                                              10 as AzFloat,
                                              &dash_pattern);
         let (start, end)  = match direction {
             Direction::Top => {
                 let y = rect.origin.y + border.top * 0.5;
-                let start = Point2D(rect.origin.x, y);
-                let end = Point2D(rect.origin.x + rect.size.width, y);
+                let start = Point2D::new(rect.origin.x, y);
+                let end = Point2D::new(rect.origin.x + rect.size.width, y);
                 (start, end)
             }
             Direction::Left => {
                 let x = rect.origin.x + border.left * 0.5;
-                let start = Point2D(x, rect.origin.y + rect.size.height);
-                let end = Point2D(x, rect.origin.y + border.top);
+                let start = Point2D::new(x, rect.origin.y + rect.size.height);
+                let end = Point2D::new(x, rect.origin.y + border.top);
                 (start, end)
             }
             Direction::Right => {
                 let x = rect.origin.x + rect.size.width - border.right * 0.5;
-                let start = Point2D(x, rect.origin.y);
-                let end = Point2D(x, rect.origin.y + rect.size.height);
+                let start = Point2D::new(x, rect.origin.y);
+                let end = Point2D::new(x, rect.origin.y + rect.size.height);
                 (start, end)
             }
             Direction::Bottom => {
                 let y = rect.origin.y + rect.size.height - border.bottom * 0.5;
-                let start = Point2D(rect.origin.x + rect.size.width, y);
-                let end = Point2D(rect.origin.x + border.left, y);
+                let start = Point2D::new(rect.origin.x + rect.size.width, y);
+                let end = Point2D::new(rect.origin.x + border.left, y);
                 (start, end)
             }
         };
 
         self.draw_target.stroke_line(start,
                                      end,
                                      &ColorPattern::new(color),
                                      &stroke_opts,
@@ -679,22 +679,22 @@ impl<'a> PaintContext<'a> {
                              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,
                                                  shrink_factor * border.bottom,
                                                  shrink_factor * border.left);
-        let left_top        = Point2D(rect.origin.x, rect.origin.y);
-        let scaled_left_top = left_top + Point2D(scaled_border.left,
-                                                 scaled_border.top);
-        return Rect(scaled_left_top,
-                    Size2D(rect.size.width - 2.0 * scaled_border.right,
-                           rect.size.height - 2.0 * scaled_border.bottom));
+        let left_top        = Point2D::new(rect.origin.x, rect.origin.y);
+        let scaled_left_top = left_top + Point2D::new(scaled_border.left,
+                                                      scaled_border.top);
+        return Rect::new(scaled_left_top,
+                         Size2D::new(rect.size.width - 2.0 * scaled_border.right,
+                                     rect.size.height - 2.0 * scaled_border.bottom));
     }
 
     fn scale_color(&self, color: Color, scale_factor: f32) -> Color {
         return color::new(color.r * scale_factor,
                           color.g * scale_factor,
                           color.b * scale_factor,
                           color.a);
     }
@@ -901,31 +901,31 @@ impl<'a> PaintContext<'a> {
             // resulting in a situation whereby display items are seemingly randomly clipped out.
             self.remove_transient_clip_if_applicable();
 
             return self.draw_target.clone()
         }
 
         // FIXME(pcwalton): This surface might be bigger than necessary and waste memory.
         let size = self.draw_target.get_size(); //Az size.
-        let mut size = Size2D(size.width, size.height); //Geom::Size.
+        let mut size = Size2D::new(size.width, size.height); //Geom::Size.
 
         // Pre-calculate if there is a blur expansion need.
         let accum_blur = filters::calculate_accumulated_blur(filters);
         let mut matrix = self.draw_target.get_transform();
         if accum_blur > Au(0) {
             // Set the correct size.
             let side_inflation = accum_blur * BLUR_INFLATION_FACTOR;
-            size = Size2D(size.width + (side_inflation.to_nearest_px() * 2) as i32,
-                          size.height + (side_inflation.to_nearest_px() * 2) as i32);
+            size = Size2D::new(size.width + (side_inflation.to_nearest_px() * 2) as i32,
+                               size.height + (side_inflation.to_nearest_px() * 2) as i32);
 
             // Calculate the transform matrix.
             let old_transform = self.draw_target.get_transform();
-            let inflated_size = Rect(Point2D(0.0, 0.0), Size2D(size.width as AzFloat,
-                                                               size.height as AzFloat));
+            let inflated_size = Rect::new(Point2D::new(0.0, 0.0), Size2D::new(size.width as AzFloat,
+                                                                              size.height as AzFloat));
             let temporary_draw_target_bounds = old_transform.transform_rect(&inflated_size);
             matrix = Matrix2D::identity().translate(
                 -temporary_draw_target_bounds.origin.x as AzFloat,
                 -temporary_draw_target_bounds.origin.y as AzFloat).mul(&old_transform);
         }
 
         let temporary_draw_target =
             self.draw_target.create_similar_draw_target(&size, self.draw_target.get_format());
@@ -943,19 +943,19 @@ impl<'a> PaintContext<'a> {
         if (*temporary_draw_target) == self.draw_target {
             // We're directly painting to the surface; nothing to do.
             return
         }
 
         // Set up transforms.
         let old_transform = self.draw_target.get_transform();
         self.draw_target.set_transform(&Matrix2D::identity());
-        let rect = Rect(Point2D(0.0, 0.0), self.draw_target.get_size().to_azure_size());
+        let rect = Rect::new(Point2D::new(0.0, 0.0), self.draw_target.get_size().to_azure_size());
 
-        let rect_temporary = Rect(Point2D(0.0, 0.0), temporary_draw_target.get_size().to_azure_size());
+        let rect_temporary = Rect::new(Point2D::new(0.0, 0.0), temporary_draw_target.get_size().to_azure_size());
 
         // Create the Azure filter pipeline.
         let mut accum_blur = Au(0);
         let (filter_node, opacity) = filters::create_filters(&self.draw_target,
                                                              temporary_draw_target,
                                                              filters,
                                                              &mut accum_blur);
 
@@ -1106,69 +1106,69 @@ impl<'a> PaintContext<'a> {
 
 pub trait ToAzurePoint {
     fn to_nearest_azure_point(&self) -> Point2D<AzFloat>;
     fn to_azure_point(&self) -> Point2D<AzFloat>;
 }
 
 impl ToAzurePoint for Point2D<Au> {
     fn to_nearest_azure_point(&self) -> Point2D<AzFloat> {
-        Point2D(self.x.to_nearest_px() as AzFloat, self.y.to_nearest_px() as AzFloat)
+        Point2D::new(self.x.to_nearest_px() as AzFloat, self.y.to_nearest_px() as AzFloat)
     }
     fn to_azure_point(&self) -> Point2D<AzFloat> {
-        Point2D(self.x.to_f32_px(), self.y.to_f32_px())
+        Point2D::new(self.x.to_f32_px(), self.y.to_f32_px())
     }
 }
 
 pub trait ToAzureRect {
     fn to_nearest_azure_rect(&self) -> Rect<AzFloat>;
     fn to_azure_rect(&self) -> Rect<AzFloat>;
 }
 
 impl ToAzureRect for Rect<Au> {
     fn to_nearest_azure_rect(&self) -> Rect<AzFloat> {
-        Rect(self.origin.to_nearest_azure_point(), Size2D(self.size.width.to_nearest_px() as AzFloat,
-                                                  self.size.height.to_nearest_px() as AzFloat))
+        Rect::new(self.origin.to_nearest_azure_point(), Size2D::new(self.size.width.to_nearest_px() as AzFloat,
+                                                                    self.size.height.to_nearest_px() as AzFloat))
 
     }
     fn to_azure_rect(&self) -> Rect<AzFloat> {
-        Rect(self.origin.to_azure_point(), Size2D(self.size.width.to_f32_px(),
-                                                        self.size.height.to_f32_px()))
+        Rect::new(self.origin.to_azure_point(), Size2D::new(self.size.width.to_f32_px(),
+                                                            self.size.height.to_f32_px()))
     }
 }
 
 pub trait ToAzureSize {
     fn to_azure_size(&self) -> Size2D<AzFloat>;
 }
 
 impl ToAzureSize for AzIntSize {
     fn to_azure_size(&self) -> Size2D<AzFloat> {
-        Size2D(self.width as AzFloat, self.height as AzFloat)
+        Size2D::new(self.width as AzFloat, self.height as AzFloat)
     }
 }
 
 trait ToAzureIntSize {
     fn to_azure_int_size(&self) -> Size2D<i32>;
 }
 
 impl ToAzureIntSize for Size2D<Au> {
     fn to_azure_int_size(&self) -> Size2D<i32> {
-        Size2D(self.width.to_nearest_px() as i32, self.height.to_nearest_px() as i32)
+        Size2D::new(self.width.to_nearest_px() as i32, self.height.to_nearest_px() as i32)
     }
 }
 
 impl ToAzureIntSize for Size2D<AzFloat> {
     fn to_azure_int_size(&self) -> Size2D<i32> {
-        Size2D(self.width as i32, self.height as i32)
+        Size2D::new(self.width as i32, self.height as i32)
     }
 }
 
 impl ToAzureIntSize for Size2D<i32> {
     fn to_azure_int_size(&self) -> Size2D<i32> {
-        Size2D(self.width, self.height)
+        Size2D::new(self.width, self.height)
     }
 }
 
 trait ToSideOffsetsPx {
     fn to_float_px(&self) -> SideOffsets2D<AzFloat>;
 }
 
 impl ToSideOffsetsPx for SideOffsets2D<Au> {
@@ -1238,17 +1238,17 @@ impl ScaledFontExtensionMethods for Scal
                 let glyph_offset = glyph.offset().unwrap_or(Point2D::zero());
                 let azglyph = struct__AzGlyph {
                     mIndex: glyph.id() as uint32_t,
                     mPosition: struct__AzPoint {
                         x: (origin.x + glyph_offset.x).to_f32_px(),
                         y: (origin.y + glyph_offset.y).to_f32_px(),
                     }
                 };
-                origin = Point2D(origin.x + glyph_advance, origin.y);
+                origin = Point2D::new(origin.x + glyph_advance, origin.y);
                 azglyphs.push(azglyph)
             };
         }
 
         let azglyph_buf_len = azglyphs.len();
         if azglyph_buf_len == 0 { return; } // Otherwise the Quartz backend will assert.
 
         let mut glyphbuf = struct__AzGlyphBuffer {
@@ -1301,35 +1301,35 @@ impl DrawTargetExtensions for DrawTarget
         // |   +---+   |
         // |    8   7  |
         // |           |
         // +-----------+
         //  3           4
 
         let (outer_rect, inner_rect) = (outer_rect.to_nearest_azure_rect(), inner_rect.to_nearest_azure_rect());
         let path_builder = self.create_path_builder();
-        path_builder.move_to(Point2D(outer_rect.max_x(), outer_rect.origin.y));     // 1
-        path_builder.line_to(Point2D(outer_rect.origin.x, outer_rect.origin.y));    // 2
-        path_builder.line_to(Point2D(outer_rect.origin.x, outer_rect.max_y()));     // 3
-        path_builder.line_to(Point2D(outer_rect.max_x(), outer_rect.max_y()));      // 4
-        path_builder.line_to(Point2D(outer_rect.max_x(), inner_rect.origin.y));     // 5
-        path_builder.line_to(Point2D(inner_rect.max_x(), inner_rect.origin.y));     // 6
-        path_builder.line_to(Point2D(inner_rect.max_x(), inner_rect.max_y()));      // 7
-        path_builder.line_to(Point2D(inner_rect.origin.x, inner_rect.max_y()));     // 8
-        path_builder.line_to(inner_rect.origin);                                    // 9
-        path_builder.line_to(Point2D(outer_rect.max_x(), inner_rect.origin.y));     // 10
+        path_builder.move_to(Point2D::new(outer_rect.max_x(), outer_rect.origin.y));     // 1
+        path_builder.line_to(Point2D::new(outer_rect.origin.x, outer_rect.origin.y));    // 2
+        path_builder.line_to(Point2D::new(outer_rect.origin.x, outer_rect.max_y()));     // 3
+        path_builder.line_to(Point2D::new(outer_rect.max_x(), outer_rect.max_y()));      // 4
+        path_builder.line_to(Point2D::new(outer_rect.max_x(), inner_rect.origin.y));     // 5
+        path_builder.line_to(Point2D::new(inner_rect.max_x(), inner_rect.origin.y));     // 6
+        path_builder.line_to(Point2D::new(inner_rect.max_x(), inner_rect.max_y()));      // 7
+        path_builder.line_to(Point2D::new(inner_rect.origin.x, inner_rect.max_y()));     // 8
+        path_builder.line_to(inner_rect.origin);                                         // 9
+        path_builder.line_to(Point2D::new(outer_rect.max_x(), inner_rect.origin.y));     // 10
         path_builder.finish()
     }
 
     fn create_rectangular_path(&self, rect: &Rect<Au>) -> Path {
         let path_builder = self.create_path_builder();
         path_builder.move_to(rect.origin.to_nearest_azure_point());
-        path_builder.line_to(Point2D(rect.max_x(), rect.origin.y).to_nearest_azure_point());
-        path_builder.line_to(Point2D(rect.max_x(), rect.max_y()).to_nearest_azure_point());
-        path_builder.line_to(Point2D(rect.origin.x, rect.max_y()).to_nearest_azure_point());
+        path_builder.line_to(Point2D::new(rect.max_x(), rect.origin.y).to_nearest_azure_point());
+        path_builder.line_to(Point2D::new(rect.max_x(), rect.max_y()).to_nearest_azure_point());
+        path_builder.line_to(Point2D::new(rect.origin.x, rect.max_y()).to_nearest_azure_point());
         path_builder.finish()
     }
 }
 
 /// Converts a CSS blend mode (per CSS-COMPOSITING) to an Azure `CompositionOp`.
 trait ToAzureCompositionOp {
     /// Converts a CSS blend mode (per CSS-COMPOSITING) to an Azure `CompositionOp`.
     fn to_azure_composition_op(&self) -> CompositionOp;
@@ -1368,30 +1368,30 @@ struct TemporaryDrawTarget {
     offset: Point2D<AzFloat>,
 }
 
 impl TemporaryDrawTarget {
     /// Creates a temporary draw target that simply draws to the main draw target.
     fn from_main_draw_target(main_draw_target: &DrawTarget) -> TemporaryDrawTarget {
         TemporaryDrawTarget {
             draw_target: main_draw_target.clone(),
-            offset: Point2D(0.0, 0.0),
+            offset: Point2D::new(0.0, 0.0),
         }
     }
 
     /// Creates a temporary draw target large enough to encompass the given bounding rect in page
     /// coordinates. The temporary draw target will have the same transform as the tile we're
     /// drawing to.
     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_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);
+            Size2D::new(temporary_draw_target_bounds.size.width.ceil() as i32,
+                        temporary_draw_target_bounds.size.height.ceil() as i32);
         let temporary_draw_target =
             main_draw_target.create_similar_draw_target(&temporary_draw_target_size,
                                                         main_draw_target.get_format());
         let matrix =
             Matrix2D::identity().translate(-temporary_draw_target_bounds.origin.x as AzFloat,
                                            -temporary_draw_target_bounds.origin.y as AzFloat)
                                 .mul(&draw_target_transform);
         temporary_draw_target.set_transform(&matrix);
@@ -1400,22 +1400,22 @@ impl TemporaryDrawTarget {
             offset: temporary_draw_target_bounds.origin,
         }
     }
 
     /// Composites this temporary draw target onto the main surface, with the given Azure filter.
     fn draw_filter(self, main_draw_target: &DrawTarget, filter: FilterNode) {
         let main_draw_target_transform = main_draw_target.get_transform();
         let temporary_draw_target_size = self.draw_target.get_size();
-        let temporary_draw_target_size = Size2D(temporary_draw_target_size.width as AzFloat,
-                                                temporary_draw_target_size.height as AzFloat);
+        let temporary_draw_target_size = Size2D::new(temporary_draw_target_size.width as AzFloat,
+                                                     temporary_draw_target_size.height as AzFloat);
 
         // Blit the blur onto the tile. We undo the transforms here because we want to directly
         // stack the temporary draw target onto the tile.
         main_draw_target.set_transform(&Matrix2D::identity());
         main_draw_target.draw_filter(&filter,
-                                     &Rect(Point2D(0.0, 0.0), temporary_draw_target_size),
+                                     &Rect::new(Point2D::new(0.0, 0.0), temporary_draw_target_size),
                                      &self.offset,
                                      DrawOptions::new(1.0, CompositionOp::Over, AntialiasMode::None));
         main_draw_target.set_transform(&main_draw_target_transform);
 
     }
 }
--- a/servo/components/gfx/paint_task.rs
+++ b/servo/components/gfx/paint_task.rs
@@ -8,17 +8,16 @@ use buffer_map::BufferMap;
 use display_list::{self, StackingContext};
 use font_cache_task::FontCacheTask;
 use font_context::FontContext;
 use paint_context::PaintContext;
 
 use azure::azure_hl::{SurfaceFormat, Color, DrawTarget, BackendType};
 use azure::AzFloat;
 use geom::Matrix4;
-use geom::matrix::identity;
 use geom::point::Point2D;
 use geom::rect::Rect;
 use geom::size::Size2D;
 use layers::platform::surface::{NativeGraphicsMetadata, NativePaintingGraphicsContext};
 use layers::platform::surface::NativeSurface;
 use layers::layers::{BufferRequest, LayerBuffer, LayerBufferSet};
 use layers;
 use canvas_traits::CanvasMsg;
@@ -381,17 +380,17 @@ impl<C> PaintTask<C> where C: PaintListe
             }
             None => {}
         }
 
         // Create an empty native surface. We mark it as not leaking
         // in case it dies in transit to the compositor task.
         let mut native_surface: NativeSurface =
             layers::platform::surface::NativeSurface::new(native_graphics_context!(self),
-                                                          Size2D(width as i32, height as i32),
+                                                          Size2D::new(width as i32, height as i32),
                                                           width as i32 * 4);
         native_surface.mark_wont_leak();
 
         Some(box LayerBuffer {
             native_surface: native_surface,
             rect: tile.page_rect,
             screen_pos: tile.screen_rect,
             resolution: scale,
@@ -458,20 +457,20 @@ impl<C> PaintTask<C> where C: PaintListe
                  stacking_context: &StackingContext,
                  page_position: &Point2D<Au>) {
             let page_position = stacking_context.bounds.origin + *page_position;
             if let Some(ref paint_layer) = stacking_context.layer {
                 // Layers start at the top left of their overflow rect, as far as the info we give to
                 // the compositor is concerned.
                 let overflow_relative_page_position = page_position + stacking_context.overflow.origin;
                 let layer_position =
-                    Rect(Point2D(overflow_relative_page_position.x.to_nearest_px() as f32,
-                                 overflow_relative_page_position.y.to_nearest_px() as f32),
-                         Size2D(stacking_context.overflow.size.width.to_nearest_px() as f32,
-                                stacking_context.overflow.size.height.to_nearest_px() as f32));
+                    Rect::new(Point2D::new(overflow_relative_page_position.x.to_nearest_px() as f32,
+                                           overflow_relative_page_position.y.to_nearest_px() as f32),
+                              Size2D::new(stacking_context.overflow.size.width.to_nearest_px() as f32,
+                                          stacking_context.overflow.size.height.to_nearest_px() as f32));
                 properties.push(LayerProperties {
                     id: paint_layer.id,
                     rect: layer_position,
                     background_color: paint_layer.background_color,
                     scroll_policy: paint_layer.scroll_policy,
                 })
             }
 
@@ -582,17 +581,17 @@ impl WorkerThread {
     }
 
     fn optimize_and_paint_tile(&mut self,
                                thread_id: usize,
                                tile: &BufferRequest,
                                stacking_context: Arc<StackingContext>,
                                scale: f32)
                                -> DrawTarget {
-        let size = Size2D(tile.screen_rect.size.width as i32, tile.screen_rect.size.height as i32);
+        let size = Size2D::new(tile.screen_rect.size.width as i32, tile.screen_rect.size.height as i32);
         let draw_target = if !opts::get().gpu_painting {
             DrawTarget::new(BackendType::Skia, size, SurfaceFormat::B8G8R8A8)
         } else {
             // FIXME(pcwalton): Cache the components of draw targets (texture color buffer,
             // paintbuffers) instead of recreating them.
             let native_graphics_context =
                 native_graphics_context!(self) as *const _ as SkiaGrGLNativeContextRef;
             let draw_target = DrawTarget::new_with_fbo(BackendType::Skia,
@@ -613,21 +612,21 @@ impl WorkerThread {
                 screen_rect: tile.screen_rect,
                 clip_rect: None,
                 transient_clip: None,
             };
 
             // 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_f32_px(),
-                         stacking_context.overflow.origin.y.to_f32_px()));
+                &Point2D::new(stacking_context.overflow.origin.x.to_f32_px(),
+                              stacking_context.overflow.origin.y.to_f32_px()));
 
             // Apply the translation to paint the tile we want.
-            let matrix: Matrix4 = identity();
+            let matrix = Matrix4::identity();
             let matrix = matrix.scale(scale as AzFloat, scale as AzFloat, 1.0);
             let matrix = matrix.translate(-tile_bounds.origin.x as AzFloat,
                                           -tile_bounds.origin.y as AzFloat,
                                           0.0);
 
             // Clear the buffer.
             paint_context.clear();
 
@@ -642,27 +641,27 @@ impl WorkerThread {
                                                                 None);
                 paint_context.draw_target.flush();
                     });
 
             if opts::get().show_debug_parallel_paint {
                 // Overlay a transparent solid color to identify the thread that
                 // painted this tile.
                 let color = THREAD_TINT_COLORS[thread_id % THREAD_TINT_COLORS.len()];
-                paint_context.draw_solid_color(&Rect(Point2D(Au(0), Au(0)),
-                                                     Size2D(Au::from_px(size.width),
-                                                            Au::from_px(size.height))),
+                paint_context.draw_solid_color(&Rect::new(Point2D::new(Au(0), Au(0)),
+                                                          Size2D::new(Au::from_px(size.width),
+                                                                      Au::from_px(size.height))),
                                                color);
             }
             if opts::get().paint_flashing {
                 // Overlay a random transparent color.
                 let color = *rand::thread_rng().choose(&THREAD_TINT_COLORS[..]).unwrap();
-                paint_context.draw_solid_color(&Rect(Point2D(Au(0), Au(0)),
-                                                     Size2D(Au::from_px(size.width),
-                                                            Au::from_px(size.height))),
+                paint_context.draw_solid_color(&Rect::new(Point2D::new(Au(0), Au(0)),
+                                                          Size2D::new(Au::from_px(size.width),
+                                                                      Au::from_px(size.height))),
                                                color);
             }
         }
 
         draw_target
     }
 
     fn create_layer_buffer_for_painted_tile(&mut self,
--- a/servo/components/gfx/text/shaping/harfbuzz.rs
+++ b/servo/components/gfx/text/shaping/harfbuzz.rs
@@ -125,17 +125,17 @@ impl ShapedGlyphData {
             let offset = if x_offset == Au(0) && y_offset == Au(0) && y_advance == Au(0) {
                 None
             } else {
                 // adjust the pen..
                 if y_advance > Au(0) {
                     *y_pos = *y_pos - y_advance;
                 }
 
-                Some(Point2D(x_offset, *y_pos - y_offset))
+                Some(Point2D::new(x_offset, *y_pos - y_offset))
             };
 
             ShapedGlyphEntry {
                 codepoint: (*glyph_info_i).codepoint as GlyphId,
                 advance: x_advance,
                 offset: offset,
             }
         }
--- a/servo/components/layout/block.rs
+++ b/servo/components/layout/block.rs
@@ -1042,17 +1042,17 @@ impl BlockFlow {
             kind: float_info.float_kind,
         };
 
         // Place the float and return the `Floats` back to the parent flow.
         // After, grab the position and use that to set our position.
         self.base.floats.add_float(&info);
 
         // FIXME (mbrubeck) Get the correct container size for self.base.floats;
-        let container_size = Size2D(self.base.block_container_inline_size, Au(0));
+        let container_size = Size2D::new(self.base.block_container_inline_size, Au(0));
 
         // Move in from the margin edge, as per CSS 2.1 § 9.5, floats may not overlap anything on
         // their margin edges.
         let float_offset = self.base.floats.last_float_pos().unwrap()
                                            .convert(self.base.floats.writing_mode,
                                                     self.base.writing_mode,
                                                     container_size)
                                            .start;
@@ -1664,17 +1664,17 @@ impl Flow for BlockFlow {
                    flow::base(self).debug_id());
             self.assign_block_size_block_base(ctx, MarginsMayCollapseFlag::MarginsMayCollapse);
         }
     }
 
     fn compute_absolute_position(&mut self, layout_context: &LayoutContext) {
         // FIXME (mbrubeck): Get the real container size, taking the container writing mode into
         // account.  Must handle vertical writing modes.
-        let container_size = Size2D(self.base.block_container_inline_size, Au(0));
+        let container_size = Size2D::new(self.base.block_container_inline_size, Au(0));
 
         if self.is_root() {
             self.base.clip = ClippingRegion::max();
             self.base.stacking_relative_position_of_display_port = MAX_RECT;
         }
 
         if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
             let position_start = self.base.position.start.to_physical(self.base.writing_mode,
@@ -1771,30 +1771,30 @@ impl Flow for BlockFlow {
         if is_stacking_context {
             // We establish a stacking context, so the position of our children is vertically
             // correct, but has to be adjusted to accommodate horizontal margins. (Note the
             // calculation involving `position` below and recall that inline-direction flow
             // positions are relative to the edges of the margin box.)
             //
             // FIXME(pcwalton): Is this vertical-writing-direction-safe?
             let margin = self.fragment.margin.to_physical(self.base.writing_mode);
-            origin_for_children = Point2D(-margin.left, Au(0)) + relative_offset;
+            origin_for_children = Point2D::new(-margin.left, Au(0)) + relative_offset;
             clip_in_child_coordinate_system =
                 self.base.clip.translate(&-self.base.stacking_relative_position);
         } else {
             origin_for_children = self.base.stacking_relative_position + relative_offset;
             clip_in_child_coordinate_system = self.base.clip.clone();
         }
 
         let stacking_relative_position_of_display_port_for_children =
             if (is_stacking_context && self.will_get_layer()) || self.is_root() {
                 let visible_rect =
                     match layout_context.shared.visible_rects.get(&self.layer_id(0)) {
                         Some(visible_rect) => *visible_rect,
-                        None => Rect(Point2D::zero(), layout_context.shared.screen_size),
+                        None => Rect::new(Point2D::zero(), layout_context.shared.screen_size),
                     };
 
                 let screen_size = layout_context.shared.screen_size;
                 visible_rect.inflate(screen_size.width * DISPLAY_PORT_SIZE_FACTOR,
                                      screen_size.height * DISPLAY_PORT_SIZE_FACTOR)
             } else if is_stacking_context {
                 self.base
                     .stacking_relative_position_of_display_port
--- a/servo/components/layout/display_list_builder.rs
+++ b/servo/components/layout/display_list_builder.rs
@@ -17,17 +17,16 @@ use flow::{self, BaseFlow, Flow, IS_ABSO
 use fragment::{CoordinateSystem, Fragment, IframeFragmentInfo, ImageFragmentInfo};
 use fragment::{ScannedTextFragmentInfo, SpecificFragmentInfo};
 use inline::InlineFlow;
 use list_item::ListItemFlow;
 use model::{self, MaybeAuto, ToGfxMatrix, ToAu};
 use table_cell::CollapsedBordersForCell;
 
 use geom::{Point2D, Rect, Size2D, SideOffsets2D};
-use geom::matrix::identity;
 use geom::Matrix4;
 use gfx_traits::color;
 use gfx::display_list::{BLUR_INFLATION_FACTOR, BaseDisplayItem, BorderDisplayItem};
 use gfx::display_list::{BorderRadii, BoxShadowClipMode, BoxShadowDisplayItem, ClippingRegion};
 use gfx::display_list::{DisplayItem, DisplayList, DisplayItemMetadata};
 use gfx::display_list::{GradientDisplayItem};
 use gfx::display_list::{GradientStop, ImageDisplayItem, LineDisplayItem};
 use gfx::display_list::{OpaqueNode, SolidColorDisplayItem};
@@ -387,53 +386,53 @@ impl FragmentDisplayListBuilding for Fra
                                      style: &ComputedValues,
                                      bounds: &Rect<Au>,
                                      image: &png::Image)
                                      -> Size2D<Au> {
         // 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_f64_px() / bounds.size.height.to_f64_px();
-        let intrinsic_size = Size2D(Au::from_px(image.width as i32),
-                                    Au::from_px(image.height as i32));
+        let intrinsic_size = Size2D::new(Au::from_px(image.width as i32),
+                                         Au::from_px(image.height as i32));
         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_f64_px(bounds.size.width.to_f64_px() / image_aspect_ratio))
+                Size2D::new(bounds.size.width,
+                            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_f64_px(bounds.size.height.to_f64_px() * image_aspect_ratio),
-                       bounds.size.height)
+                Size2D::new(Au::from_f64_px(bounds.size.height.to_f64_px() * image_aspect_ratio),
+                            bounds.size.height)
             }
 
             (background_size::T::Explicit(background_size::ExplicitSize {
                 width,
                 height: LengthOrPercentageOrAuto::Auto,
             }), _) => {
                 let width = MaybeAuto::from_style(width, bounds.size.width)
                                       .specified_or_default(intrinsic_size.width);
-                Size2D(width, Au::from_f64_px(width.to_f64_px() / image_aspect_ratio))
+                Size2D::new(width, Au::from_f64_px(width.to_f64_px() / image_aspect_ratio))
             }
 
             (background_size::T::Explicit(background_size::ExplicitSize {
                 width: LengthOrPercentageOrAuto::Auto,
                 height
             }), _) => {
                 let height = MaybeAuto::from_style(height, bounds.size.height)
                                        .specified_or_default(intrinsic_size.height);
-                Size2D(Au::from_f64_px(height.to_f64_px() * image_aspect_ratio), height)
+                Size2D::new(Au::from_f64_px(height.to_f64_px() * image_aspect_ratio), height)
             }
 
             (background_size::T::Explicit(background_size::ExplicitSize {
                 width,
                 height
             }), _) => {
-                Size2D(MaybeAuto::from_style(width, bounds.size.width)
+                Size2D::new(MaybeAuto::from_style(width, bounds.size.width)
                                  .specified_or_default(intrinsic_size.width),
                        MaybeAuto::from_style(height, bounds.size.height)
                                  .specified_or_default(intrinsic_size.height))
             }
         }
     }
 
     fn build_display_list_for_background_image(&self,
@@ -537,17 +536,17 @@ impl FragmentDisplayListBuilding for Fra
             // Create the image display item.
             display_list.push(DisplayItem::ImageClass(box ImageDisplayItem {
                 base: BaseDisplayItem::new(bounds,
                                            DisplayItemMetadata::new(self.node,
                                                                     style,
                                                                     Cursor::DefaultCursor),
                                            clip),
                 image: image.clone(),
-                stretch_size: Size2D(image_size.width, image_size.height),
+                stretch_size: Size2D::new(image_size.width, image_size.height),
                 image_rendering: style.get_effects().image_rendering.clone(),
             }), level);
         }
     }
 
     fn build_display_list_for_background_linear_gradient(&self,
                                                          display_list: &mut DisplayList,
                                                          level: StackingLevel,
@@ -556,32 +555,32 @@ impl FragmentDisplayListBuilding for Fra
                                                          gradient: &LinearGradient,
                                                          style: &ComputedValues) {
         let clip = clip.clone().intersect_rect(absolute_bounds);
 
         // This is the distance between the center and the ending point; i.e. half of the distance
         // between the starting point and the ending point.
         let delta = match gradient.angle_or_corner {
             AngleOrCorner::Angle(angle) => {
-                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))
+                Point2D::new(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 {
                     HorizontalDirection::Left => -1,
                     HorizontalDirection::Right => 1,
                 };
                 let y_factor = match vertical {
                     VerticalDirection::Top => -1,
                     VerticalDirection::Bottom => 1,
                 };
-                Point2D(absolute_bounds.size.width * x_factor / 2,
-                        absolute_bounds.size.height * y_factor / 2)
+                Point2D::new(absolute_bounds.size.width * x_factor / 2,
+                             absolute_bounds.size.height * y_factor / 2)
             }
         };
 
         // This is the length of the gradient line.
         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.
@@ -638,18 +637,18 @@ impl FragmentDisplayListBuilding for Fra
                 }
             };
             stops.push(GradientStop {
                 offset: offset,
                 color: style.resolve_color(stop.color).to_gfx_color()
             })
         }
 
-        let center = Point2D(absolute_bounds.origin.x + absolute_bounds.size.width / 2,
-                             absolute_bounds.origin.y + absolute_bounds.size.height / 2);
+        let center = Point2D::new(absolute_bounds.origin.x + absolute_bounds.size.width / 2,
+                                  absolute_bounds.origin.y + absolute_bounds.size.height / 2);
 
         let gradient_display_item = DisplayItem::GradientClass(box GradientDisplayItem {
             base: BaseDisplayItem::new(*absolute_bounds,
                                        DisplayItemMetadata::new(self.node,
                                                                 style,
                                                                 Cursor::DefaultCursor),
                                        clip),
             start_point: center - delta,
@@ -664,29 +663,29 @@ impl FragmentDisplayListBuilding for Fra
                                                        style: &ComputedValues,
                                                        list: &mut DisplayList,
                                                        _layout_context: &LayoutContext,
                                                        level: StackingLevel,
                                                        absolute_bounds: &Rect<Au>,
                                                        clip: &ClippingRegion) {
         // NB: According to CSS-BACKGROUNDS, box shadows render in *reverse* order (front to back).
         for box_shadow in style.get_effects().box_shadow.iter().rev() {
-            let bounds = shadow_bounds(&absolute_bounds.translate(&Point2D(box_shadow.offset_x,
-                                                                           box_shadow.offset_y)),
+            let bounds = shadow_bounds(&absolute_bounds.translate(&Point2D::new(box_shadow.offset_x,
+                                                                                box_shadow.offset_y)),
                                        box_shadow.blur_radius,
                                        box_shadow.spread_radius);
             list.push(DisplayItem::BoxShadowClass(box BoxShadowDisplayItem {
                 base: BaseDisplayItem::new(bounds,
                                            DisplayItemMetadata::new(self.node,
                                                                     style,
                                                                     Cursor::DefaultCursor),
                                            (*clip).clone()),
                 box_bounds: *absolute_bounds,
                 color: style.resolve_color(box_shadow.color).to_gfx_color(),
-                offset: Point2D(box_shadow.offset_x, box_shadow.offset_y),
+                offset: Point2D::new(box_shadow.offset_x, box_shadow.offset_y),
                 blur_radius: box_shadow.blur_radius,
                 spread_radius: box_shadow.spread_radius,
                 clip_mode: if box_shadow.inset {
                     BoxShadowClipMode::Inset
                 } else {
                     BoxShadowClipMode::Outset
                 },
             }), level);
@@ -862,22 +861,22 @@ impl FragmentDisplayListBuilding for Fra
         // Account for `clip` per CSS 2.1 § 11.1.2.
         let style_clip_rect = match (self.style().get_box().position,
                                      self.style().get_effects().clip) {
             (position::T::absolute, Some(style_clip_rect)) => style_clip_rect,
             _ => return (*parent_clip).clone(),
         };
 
         // FIXME(pcwalton, #2795): Get the real container size.
-        let clip_origin = Point2D(stacking_relative_border_box.origin.x + style_clip_rect.left,
-                                  stacking_relative_border_box.origin.y + style_clip_rect.top);
+        let clip_origin = Point2D::new(stacking_relative_border_box.origin.x + style_clip_rect.left,
+                                       stacking_relative_border_box.origin.y + style_clip_rect.top);
         let right = style_clip_rect.right.unwrap_or(stacking_relative_border_box.size.width);
         let bottom = style_clip_rect.bottom.unwrap_or(stacking_relative_border_box.size.height);
-        let clip_size = Size2D(right - clip_origin.x, bottom - clip_origin.y);
-        (*parent_clip).clone().intersect_rect(&Rect(clip_origin, clip_size))
+        let clip_size = Size2D::new(right - clip_origin.x, bottom - clip_origin.y);
+        (*parent_clip).clone().intersect_rect(&Rect::new(clip_origin, clip_size))
     }
 
     fn build_display_list(&mut self,
                           display_list: &mut DisplayList,
                           layout_context: &LayoutContext,
                           stacking_relative_flow_origin: &Point2D<Au>,
                           relative_containing_block_size: &LogicalSize<Au>,
                           relative_containing_block_mode: WritingMode,
@@ -1025,34 +1024,34 @@ impl FragmentDisplayListBuilding for Fra
         match self.specific {
             SpecificFragmentInfo::ScannedText(ref text_fragment) => {
                 // Create items for shadows.
                 //
                 // NB: According to CSS-BACKGROUNDS, text shadows render in *reverse* order (front
                 // to back).
                 let text_color = self.style().get_color().color;
                 for text_shadow in self.style.get_effects().text_shadow.0.iter().rev() {
-                    let offset = &Point2D(text_shadow.offset_x, text_shadow.offset_y);
+                    let offset = &Point2D::new(text_shadow.offset_x, text_shadow.offset_y);
                     let color = self.style().resolve_color(text_shadow.color);
                     self.build_display_list_for_text_fragment(display_list,
                                                               &**text_fragment,
                                                               color,
                                                               &stacking_relative_content_box,
                                                               Some(text_shadow.blur_radius),
                                                               offset,
                                                               clip);
                 }
 
                 // Create the main text display item.
                 self.build_display_list_for_text_fragment(display_list,
                                                           &**text_fragment,
                                                           text_color,
                                                           &stacking_relative_content_box,
                                                           None,
-                                                          &Point2D(Au(0), Au(0)),
+                                                          &Point2D::new(Au(0), Au(0)),
                                                           clip);
 
                 if opts::get().show_debug_fragment_borders {
                     self.build_debug_borders_around_text_fragments(self.style(),
                                                                    display_list,
                                                                    stacking_relative_border_box,
                                                                    &stacking_relative_content_box,
                                                                    &**text_fragment,
@@ -1137,25 +1136,25 @@ impl FragmentDisplayListBuilding for Fra
                                -> Arc<StackingContext> {
         let border_box = self.stacking_relative_border_box(&base_flow.stacking_relative_position,
                                                                &base_flow.absolute_position_info
                                                                .relative_containing_block_size,
                                                                base_flow.absolute_position_info
                                                                .relative_containing_block_mode,
                                                                CoordinateSystem::Parent);
 
-        let mut transform = identity();
+        let mut transform = Matrix4::identity();
 
         if let Some(ref operations) = self.style().get_effects().transform {
             let transform_origin = self.style().get_effects().transform_origin;
             let transform_origin =
-                Point2D(model::specified(transform_origin.horizontal,
-                                         border_box.size.width).to_f32_px(),
-                        model::specified(transform_origin.vertical,
-                                         border_box.size.height).to_f32_px());
+                Point2D::new(model::specified(transform_origin.horizontal,
+                                              border_box.size.width).to_f32_px(),
+                             model::specified(transform_origin.vertical,
+                                              border_box.size.height).to_f32_px());
 
             let pre_transform = Matrix4::create_translation(transform_origin.x,
                                                             transform_origin.y,
                                                             0.0);
             let post_transform = Matrix4::create_translation(-transform_origin.x,
                                                              -transform_origin.y,
                                                              0.0);
 
@@ -1188,17 +1187,17 @@ impl FragmentDisplayListBuilding for Fra
                 transform = transform.mul(&matrix);
             }
 
             transform = pre_transform.mul(&transform).mul(&post_transform);
         }
 
         // FIXME(pcwalton): Is this vertical-writing-direction-safe?
         let margin = self.margin.to_physical(base_flow.writing_mode);
-        let overflow = base_flow.overflow.translate(&-Point2D(margin.left, Au(0)));
+        let overflow = base_flow.overflow.translate(&-Point2D::new(margin.left, Au(0)));
 
         // Create the filter pipeline.
         let effects = self.style().get_effects();
         let mut filters = effects.filter.clone();
         if effects.opacity != 1.0 {
             filters.push(Filter::Opacity(effects.opacity))
         }
 
@@ -1236,20 +1235,20 @@ impl FragmentDisplayListBuilding for Fra
 
     #[inline(never)]
     fn finalize_position_and_size_of_iframe(&self,
                                             iframe_fragment: &IframeFragmentInfo,
                                             offset: Point2D<Au>,
                                             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_f32_px(),
-                                       (offset.y + border_padding.top).to_f32_px()),
-                               Size2D(content_size.width.to_f32_px(),
-                                      content_size.height.to_f32_px()));
+        let iframe_rect = Rect::new(Point2D::new((offset.x + border_padding.left).to_f32_px(),
+                                                 (offset.y + border_padding.top).to_f32_px()),
+                                    Size2D::new(content_size.width.to_f32_px(),
+                                                content_size.height.to_f32_px()));
 
         debug!("finalizing position and size of iframe for {:?},{:?}",
                iframe_fragment.pipeline_id,
                iframe_fragment.subpage_id);
         let ConstellationChan(ref chan) = layout_context.shared.constellation_chan;
         chan.send(ConstellationMsg::FrameRect(iframe_fragment.pipeline_id,
                                               iframe_fragment.subpage_id,
                                               iframe_rect)).unwrap();
@@ -1721,18 +1720,18 @@ impl BaseFlowDisplayListBuilding for Bas
                                               display_list: &mut DisplayList,
                                               node: OpaqueNode) {
         if !opts::get().show_debug_parallel_layout {
             return
         }
 
         let thread_id = self.thread_id;
         let stacking_context_relative_bounds =
-            Rect(self.stacking_relative_position,
-                 self.position.size.to_physical(self.writing_mode));
+            Rect::new(self.stacking_relative_position,
+                      self.position.size.to_physical(self.writing_mode));
 
         let mut color = THREAD_TINT_COLORS[thread_id as usize % THREAD_TINT_COLORS.len()];
         color.a = 1.0;
         display_list.push(DisplayItem::BorderClass(box BorderDisplayItem {
             base: BaseDisplayItem::new(stacking_context_relative_bounds.inflate(Au::from_px(2),
                                                                                 Au::from_px(2)),
                                        DisplayItemMetadata {
                                            node: node,
--- a/servo/components/layout/flow.rs
+++ b/servo/components/layout/flow.rs
@@ -1067,17 +1067,17 @@ impl BaseFlow {
     /// Ensures that all display list items generated by this flow are within the flow's overflow
     /// rect. This should only be used for debugging.
     pub fn validate_display_list_geometry(&self) {
         // FIXME(pcwalton, #2795): Get the real container size.
         let container_size = Size2D::zero();
         let position_with_overflow = self.position
                                          .to_physical(self.writing_mode, container_size)
                                          .union(&self.overflow);
-        let bounds = Rect(self.stacking_relative_position, position_with_overflow.size);
+        let bounds = Rect::new(self.stacking_relative_position, position_with_overflow.size);
 
         let all_items = match self.display_list_building_result {
             DisplayListBuildingResult::None => Vec::new(),
             DisplayListBuildingResult::StackingContext(ref stacking_context) => {
                 stacking_context.display_list.all_display_items()
             }
             DisplayListBuildingResult::Normal(ref display_list) => display_list.all_display_items(),
         };
--- a/servo/components/layout/fragment.rs
+++ b/servo/components/layout/fragment.rs
@@ -1952,37 +1952,37 @@ impl Fragment {
                                         relative_containing_block_size: &LogicalSize<Au>,
                                         relative_containing_block_mode: WritingMode,
                                         coordinate_system: CoordinateSystem)
                                         -> Rect<Au> {
         let container_size =
             relative_containing_block_size.to_physical(relative_containing_block_mode);
         let border_box = self.border_box.to_physical(self.style.writing_mode, container_size);
         if coordinate_system == CoordinateSystem::Own && self.establishes_stacking_context() {
-            return Rect(ZERO_POINT, border_box.size)
+            return Rect::new(ZERO_POINT, border_box.size)
         }
 
         // FIXME(pcwalton): This can double-count relative position sometimes for inlines (e.g.
         // `<div style="position:relative">x</div>`, because the `position:relative` trickles down
         // to the inline flow. Possibly we should extend the notion of "primary fragment" to fix
         // this.
         let relative_position = self.relative_position(relative_containing_block_size);
         border_box.translate_by_size(&relative_position.to_physical(self.style.writing_mode))
                   .translate(stacking_relative_flow_origin)
     }
 
     /// Given the stacking-context-relative border box, returns the stacking-context-relative
     /// content box.
     pub fn stacking_relative_content_box(&self, stacking_relative_border_box: &Rect<Au>)
                                          -> Rect<Au> {
         let border_padding = self.border_padding.to_physical(self.style.writing_mode);
-        Rect(Point2D(stacking_relative_border_box.origin.x + border_padding.left,
-                     stacking_relative_border_box.origin.y + border_padding.top),
-             Size2D(stacking_relative_border_box.size.width - border_padding.horizontal(),
-                    stacking_relative_border_box.size.height - border_padding.vertical()))
+        Rect::new(Point2D::new(stacking_relative_border_box.origin.x + border_padding.left,
+                               stacking_relative_border_box.origin.y + border_padding.top),
+                  Size2D::new(stacking_relative_border_box.size.width - border_padding.horizontal(),
+                              stacking_relative_border_box.size.height - border_padding.vertical()))
     }
 
     /// Returns true if this fragment establishes a new stacking context and false otherwise.
     pub fn establishes_stacking_context(&self) -> bool {
         if self.style().get_effects().opacity != 1.0 {
             return true
         }
         if !self.style().get_effects().filter.is_empty() {
@@ -2028,17 +2028,17 @@ impl Fragment {
         let relative_position =
             self.relative_position(&LogicalSize::zero(self.style.writing_mode));
         border_box =
             border_box.translate_by_size(&relative_position.to_physical(self.style.writing_mode));
         let mut overflow = border_box;
 
         // Box shadows cause us to draw outside our border box.
         for box_shadow in self.style().get_effects().box_shadow.iter() {
-            let offset = Point2D(box_shadow.offset_x, box_shadow.offset_y);
+            let offset = Point2D::new(box_shadow.offset_x, box_shadow.offset_y);
             let inflation = box_shadow.spread_radius + box_shadow.blur_radius *
                 BLUR_INFLATION_FACTOR;
             overflow = overflow.union(&border_box.translate(&offset).inflate(inflation, inflation))
         }
 
         // Outlines cause us to draw outside our border box.
         let outline_width = self.style.get_outline().outline_width;
         if outline_width != Au(0) {
--- a/servo/components/layout/inline.rs
+++ b/servo/components/layout/inline.rs
@@ -1462,17 +1462,17 @@ impl Flow for InlineFlow {
                                                     -self.base.position.size.block));
 
         self.base.restyle_damage.remove(REFLOW_OUT_OF_FLOW | REFLOW);
     }
 
     fn compute_absolute_position(&mut self, _: &LayoutContext) {
         // First, gather up the positions of all the containing blocks (if any).
         let mut containing_block_positions = Vec::new();
-        let container_size = Size2D(self.base.block_container_inline_size, Au(0));
+        let container_size = Size2D::new(self.base.block_container_inline_size, Au(0));
         for (fragment_index, fragment) in self.fragments.fragments.iter().enumerate() {
             if let SpecificFragmentInfo::InlineAbsolute(_) = fragment.specific {
                 let containing_block_range =
                     self.containing_block_range_for_flow_surrounding_fragment_at_index(
                         FragmentIndex(fragment_index as isize));
                 let first_fragment_index = containing_block_range.begin().get() as usize;
                 debug_assert!(first_fragment_index < self.fragments.fragments.len());
                 let first_fragment = &self.fragments.fragments[first_fragment_index];
--- a/servo/components/layout/layout_task.rs
+++ b/servo/components/layout/layout_task.rs
@@ -23,17 +23,17 @@ use parallel::{self, UnsafeFlow};
 use sequential;
 use wrapper::{LayoutNode, TLayoutNode};
 
 use azure::azure::AzColor;
 use canvas_traits::CanvasMsg;
 use encoding::EncodingRef;
 use encoding::all::UTF_8;
 use fnv::FnvHasher;
-use geom::matrix;
+use geom::Matrix4;
 use geom::point::Point2D;
 use geom::rect::Rect;
 use geom::scale_factor::ScaleFactor;
 use geom::size::Size2D;
 use gfx_traits::color;
 use gfx::display_list::{ClippingRegion, DisplayItemMetadata, DisplayList, OpaqueNode};
 use gfx::display_list::{StackingContext};
 use gfx::font_cache_task::FontCacheTask;
@@ -290,17 +290,17 @@ impl LayoutTask {
            constellation_chan: ConstellationChan,
            script_chan: ScriptControlChan,
            paint_chan: PaintChan,
            image_cache_task: ImageCacheTask,
            font_cache_task: FontCacheTask,
            time_profiler_chan: time::ProfilerChan,
            mem_profiler_chan: mem::ProfilerChan)
            -> LayoutTask {
-        let screen_size = Size2D(Au(0), Au(0));
+        let screen_size = Size2D::new(Au(0), Au(0));
         let device = Device::new(
             MediaType::Screen,
             opts::get().initial_window_size.as_f32() * ScaleFactor::new(1.0));
         let parallel_traversal = if opts::get().layout_threads != 1 {
             Some(WorkQueue::new("LayoutWorker", task_state::LAYOUT,
                                 opts::get().layout_threads,
                                 SharedLayoutContextWrapper(ptr::null())))
         } else {
@@ -862,23 +862,23 @@ impl LayoutTask {
                     root_flow.position.size.to_physical(root_flow.writing_mode)
                 };
                 let mut display_list = box DisplayList::new();
                 flow::mut_base(&mut **layout_root).display_list_building_result
                                                   .add_to(&mut *display_list);
                 let paint_layer = Arc::new(PaintLayer::new(layout_root.layer_id(0),
                                                            root_background_color,
                                                            ScrollPolicy::Scrollable));
-                let origin = Rect(Point2D(Au(0), Au(0)), root_size);
+                let origin = Rect::new(Point2D::new(Au(0), Au(0)), root_size);
 
                 let stacking_context = Arc::new(StackingContext::new(display_list,
                                                                      &origin,
                                                                      &origin,
                                                                      0,
-                                                                     &matrix::identity(),
+                                                                     &Matrix4::identity(),
                                                                      filter::T::new(Vec::new()),
                                                                      mix_blend_mode::T::normal,
                                                                      Some(paint_layer)));
 
                 if opts::get().dump_display_list {
                     println!("#### start printing display list.");
                     stacking_context.print("#".to_owned());
                 }
@@ -911,33 +911,33 @@ impl LayoutTask {
         if log_enabled!(log::LogLevel::Debug) {
             node.dump();
         }
 
         let mut rw_data = self.lock_rw_data(possibly_locked_rw_data);
 
         let initial_viewport = data.window_size.initial_viewport;
         let old_screen_size = rw_data.screen_size;
-        let current_screen_size = Size2D(Au::from_f32_px(initial_viewport.width.get()),
-                                         Au::from_f32_px(initial_viewport.height.get()));
+        let current_screen_size = Size2D::new(Au::from_f32_px(initial_viewport.width.get()),
+                                              Au::from_f32_px(initial_viewport.height.get()));
         rw_data.screen_size = current_screen_size;
 
         // Handle conditions where the entire flow tree is invalid.
         let screen_size_changed = current_screen_size != old_screen_size;
         if screen_size_changed {
             // Calculate the actual viewport as per DEVICE-ADAPT § 6
             let device = Device::new(MediaType::Screen, initial_viewport);
             rw_data.stylist.set_device(device);
 
             if let Some(constraints) = rw_data.stylist.constrain_viewport() {
                 debug!("Viewport constraints: {:?}", constraints);
 
                 // other rules are evaluated against the actual viewport
-                rw_data.screen_size = Size2D(Au::from_f32_px(constraints.size.width.get()),
-                                             Au::from_f32_px(constraints.size.height.get()));
+                rw_data.screen_size = Size2D::new(Au::from_f32_px(constraints.size.width.get()),
+                                                  Au::from_f32_px(constraints.size.height.get()));
                 let device = Device::new(MediaType::Screen, constraints.size);
                 rw_data.stylist.set_device(device);
 
                 // let the constellation know about the viewport constraints
                 let ConstellationChan(ref constellation_chan) = rw_data.constellation_chan;
                 constellation_chan.send(ConstellationMsg::ViewportConstrained(
                         self.id, constraints)).unwrap();
             }
@@ -1030,18 +1030,18 @@ impl LayoutTask {
         let mut rw_data = self.lock_rw_data(possibly_locked_rw_data);
 
         // First, determine if we need to regenerate the display lists. This will happen if the
         // layers have moved more than `DISPLAY_PORT_THRESHOLD_SIZE_FACTOR` away from their last
         // positions.
         let mut must_regenerate_display_lists = false;
         let mut old_visible_rects = HashMap::with_hash_state(Default::default());
         let inflation_amount =
-            Size2D(rw_data.screen_size.width * DISPLAY_PORT_THRESHOLD_SIZE_FACTOR,
-                   rw_data.screen_size.height * DISPLAY_PORT_THRESHOLD_SIZE_FACTOR);
+            Size2D::new(rw_data.screen_size.width * DISPLAY_PORT_THRESHOLD_SIZE_FACTOR,
+                        rw_data.screen_size.height * DISPLAY_PORT_THRESHOLD_SIZE_FACTOR);
         for &(ref layer_id, ref new_visible_rect) in new_visible_rects.iter() {
             match rw_data.visible_rects.get(layer_id) {
                 None => {
                     old_visible_rects.insert(*layer_id, *new_visible_rect);
                 }
                 Some(old_visible_rect) => {
                     old_visible_rects.insert(*layer_id, *old_visible_rect);
 
@@ -1246,17 +1246,17 @@ impl LayoutRPC for LayoutRPCImpl {
     fn content_boxes(&self) -> ContentBoxesResponse {
         let &LayoutRPCImpl(ref rw_data) = self;
         let rw_data = rw_data.lock().unwrap();
         ContentBoxesResponse(rw_data.content_boxes_response.clone())
     }
 
     /// Requests the node containing the point of interest.
     fn hit_test(&self, _: TrustedNodeAddress, point: Point2D<f32>) -> Result<HitTestResponse, ()> {
-        let point = Point2D(Au::from_f32_px(point.x), Au::from_f32_px(point.y));
+        let point = Point2D::new(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();
             match rw_data.stacking_context {
                 None => panic!("no root stacking context!"),
                 Some(ref stacking_context) => {
                     let mut result = Vec::new();
                     stacking_context.hit_test(point, &mut result, true);
@@ -1273,17 +1273,17 @@ impl LayoutRPC for LayoutRPCImpl {
             return Ok(resp.unwrap());
         }
         Err(())
     }
 
     fn mouse_over(&self, _: TrustedNodeAddress, point: Point2D<f32>)
                   -> Result<MouseOverResponse, ()> {
         let mut mouse_over_list: Vec<DisplayItemMetadata> = vec!();
-        let point = Point2D(Au::from_f32_px(point.x), Au::from_f32_px(point.y));
+        let point = Point2D::new(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();
             match rw_data.stacking_context {
                 None => panic!("no root stacking context!"),
                 Some(ref stacking_context) => {
                     stacking_context.hit_test(point, &mut mouse_over_list, false);
                 }
--- a/servo/components/layout/table_cell.rs
+++ b/servo/components/layout/table_cell.rs
@@ -319,24 +319,24 @@ impl CollapsedBordersForCell {
         } else {
             -2
         };
         let block_end_offset = self.block_end_width / 2 + self.block_end_border.width /
             block_end_divisor;
 
         // FIXME(pcwalton): Get the real container size.
         let mut logical_bounds =
-            LogicalRect::from_physical(writing_mode, *border_bounds, Size2D(Au(0), Au(0)));
+            LogicalRect::from_physical(writing_mode, *border_bounds, Size2D::new(Au(0), Au(0)));
         logical_bounds.start.i = logical_bounds.start.i - inline_start_offset;
         logical_bounds.start.b = logical_bounds.start.b - block_start_offset;
         logical_bounds.size.inline = logical_bounds.size.inline + inline_start_offset +
             inline_end_offset;
         logical_bounds.size.block = logical_bounds.size.block + block_start_offset +
             block_end_offset;
-        *border_bounds = logical_bounds.to_physical(writing_mode, Size2D(Au(0), Au(0)))
+        *border_bounds = logical_bounds.to_physical(writing_mode, Size2D::new(Au(0), Au(0)))
     }
 
     pub fn adjust_border_colors_and_styles_for_painting(
             &self,
             border_colors: &mut SideOffsets2D<Color>,
             border_styles: &mut SideOffsets2D<border_top_style::T>,
             writing_mode: WritingMode) {
         let logical_border_colors = LogicalMargin::new(writing_mode,
--- a/servo/components/script/dom/canvasrenderingcontext2d.rs
+++ b/servo/components/script/dom/canvasrenderingcontext2d.rs
@@ -150,46 +150,46 @@ impl CanvasRenderingContext2D {
     // It is used by DrawImage to calculate the size of the source and destination rectangles based
     // on the drawImage call arguments
     // source rectangle = area of the original image to be copied
     // destination rectangle = area of the destination canvas where the source image is going to be drawn
     fn adjust_source_dest_rects(&self,
                   image_size: Size2D<f64>,
                   sx: f64, sy: f64, sw: f64, sh: f64,
                   dx: f64, dy: f64, dw: f64, dh: f64) -> (Rect<f64>, Rect<f64>) {
-        let image_rect = Rect(Point2D(0f64, 0f64),
-                              Size2D(image_size.width as f64, image_size.height as f64));
+        let image_rect = Rect::new(Point2D::new(0f64, 0f64),
+                                   Size2D::new(image_size.width as f64, image_size.height as f64));
 
         // The source rectangle is the rectangle whose corners are the four points (sx, sy),
         // (sx+sw, sy), (sx+sw, sy+sh), (sx, sy+sh).
-        let source_rect = Rect(Point2D(sx.min(sx+sw), sy.min(sy+sh)),
-                               Size2D(sw.abs(), sh.abs()));
+        let source_rect = Rect::new(Point2D::new(sx.min(sx+sw), sy.min(sy+sh)),
+                                    Size2D::new(sw.abs(), sh.abs()));
 
         // When the source rectangle is outside the source image,
         // the source rectangle must be clipped to the source image
         let source_rect_clipped = source_rect.intersection(&image_rect).unwrap_or(Rect::zero());
 
         // Width and height ratios between the non clipped and clipped source rectangles
         let width_ratio: f64 = source_rect_clipped.size.width / source_rect.size.width;
         let height_ratio: f64 = source_rect_clipped.size.height / source_rect.size.height;
 
         // When the source rectangle is outside the source image,
         // the destination rectangle must be clipped in the same proportion.
         let dest_rect_width_scaled: f64 = dw * width_ratio;
         let dest_rect_height_scaled: f64 = dh * height_ratio;
 
         // The destination rectangle is the rectangle whose corners are the four points (dx, dy),
         // (dx+dw, dy), (dx+dw, dy+dh), (dx, dy+dh).
-        let dest_rect = Rect(Point2D(dx.min(dx+dest_rect_width_scaled), dy.min(dy+dest_rect_height_scaled)),
-                             Size2D(dest_rect_width_scaled.abs(), dest_rect_height_scaled.abs()));
+        let dest_rect = Rect::new(Point2D::new(dx.min(dx+dest_rect_width_scaled), dy.min(dy+dest_rect_height_scaled)),
+                                  Size2D::new(dest_rect_width_scaled.abs(), dest_rect_height_scaled.abs()));
 
-        let source_rect = Rect(Point2D(source_rect_clipped.origin.x,
-                                     source_rect_clipped.origin.y),
-                             Size2D(source_rect_clipped.size.width,
-                                    source_rect_clipped.size.height));
+        let source_rect = Rect::new(Point2D::new(source_rect_clipped.origin.x,
+                                                 source_rect_clipped.origin.y),
+                                    Size2D::new(source_rect_clipped.size.width,
+                                                source_rect_clipped.size.height));
 
         return (source_rect, dest_rect)
     }
 
     //
     // drawImage coordinates explained
     //
     //  Source Image      Destination Canvas
@@ -215,17 +215,17 @@ impl CanvasRenderingContext2D {
                   sx: f64, sy: f64, sw: f64, sh: f64,
                   dx: f64, dy: f64, dw: f64, dh: f64) -> Fallible<()> {
         // 1. Check the usability of the image argument
         if !canvas.is_valid() {
             return Err(InvalidState)
         }
 
         let canvas_size = canvas.get_size();
-        let image_size = Size2D(canvas_size.width as f64, canvas_size.height as f64);
+        let image_size = Size2D::new(canvas_size.width as f64, canvas_size.height as f64);
         // 2. Establish the source and destination rectangles
         let (source_rect, dest_rect) = self.adjust_source_dest_rects(image_size, sx, sy, sw, sh, dx, dy, dw, dh);
 
         if !is_rect_valid(source_rect) || !is_rect_valid(dest_rect) {
             return Err(IndexSize)
         }
 
         let smoothing_enabled = self.state.borrow().image_smoothing_enabled;
@@ -282,17 +282,17 @@ impl CanvasRenderingContext2D {
             None => return None,
         };
 
         let img = match self.request_image_from_cache(url) {
             ImageResponse::Loaded(img) => img,
             ImageResponse::PlaceholderLoaded(_) | ImageResponse::None => return None,
         };
 
-        let image_size = Size2D(img.width as f64, img.height as f64);
+        let image_size = Size2D::new(img.width as f64, img.height as f64);
         let mut image_data = match img.pixels {
             PixelsByColorType::RGBA8(ref pixels) => pixels.to_vec(),
             PixelsByColorType::K8(_) => panic!("K8 color type not supported"),
             PixelsByColorType::RGB8(_) => panic!("RGB8 color type not supported"),
             PixelsByColorType::KA8(_) => panic!("KA8 color type not supported"),
         };
         // Pixels come from cache in BGRA order and drawImage expects RGBA so we
         // have to swap the color values
@@ -315,17 +315,17 @@ impl CanvasRenderingContext2D {
         if !([x, y, w, h].iter().all(|val| val.is_finite())) {
             return None;
         }
 
         if w == 0.0 && h == 0.0 {
             return None;
         }
 
-        Some(Rect(Point2D(x as f32, y as f32), Size2D(w as f32, h as f32)))
+        Some(Rect::new(Point2D::new(x as f32, y as f32), Size2D::new(w as f32, h as f32)))
     }
 }
 
 pub trait CanvasRenderingContext2DHelpers {
     fn get_renderer(&self) -> Sender<CanvasMsg>;
 }
 
 impl CanvasRenderingContext2DHelpers for CanvasRenderingContext2D {
@@ -698,89 +698,110 @@ impl<'a> CanvasRenderingContext2DMethods
     }
 
     // https://html.spec.whatwg.org/multipage/#dom-context-2d-moveto
     fn MoveTo(self, x: f64, y: f64) {
         if !(x.is_finite() && y.is_finite()) {
             return;
         }
 
-        self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::MoveTo(Point2D(x as f32, y as f32)))).unwrap();
+        let msg = CanvasMsg::Canvas2d(
+            Canvas2dMsg::MoveTo(
+                Point2D::new(x as f32, y as f32)));
+        self.renderer.send(msg).unwrap();
     }
 
     // https://html.spec.whatwg.org/multipage/#dom-context-2d-lineto
     fn LineTo(self, x: f64, y: f64) {
         if !(x.is_finite() && y.is_finite()) {
             return;
         }
 
-        self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::LineTo(Point2D(x as f32, y as f32)))).unwrap();
+        let msg = CanvasMsg::Canvas2d(
+            Canvas2dMsg::LineTo(
+                Point2D::new(x as f32, y as f32)));
+        self.renderer.send(msg).unwrap();
     }
 
     // https://html.spec.whatwg.org/multipage/#dom-context-2d-rect
     fn Rect(self, x: f64, y: f64, width: f64, height: f64) {
         if [x, y, width, height].iter().all(|val| val.is_finite()) {
-            let rect = Rect(Point2D(x as f32, y as f32),
-                            Size2D(width as f32, height as f32));
-            self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::Rect(rect))).unwrap();
+            let rect = Rect::new(Point2D::new(x as f32, y as f32),
+                                 Size2D::new(width as f32, height as f32));
+            let msg = CanvasMsg::Canvas2d(Canvas2dMsg::Rect(rect));
+            self.renderer.send(msg).unwrap();
         }
     }
 
     // https://html.spec.whatwg.org/multipage/#dom-context-2d-quadraticcurveto
     fn QuadraticCurveTo(self, cpx: f64, cpy: f64, x: f64, y: f64) {
         if !(cpx.is_finite() && cpy.is_finite() &&
              x.is_finite() && y.is_finite()) {
             return;
         }
 
-        self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::QuadraticCurveTo(Point2D(cpx as f32, cpy as f32),
-                                                            Point2D(x as f32, y as f32)))).unwrap();
+        let msg = CanvasMsg::Canvas2d(
+            Canvas2dMsg::QuadraticCurveTo(
+                Point2D::new(cpx as f32, cpy as f32),
+                Point2D::new(x as f32, y as f32)));
+        self.renderer.send(msg).unwrap();
     }
 
     // https://html.spec.whatwg.org/multipage/#dom-context-2d-beziercurveto
     fn BezierCurveTo(self, cp1x: f64, cp1y: f64, cp2x: f64, cp2y: f64, x: f64, y: f64) {
         if !(cp1x.is_finite() && cp1y.is_finite() && cp2x.is_finite() && cp2y.is_finite() &&
              x.is_finite() && y.is_finite()) {
             return;
         }
 
-        self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::BezierCurveTo(Point2D(cp1x as f32, cp1y as f32),
-                                                            Point2D(cp2x as f32, cp2y as f32),
-                                                            Point2D(x as f32, y as f32)))).unwrap();
+        let msg = CanvasMsg::Canvas2d(
+            Canvas2dMsg::BezierCurveTo(
+                Point2D::new(cp1x as f32, cp1y as f32),
+                Point2D::new(cp2x as f32, cp2y as f32),
+                Point2D::new(x as f32, y as f32)));
+        self.renderer.send(msg).unwrap();
     }
 
     // https://html.spec.whatwg.org/multipage/#dom-context-2d-arc
     fn Arc(self, x: Finite<f64>, y: Finite<f64>, r: Finite<f64>,
            start: Finite<f64>, end: Finite<f64>, ccw: bool) -> Fallible<()> {
         let x = *x;
         let y = *y;
         let r = *r;
         let start = *start;
         let end = *end;
 
         if r < 0.0 {
             return Err(IndexSize);
         }
 
-        self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::Arc(Point2D(x as f32, y as f32), r as f32,
-                                                                start as f32, end as f32, ccw))).unwrap();
+        let msg = CanvasMsg::Canvas2d(
+            Canvas2dMsg::Arc(
+                Point2D::new(x as f32, y as f32), r as f32,
+                start as f32, end as f32, ccw));
+
+        self.renderer.send(msg).unwrap();
         Ok(())
     }
 
     // https://html.spec.whatwg.org/multipage/#dom-context-2d-arcto
     fn ArcTo(self, cp1x: f64, cp1y: f64, cp2x: f64, cp2y: f64, r: f64) -> Fallible<()> {
         if !([cp1x, cp1y, cp2x, cp2y, r].iter().all(|x| x.is_finite())) {
             return Ok(());
         }
         if r < 0.0 {
             return Err(IndexSize);
         }
-        self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::ArcTo(Point2D(cp1x as f32, cp1y as f32),
-                                                                  Point2D(cp2x as f32, cp2y as f32),
-                                                                  r as f32))).unwrap();
+
+        let msg = CanvasMsg::Canvas2d(
+            Canvas2dMsg::ArcTo(
+                Point2D::new(cp1x as f32, cp1y as f32),
+                Point2D::new(cp2x as f32, cp2y as f32),
+                r as f32));
+        self.renderer.send(msg).unwrap();
         Ok(())
     }
 
     // https://html.spec.whatwg.org/#dom-context-2d-imagesmoothingenabled
     fn ImageSmoothingEnabled(self) -> bool {
         let state = self.state.borrow();
         state.image_smoothing_enabled
     }
@@ -902,19 +923,20 @@ impl<'a> CanvasRenderingContext2DMethods
         let sw = *sw;
         let sh = *sh;
 
         if sw == 0.0 || sh == 0.0 {
             return Err(IndexSize)
         }
 
         let (sender, receiver) = channel::<Vec<u8>>();
-        let dest_rect = Rect(Point2D(sx as f64, sy as f64), Size2D(sw as f64, sh as f64));
+        let dest_rect = Rect::new(Point2D::new(sx as f64, sy as f64),
+                                  Size2D::new(sw as f64, sh as f64));
         let canvas_size = self.canvas.root().r().get_size();
-        let canvas_size = Size2D(canvas_size.width as f64, canvas_size.height as f64);
+        let canvas_size = Size2D::new(canvas_size.width as f64, canvas_size.height as f64);
         self.renderer.send(CanvasMsg::Canvas2d(Canvas2dMsg::GetImageData(dest_rect, canvas_size, sender))).unwrap();
         let data = receiver.recv().unwrap();
         Ok(ImageData::new(self.global.root().r(), sw.abs().to_u32().unwrap(), sh.abs().to_u32().unwrap(), Some(data)))
     }
 
     // https://html.spec.whatwg.org/multipage/#dom-context-2d-putimagedata
     fn PutImageData(self, imagedata: JSRef<ImageData>, dx: Finite<f64>, dy: Finite<f64>) {
         let dx = *dx;
@@ -924,18 +946,18 @@ impl<'a> CanvasRenderingContext2DMethods
         // By the spec: http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas_CR/#dom-context-2d-putimagedata
         // "If any of the arguments to the method are infinite or NaN, the method must throw a NotSupportedError
         // exception"
         // But this arguments are stricted value, so if they are not finite values,
         // they will be TypeError by WebIDL spec before call this methods.
 
         let data = imagedata.get_data_array(&self.global.root().r());
         let image_data_size = imagedata.get_size();
-        let image_data_size = Size2D(image_data_size.width as f64, image_data_size.height as f64);
-        let image_data_rect = Rect(Point2D(dx, dy), image_data_size);
+        let image_data_size = Size2D::new(image_data_size.width as f64, image_data_size.height as f64);
+        let image_data_rect = Rect::new(Point2D::new(dx, dy), image_data_size);
         let dirty_rect = None;
         let msg = CanvasMsg::Canvas2d(Canvas2dMsg::PutImageData(data, image_data_rect, dirty_rect));
         self.renderer.send(msg).unwrap();
         self.mark_as_dirty();
     }
 
     // https://html.spec.whatwg.org/multipage/#dom-context-2d-putimagedata
     fn PutImageData_(self, imagedata: JSRef<ImageData>, dx: Finite<f64>, dy: Finite<f64>,
@@ -950,21 +972,21 @@ impl<'a> CanvasRenderingContext2DMethods
         // XXX:
         // By the spec: http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas_CR/#dom-context-2d-putimagedata
         // "If any of the arguments to the method are infinite or NaN, the method must throw a NotSupportedError
         // exception"
         // But this arguments are stricted value, so if they are not finite values,
         // they will be TypeError by WebIDL spec before call this methods.
 
         let data = imagedata.get_data_array(&self.global.root().r());
-        let image_data_rect = Rect(Point2D(dx, dy),
-                                   Size2D(imagedata.Width() as f64,
-                                          imagedata.Height() as f64));
-        let dirty_rect = Some(Rect(Point2D(dirtyX, dirtyY),
-                                   Size2D(dirtyWidth, dirtyHeight)));
+        let image_data_rect = Rect::new(Point2D::new(dx, dy),
+                                        Size2D::new(imagedata.Width() as f64,
+                                                    imagedata.Height() as f64));
+        let dirty_rect = Some(Rect::new(Point2D::new(dirtyX, dirtyY),
+                                        Size2D::new(dirtyWidth, dirtyHeight)));
         let msg = CanvasMsg::Canvas2d(Canvas2dMsg::PutImageData(data, image_data_rect, dirty_rect));
         self.renderer.send(msg).unwrap();
         self.mark_as_dirty();
     }
 
     // https://html.spec.whatwg.org/multipage/#dom-context-2d-createlineargradient
     fn CreateLinearGradient(self, x0: Finite<f64>, y0: Finite<f64>,
                                   x1: Finite<f64>, y1: Finite<f64>) -> Fallible<Temporary<CanvasGradient>> {
@@ -1014,28 +1036,28 @@ impl<'a> CanvasRenderingContext2DMethods
                     None => return Err(InvalidState),
                 };
 
                 let img = match self.request_image_from_cache(url) {
                     ImageResponse::Loaded(img) => img,
                     ImageResponse::PlaceholderLoaded(_) | ImageResponse::None => return Err(InvalidState),
                 };
 
-                let image_size = Size2D(img.width as f64, img.height as f64);
+                let image_size = Size2D::new(img.width as f64, img.height as f64);
                 let image_data = match img.pixels {
                     PixelsByColorType::RGBA8(ref pixels) => pixels.to_vec(),
                     PixelsByColorType::K8(_) => panic!("K8 color type not supported"),
                     PixelsByColorType::RGB8(_) => panic!("RGB8 color type not supported"),
                     PixelsByColorType::KA8(_) => panic!("KA8 color type not supported"),
                 };
 
                 if let Some(rep) = RepetitionStyle::from_str(&repetition) {
                     return Ok(CanvasPattern::new(self.global.root().r(),
                                                  image_data,
-                                                 Size2D(image_size.width as i32, image_size.height as i32),
+                                                 Size2D::new(image_size.width as i32, image_size.height as i32),
                                                  rep));
                 }
                 return Err(Syntax);
             },
             _ => return Err(Type("Not implemented".to_owned())),
         }
     }
 
--- a/servo/components/script/dom/htmlcanvaselement.rs
+++ b/servo/components/script/dom/htmlcanvaselement.rs
@@ -93,17 +93,17 @@ impl HTMLCanvasElement {
             match context {
                 CanvasContext::Context2d(context) => context.root().r().recreate(size),
                 CanvasContext::WebGL(context) => context.root().r().recreate(size),
             }
         }
     }
 
     pub fn get_size(&self) -> Size2D<i32> {
-        Size2D(self.width.get() as i32, self.height.get() as i32)
+        Size2D::new(self.width.get() as i32, self.height.get() as i32)
     }
 }
 
 pub trait LayoutHTMLCanvasElementHelpers {
     #[allow(unsafe_code)]
     unsafe fn get_renderer(&self) -> Option<Sender<CanvasMsg>>;
     #[allow(unsafe_code)]
     unsafe fn get_canvas_width(&self) -> u32;
--- a/servo/components/script/dom/imagedata.rs
+++ b/servo/components/script/dom/imagedata.rs
@@ -63,17 +63,17 @@ impl<'a> ImageDataHelpers for JSRef<'a, 
             let cx = global.get_cx();
             let data: *const uint8_t = JS_GetUint8ClampedArrayData(self.Data(cx), cx) as *const uint8_t;
             let len = self.Width() * self.Height() * 4;
             slice::from_raw_parts(data, len as usize).to_vec()
         }
     }
 
     fn get_size(&self) -> Size2D<i32> {
-        Size2D(self.Width() as i32, self.Height() as i32)
+        Size2D::new(self.Width() as i32, self.Height() as i32)
     }
 }
 
 impl<'a> ImageDataMethods for JSRef<'a, ImageData> {
     // https://html.spec.whatwg.org/multipage/#dom-imagedata-width
     fn Width(self) -> u32 {
         self.width
     }
--- a/servo/components/script/dom/window.rs
+++ b/servo/components/script/dom/window.rs
@@ -1015,20 +1015,20 @@ impl Window {
             webdriver_script_chan: RefCell::new(None),
         };
 
         WindowBinding::Wrap(runtime.cx(), win)
     }
 }
 
 fn should_move_clip_rect(clip_rect: Rect<Au>, new_viewport: Rect<f32>) -> bool{
-    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()));
+    let clip_rect = Rect::new(Point2D::new(clip_rect.origin.x.to_f32_px(),
+                                           clip_rect.origin.y.to_f32_px()),
+                              Size2D::new(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
     // for "close."
     static VIEWPORT_SCROLL_MARGIN_SIZE: f32 = 0.5;
     let viewport_scroll_margin = new_viewport.size * VIEWPORT_SCROLL_MARGIN_SIZE;
 
     (clip_rect.origin.x - new_viewport.origin.x).abs() <= viewport_scroll_margin.width ||
--- a/servo/components/script/script_task.rs
+++ b/servo/components/script/script_task.rs
@@ -1335,17 +1335,17 @@ impl ScriptTask {
                                                         page_info)).unwrap();
             }
         }
     }
 
     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_f32_px(), rect.origin.y.to_f32_px());
+        let point = Point2D::new(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
         // compositor.
         self.compositor.borrow_mut().scroll_fragment_point(pipeline_id, LayerId::null(), point);
     }
 
     /// Reflows non-incrementally, rebuilding the entire layout tree in the process.
--- a/servo/components/servo/Cargo.lock
+++ b/servo/components/servo/Cargo.lock
@@ -380,17 +380,17 @@ version = "0.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "winapi 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "geom"
 version = "0.1.0"
-source = "git+https://github.com/servo/rust-geom#1b49f8ce1c4e8ade720dd940d1964c657a96817f"
+source = "git+https://github.com/servo/rust-geom#16b91afc0b9b532f2fb56879069bc381f2143df1"
 dependencies = [
  "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "num 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-serialize 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -619,17 +619,17 @@ dependencies = [
 [[package]]
 name = "khronos_api"
 version = "0.0.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "layers"
 version = "0.1.0"
-source = "git+https://github.com/servo/rust-layers#ca37ca2949c46f91e37f28fa31ad6c1e8036f2d0"
+source = "git+https://github.com/servo/rust-layers#e566d3fc6ec80fe3aaf8ce67785683c99c46a015"
 dependencies = [
  "azure 0.1.0 (git+https://github.com/servo/rust-azure)",
  "cgl 0.0.1 (git+https://github.com/servo/cgl-rs)",
  "core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "egl 0.1.0 (git+https://github.com/servo/rust-egl)",
  "geom 0.1.0 (git+https://github.com/servo/rust-geom)",
  "gleam 0.0.1 (git+https://github.com/servo/gleam)",
  "glx 0.0.1 (git+https://github.com/servo/rust-glx)",
@@ -851,17 +851,17 @@ source = "registry+https://github.com/ru
 dependencies = [
  "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "malloc_buf 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "offscreen_gl_context"
 version = "0.0.1"
-source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#0fd217b95d806bdcb6d381cf092ca8776de273c8"
+source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#c402c86f8d4472785e04e59505feb28638101700"
 dependencies = [
  "cgl 0.0.1 (git+https://github.com/servo/cgl-rs)",
  "core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "egl 0.1.0 (git+https://github.com/servo/rust-egl)",
  "geom 0.1.0 (git+https://github.com/servo/rust-geom)",
  "gleam 0.0.1 (git+https://github.com/servo/gleam)",
  "glx 0.0.1 (git+https://github.com/servo/rust-glx)",
  "layers 0.1.0 (git+https://github.com/servo/rust-layers)",
--- a/servo/components/style/media_queries.rs
+++ b/servo/components/style/media_queries.rs
@@ -198,18 +198,18 @@ pub fn parse_media_query_list(input: &mu
         }
         media_queries
     };
     MediaQueryList { media_queries: queries }
 }
 
 impl MediaQueryList {
     pub fn evaluate(&self, device: &Device) -> bool {
-        let viewport_size = Size2D(Au::from_f32_px(device.viewport_size.width.get()),
-                                   Au::from_f32_px(device.viewport_size.height.get()));
+        let viewport_size = Size2D::new(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| {
             // Check if media matches. Unknown media never matches.
             let media_match = match mq.media_type {
                 MediaQueryType::MediaType(MediaType::Unknown) => false,
                 MediaQueryType::MediaType(media_type) => media_type == device.media_type,
                 MediaQueryType::All => true,
--- a/servo/components/style/properties.mako.rs
+++ b/servo/components/style/properties.mako.rs
@@ -3891,17 +3891,17 @@ pub mod longhands {
                             try!(input.expect_comma());
                             p1y = try!(input.expect_number());
                             try!(input.expect_comma());
                             p2x = try!(input.expect_number());
                             try!(input.expect_comma());
                             p2y = try!(input.expect_number());
                             Ok(())
                         }));
-                        let (p1, p2) = (Point2D(p1x, p1y), Point2D(p2x, p2y));
+                        let (p1, p2) = (Point2D::new(p1x, p1y), Point2D::new(p2x, p2y));
                         Ok(TransitionTimingFunction::CubicBezier(p1, p2))
                     },
                     "steps" => {
                         let (mut step_count, mut start_end) = (0, computed_value::StartEnd::Start);
                         try!(input.parse_nested_block(|input| {
                             step_count = try!(input.expect_integer());
                             try!(input.expect_comma());
                             start_end = try!(match_ignore_ascii_case! {
--- a/servo/components/style/viewport.rs
+++ b/servo/components/style/viewport.rs
@@ -412,18 +412,18 @@ impl ViewportConstraints {
         if initial_zoom.is_some() {
             initial_zoom = max!(min_zoom, min!(max_zoom, initial_zoom));
         }
 
         // DEVICE-ADAPT § 6.2.3 Resolve non-auto lengths to pixel lengths
         //
         // Note: DEVICE-ADAPT § 5. states that relative length values are
         // resolved against initial values
-        let initial_viewport = Size2D(Au::from_f32_px(initial_viewport.width.get()),
-                                      Au::from_f32_px(initial_viewport.height.get()));
+        let initial_viewport = Size2D::new(Au::from_f32_px(initial_viewport.width.get()),
+                                           Au::from_f32_px(initial_viewport.height.get()));
 
         macro_rules! to_pixel_length {
             ($value:ident, $dimension:ident) => {
                 if let Some($value) = $value {
                     match $value {
                         LengthOrPercentageOrAuto::Length(ref value) => Some(match value {
                             &Length::Absolute(length) => length,
                             &Length::FontRelative(length) => {
@@ -491,17 +491,17 @@ impl ViewportConstraints {
             Au(0) => initial_viewport.height,
             initial_width => {
                 let ratio = initial_viewport.height.to_f32_px() / initial_width.to_f32_px();
                 Au::from_f32_px(width.to_f32_px() * ratio)
             }
         });
 
         Some(ViewportConstraints {
-            size: TypedSize2D(width.to_f32_px(), height.to_f32_px()),
+            size: Size2D::typed(width.to_f32_px(), height.to_f32_px()),
 
             // TODO: compute a zoom factor for 'auto' as suggested by DEVICE-ADAPT § 10.
             initial_zoom: ScaleFactor::new(initial_zoom.unwrap_or(1.)),
             min_zoom: min_zoom.map(ScaleFactor::new),
             max_zoom: max_zoom.map(ScaleFactor::new),
 
             user_zoom: user_zoom,
             orientation: orientation
--- a/servo/components/util/geometry.rs
+++ b/servo/components/util/geometry.rs
@@ -272,12 +272,12 @@ pub fn px_to_pt(px: f64) -> f64 {
 /// not considered inside the rectangle.
 pub fn rect_contains_point<T:PartialOrd + Add<T, Output=T>>(rect: Rect<T>, point: Point2D<T>) -> bool {
     point.x >= rect.origin.x && point.x < rect.origin.x + rect.size.width &&
         point.y >= rect.origin.y && point.y < rect.origin.y + rect.size.height
 }
 
 /// 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_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)))
+    Rect::new(Point2D::new(Au::from_f32_px(rect.origin.x), Au::from_f32_px(rect.origin.y)),
+              Size2D::new(Au::from_f32_px(rect.size.width), Au::from_f32_px(rect.size.height)))
 }
 
--- a/servo/components/util/opts.rs
+++ b/servo/components/util/opts.rs
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 //! Configuration options for a single run of the servo application. Created
 //! from command line arguments.
 
 use geometry::ScreenPx;
 
 use geom::scale_factor::ScaleFactor;
-use geom::size::TypedSize2D;
+use geom::size::{Size2D, TypedSize2D};
 use layers::geometry::DevicePixel;
 use getopts;
 use num_cpus;
 use std::collections::HashSet;
 use std::cmp;
 use std::env;
 use std::io::{self, Write};
 use std::fs::PathExt;
@@ -225,17 +225,17 @@ pub fn default_opts() -> Opts {
         show_debug_parallel_paint: false,
         show_debug_parallel_layout: false,
         paint_flashing: false,
         enable_text_antialiasing: false,
         enable_canvas_antialiasing: false,
         trace_layout: false,
         devtools_port: None,
         webdriver_port: None,
-        initial_window_size: TypedSize2D(800, 600),
+        initial_window_size: Size2D::typed(800, 600),
         user_agent: None,
         dump_flow_tree: false,
         dump_display_list: false,
         dump_display_list_optimized: false,
         relayout_event: false,
         validate_display_list_geometry: false,
         profile_tasks: false,
         resources_path: None,
@@ -370,20 +370,20 @@ pub fn from_cmdline_args(args: &[String]
 
     let webdriver_port = opt_match.opt_default("webdriver", "7000").map(|port| {
         port.parse().unwrap()
     });
 
     let initial_window_size = match opt_match.opt_str("resolution") {
         Some(res_string) => {
             let res: Vec<u32> = res_string.split('x').map(|r| r.parse().unwrap()).collect();
-            TypedSize2D(res[0], res[1])
+            Size2D::typed(res[0], res[1])
         }
         None => {
-            TypedSize2D(800, 600)
+            Size2D::typed(800, 600)
         }
     };
 
     let opts = Opts {
         url: Some(url),
         paint_threads: paint_threads,
         gpu_painting: gpu_painting,
         tile_size: tile_size,
--- a/servo/ports/cef/Cargo.lock
+++ b/servo/ports/cef/Cargo.lock
@@ -379,17 +379,17 @@ version = "0.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "winapi 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "geom"
 version = "0.1.0"
-source = "git+https://github.com/servo/rust-geom#1b49f8ce1c4e8ade720dd940d1964c657a96817f"
+source = "git+https://github.com/servo/rust-geom#16b91afc0b9b532f2fb56879069bc381f2143df1"
 dependencies = [
  "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "num 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-serialize 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -611,17 +611,17 @@ dependencies = [
 [[package]]
 name = "khronos_api"
 version = "0.0.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "layers"
 version = "0.1.0"
-source = "git+https://github.com/servo/rust-layers#ca37ca2949c46f91e37f28fa31ad6c1e8036f2d0"
+source = "git+https://github.com/servo/rust-layers#e566d3fc6ec80fe3aaf8ce67785683c99c46a015"
 dependencies = [
  "azure 0.1.0 (git+https://github.com/servo/rust-azure)",
  "cgl 0.0.1 (git+https://github.com/servo/cgl-rs)",
  "core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "egl 0.1.0 (git+https://github.com/servo/rust-egl)",
  "geom 0.1.0 (git+https://github.com/servo/rust-geom)",
  "gleam 0.0.1 (git+https://github.com/servo/gleam)",
  "glx 0.0.1 (git+https://github.com/servo/rust-glx)",
@@ -831,17 +831,17 @@ source = "registry+https://github.com/ru
 dependencies = [
  "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "malloc_buf 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "offscreen_gl_context"
 version = "0.0.1"
-source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#0fd217b95d806bdcb6d381cf092ca8776de273c8"
+source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#c402c86f8d4472785e04e59505feb28638101700"
 dependencies = [
  "cgl 0.0.1 (git+https://github.com/servo/cgl-rs)",
  "core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "egl 0.1.0 (git+https://github.com/servo/rust-egl)",
  "geom 0.1.0 (git+https://github.com/servo/rust-geom)",
  "gleam 0.0.1 (git+https://github.com/servo/gleam)",
  "glx 0.0.1 (git+https://github.com/servo/rust-glx)",
  "layers 0.1.0 (git+https://github.com/servo/rust-layers)",
--- a/servo/ports/cef/browser_host.rs
+++ b/servo/ports/cef/browser_host.rs
@@ -6,18 +6,18 @@ use eutil::Downcast;
 use interfaces::{CefBrowser, CefBrowserHost, CefClient, cef_browser_t, cef_browser_host_t, cef_client_t};
 use types::{cef_mouse_button_type_t, cef_mouse_event, cef_rect_t, cef_key_event, cef_window_handle_t};
 use types::cef_key_event_type_t::{KEYEVENT_CHAR, KEYEVENT_KEYDOWN, KEYEVENT_KEYUP, KEYEVENT_RAWKEYDOWN};
 use types::cef_event_flags_t::{EVENTFLAG_ALT_DOWN, EVENTFLAG_CONTROL_DOWN, EVENTFLAG_SHIFT_DOWN};
 use browser::{self, ServoCefBrowserExtensions};
 use wrappers::CefWrap;
 
 use compositing::windowing::{WindowEvent, MouseWindowEvent};
-use geom::point::TypedPoint2D;
-use geom::size::TypedSize2D;
+use geom::point::Point2D;
+use geom::size::Size2D;
 use libc::{c_double, c_int};
 use msg::constellation_msg::{self, KeyModifiers, KeyState};
 use script_traits::MouseButton;
 use std::cell::{Cell, RefCell};
 use std::mem::transmute;
 use std::intrinsics;
 
 pub struct ServoCefBrowserHost {
@@ -380,17 +380,17 @@ full_cef_class_impl! {
                         .get_backing_rect(this.downcast().browser.borrow().clone().unwrap(), &mut rect);
                 }
             } else if check_ptr_exist!(this.get_client(), get_render_handler) &&
                check_ptr_exist!(this.get_client().get_render_handler(), get_view_rect) {
                 this.get_client()
                     .get_render_handler()
                     .get_view_rect(this.downcast().browser.borrow().clone().unwrap(), &mut rect);
                }
-            let size = TypedSize2D(rect.width as u32, rect.height as u32);
+            let size = Size2D::typed(rect.width as u32, rect.height as u32);
             this.downcast().send_window_event(WindowEvent::Resize(size));
         }}
 
         fn close_browser(&this, _force: c_int [c_int],) -> () {{
             browser::close(this.downcast().browser.borrow_mut().take().unwrap());
         }}
 
         fn send_focus_event(&this, focus: c_int [c_int],) -> () {{
@@ -438,44 +438,44 @@ full_cef_class_impl! {
             let event: &cef_mouse_event = event;
             let mouse_button_type: cef_mouse_button_type_t = mouse_button_type;
             let mouse_up: c_int = mouse_up;
             let button_type = match mouse_button_type {
                 cef_mouse_button_type_t::MBT_LEFT => MouseButton::Left,
                 cef_mouse_button_type_t::MBT_MIDDLE => MouseButton::Middle,
                 cef_mouse_button_type_t::MBT_RIGHT => MouseButton::Right,
             };
-            let point = TypedPoint2D((*event).x as f32, (*event).y as f32);
+            let point = Point2D::typed((*event).x as f32, (*event).y as f32);
             if mouse_up != 0 {
                 this.downcast().send_window_event(WindowEvent::MouseWindowEventClass(
                     MouseWindowEvent::Click(button_type, point)))
             } else {
                 this.downcast().send_window_event(WindowEvent::MouseWindowEventClass(
                     MouseWindowEvent::MouseUp(button_type, point)))
             }
         }}
 
         fn send_mouse_move_event(&this, event: *const cef_mouse_event [&cef_mouse_event],
                                  _mouse_exited: c_int [c_int],)
                                  -> () {{
             let event: &cef_mouse_event = event;
-            let point = TypedPoint2D((*event).x as f32, (*event).y as f32);
+            let point = Point2D::typed((*event).x as f32, (*event).y as f32);
             this.downcast().send_window_event(WindowEvent::MouseWindowMoveEventClass(point))
         }}
 
         fn send_mouse_wheel_event(&this,
                                   event: *const cef_mouse_event [&cef_mouse_event],
                                   delta_x: c_int [c_int],
                                   delta_y: c_int [c_int],)
                                   -> () {{
             let event: &cef_mouse_event = event;
             let delta_x: c_int = delta_x;
             let delta_y: c_int = delta_y;
-            let delta = TypedPoint2D(delta_x as f32, delta_y as f32);
-            let origin = TypedPoint2D((*event).x as i32, (*event).y as i32);
+            let delta = Point2D::typed(delta_x as f32, delta_y as f32);
+            let origin = Point2D::typed((*event).x as i32, (*event).y as i32);
             this.downcast().send_window_event(WindowEvent::Scroll(delta, origin))
         }}
 
         fn get_zoom_level(&this,) -> c_double {{
             this.downcast().pinch_zoom_level() as c_double
         }}
 
         fn set_zoom_level(&this, new_zoom_level: c_double [c_double],) -> () {{
--- a/servo/ports/cef/window.rs
+++ b/servo/ports/cef/window.rs
@@ -13,17 +13,17 @@ use interfaces::{CefApp, CefBrowser};
 use render_handler::CefRenderHandlerExtensions;
 use rustc_unicode::str::Utf16Encoder;
 use types::{cef_cursor_handle_t, cef_cursor_type_t, cef_rect_t};
 use wrappers::CefWrap;
 
 use compositing::compositor_task::{self, CompositorProxy, CompositorReceiver};
 use compositing::windowing::{WindowEvent, WindowMethods};
 use geom::scale_factor::ScaleFactor;
-use geom::size::TypedSize2D;
+use geom::size::{Size2D, TypedSize2D};
 use gleam::gl;
 use layers::geometry::DevicePixel;
 use layers::platform::surface::NativeGraphicsMetadata;
 use libc::{c_char, c_void};
 use msg::constellation_msg::{Key, KeyModifiers};
 use net::net_error_list::NetError;
 use std::ptr;
 use std_url::Url;
@@ -81,17 +81,17 @@ fn load_gl() {
 
 impl Window {
     /// Creates a new window.
     pub fn new(width: u32, height: u32) -> Rc<Window> {
         load_gl();
 
         Rc::new(Window {
             cef_browser: RefCell::new(None),
-            size: TypedSize2D(width, height)
+            size: Size2D::typed(width, height)
         })
     }
 
     /// Sets the current browser.
     pub fn set_browser(&self, browser: CefBrowser) {
         *self.cef_browser.borrow_mut() = Some(browser)
     }
 
@@ -194,33 +194,33 @@ impl WindowMethods for Window {
                            check_ptr_exist!(browser.get_host().get_client().get_render_handler(), get_view_rect) {
                             browser.get_host()
                                    .get_client()
                                    .get_render_handler()
                                    .get_view_rect((*browser).clone(), &mut rect);
                         }
                     }
 
-                    TypedSize2D(rect.width as u32, rect.height as u32)
+                    Size2D::typed(rect.width as u32, rect.height as u32)
                 }
             }
         }
     }
 
     fn size(&self) -> TypedSize2D<ScreenPx,f32> {
         let browser = self.cef_browser.borrow();
         match *browser {
-            None => TypedSize2D(400.0, 300.0),
+            None => Size2D::typed(400.0, 300.0),
             Some(ref browser) => {
                 let mut rect = cef_rect_t::zero();
                 browser.get_host()
                        .get_client()
                        .get_render_handler()
                        .get_view_rect((*browser).clone(), &mut rect);
-                TypedSize2D(rect.width as f32, rect.height as f32)
+                Size2D::typed(rect.width as f32, rect.height as f32)
             }
         }
     }
 
     fn present(&self) {
         let browser = self.cef_browser.borrow();
         match *browser {
             None => {}
--- a/servo/ports/glutin/window.rs
+++ b/servo/ports/glutin/window.rs
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 //! A windowing implementation using glutin.
 
 use compositing::compositor_task::{self, CompositorProxy, CompositorReceiver};
 use compositing::windowing::{WindowEvent, WindowMethods};
 use geom::scale_factor::ScaleFactor;
-use geom::size::TypedSize2D;
+use geom::size::{Size2D, TypedSize2D};
 use gleam::gl;
 use glutin;
 use layers::geometry::DevicePixel;
 use layers::platform::surface::NativeGraphicsMetadata;
 use msg::constellation_msg;
 use msg::constellation_msg::Key;
 use net::net_error_list::NetError;
 use std::rc::Rc;
@@ -21,17 +21,17 @@ use url::Url;
 use util::cursor::Cursor;
 use util::geometry::ScreenPx;
 
 use NestedEventLoopListener;
 
 #[cfg(feature = "window")]
 use compositing::windowing::{MouseWindowEvent, WindowNavigateMsg};
 #[cfg(feature = "window")]
-use geom::point::{Point2D, TypedPoint2D};
+use geom::point::Point2D;
 #[cfg(feature = "window")]
 use glutin::{Api, ElementState, Event, GlRequest, MouseButton, VirtualKeyCode};
 #[cfg(feature = "window")]
 use msg::constellation_msg::{KeyState, CONTROL, SHIFT, ALT};
 #[cfg(feature = "window")]
 use std::cell::{Cell, RefCell};
 #[cfg(feature = "window")]
 use util::opts;
@@ -85,19 +85,19 @@ impl Window {
         glutin_window.set_window_resize_callback(Some(Window::nested_window_resize as fn(u32, u32)));
 
         Window::load_gl_functions(&glutin_window);
 
         let window = Window {
             window: glutin_window,
             event_queue: RefCell::new(vec!()),
             mouse_down_button: Cell::new(None),
-            mouse_down_point: Cell::new(Point2D(0, 0)),
+            mouse_down_point: Cell::new(Point2D::new(0, 0)),
 
-            mouse_pos: Cell::new(Point2D(0, 0)),
+            mouse_pos: Cell::new(Point2D::new(0, 0)),
             key_modifiers: Cell::new(KeyModifiers::empty()),
         };
 
         gl::clear_color(0.6, 0.6, 0.6, 1.0);
         gl::clear(gl::COLOR_BUFFER_BIT);
         gl::finish();
         window.present();
 
@@ -108,17 +108,18 @@ impl Window {
         unsafe { self.window.platform_window() }
     }
 
     fn nested_window_resize(width: u32, height: u32) {
         unsafe {
             match g_nested_event_loop_listener {
                 None => {}
                 Some(listener) => {
-                    (*listener).handle_event_from_nested_event_loop(WindowEvent::Resize(TypedSize2D(width, height)));
+                    (*listener).handle_event_from_nested_event_loop(
+                        WindowEvent::Resize(Size2D::typed(width, height)));
                 }
             }
         }
     }
 
     #[cfg(not(target_os="android"))]
     fn gl_version() -> GlRequest {
         GlRequest::Specific(Api::OpenGl, (3, 0))
@@ -164,29 +165,29 @@ impl Window {
                                 }
                                 _ => {}
                             }
                         }
                     }
                 }
             }
             Event::Resized(width, height) => {
-                self.event_queue.borrow_mut().push(WindowEvent::Resize(TypedSize2D(width, height)));
+                self.event_queue.borrow_mut().push(WindowEvent::Resize(Size2D::typed(width, height)));
             }
             Event::MouseInput(element_state, mouse_button) => {
                 if mouse_button == MouseButton::Left ||
                                     mouse_button == MouseButton::Right {
                         let mouse_pos = self.mouse_pos.get();
                         self.handle_mouse(mouse_button, element_state, mouse_pos.x, mouse_pos.y);
                    }
             }
             Event::MouseMoved((x, y)) => {
-                self.mouse_pos.set(Point2D(x, y));
+                self.mouse_pos.set(Point2D::new(x, y));
                 self.event_queue.borrow_mut().push(
-                    WindowEvent::MouseWindowMoveEventClass(TypedPoint2D(x as f32, y as f32)));
+                    WindowEvent::MouseWindowMoveEventClass(Point2D::typed(x as f32, y as f32)));
             }
             Event::MouseWheel(delta) => {
                 if self.ctrl_pressed() {
                     // Ctrl-Scrollwheel simulates a "pinch zoom" gesture.
                     if delta < 0 {
                         self.event_queue.borrow_mut().push(WindowEvent::PinchZoom(1.0/1.1));
                     } else if delta > 0 {
                         self.event_queue.borrow_mut().push(WindowEvent::PinchZoom(1.1));
@@ -215,44 +216,44 @@ impl Window {
         let mut modifiers = self.key_modifiers.get();
         modifiers.toggle(modifier);
         self.key_modifiers.set(modifiers);
     }
 
     /// Helper function to send a scroll event.
     fn scroll_window(&self, dx: f32, dy: f32) {
         let mouse_pos = self.mouse_pos.get();
-        let event = WindowEvent::Scroll(TypedPoint2D(dx as f32, dy as f32),
-                                        TypedPoint2D(mouse_pos.x as i32, mouse_pos.y as i32));
+        let event = WindowEvent::Scroll(Point2D::typed(dx as f32, dy as f32),
+                                        Point2D::typed(mouse_pos.x as i32, mouse_pos.y as i32));
         self.event_queue.borrow_mut().push(event);
     }
 
     /// Helper function to handle a click
     fn handle_mouse(&self, button: glutin::MouseButton, action: glutin::ElementState, x: i32, y: i32) {
         use script_traits::MouseButton;
 
         // FIXME(tkuehn): max pixel dist should be based on pixel density
         let max_pixel_dist = 10f64;
         let event = match action {
             ElementState::Pressed => {
-                self.mouse_down_point.set(Point2D(x, y));
+                self.mouse_down_point.set(Point2D::new(x, y));
                 self.mouse_down_button.set(Some(button));
-                MouseWindowEvent::MouseDown(MouseButton::Left, TypedPoint2D(x as f32, y as f32))
+                MouseWindowEvent::MouseDown(MouseButton::Left, Point2D::typed(x as f32, y as f32))
             }
             ElementState::Released => {
-                let mouse_up_event = MouseWindowEvent::MouseUp(MouseButton::Left, TypedPoint2D(x as f32, y as f32));
+                let mouse_up_event = MouseWindowEvent::MouseUp(MouseButton::Left, Point2D::typed(x as f32, y as f32));
                 match self.mouse_down_button.get() {
                     None => mouse_up_event,
                     Some(but) if button == but => {
-                        let pixel_dist = self.mouse_down_point.get() - Point2D(x, y);
+                        let pixel_dist = self.mouse_down_point.get() - Point2D::new(x, y);
                         let pixel_dist = ((pixel_dist.x * pixel_dist.x +
                                            pixel_dist.y * pixel_dist.y) as f64).sqrt();
                         if pixel_dist < max_pixel_dist {
                             self.event_queue.borrow_mut().push(WindowEvent::MouseWindowEventClass(mouse_up_event));
-                            MouseWindowEvent::Click(MouseButton::Left, TypedPoint2D(x as f32, y as f32))
+                            MouseWindowEvent::Click(MouseButton::Left, Point2D::typed(x as f32, y as f32))
                         } else {
                             mouse_up_event
                         }
                     },
                     Some(_) => mouse_up_event,
                 }
             }
         };
@@ -457,22 +458,22 @@ fn create_window_proxy(window: &Rc<Windo
     Some(window.window.create_window_proxy())
 }
 
 #[cfg(feature = "window")]
 impl WindowMethods for Window {
     fn framebuffer_size(&self) -> TypedSize2D<DevicePixel, u32> {
         let scale_factor = self.window.hidpi_factor() as u32;
         let (width, height) = self.window.get_inner_size().unwrap();
-        TypedSize2D(width * scale_factor, height * scale_factor)
+        Size2D::typed(width * scale_factor, height * scale_factor)
     }
 
     fn size(&self) -> TypedSize2D<ScreenPx, f32> {
         let (width, height) = self.window.get_inner_size().unwrap();
-        TypedSize2D(width as f32, height as f32)
+        Size2D::typed(width as f32, height as f32)
     }
 
     fn present(&self) {
         self.window.swap_buffers()
     }
 
     fn create_compositor_channel(window: &Option<Rc<Window>>)
                                  -> (Box<CompositorProxy+Send>, Box<CompositorReceiver>) {
@@ -667,21 +668,21 @@ impl Window {
 
     pub unsafe fn remove_nested_event_loop_listener(&self) {
     }
 }
 
 #[cfg(feature = "headless")]
 impl WindowMethods for Window {
     fn framebuffer_size(&self) -> TypedSize2D<DevicePixel, u32> {
-        TypedSize2D(self.width, self.height)
+        Size2D::typed(self.width, self.height)
     }
 
     fn size(&self) -> TypedSize2D<ScreenPx, f32> {
-        TypedSize2D(self.width as f32, self.height as f32)
+        Size2D::typed(self.width as f32, self.height as f32)
     }
 
     fn present(&self) {
     }
 
     fn create_compositor_channel(_: &Option<Rc<Window>>)
                                  -> (Box<CompositorProxy+Send>, Box<CompositorReceiver>) {
         let (sender, receiver) = channel();
--- a/servo/ports/gonk/Cargo.lock
+++ b/servo/ports/gonk/Cargo.lock
@@ -358,17 +358,17 @@ source = "git+https://github.com/servo/l
 [[package]]
 name = "gcc"
 version = "0.3.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "geom"
 version = "0.1.0"
-source = "git+https://github.com/servo/rust-geom#1b49f8ce1c4e8ade720dd940d1964c657a96817f"
+source = "git+https://github.com/servo/rust-geom#16b91afc0b9b532f2fb56879069bc381f2143df1"
 dependencies = [
  "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "num 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "rustc-serialize 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -545,17 +545,17 @@ dependencies = [
 [[package]]
 name = "khronos_api"
 version = "0.0.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "layers"
 version = "0.1.0"
-source = "git+https://github.com/servo/rust-layers#ca37ca2949c46f91e37f28fa31ad6c1e8036f2d0"
+source = "git+https://github.com/servo/rust-layers#e566d3fc6ec80fe3aaf8ce67785683c99c46a015"
 dependencies = [
  "azure 0.1.0 (git+https://github.com/servo/rust-azure)",
  "cgl 0.0.1 (git+https://github.com/servo/cgl-rs)",
  "core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "egl 0.1.0 (git+https://github.com/servo/rust-egl)",
  "geom 0.1.0 (git+https://github.com/servo/rust-geom)",
  "gleam 0.0.1 (git+https://github.com/servo/gleam)",
  "glx 0.0.1 (git+https://github.com/servo/rust-glx)",
@@ -748,17 +748,17 @@ version = "0.2.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "libc 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "offscreen_gl_context"
 version = "0.0.1"
-source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#0fd217b95d806bdcb6d381cf092ca8776de273c8"
+source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#c402c86f8d4472785e04e59505feb28638101700"
 dependencies = [
  "cgl 0.0.1 (git+https://github.com/servo/cgl-rs)",
  "core-foundation 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "egl 0.1.0 (git+https://github.com/servo/rust-egl)",
  "geom 0.1.0 (git+https://github.com/servo/rust-geom)",
  "gleam 0.0.1 (git+https://github.com/servo/gleam)",
  "glx 0.0.1 (git+https://github.com/servo/rust-glx)",
  "layers 0.1.0 (git+https://github.com/servo/rust-layers)",
--- a/servo/ports/gonk/src/input.rs
+++ b/servo/ports/gonk/src/input.rs
@@ -9,17 +9,17 @@ use std::mem::size_of;
 use std::mem::transmute;
 use std::mem::zeroed;
 use std::os::unix::io::AsRawFd;
 use std::fs::File;
 use std::thread;
 use std::sync::mpsc::Sender;
 use std::io::Read;
 
-use geom::point::TypedPoint2D;
+use geom::point::Point2D;
 
 use errno::errno;
 use libc::c_int;
 use libc::c_long;
 use libc::time_t;
 
 use compositing::windowing::WindowEvent;
 use compositing::windowing::MouseWindowEvent;
@@ -162,17 +162,17 @@ fn read_input_device(device_path: &Path,
                     if tracking_updated {
                         tracking_updated = false;
                         if slotA.tracking_id == -1 {
                             println!("Touch up");
                             let delta_x = slotA.x - first_x;
                             let delta_y = slotA.y - first_y;
                             let dist = delta_x * delta_x + delta_y * delta_y;
                             if dist < 16 {
-                                let click_pt = TypedPoint2D(slotA.x as f32, slotA.y as f32);
+                                let click_pt = Point2D::typed(slotA.x as f32, slotA.y as f32);
                                 println!("Dispatching click!");
                                 sender.send(
                                     WindowEvent::MouseWindowEventClass(
                                         MouseWindowEvent::MouseDown(MouseButton::Left, click_pt))).ok().unwrap();
                                 sender.send(
                                     WindowEvent::MouseWindowEventClass(
                                         MouseWindowEvent::MouseUp(MouseButton::Left, click_pt))).ok().unwrap();
                                 sender.send(
@@ -188,18 +188,18 @@ fn read_input_device(device_path: &Path,
                             if touch_count >= 2 {
                                 let slotB = &slots[1];
                                 last_dist = dist(slotA.x, slotB.x, slotA.y, slotB.y);
                             }
                         }
                     } else {
                         println!("Touch move x: {}, y: {}", slotA.x, slotA.y);
                         sender.send(
-                            WindowEvent::Scroll(TypedPoint2D((slotA.x - last_x) as f32, (slotA.y - last_y) as f32),
-                                                TypedPoint2D(slotA.x, slotA.y))).ok().unwrap();
+                            WindowEvent::Scroll(Point2D::typed((slotA.x - last_x) as f32, (slotA.y - last_y) as f32),
+                                                Point2D::typed(slotA.x, slotA.y))).ok().unwrap();
                         last_x = slotA.x;
                         last_y = slotA.y;
                         if touch_count >= 2 {
                             let slotB = &slots[1];
                             let cur_dist = dist(slotA.x, slotB.x, slotA.y, slotB.y);
                             println!("Zooming {} {} {} {}",
                                      cur_dist, last_dist, screen_dist,
                                      ((screen_dist + (cur_dist - last_dist))/screen_dist));
--- a/servo/ports/gonk/src/window.rs
+++ b/servo/ports/gonk/src/window.rs
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 //! A windowing implementation using gonk interfaces.
 
 use compositing::compositor_task::{self, CompositorProxy, CompositorReceiver};
 use compositing::windowing::{WindowEvent, WindowMethods};
 use geom::scale_factor::ScaleFactor;
-use geom::size::TypedSize2D;
+use geom::size::{Size2D, TypedSize2D};
 use layers::geometry::DevicePixel;
 use layers::platform::surface::NativeGraphicsMetadata;
 use libc::c_int;
 use msg::constellation_msg::{Key, KeyModifiers};
 use net::net_error_list::NetError;
 use std::sync::mpsc::{channel, Sender, Receiver};
 use std::rc::Rc;
 use std::mem::transmute;
@@ -779,22 +779,22 @@ impl Drop for Window {
             ((*self.native_window).window.common.decRef)(&mut (*self.native_window).window.common);
         }
     }
 }
 
 impl WindowMethods for Window {
     /// Returns the size of the window in hardware pixels.
     fn framebuffer_size(&self) -> TypedSize2D<DevicePixel, u32> {
-        TypedSize2D(self.width as u32, self.height as u32)
+        Size2D::typed(self.width as u32, self.height as u32)
     }
 
     /// Returns the size of the window in density-independent "px" units.
     fn size(&self) -> TypedSize2D<ScreenPx, f32> {
-        TypedSize2D(self.width as f32, self.height as f32)
+        Size2D::typed(self.width as f32, self.height as f32)
     }
 
     /// Presents the window to the screen (perhaps by page flipping).
     fn present(&self) {
         let _ = egl::SwapBuffers(self.dpy, self.surf);
     }
 
     fn set_page_title(&self, _: Option<String>) {
--- a/servo/tests/unit/style/media_queries.rs
+++ b/servo/tests/unit/style/media_queries.rs
@@ -1,13 +1,13 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-use geom::size::TypedSize2D;
+use geom::size::Size2D;
 use style::stylesheets::{Stylesheet, CSSRuleIteratorExt};
 use style::stylesheets::Origin;
 use style::media_queries::*;
 use style::values::specified;
 use std::borrow::ToOwned;
 use url::Url;
 use util::geometry::Au;
 
@@ -344,17 +344,17 @@ fn test_mq_malformed_expressions() {
         assert!(q1.expressions.len() == 0, css.to_owned());
     });
 }
 
 #[test]
 fn test_matching_simple() {
     let device = Device {
         media_type: MediaType::Screen,
-        viewport_size: TypedSize2D(200.0, 100.0),
+        viewport_size: Size2D::typed(200.0, 100.0),
     };
 
     media_query_test(&device, "@media not all { a { color: red; } }", 0);
     media_query_test(&device, "@media not screen { a { color: red; } }", 0);
     media_query_test(&device, "@media not print { a { color: red; } }", 1);
 
     media_query_test(&device, "@media unknown { a { color: red; } }", 0);
     media_query_test(&device, "@media not unknown { a { color: red; } }", 1);
@@ -363,17 +363,17 @@ fn test_matching_simple() {
     media_query_test(&device, "@media screen { a { color: red; } }", 1);
     media_query_test(&device, "@media print { a { color: red; } }", 0);
 }
 
 #[test]
 fn test_matching_width() {
     let device = Device {
         media_type: MediaType::Screen,
-        viewport_size: TypedSize2D(200.0, 100.0),
+        viewport_size: Size2D::typed(200.0, 100.0),
     };
 
     media_query_test(&device, "@media { a { color: red; } }", 1);
 
     media_query_test(&device, "@media (min-width: 50px) { a { color: red; } }", 1);
     media_query_test(&device, "@media (min-width: 150px) { a { color: red; } }", 1);
     media_query_test(&device, "@media (min-width: 300px) { a { color: red; } }", 0);
 
@@ -407,15 +407,15 @@ fn test_matching_width() {
     media_query_test(
         &device, "@media not screen and (min-width: 3em) and (max-width: 250px) { a { color: red; } }", 0);
 }
 
 #[test]
 fn test_matching_invalid() {
     let device = Device {
         media_type: MediaType::Screen,
-        viewport_size: TypedSize2D(200.0, 100.0),
+        viewport_size: Size2D::typed(200.0, 100.0),
     };
 
     media_query_test(&device, "@media fridge { a { color: red; } }", 0);
     media_query_test(&device, "@media screen and (height: 100px) { a { color: red; } }", 0);
     media_query_test(&device, "@media not print and (width: 100) { a { color: red; } }", 0);
 }
--- a/servo/tests/unit/style/viewport.rs
+++ b/servo/tests/unit/style/viewport.rs
@@ -1,14 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use cssparser::Parser;
-use geom::size::TypedSize2D;
+use geom::size::Size2D;
 use geom::scale_factor::ScaleFactor;
 use style::media_queries::{Device, MediaType};
 use style::parser::ParserContext;
 use style::stylesheets::{Origin, Stylesheet, CSSRuleIteratorExt};
 use style::values::specified::{Length, LengthOrPercentageOrAuto};
 use style::viewport::*;
 use url::Url;
 
@@ -46,17 +46,17 @@ macro_rules! assert_decl_len {
         assert!($declarations.len() == $len,
                 "expected {} declarations; have {}: {:?})",
                 $len, $declarations.len(), $declarations)
     }
 }
 
 #[test]
 fn empty_viewport_rule() {
-    let device = Device::new(MediaType::Screen, TypedSize2D(800., 600.));
+    let device = Device::new(MediaType::Screen, Size2D::typed(800., 600.));
 
     test_viewport_rule("@viewport {}", &device, |declarations, css| {
         println!("{}", css);
         assert_decl_len!(declarations == 0);
     });
 }
 
 macro_rules! assert_decl_eq {
@@ -69,17 +69,17 @@ macro_rules! assert_decl_eq {
         assert_eq!($d.origin, Origin::$origin);
         assert_eq!($d.descriptor, ViewportDescriptor::$expected($value));
         assert!($d.important == true, "descriptor should be !important");
     }};
 }
 
 #[test]
 fn simple_viewport_rules() {
-    let device = Device::new(MediaType::Screen, TypedSize2D(800., 600.));
+    let device = Device::new(MediaType::Screen, Size2D::typed(800., 600.));
 
     test_viewport_rule("@viewport { width: auto; height: auto;\
                                     zoom: auto; min-zoom: 0; max-zoom: 200%;\
                                     user-zoom: zoom; orientation: auto; }",
                        &device, |declarations, css| {
         println!("{}", css);
         assert_decl_len!(declarations == 9);
         assert_decl_eq!(&declarations[0], Author, MinWidth: LengthOrPercentageOrAuto::Auto);
@@ -102,17 +102,17 @@ fn simple_viewport_rules() {
         assert_decl_eq!(&declarations[1], Author, MaxWidth: LengthOrPercentageOrAuto::Auto);
         assert_decl_eq!(&declarations[2], Author, MinHeight: LengthOrPercentageOrAuto::Length(Length::from_px(200.)));
         assert_decl_eq!(&declarations[3], Author, MaxHeight: LengthOrPercentageOrAuto::Auto);
     });
 }
 
 #[test]
 fn cascading_within_viewport_rule() {
-    let device = Device::new(MediaType::Screen, TypedSize2D(800., 600.));
+    let device = Device::new(MediaType::Screen, Size2D::typed(800., 600.));
 
     // normal order of appearance
     test_viewport_rule("@viewport { min-width: 200px; min-width: auto; }",
                        &device, |declarations, css| {
         println!("{}", css);
         assert_decl_len!(declarations == 1);
         assert_decl_eq!(&declarations[0], Author, MinWidth: LengthOrPercentageOrAuto::Auto);
     });
@@ -167,17 +167,17 @@ fn cascading_within_viewport_rule() {
         assert_decl_len!(declarations == 2);
         assert_decl_eq!(&declarations[0], Author, MinWidth: LengthOrPercentageOrAuto::Auto, !important);
         assert_decl_eq!(&declarations[1], Author, MaxWidth: LengthOrPercentageOrAuto::Auto, !important);
     });
 }
 
 #[test]
 fn multiple_stylesheets_cascading() {
-    let device = Device::new(MediaType::Screen, TypedSize2D(800., 600.));
+    let device = Device::new(MediaType::Screen, Size2D::typed(800., 600.));
 
     let stylesheets = vec![
         stylesheet!("@viewport { min-width: 100px; min-height: 100px; zoom: 1; }", UserAgent),
         stylesheet!("@viewport { min-width: 200px; min-height: 200px; }", User),
         stylesheet!("@viewport { min-width: 300px; }", Author)];
 
     let declarations = stylesheets.iter()
         .flat_map(|s| s.effective_rules(&device).viewport())
@@ -212,60 +212,60 @@ fn constrain_viewport() {
     let context = ParserContext::new(Origin::Author, &url);
 
     macro_rules! from_css {
         ($css:expr) => {
             &ViewportRule::parse(&mut Parser::new($css), &context).unwrap()
         }
     }
 
-    let initial_viewport = TypedSize2D(800., 600.);
+    let initial_viewport = Size2D::typed(800., 600.);
     assert_eq!(ViewportConstraints::maybe_new(initial_viewport, from_css!("")),
                None);
 
-    let initial_viewport = TypedSize2D(800., 600.);
+    let initial_viewport = Size2D::typed(800., 600.);
     assert_eq!(ViewportConstraints::maybe_new(initial_viewport, from_css!("width: 320px auto")),
                Some(ViewportConstraints {
                    size: initial_viewport,
 
                    initial_zoom: ScaleFactor::new(1.),
                    min_zoom: None,
                    max_zoom: None,
 
                    user_zoom: UserZoom::Zoom,
                    orientation: Orientation::Auto
                }));
 
-    let initial_viewport = TypedSize2D(200., 150.);
+    let initial_viewport = Size2D::typed(200., 150.);
     assert_eq!(ViewportConstraints::maybe_new(initial_viewport, from_css!("width: 320px auto")),
                Some(ViewportConstraints {
-                   size: TypedSize2D(320., 240.),
+                   size: Size2D::typed(320., 240.),
 
                    initial_zoom: ScaleFactor::new(1.),
                    min_zoom: None,
                    max_zoom: None,
 
                    user_zoom: UserZoom::Zoom,
                    orientation: Orientation::Auto
                }));
 
-    let initial_viewport = TypedSize2D(800., 600.);
+    let initial_viewport = Size2D::typed(800., 600.);
     assert_eq!(ViewportConstraints::maybe_new(initial_viewport, from_css!("width: 320px auto")),
                Some(ViewportConstraints {
                    size: initial_viewport,
 
                    initial_zoom: ScaleFactor::new(1.),
                    min_zoom: None,
                    max_zoom: None,
 
                    user_zoom: UserZoom::Zoom,
                    orientation: Orientation::Auto
                }));
 
-    let initial_viewport = TypedSize2D(800., 600.);
+    let initial_viewport = Size2D::typed(800., 600.);
     assert_eq!(ViewportConstraints::maybe_new(initial_viewport, from_css!("width: 800px; height: 600px;\
                                                                      zoom: 1;\
                                                                      user-zoom: zoom;\
                                                                      orientation: auto;")),
                Some(ViewportConstraints {
                    size: initial_viewport,
 
                    initial_zoom: ScaleFactor::new(1.),
--- a/servo/tests/unit/util/logical_geometry.rs
+++ b/servo/tests/unit/util/logical_geometry.rs
@@ -19,29 +19,29 @@ fn modes() -> [WritingMode; 10] {
         FLAG_VERTICAL | FLAG_VERTICAL_LR | FLAG_RTL,
         FLAG_VERTICAL | FLAG_VERTICAL_LR | FLAG_SIDEWAYS_LEFT | FLAG_RTL,
         FLAG_VERTICAL | FLAG_SIDEWAYS_LEFT | FLAG_RTL,
     ]
 }
 
 #[test]
 fn test_size_round_trip() {
-    let physical = Size2D(1u32, 2u32);
+    let physical = Size2D::new(1u32, 2u32);
     for &mode in modes().iter() {
         let logical = LogicalSize::from_physical(mode, physical);
         assert!(logical.to_physical(mode) == physical);
         assert!(logical.width(mode) == 1);
         assert!(logical.height(mode) == 2);
     }
 }
 
 #[test]
 fn test_point_round_trip() {
-    let physical = Point2D(1u32, 2u32);
-    let container = Size2D(100, 200);
+    let physical = Point2D::new(1u32, 2u32);
+    let container = Size2D::new(100, 200);
     for &mode in modes().iter() {
         let logical = LogicalPoint::from_physical(mode, physical, container);
         assert!(logical.to_physical(mode, container) == physical);
         assert!(logical.x(mode, container) == 1);
         assert!(logical.y(mode, container) == 2);
     }
 }
 
@@ -55,15 +55,15 @@ fn test_margin_round_trip() {
         assert!(logical.right(mode) == 2);
         assert!(logical.bottom(mode) == 3);
         assert!(logical.left(mode) == 4);
     }
 }
 
 #[test]
 fn test_rect_round_trip() {
-    let physical = Rect(Point2D(1u32, 2u32), Size2D(3u32, 4u32));
-    let container = Size2D(100, 200);
+    let physical = Rect::new(Point2D::new(1u32, 2u32), Size2D::new(3u32, 4u32));
+    let container = Size2D::new(100, 200);
     for &mode in modes().iter() {
         let logical = LogicalRect::from_physical(mode, physical, container);
         assert!(logical.to_physical(mode, container) == physical);
     }
 }