diff options
56 files changed, 538 insertions, 558 deletions
diff --git a/components/canvas/Cargo.toml b/components/canvas/Cargo.toml index d51f75fc12b..1862d51462c 100644 --- a/components/canvas/Cargo.toml +++ b/components/canvas/Cargo.toml @@ -12,13 +12,13 @@ path = "lib.rs" [dependencies] azure = {git = "https://github.com/servo/rust-azure", features = ["plugins"]} canvas_traits = {path = "../canvas_traits"} -euclid = "0.7.1" +euclid = "0.8.2" gfx_traits = {path = "../gfx_traits"} gleam = "0.2.8" ipc-channel = "0.4.0" log = "0.3.5" num-traits = "0.1.32" -offscreen_gl_context = "0.1.2" +offscreen_gl_context = "0.2.0" plugins = {path = "../plugins"} util = {path = "../util"} diff --git a/components/canvas/canvas_paint_thread.rs b/components/canvas/canvas_paint_thread.rs index 2eeb827d73c..fde7e9f2607 100644 --- a/components/canvas/canvas_paint_thread.rs +++ b/components/canvas/canvas_paint_thread.rs @@ -520,7 +520,7 @@ impl<'a> CanvasPaintThread<'a> { } fn set_transform(&mut self, transform: &Matrix2D<f32>) { - self.state.transform = *transform; + self.state.transform = transform.clone(); self.drawtarget.set_transform(transform) } diff --git a/components/canvas_traits/Cargo.toml b/components/canvas_traits/Cargo.toml index 7016dc297a3..5f24a59ce6a 100644 --- a/components/canvas_traits/Cargo.toml +++ b/components/canvas_traits/Cargo.toml @@ -12,7 +12,7 @@ path = "lib.rs" [dependencies] azure = {git = "https://github.com/servo/rust-azure", features = ["plugins"]} cssparser = {version = "0.5.4", features = ["heap_size", "serde-serialization"]} -euclid = "0.7.1" +euclid = "0.8.2" gfx_traits = {path = "../gfx_traits"} heapsize = "0.3.0" heapsize_plugin = "0.1.2" diff --git a/components/compositing/Cargo.toml b/components/compositing/Cargo.toml index ff5440b54d5..f928ef72793 100644 --- a/components/compositing/Cargo.toml +++ b/components/compositing/Cargo.toml @@ -12,7 +12,7 @@ path = "lib.rs" [dependencies] app_units = "0.2.5" azure = {git = "https://github.com/servo/rust-azure", features = ["plugins"]} -euclid = "0.7.1" +euclid = "0.8.2" gfx_traits = {path = "../gfx_traits"} gleam = "0.2.8" image = "0.10" diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 653fb219447..8c0c3c26018 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -153,24 +153,24 @@ pub struct IOCompositor<Window: WindowMethods> { scene: Scene<CompositorData>, /// The application window size. - window_size: TypedSize2D<DevicePixel, u32>, + window_size: TypedSize2D<u32, DevicePixel>, /// The overridden viewport. - viewport: Option<(TypedPoint2D<DevicePixel, u32>, TypedSize2D<DevicePixel, u32>)>, + viewport: Option<(TypedPoint2D<u32, DevicePixel>, TypedSize2D<u32, DevicePixel>)>, /// "Mobile-style" zoom that does not reflow the page. - viewport_zoom: ScaleFactor<PagePx, ViewportPx, f32>, + viewport_zoom: ScaleFactor<f32, PagePx, ViewportPx>, /// Viewport zoom constraints provided by @viewport. - min_viewport_zoom: Option<ScaleFactor<PagePx, ViewportPx, f32>>, - max_viewport_zoom: Option<ScaleFactor<PagePx, ViewportPx, f32>>, + min_viewport_zoom: Option<ScaleFactor<f32, PagePx, ViewportPx>>, + max_viewport_zoom: Option<ScaleFactor<f32, PagePx, ViewportPx>>, /// "Desktop-style" zoom that resizes the viewport to fit the window. /// See `ViewportPx` docs in util/geom.rs for details. - page_zoom: ScaleFactor<ViewportPx, ScreenPx, f32>, + page_zoom: ScaleFactor<f32, ViewportPx, ScreenPx>, /// The device pixel ratio for this window. - scale_factor: ScaleFactor<ScreenPx, DevicePixel, f32>, + scale_factor: ScaleFactor<f32, ScreenPx, DevicePixel>, channel_to_self: Box<CompositorProxy + Send>, @@ -254,9 +254,9 @@ struct ScrollZoomEvent { /// Change the pinch zoom level by this factor magnification: f32, /// Scroll by this offset - delta: TypedPoint2D<DevicePixel, f32>, + delta: TypedPoint2D<f32, DevicePixel>, /// Apply changes to the frame at this location - cursor: TypedPoint2D<DevicePixel, i32>, + cursor: TypedPoint2D<i32, DevicePixel>, /// The scroll event phase. phase: ScrollEventPhase, /// The number of OS events that have been coalesced together into this one event. @@ -281,7 +281,7 @@ struct HitTestResult { /// The topmost layer containing the requested point layer: Rc<Layer<CompositorData>>, /// The point in client coordinates of the innermost window or frame containing `layer` - point: TypedPoint2D<LayerPixel, f32>, + point: TypedPoint2D<f32, LayerPixel>, } struct PipelineDetails { @@ -467,10 +467,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { context: None, root_pipeline: None, pipeline_details: HashMap::new(), - scene: Scene::new(Rect { - origin: Point2D::zero(), - size: window_size.as_f32(), - }), + scene: Scene::new(TypedRect::new(TypedPoint2D::zero(), window_size.as_f32())), window_size: window_size, viewport: None, scale_factor: scale_factor, @@ -792,7 +789,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { match self.find_layer_with_pipeline_and_layer_id(pipeline_id, layer_id) { Some(ref layer) => { let typed = layer.extra_data.borrow().scroll_offset; - let _ = sender.send(Point2D::new(typed.x.get(), typed.y.get())); + let _ = sender.send(Point2D::new(typed.x, typed.y)); }, None => { warn!("Can't find requested layer in handling Msg::GetScrollOffset"); @@ -913,7 +910,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { fn create_root_layer_for_pipeline_and_size(&mut self, pipeline: &CompositionPipeline, - frame_size: Option<TypedSize2D<PagePx, f32>>) + frame_size: Option<TypedSize2D<f32, PagePx>>) -> Rc<Layer<CompositorData>> { let layer_properties = LayerProperties { id: LayerId::null(), @@ -939,8 +936,8 @@ impl<Window: WindowMethods> IOCompositor<Window> { *root_layer.masks_to_bounds.borrow_mut() = true; if let Some(ref frame_size) = frame_size { - let frame_size = frame_size.to_untyped(); - root_layer.bounds.borrow_mut().size = Size2D::from_untyped(&frame_size); + root_layer.bounds.borrow_mut().size = + TypedSize2D::new(frame_size.width, frame_size.height); } root_layer @@ -998,8 +995,9 @@ impl<Window: WindowMethods> IOCompositor<Window> { if let Some(subpage_id) = properties.subpage_pipeline_id { match self.find_layer_with_pipeline_and_layer_id(subpage_id, LayerId::null()) { Some(layer) => { - *layer.bounds.borrow_mut() = Rect::from_untyped( - &Rect::new(Point2D::zero(), properties.rect.size)); + *layer.bounds.borrow_mut() = + TypedRect::new(TypedPoint2D::zero(), + TypedSize2D::from_untyped(&properties.rect.size)); } None => warn!("Tried to update non-existent subpage root layer: {:?}", subpage_id), } @@ -1178,12 +1176,12 @@ impl<Window: WindowMethods> IOCompositor<Window> { fn move_layer(&self, pipeline_id: PipelineId, layer_id: LayerId, - origin: TypedPoint2D<LayerPixel, f32>) + origin: TypedPoint2D<f32, LayerPixel>) -> 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(Point2D::typed(0f32, 0f32) - origin); + layer.clamp_scroll_offset_and_scroll_layer(TypedPoint2D::zero() - origin); } true } @@ -1195,7 +1193,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { pipeline_id: PipelineId, layer_id: LayerId) { if let Some(point) = self.fragment_point.take() { - if !self.move_layer(pipeline_id, layer_id, Point2D::from_untyped(&point)) { + if !self.move_layer(pipeline_id, layer_id, TypedPoint2D::from_untyped(&point)) { return warn!("Compositor: Tried to scroll to fragment with unknown layer."); } @@ -1251,8 +1249,8 @@ impl<Window: WindowMethods> IOCompositor<Window> { new_layer_buffer_set: Box<LayerBufferSet>, epoch: Epoch) { debug!("compositor received new frame at size {:?}x{:?}", - self.window_size.width.get(), - self.window_size.height.get()); + self.window_size.width, + self.window_size.height); // From now on, if we destroy the buffers, they will leak. let mut new_layer_buffer_set = new_layer_buffer_set; @@ -1268,7 +1266,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { pipeline_id: PipelineId, layer_id: LayerId, point: Point2D<f32>) { - if self.move_layer(pipeline_id, layer_id, Point2D::from_untyped(&point)) { + if self.move_layer(pipeline_id, layer_id, TypedPoint2D::from_untyped(&point)) { self.perform_updates_after_scroll(); self.send_viewport_rects_for_all_layers() } else { @@ -1369,7 +1367,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { } } - fn on_resize_window_event(&mut self, new_size: TypedSize2D<DevicePixel, u32>) { + fn on_resize_window_event(&mut self, new_size: TypedSize2D<u32, DevicePixel>) { debug!("compositor resizing to {:?}", new_size.to_untyped()); // A size change could also mean a resolution change. @@ -1457,7 +1455,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { } } - fn on_mouse_window_move_event_class(&mut self, cursor: TypedPoint2D<DevicePixel, f32>) { + fn on_mouse_window_move_event_class(&mut self, cursor: TypedPoint2D<f32, DevicePixel>) { if opts::get().convert_mouse_to_touch { self.on_touch_move(TouchId(0), cursor); return @@ -1505,7 +1503,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { } } - fn on_touch_down(&mut self, identifier: TouchId, point: TypedPoint2D<DevicePixel, f32>) { + fn on_touch_down(&mut self, identifier: TouchId, point: TypedPoint2D<f32, DevicePixel>) { self.touch_handler.on_touch_down(identifier, point); if let Some(result) = self.find_topmost_layer_at_point(point / self.scene.scale) { result.layer.send_event(self, TouchEvent(TouchEventType::Down, identifier, @@ -1513,7 +1511,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { } } - fn on_touch_move(&mut self, identifier: TouchId, point: TypedPoint2D<DevicePixel, f32>) { + fn on_touch_move(&mut self, identifier: TouchId, point: TypedPoint2D<f32, DevicePixel>) { match self.touch_handler.on_touch_move(identifier, point) { TouchAction::Scroll(delta) => { match point.cast() { @@ -1522,7 +1520,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { } } TouchAction::Zoom(magnification, scroll_delta) => { - let cursor = Point2D::typed(-1, -1); // Make sure this hits the base layer. + let cursor = TypedPoint2D::new(-1, -1); // Make sure this hits the base layer. self.pending_scroll_zoom_events.push(ScrollZoomEvent { magnification: magnification, delta: scroll_delta, @@ -1542,7 +1540,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { } } - fn on_touch_up(&mut self, identifier: TouchId, point: TypedPoint2D<DevicePixel, f32>) { + fn on_touch_up(&mut self, identifier: TouchId, point: TypedPoint2D<f32, DevicePixel>) { if let Some(result) = self.find_topmost_layer_at_point(point / self.scene.scale) { result.layer.send_event(self, TouchEvent(TouchEventType::Up, identifier, result.point.to_untyped())); @@ -1552,7 +1550,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { } } - fn on_touch_cancel(&mut self, identifier: TouchId, point: TypedPoint2D<DevicePixel, f32>) { + fn on_touch_cancel(&mut self, identifier: TouchId, point: TypedPoint2D<f32, DevicePixel>) { // Send the event to script. self.touch_handler.on_touch_cancel(identifier, point); if let Some(result) = self.find_topmost_layer_at_point(point / self.scene.scale) { @@ -1562,7 +1560,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { } /// http://w3c.github.io/touch-events/#mouse-events - fn simulate_mouse_click(&self, p: TypedPoint2D<DevicePixel, f32>) { + fn simulate_mouse_click(&self, p: TypedPoint2D<f32, DevicePixel>) { match self.find_topmost_layer_at_point(p / self.scene.scale) { Some(HitTestResult { layer, point }) => { let button = MouseButton::Left; @@ -1576,8 +1574,8 @@ impl<Window: WindowMethods> IOCompositor<Window> { } fn on_scroll_window_event(&mut self, - delta: TypedPoint2D<DevicePixel, f32>, - cursor: TypedPoint2D<DevicePixel, i32>) { + delta: TypedPoint2D<f32, DevicePixel>, + cursor: TypedPoint2D<i32, DevicePixel>) { self.pending_scroll_zoom_events.push(ScrollZoomEvent { magnification: 1.0, delta: delta, @@ -1589,8 +1587,8 @@ impl<Window: WindowMethods> IOCompositor<Window> { } fn on_scroll_start_window_event(&mut self, - delta: TypedPoint2D<DevicePixel, f32>, - cursor: TypedPoint2D<DevicePixel, i32>) { + delta: TypedPoint2D<f32, DevicePixel>, + cursor: TypedPoint2D<i32, DevicePixel>) { self.scroll_in_progress = true; self.pending_scroll_zoom_events.push(ScrollZoomEvent { magnification: 1.0, @@ -1603,8 +1601,8 @@ impl<Window: WindowMethods> IOCompositor<Window> { } fn on_scroll_end_window_event(&mut self, - delta: TypedPoint2D<DevicePixel, f32>, - cursor: TypedPoint2D<DevicePixel, i32>) { + delta: TypedPoint2D<f32, DevicePixel>, + cursor: TypedPoint2D<i32, DevicePixel>) { self.scroll_in_progress = false; self.pending_scroll_zoom_events.push(ScrollZoomEvent { magnification: 1.0, @@ -1710,17 +1708,19 @@ impl<Window: WindowMethods> IOCompositor<Window> { /// 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>, + window_size: &TypedSize2D<f32, LayerPixel>, new_display_ports: &mut HashMap<PipelineId, Vec<(LayerId, Rect<Au>)>>) { let visible_rect = - 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))); + TypedRect::new(TypedPoint2D::zero(), *window_size) + .translate(&-*layer.content_offset.borrow()) + .intersection(&*layer.bounds.borrow()) + .unwrap_or(TypedRect::zero()) + .to_untyped(); + let visible_rect = TypedRect::new( + TypedPoint2D::new(Au::from_f32_px(visible_rect.origin.x), + Au::from_f32_px(visible_rect.origin.y)), + TypedSize2D::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) { @@ -1815,7 +1815,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { } } - fn device_pixels_per_screen_px(&self) -> ScaleFactor<ScreenPx, DevicePixel, f32> { + fn device_pixels_per_screen_px(&self) -> ScaleFactor<f32, ScreenPx, DevicePixel> { match opts::get().device_pixels_per_px { Some(device_pixels_per_px) => ScaleFactor::new(device_pixels_per_px), None => match opts::get().output_file { @@ -1825,7 +1825,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { } } - fn device_pixels_per_page_px(&self) -> ScaleFactor<PagePx, DevicePixel, f32> { + fn device_pixels_per_page_px(&self) -> ScaleFactor<f32, PagePx, DevicePixel> { self.viewport_zoom * self.page_zoom * self.device_pixels_per_screen_px() } @@ -1855,8 +1855,8 @@ impl<Window: WindowMethods> IOCompositor<Window> { fn on_pinch_zoom_window_event(&mut self, magnification: f32) { self.pending_scroll_zoom_events.push(ScrollZoomEvent { magnification: magnification, - delta: Point2D::typed(0.0, 0.0), // TODO: Scroll to keep the center in view? - cursor: Point2D::typed(-1, -1), // Make sure this hits the base layer. + delta: TypedPoint2D::zero(), // TODO: Scroll to keep the center in view? + cursor: TypedPoint2D::new(-1, -1), // Make sure this hits the base layer. phase: ScrollEventPhase::Move(true), event_count: 1, }); @@ -1874,7 +1874,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { } } - fn on_touchpad_pressure_event(&self, cursor: TypedPoint2D<DevicePixel, f32>, pressure: f32, + fn on_touchpad_pressure_event(&self, cursor: TypedPoint2D<f32, DevicePixel>, pressure: f32, phase: TouchpadPressurePhase) { if let Some(true) = PREFS.get("dom.forcetouch.enabled").as_boolean() { match self.find_topmost_layer_at_point(cursor / self.scene.scale) { @@ -2194,7 +2194,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { return Err(UnableToComposite::NoContext) } let (width, height) = - (self.window_size.width.get() as usize, self.window_size.height.get() as usize); + (self.window_size.width as usize, self.window_size.height as usize); if !self.window.prepare_for_composite(width, height) { return Err(UnableToComposite::WindowUnprepared) } @@ -2236,15 +2236,8 @@ impl<Window: WindowMethods> IOCompositor<Window> { self.dump_layer_tree(); // Adjust the layer dimensions as necessary to correspond to the size of the window. self.scene.viewport = match self.viewport { - Some((point, size)) => Rect { - origin: point.as_f32(), - size: size.as_f32(), - }, - - None => Rect { - origin: Point2D::zero(), - size: self.window_size.as_f32(), - } + Some((point, size)) => TypedRect::new(point.as_f32(), size.as_f32()), + None => TypedRect::new(TypedPoint2D::zero(), self.window_size.as_f32()), }; // Paint the scene. @@ -2255,15 +2248,13 @@ impl<Window: WindowMethods> IOCompositor<Window> { match self.context { Some(context) => { if let Some((point, size)) = self.viewport { - let point = point.to_untyped(); - let size = size.to_untyped(); + let point = point.to_untyped(); let size = size.to_untyped(); - gl::scissor(point.x as GLint, point.y as GLint, - size.width as GLsizei, size.height as GLsizei); + gl::scissor(point.x as GLint, point.y as GLint, size.width as GLsizei, + size.height as GLsizei); - gl::enable(gl::SCISSOR_TEST); - rendergl::render_scene(layer.clone(), context, &self.scene); - gl::disable(gl::SCISSOR_TEST); + gl::enable(gl::SCISSOR_TEST); rendergl::render_scene(layer.clone(), + context, &self.scene); gl::disable(gl::SCISSOR_TEST); } else { rendergl::render_scene(layer.clone(), context, &self.scene); @@ -2389,8 +2380,8 @@ impl<Window: WindowMethods> IOCompositor<Window> { fn find_topmost_layer_at_point_for_layer(&self, layer: Rc<Layer<CompositorData>>, - point_in_parent_layer: TypedPoint2D<LayerPixel, f32>, - clip_rect_in_parent_layer: &TypedRect<LayerPixel, f32>) + point_in_parent_layer: TypedPoint2D<f32, LayerPixel>, + clip_rect_in_parent_layer: &TypedRect<f32, LayerPixel>) -> Option<HitTestResult> { let layer_bounds = *layer.bounds.borrow(); let masks_to_bounds = *layer.masks_to_bounds.borrow(); @@ -2439,7 +2430,7 @@ impl<Window: WindowMethods> IOCompositor<Window> { } fn find_topmost_layer_at_point(&self, - point: TypedPoint2D<LayerPixel, f32>) + point: TypedPoint2D<f32, LayerPixel>) -> Option<HitTestResult> { match self.scene.root { Some(ref layer) => { diff --git a/components/compositing/compositor_layer.rs b/components/compositing/compositor_layer.rs index 9f5e0480e1b..745da90f2d3 100644 --- a/components/compositing/compositor_layer.rs +++ b/components/compositing/compositor_layer.rs @@ -4,9 +4,8 @@ use azure::azure_hl; use compositor::IOCompositor; -use euclid::length::Length; -use euclid::point::{Point2D, TypedPoint2D}; -use euclid::rect::Rect; +use euclid::point::TypedPoint2D; +use euclid::rect::TypedRect; use euclid::size::TypedSize2D; use gfx_traits::{Epoch, LayerId, LayerProperties, ScrollPolicy}; use layers::color::Color; @@ -44,7 +43,7 @@ pub struct CompositorData { /// The scroll offset originating from this scrolling root. This allows scrolling roots /// to track their current scroll position even while their content_offset does not change. - pub scroll_offset: TypedPoint2D<LayerPixel, f32>, + pub scroll_offset: TypedPoint2D<f32, LayerPixel>, /// The pipeline ID of this layer, if it represents a subpage. pub subpage_info: Option<PipelineId>, @@ -63,11 +62,11 @@ impl CompositorData { scroll_policy: layer_properties.scroll_policy, requested_epoch: Epoch(0), painted_epoch: Epoch(0), - scroll_offset: Point2D::typed(0., 0.), + scroll_offset: TypedPoint2D::zero(), subpage_info: layer_properties.subpage_pipeline_id, }; - Rc::new(Layer::new(Rect::from_untyped(&layer_properties.rect), + Rc::new(Layer::new(TypedRect::from_untyped(&layer_properties.rect), tile_size, to_layers_color(&layer_properties.background_color), 1.0, @@ -117,8 +116,8 @@ pub trait CompositorLayer { /// ScrollPositionUnchanged or ScrollPositionChanged. If no layer was targeted by the event /// returns ScrollEventUnhandled. fn handle_scroll_event(&self, - delta: TypedPoint2D<LayerPixel, f32>, - cursor: TypedPoint2D<LayerPixel, f32>) + delta: TypedPoint2D<f32, LayerPixel>, + cursor: TypedPoint2D<f32, LayerPixel>) -> ScrollEventResult; // Takes in a MouseWindowEvent, determines if it should be passed to children, and @@ -127,12 +126,12 @@ pub trait CompositorLayer { fn send_mouse_event<Window>(&self, compositor: &IOCompositor<Window>, event: MouseWindowEvent, - cursor: TypedPoint2D<LayerPixel, f32>) + cursor: TypedPoint2D<f32, LayerPixel>) where Window: WindowMethods; fn send_mouse_move_event<Window>(&self, compositor: &IOCompositor<Window>, - cursor: TypedPoint2D<LayerPixel, f32>) + cursor: TypedPoint2D<f32, LayerPixel>) where Window: WindowMethods; fn send_event<Window>(&self, @@ -142,17 +141,17 @@ pub trait CompositorLayer { fn send_touchpad_pressure_event<Window>(&self, compositor: &IOCompositor<Window>, - cursor: TypedPoint2D<LayerPixel, f32>, + cursor: TypedPoint2D<f32, LayerPixel>, pressure: f32, phase: TouchpadPressurePhase) where Window: WindowMethods; fn clamp_scroll_offset_and_scroll_layer(&self, - new_offset: TypedPoint2D<LayerPixel, f32>) + new_offset: TypedPoint2D<f32, LayerPixel>) -> ScrollEventResult; fn scroll_layer_and_all_child_layers(&self, - new_offset: TypedPoint2D<LayerPixel, f32>) + new_offset: TypedPoint2D<f32, LayerPixel>) -> bool; /// Return a flag describing how this layer deals with scroll events. @@ -202,8 +201,8 @@ impl Clampable for f32 { } fn calculate_content_size_for_layer(layer: &Layer<CompositorData>) - -> TypedSize2D<LayerPixel, f32> { - layer.children().iter().fold(Rect::zero(), + -> TypedSize2D<f32, LayerPixel> { + layer.children().iter().fold(TypedRect::zero(), |unioned_rect, child_rect| { unioned_rect.union(&*child_rect.bounds.borrow()) }).size @@ -229,11 +228,11 @@ impl CompositorLayer for Layer<CompositorData> { } fn update_layer(&self, layer_properties: LayerProperties) { - *self.bounds.borrow_mut() = Rect::from_untyped(&layer_properties.rect); + *self.bounds.borrow_mut() = TypedRect::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(Point2D::typed(0f32, 0f32), Point2D::typed(-1f32, -1f32)); + self.handle_scroll_event(TypedPoint2D::zero(), TypedPoint2D::new(-1f32, -1f32)); self.update_layer_except_bounds(layer_properties); } @@ -320,8 +319,8 @@ impl CompositorLayer for Layer<CompositorData> { } fn handle_scroll_event(&self, - delta: TypedPoint2D<LayerPixel, f32>, - cursor: TypedPoint2D<LayerPixel, f32>) + delta: TypedPoint2D<f32, LayerPixel>, + cursor: TypedPoint2D<f32, LayerPixel>) -> ScrollEventResult { // Allow children to scroll. let scroll_offset = self.extra_data.borrow().scroll_offset; @@ -344,15 +343,15 @@ impl CompositorLayer for Layer<CompositorData> { self.clamp_scroll_offset_and_scroll_layer(scroll_offset + delta) } - fn clamp_scroll_offset_and_scroll_layer(&self, new_offset: TypedPoint2D<LayerPixel, f32>) + fn clamp_scroll_offset_and_scroll_layer(&self, new_offset: TypedPoint2D<f32, LayerPixel>) -> 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::new(Length::new(new_offset.x.get().clamp(&min_x, &0.0)), - Length::new(new_offset.y.get().clamp(&min_y, &0.0))); + let min_x = (layer_size.width - content_size.width).min(0.0); + let min_y = (layer_size.height - content_size.height).min(0.0); + let new_offset: TypedPoint2D<f32, LayerPixel> = + TypedPoint2D::new(new_offset.x.clamp(&min_x, &0.0), + new_offset.y.clamp(&min_y, &0.0)); if self.extra_data.borrow().scroll_offset == new_offset { return ScrollEventResult::ScrollPositionUnchanged; @@ -377,7 +376,7 @@ impl CompositorLayer for Layer<CompositorData> { fn send_mouse_event<Window>(&self, compositor: &IOCompositor<Window>, event: MouseWindowEvent, - cursor: TypedPoint2D<LayerPixel, f32>) + cursor: TypedPoint2D<f32, LayerPixel>) where Window: WindowMethods { let event_point = cursor.to_untyped(); let message = match event { @@ -393,7 +392,7 @@ impl CompositorLayer for Layer<CompositorData> { fn send_mouse_move_event<Window>(&self, compositor: &IOCompositor<Window>, - cursor: TypedPoint2D<LayerPixel, f32>) + cursor: TypedPoint2D<f32, LayerPixel>) where Window: WindowMethods { self.send_event(compositor, MouseMoveEvent(Some(cursor.to_untyped()))); } @@ -409,7 +408,7 @@ impl CompositorLayer for Layer<CompositorData> { fn send_touchpad_pressure_event<Window>(&self, compositor: &IOCompositor<Window>, - cursor: TypedPoint2D<LayerPixel, f32>, + cursor: TypedPoint2D<f32, LayerPixel>, pressure: f32, phase: TouchpadPressurePhase) where Window: WindowMethods { @@ -419,14 +418,14 @@ impl CompositorLayer for Layer<CompositorData> { } } - fn scroll_layer_and_all_child_layers(&self, new_offset: TypedPoint2D<LayerPixel, f32>) + fn scroll_layer_and_all_child_layers(&self, new_offset: TypedPoint2D<f32, LayerPixel>) -> 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.content_offset.borrow_mut() = Point2D::from_untyped(&new_offset); + *self.content_offset.borrow_mut() = TypedPoint2D::from_untyped(&new_offset); result = true } diff --git a/components/compositing/lib.rs b/components/compositing/lib.rs index 1f510d39e8d..3888b03e6d3 100644 --- a/components/compositing/lib.rs +++ b/components/compositing/lib.rs @@ -55,7 +55,7 @@ pub mod windowing; pub struct SendableFrameTree { pub pipeline: CompositionPipeline, - pub size: Option<TypedSize2D<PagePx, f32>>, + pub size: Option<TypedSize2D<f32, PagePx>>, pub children: Vec<SendableFrameTree>, } diff --git a/components/compositing/touch.rs b/components/compositing/touch.rs index 4f20afedd63..3bc22440994 100644 --- a/components/compositing/touch.rs +++ b/components/compositing/touch.rs @@ -19,11 +19,11 @@ pub struct TouchHandler { #[derive(Clone, Copy, Debug)] pub struct TouchPoint { pub id: TouchId, - pub point: TypedPoint2D<DevicePixel, f32> + pub point: TypedPoint2D<f32, DevicePixel> } impl TouchPoint { - pub fn new(id: TouchId, point: TypedPoint2D<DevicePixel, f32>) -> Self { + pub fn new(id: TouchId, point: TypedPoint2D<f32, DevicePixel>) -> Self { TouchPoint { id: id, point: point } } } @@ -57,9 +57,9 @@ pub enum TouchAction { /// Simulate a mouse click. Click, /// Scroll by the provided offset. - Scroll(TypedPoint2D<DevicePixel, f32>), + Scroll(TypedPoint2D<f32, DevicePixel>), /// Zoom by a magnification factor and scroll by the provided offset. - Zoom(f32, TypedPoint2D<DevicePixel, f32>), + Zoom(f32, TypedPoint2D<f32, DevicePixel>), /// Send a JavaScript event to content. DispatchEvent, /// Don't do anything. @@ -74,7 +74,7 @@ impl TouchHandler { } } - pub fn on_touch_down(&mut self, id: TouchId, point: TypedPoint2D<DevicePixel, f32>) { + pub fn on_touch_down(&mut self, id: TouchId, point: TypedPoint2D<f32, DevicePixel>) { let point = TouchPoint::new(id, point); self.active_touch_points.push(point); @@ -87,7 +87,7 @@ impl TouchHandler { }; } - pub fn on_touch_move(&mut self, id: TouchId, point: TypedPoint2D<DevicePixel, f32>) + pub fn on_touch_move(&mut self, id: TouchId, point: TypedPoint2D<f32, DevicePixel>) -> TouchAction { let idx = match self.active_touch_points.iter_mut().position(|t| t.id == id) { Some(i) => i, @@ -101,10 +101,10 @@ impl TouchHandler { let action = match self.state { Touching => { let delta = point - old_point; - // TODO let delta: TypedPoint2D<ScreenPx, _> = delta / self.device_pixels_per_screen_px(); + // TODO let delta: TypedPoint2D<_, ScreenPx> = delta / self.device_pixels_per_screen_px(); - if delta.x.get().abs() > TOUCH_PAN_MIN_SCREEN_PX || - delta.y.get().abs() > TOUCH_PAN_MIN_SCREEN_PX + if delta.x.abs() > TOUCH_PAN_MIN_SCREEN_PX || + delta.y.abs() > TOUCH_PAN_MIN_SCREEN_PX { self.state = Panning; TouchAction::Scroll(delta) @@ -142,7 +142,7 @@ impl TouchHandler { action } - pub fn on_touch_up(&mut self, id: TouchId, _point: TypedPoint2D<DevicePixel, f32>) + pub fn on_touch_up(&mut self, id: TouchId, _point: TypedPoint2D<f32, DevicePixel>) -> TouchAction { match self.active_touch_points.iter().position(|t| t.id == id) { Some(i) => { @@ -176,7 +176,7 @@ impl TouchHandler { } } - pub fn on_touch_cancel(&mut self, id: TouchId, _point: TypedPoint2D<DevicePixel, f32>) { + pub fn on_touch_cancel(&mut self, id: TouchId, _point: TypedPoint2D<f32, DevicePixel>) { match self.active_touch_points.iter().position(|t| t.id == id) { Some(i) => { self.active_touch_points.swap_remove(i); @@ -219,16 +219,14 @@ impl TouchHandler { self.active_touch_points.len() } - fn pinch_distance_and_center(&self) -> (f32, TypedPoint2D<DevicePixel, f32>) { + fn pinch_distance_and_center(&self) -> (f32, TypedPoint2D<f32, DevicePixel>) { debug_assert!(self.touch_count() == 2); let p0 = self.active_touch_points[0].point; let p1 = self.active_touch_points[1].point; let center = (p0 + p1) / ScaleFactor::new(2.0); let d = p0 - p1; - let dx = d.x.get(); - let dy = d.y.get(); - let distance = f32::sqrt(dx * dx + dy * dy); + let distance = f32::sqrt(d.x * d.x + d.y * d.y); (distance, center) } diff --git a/components/compositing/windowing.rs b/components/compositing/windowing.rs index 2da658a9661..dc0465962ce 100644 --- a/components/compositing/windowing.rs +++ b/components/compositing/windowing.rs @@ -21,9 +21,9 @@ use util::geometry::ScreenPx; #[derive(Clone)] pub enum MouseWindowEvent { - Click(MouseButton, TypedPoint2D<DevicePixel, f32>), - MouseDown(MouseButton, TypedPoint2D<DevicePixel, f32>), - MouseUp(MouseButton, TypedPoint2D<DevicePixel, f32>), + Click(MouseButton, TypedPoint2D<f32, DevicePixel>), + MouseDown(MouseButton, TypedPoint2D<f32, DevicePixel>), + MouseUp(MouseButton, TypedPoint2D<f32, DevicePixel>), } #[derive(Clone)] @@ -49,22 +49,22 @@ pub enum WindowEvent { /// context when this message is sent. InitializeCompositing, /// Sent when the window is resized. - Resize(TypedSize2D<DevicePixel, u32>), + Resize(TypedSize2D<u32, DevicePixel>), /// Touchpad Pressure - TouchpadPressure(TypedPoint2D<DevicePixel, f32>, f32, TouchpadPressurePhase), + TouchpadPressure(TypedPoint2D<f32, DevicePixel>, f32, TouchpadPressurePhase), /// Sent when you want to override the viewport. - Viewport(TypedPoint2D<DevicePixel, u32>, TypedSize2D<DevicePixel, u32>), + Viewport(TypedPoint2D<u32, DevicePixel>, TypedSize2D<u32, DevicePixel>), /// Sent when a new URL is to be loaded. LoadUrl(String), /// Sent when a mouse hit test is to be performed. MouseWindowEventClass(MouseWindowEvent), /// Sent when a mouse move. - MouseWindowMoveEventClass(TypedPoint2D<DevicePixel, f32>), + MouseWindowMoveEventClass(TypedPoint2D<f32, DevicePixel>), /// Touch event: type, identifier, point - Touch(TouchEventType, TouchId, TypedPoint2D<DevicePixel, f32>), + Touch(TouchEventType, TouchId, TypedPoint2D<f32, DevicePixel>), /// Sent when the user scrolls. The first point is the delta and the second point is the /// origin. - Scroll(TypedPoint2D<DevicePixel, f32>, TypedPoint2D<DevicePixel, i32>, TouchEventType), + Scroll(TypedPoint2D<f32, DevicePixel>, TypedPoint2D<i32, DevicePixel>, TouchEventType), /// Sent when the user zooms. Zoom(f32), /// Simulated "pinch zoom" gesture for non-touch platforms (e.g. ctrl-scrollwheel). @@ -108,9 +108,9 @@ impl Debug for WindowEvent { pub trait WindowMethods { /// Returns the size of the window in hardware pixels. - fn framebuffer_size(&self) -> TypedSize2D<DevicePixel, u32>; + fn framebuffer_size(&self) -> TypedSize2D<u32, DevicePixel>; /// Returns the size of the window in density-independent "px" units. - fn size(&self) -> TypedSize2D<ScreenPx, f32>; + fn size(&self) -> TypedSize2D<f32, ScreenPx>; /// Presents the window to the screen (perhaps by page flipping). fn present(&self); @@ -137,7 +137,7 @@ pub trait WindowMethods { fn head_parsed(&self); /// Returns the scale factor of the system (device pixels / screen pixels). - fn scale_factor(&self) -> ScaleFactor<ScreenPx, DevicePixel, f32>; + fn scale_factor(&self) -> ScaleFactor<f32, ScreenPx, DevicePixel>; /// Gets the OS native graphics display for this window. fn native_display(&self) -> NativeDisplay; diff --git a/components/constellation/Cargo.toml b/components/constellation/Cargo.toml index d3688a51e91..4a60533d200 100644 --- a/components/constellation/Cargo.toml +++ b/components/constellation/Cargo.toml @@ -15,7 +15,7 @@ canvas = {path = "../canvas"} canvas_traits = {path = "../canvas_traits"} compositing = {path = "../compositing"} devtools_traits = {path = "../devtools_traits"} -euclid = "0.7.1" +euclid = "0.8.2" gfx = {path = "../gfx"} gfx_traits = {path = "../gfx_traits"} ipc-channel = "0.4.0" @@ -24,7 +24,7 @@ layout_traits = {path = "../layout_traits"} log = "0.3.5" msg = {path = "../msg"} net_traits = {path = "../net_traits"} -offscreen_gl_context = "0.1.2" +offscreen_gl_context = "0.2.0" plugins = {path = "../plugins"} profile_traits = {path = "../profile_traits"} rand = "0.3" diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index fcf174cc8f6..6f421e1a87c 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -535,7 +535,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> fn new_pipeline(&mut self, pipeline_id: PipelineId, parent_info: Option<(PipelineId, SubpageId, FrameType)>, - initial_window_size: Option<TypedSize2D<PagePx, f32>>, + initial_window_size: Option<TypedSize2D<f32, PagePx>>, script_channel: Option<IpcSender<ConstellationControlMsg>>, load_data: LoadData, is_private: bool) { @@ -734,7 +734,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> // frame trees in the navigation context containing the subframe. FromCompositorMsg::FrameSize(pipeline_id, size) => { debug!("constellation got frame size message"); - self.handle_frame_size_msg(pipeline_id, &Size2D::from_untyped(&size)); + self.handle_frame_size_msg(pipeline_id, &TypedSize2D::from_untyped(&size)); } FromCompositorMsg::GetFrame(pipeline_id, resp_chan) => { debug!("constellation got get root pipeline message"); @@ -1160,7 +1160,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> fn handle_frame_size_msg(&mut self, pipeline_id: PipelineId, - size: &TypedSize2D<PagePx, f32>) { + size: &TypedSize2D<f32, PagePx>) { let msg = ConstellationControlMsg::Resize(pipeline_id, WindowSizeData { visible_viewport: *size, initial_viewport: *size * ScaleFactor::new(1.0), @@ -2139,7 +2139,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF> // If the rectangle for this pipeline is zero sized, it will // never be painted. In this case, don't query the layout // thread as it won't contribute to the final output image. - if size == Size2D::zero() { + if size == TypedSize2D::zero() { continue; } diff --git a/components/constellation/pipeline.rs b/components/constellation/pipeline.rs index a75d083db64..677068b2d58 100644 --- a/components/constellation/pipeline.rs +++ b/components/constellation/pipeline.rs @@ -62,7 +62,7 @@ pub struct Pipeline { pub url: Url, /// The title of the most recently-loaded page. pub title: Option<String>, - pub size: Option<TypedSize2D<PagePx, f32>>, + pub size: Option<TypedSize2D<f32, PagePx>>, /// Whether this pipeline is currently running animations. Pipelines that are running /// animations cause composites to be continually scheduled. pub running_animations: bool, @@ -112,9 +112,9 @@ pub struct InitialPipelineState { /// A channel to the memory profiler thread. pub mem_profiler_chan: profile_mem::ProfilerChan, /// Information about the initial window size. - pub window_size: Option<TypedSize2D<PagePx, f32>>, + pub window_size: Option<TypedSize2D<f32, PagePx>>, /// Information about the device pixel ratio. - pub device_pixel_ratio: ScaleFactor<ViewportPx, DevicePixel, f32>, + pub device_pixel_ratio: ScaleFactor<f32, ViewportPx, DevicePixel>, /// A channel to the script thread, if applicable. If this is `Some`, /// then `parent_info` must also be `Some`. pub script_chan: Option<IpcSender<ConstellationControlMsg>>, @@ -280,7 +280,7 @@ impl Pipeline { chrome_to_paint_chan: Sender<ChromeToPaintMsg>, is_private: bool, url: Url, - size: Option<TypedSize2D<PagePx, f32>>, + size: Option<TypedSize2D<f32, PagePx>>, visible: bool) -> Pipeline { Pipeline { diff --git a/components/gfx/Cargo.toml b/components/gfx/Cargo.toml index 62e5927e404..cbfabf787ae 100644 --- a/components/gfx/Cargo.toml +++ b/components/gfx/Cargo.toml @@ -14,7 +14,7 @@ path = "lib.rs" app_units = "0.2.5" azure = {git = "https://github.com/servo/rust-azure", features = ["plugins"]} bitflags = "0.7" -euclid = "0.7.1" +euclid = "0.8.2" fnv = "1.0" gfx_traits = {path = "../gfx_traits"} harfbuzz-sys = "0.1" @@ -59,7 +59,7 @@ core-text = "1.1" [target.'cfg(any(target_os = "linux", target_os = "android", target_os = "windows"))'.dependencies] freetype = {git = "https://github.com/servo/rust-freetype"} -servo-fontconfig = "0.2" +servo-fontconfig = "0.2.1" [target.'cfg(any(target_arch = "x86_64", target_arch = "aarch64"))'.dependencies] simd = {git = "https://github.com/huonw/simd"} diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs index 2942c75ac67..a9a8a194312 100644 --- a/components/gfx/display_list/mod.rs +++ b/components/gfx/display_list/mod.rs @@ -45,7 +45,7 @@ use style::computed_values::{border_style, filter, image_rendering, mix_blend_mo use style_traits::cursor::Cursor; use text::TextRun; use text::glyph::ByteIndex; -use util::geometry::{self, MAX_RECT, ScreenPx}; +use util::geometry::{self, max_rect, ScreenPx}; use webrender_traits::{self, WebGLContextId}; pub use style::dom::OpaqueNode; @@ -530,7 +530,7 @@ impl DisplayList { } } -fn transformed_tile_rect(tile_rect: TypedRect<ScreenPx, usize>, transform: &Matrix4D<f32>) -> Rect<Au> { +fn transformed_tile_rect(tile_rect: TypedRect<usize, ScreenPx>, transform: &Matrix4D<f32>) -> Rect<Au> { // Invert the current transform, then use this to back transform // the tile rect (placed at the origin) into the space of this // stacking context. @@ -884,7 +884,7 @@ impl ClippingRegion { #[inline] pub fn max() -> ClippingRegion { ClippingRegion { - main: MAX_RECT, + main: max_rect(), complex: Vec::new(), } } @@ -1176,7 +1176,7 @@ impl BorderRadii<Au> { // Scale the border corner radius by the specified factor pub fn scale_corner_by(corner: Size2D<Au>, s: f32) -> Size2D<Au> { - Size2D { width: corner.width.scale_by(s), height: corner.height.scale_by(s) } + Size2D::new(corner.width.scale_by(s), corner.height.scale_by(s)) } } @@ -1193,10 +1193,10 @@ impl<T> BorderRadii<T> where T: PartialEq + Zero + Clone { /// Returns a set of border radii that all have the given value. pub fn all_same(value: T) -> BorderRadii<T> { BorderRadii { - top_left: Size2D { width: value.clone(), height: value.clone() }, - top_right: Size2D { width: value.clone(), height: value.clone() }, - bottom_right: Size2D { width: value.clone(), height: value.clone() }, - bottom_left: Size2D { width: value.clone(), height: value.clone() }, + top_left: Size2D::new(value.clone(), value.clone()), + top_right: Size2D::new(value.clone(), value.clone()), + bottom_right: Size2D::new(value.clone(), value.clone()), + bottom_left: Size2D::new(value.clone(), value.clone()), } } } diff --git a/components/gfx/paint_context.rs b/components/gfx/paint_context.rs index acfa5186fe1..e2cbf6ad5f4 100644 --- a/components/gfx/paint_context.rs +++ b/components/gfx/paint_context.rs @@ -35,16 +35,16 @@ use style::computed_values::{border_style, filter, image_rendering, mix_blend_mo use style_traits::PagePx; use text::TextRun; use text::glyph::ByteIndex; -use util::geometry::{self, MAX_RECT, ScreenPx}; +use util::geometry::{self, max_rect, ScreenPx}; use util::opts; pub struct PaintContext<'a> { pub draw_target: DrawTarget, pub font_context: &'a mut Box<FontContext>, /// The rectangle that this context encompasses in page coordinates. - pub page_rect: TypedRect<PagePx, f32>, + pub page_rect: TypedRect<f32, PagePx>, /// The rectangle that this context encompasses in screen coordinates (pixels). - pub screen_rect: TypedRect<ScreenPx, usize>, + pub screen_rect: TypedRect<usize, ScreenPx>, /// The clipping rect for the stacking context as a whole. pub clip_rect: Option<Rect<Au>>, /// The current transient clipping region, if any. A "transient clipping region" is the @@ -126,8 +126,8 @@ impl<'a> PaintContext<'a> { rect.translate(&self.subpixel_offset).to_nearest_azure_rect(self.screen_pixels_per_px()) } - pub fn screen_pixels_per_px(&self) -> ScaleFactor<PagePx, ScreenPx, f32> { - self.screen_rect.as_f32().size.width / self.page_rect.size.width + pub fn screen_pixels_per_px(&self) -> ScaleFactor<f32, PagePx, ScreenPx> { + ScaleFactor::new(self.screen_rect.as_f32().size.width / self.page_rect.size.width) } pub fn draw_target(&self) -> &DrawTarget { @@ -1539,7 +1539,7 @@ impl<'a> PaintContext<'a> { match clip_mode { BoxShadowClipMode::Inset => { path = temporary_draw_target.draw_target - .create_rectangular_border_path(&MAX_RECT, + .create_rectangular_border_path(&max_rect(), &shadow_bounds, pixels_per_px); self.draw_target.push_clip( @@ -1549,7 +1549,7 @@ impl<'a> PaintContext<'a> { path = temporary_draw_target.draw_target.create_rectangular_path(&shadow_bounds, pixels_per_px); self.draw_target.push_clip( - &self.draw_target.create_rectangular_border_path(&MAX_RECT, box_bounds, + &self.draw_target.create_rectangular_border_path(&max_rect(), box_bounds, pixels_per_px)) } BoxShadowClipMode::None => { @@ -1644,12 +1644,12 @@ impl<'a> PaintContext<'a> { } pub trait ToAzurePoint { - fn to_nearest_azure_point(&self, pixels_per_px: ScaleFactor<PagePx, ScreenPx, f32>) -> Point2D<AzFloat>; + fn to_nearest_azure_point(&self, pixels_per_px: ScaleFactor<f32, PagePx, ScreenPx>) -> Point2D<AzFloat>; fn to_azure_point(&self) -> Point2D<AzFloat>; } impl ToAzurePoint for Point2D<Au> { - fn to_nearest_azure_point(&self, pixels_per_px: ScaleFactor<PagePx, ScreenPx, f32>) -> Point2D<AzFloat> { + fn to_nearest_azure_point(&self, pixels_per_px: ScaleFactor<f32, PagePx, ScreenPx>) -> Point2D<AzFloat> { Point2D::new(self.x.to_nearest_pixel(pixels_per_px.get()) as AzFloat, self.y.to_nearest_pixel(pixels_per_px.get()) as AzFloat) } @@ -1659,15 +1659,15 @@ impl ToAzurePoint for Point2D<Au> { } pub trait ToAzureRect { - fn to_nearest_azure_rect(&self, pixels_per_px: ScaleFactor<PagePx, ScreenPx, f32>) -> Rect<AzFloat>; - fn to_nearest_non_empty_azure_rect(&self, pixels_per_px: ScaleFactor<PagePx, ScreenPx, f32>) -> Rect<AzFloat>; + fn to_nearest_azure_rect(&self, pixels_per_px: ScaleFactor<f32, PagePx, ScreenPx>) -> Rect<AzFloat>; + fn to_nearest_non_empty_azure_rect(&self, pixels_per_px: ScaleFactor<f32, PagePx, ScreenPx>) -> Rect<AzFloat>; fn to_azure_rect(&self) -> Rect<AzFloat>; } impl ToAzureRect for Rect<Au> { /// Round rects to pixel coordinates, maintaining the invariant of non-overlap, /// assuming that before rounding rects don't overlap. - fn to_nearest_azure_rect(&self, pixels_per_px: ScaleFactor<PagePx, ScreenPx, f32>) -> Rect<AzFloat> { + fn to_nearest_azure_rect(&self, pixels_per_px: ScaleFactor<f32, PagePx, ScreenPx>) -> Rect<AzFloat> { // Rounding the top left corner to the nearest pixel with the size rounded // to the nearest pixel multiple would violate the non-overlap condition, // e.g. @@ -1687,7 +1687,7 @@ impl ToAzureRect for Rect<Au> { /// 10px×0.6px at 0px,28.56px -> 10px×0px at 0px,29px /// Instead round the top left to the nearest pixel and the size to the nearest pixel /// multiple. It's possible for non-overlapping rects after this rounding to overlap. - fn to_nearest_non_empty_azure_rect(&self, pixels_per_px: ScaleFactor<PagePx, ScreenPx, f32>) -> Rect<AzFloat> { + fn to_nearest_non_empty_azure_rect(&self, pixels_per_px: ScaleFactor<f32, PagePx, ScreenPx>) -> Rect<AzFloat> { Rect::new(self.origin.to_nearest_azure_point(pixels_per_px), self.size.to_nearest_azure_size(pixels_per_px)) } @@ -1698,11 +1698,11 @@ impl ToAzureRect for Rect<Au> { } pub trait ToNearestAzureSize { - fn to_nearest_azure_size(&self, pixels_per_px: ScaleFactor<PagePx, ScreenPx, f32>) -> Size2D<AzFloat>; + fn to_nearest_azure_size(&self, pixels_per_px: ScaleFactor<f32, PagePx, ScreenPx>) -> Size2D<AzFloat>; } impl ToNearestAzureSize for Size2D<Au> { - fn to_nearest_azure_size(&self, pixels_per_px: ScaleFactor<PagePx, ScreenPx, f32>) -> Size2D<AzFloat> { + fn to_nearest_azure_size(&self, pixels_per_px: ScaleFactor<f32, PagePx, ScreenPx>) -> Size2D<AzFloat> { Size2D::new(self.width.to_nearest_pixel(pixels_per_px.get()) as AzFloat, self.height.to_nearest_pixel(pixels_per_px.get()) as AzFloat) } @@ -1735,11 +1735,11 @@ impl ToAzureIntSize for Size2D<AzFloat> { } trait ToSideOffsetsPixels { - fn to_float_pixels(&self, pixels_per_px: ScaleFactor<PagePx, ScreenPx, f32>) -> SideOffsets2D<AzFloat>; + fn to_float_pixels(&self, pixels_per_px: ScaleFactor<f32, PagePx, ScreenPx>) -> SideOffsets2D<AzFloat>; } impl ToSideOffsetsPixels for SideOffsets2D<Au> { - fn to_float_pixels(&self, pixels_per_px: ScaleFactor<PagePx, ScreenPx, f32>) -> SideOffsets2D<AzFloat> { + fn to_float_pixels(&self, pixels_per_px: ScaleFactor<f32, PagePx, ScreenPx>) -> SideOffsets2D<AzFloat> { SideOffsets2D::new(self.top.to_nearest_pixel(pixels_per_px.get()) as AzFloat, self.right.to_nearest_pixel(pixels_per_px.get()) as AzFloat, self.bottom.to_nearest_pixel(pixels_per_px.get()) as AzFloat, @@ -1748,24 +1748,24 @@ impl ToSideOffsetsPixels for SideOffsets2D<Au> { } trait ToRadiiPixels { - fn to_radii_pixels(&self, pixels_per_px: ScaleFactor<PagePx, ScreenPx, f32>) -> BorderRadii<AzFloat>; + fn to_radii_pixels(&self, pixels_per_px: ScaleFactor<f32, PagePx, ScreenPx>) -> BorderRadii<AzFloat>; } impl ToRadiiPixels for BorderRadii<Au> { - fn to_radii_pixels(&self, pixels_per_px: ScaleFactor<PagePx, ScreenPx, f32>) -> BorderRadii<AzFloat> { + fn to_radii_pixels(&self, pixels_per_px: ScaleFactor<f32, PagePx, ScreenPx>) -> BorderRadii<AzFloat> { let to_nearest_px = |x: Au| -> AzFloat { x.to_nearest_pixel(pixels_per_px.get()) as AzFloat }; BorderRadii { - top_left: Size2D { width: to_nearest_px(self.top_left.width), - height: to_nearest_px(self.top_left.height) }, - top_right: Size2D { width: to_nearest_px(self.top_right.width), - height: to_nearest_px(self.top_right.height) }, - bottom_left: Size2D { width: to_nearest_px(self.bottom_left.width), - height: to_nearest_px(self.bottom_left.height) }, - bottom_right: Size2D { width: to_nearest_px(self.bottom_right.width), - height: to_nearest_px(self.bottom_right.height) }, + top_left: Size2D::new(to_nearest_px(self.top_left.width), + to_nearest_px(self.top_left.height)), + top_right: Size2D::new(to_nearest_px(self.top_right.width), + to_nearest_px(self.top_right.height)), + bottom_left: Size2D::new(to_nearest_px(self.bottom_left.width), + to_nearest_px(self.bottom_left.height)), + bottom_right: Size2D::new(to_nearest_px(self.bottom_right.width), + to_nearest_px(self.bottom_right.height)), } } } @@ -1863,17 +1863,17 @@ trait DrawTargetExtensions { fn create_rectangular_border_path(&self, outer_rect: &Rect<Au>, inner_rect: &Rect<Au>, - pixels_per_px: ScaleFactor<PagePx, ScreenPx, f32>) -> Path; + pixels_per_px: ScaleFactor<f32, PagePx, ScreenPx>) -> Path; /// Creates and returns a path that represents a rectangle. - fn create_rectangular_path(&self, rect: &Rect<Au>, pixels_per_px: ScaleFactor<PagePx, ScreenPx, f32>) -> Path; + fn create_rectangular_path(&self, rect: &Rect<Au>, pixels_per_px: ScaleFactor<f32, PagePx, ScreenPx>) -> Path; } impl DrawTargetExtensions for DrawTarget { fn create_rectangular_border_path(&self, outer_rect: &Rect<Au>, inner_rect: &Rect<Au>, - pixels_per_px: ScaleFactor<PagePx, ScreenPx, f32>) -> Path { + pixels_per_px: ScaleFactor<f32, PagePx, ScreenPx>) -> Path { // +-----------+ // |2 |1 // | | @@ -1902,7 +1902,7 @@ impl DrawTargetExtensions for DrawTarget { path_builder.finish() } - fn create_rectangular_path(&self, rect: &Rect<Au>, pixels_per_px: ScaleFactor<PagePx, ScreenPx, f32>) -> Path { + fn create_rectangular_path(&self, rect: &Rect<Au>, pixels_per_px: ScaleFactor<f32, PagePx, ScreenPx>) -> Path { // Explicitly round to the nearest non-empty rect because when drawing // box-shadow the rect height can be between 0.5px & 1px and could // otherwise round to an empty rect. diff --git a/components/gfx/paint_thread.rs b/components/gfx/paint_thread.rs index a06ef7ee7af..f1c712b60fe 100644 --- a/components/gfx/paint_thread.rs +++ b/components/gfx/paint_thread.rs @@ -11,7 +11,7 @@ use display_list::{DisplayItem, DisplayList, DisplayListTraversal}; use display_list::{LayerInfo, StackingContext, StackingContextType}; use euclid::Matrix4D; use euclid::point::Point2D; -use euclid::rect::Rect; +use euclid::rect::{Rect, TypedRect}; use euclid::size::Size2D; use font_cache_thread::FontCacheThread; use font_context::FontContext; @@ -684,8 +684,8 @@ impl WorkerThread { let mut paint_context = PaintContext { draw_target: draw_target.clone(), font_context: &mut self.font_context, - page_rect: Rect::from_untyped(&tile.page_rect.translate(&paint_layer.display_list_origin)), - screen_rect: Rect::from_untyped(&tile.screen_rect), + page_rect: TypedRect::from_untyped(&tile.page_rect.translate(&paint_layer.display_list_origin)), + screen_rect: TypedRect::from_untyped(&tile.screen_rect), clip_rect: None, transient_clip: None, layer_kind: layer_kind, diff --git a/components/gfx_traits/Cargo.toml b/components/gfx_traits/Cargo.toml index 1d303d85438..96f0155e516 100644 --- a/components/gfx_traits/Cargo.toml +++ b/components/gfx_traits/Cargo.toml @@ -11,7 +11,7 @@ path = "lib.rs" [dependencies] azure = {git = "https://github.com/servo/rust-azure", features = ["plugins"]} -euclid = "0.7.1" +euclid = "0.8.2" heapsize = "0.3.0" heapsize_plugin = "0.1.2" layers = {git = "https://github.com/servo/rust-layers", features = ["plugins"]} diff --git a/components/layout/Cargo.toml b/components/layout/Cargo.toml index a3a3431b912..6ad730473ad 100644 --- a/components/layout/Cargo.toml +++ b/components/layout/Cargo.toml @@ -15,7 +15,7 @@ azure = {git = "https://github.com/servo/rust-azure", features = ["plugins"]} bitflags = "0.7" canvas_traits = {path = "../canvas_traits"} cssparser = {version = "0.5.4", features = ["heap_size", "serde-serialization"]} -euclid = "0.7.1" +euclid = "0.8.2" fnv = "1.0" gfx = {path = "../gfx"} gfx_traits = {path = "../gfx_traits"} diff --git a/components/layout/block.rs b/components/layout/block.rs index 62365478d2f..1dcadb8325b 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -61,7 +61,7 @@ use style::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMod use style::properties::ServoComputedValues; use style::values::computed::{LengthOrNone, LengthOrPercentageOrNone}; use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto}; -use util::geometry::MAX_RECT; +use util::geometry::max_rect; /// The number of screens of data we're allowed to generate display lists for in each direction. const DISPLAY_PORT_SIZE_FACTOR: i32 = 8; @@ -1842,7 +1842,7 @@ impl Flow for BlockFlow { if self.is_root() { self.base.clip = ClippingRegion::max(); - self.base.stacking_relative_position_of_display_port = MAX_RECT; + self.base.stacking_relative_position_of_display_port = max_rect(); } let transform_style = self.fragment.style().get_used_transform_style(); @@ -1855,7 +1855,7 @@ impl Flow for BlockFlow { (overflow_x::T::auto, _) | (overflow_x::T::scroll, _) | (_, overflow_x::T::auto) | (_, overflow_x::T::scroll) => { self.base.clip = ClippingRegion::max(); - self.base.stacking_relative_position_of_display_port = MAX_RECT; + self.base.stacking_relative_position_of_display_port = max_rect(); } _ => {} } diff --git a/components/layout/model.rs b/components/layout/model.rs index f988ef370dd..c74ced72d20 100644 --- a/components/layout/model.rs +++ b/components/layout/model.rs @@ -493,12 +493,11 @@ pub trait ToGfxMatrix { impl ToGfxMatrix for ComputedMatrix { fn to_gfx_matrix(&self) -> Matrix4D<f32> { - Matrix4D { - m11: self.m11 as f32, m12: self.m12 as f32, m13: self.m13 as f32, m14: self.m14 as f32, - m21: self.m21 as f32, m22: self.m22 as f32, m23: self.m23 as f32, m24: self.m24 as f32, - m31: self.m31 as f32, m32: self.m32 as f32, m33: self.m33 as f32, m34: self.m34 as f32, - m41: self.m41 as f32, m42: self.m42 as f32, m43: self.m43 as f32, m44: self.m44 as f32 - } + Matrix4D::new( + self.m11 as f32, self.m12 as f32, self.m13 as f32, self.m14 as f32, + self.m21 as f32, self.m22 as f32, self.m23 as f32, self.m24 as f32, + self.m31 as f32, self.m32 as f32, self.m33 as f32, self.m34 as f32, + self.m41 as f32, self.m42 as f32, self.m43 as f32, self.m44 as f32) } } diff --git a/components/layout/multicol.rs b/components/layout/multicol.rs index f440fdb34b3..555e83e129d 100644 --- a/components/layout/multicol.rs +++ b/components/layout/multicol.rs @@ -11,6 +11,7 @@ use block::BlockFlow; use context::LayoutContext; use display_list_builder::DisplayListBuildState; use euclid::Point2D; +use euclid::Size2D; use floats::FloatKind; use flow::{Flow, FlowClass, OpaqueFlow, mut_base, FragmentationContext}; use flow_ref::{self, FlowRef}; @@ -168,7 +169,7 @@ impl Flow for MulticolFlow { let pitch = pitch.to_physical(self.block_flow.base.writing_mode); for (i, child) in self.block_flow.base.children.iter_mut().enumerate() { let point = &mut mut_base(child).stacking_relative_position; - *point = *point + pitch * i as i32; + *point = *point + Size2D::new(pitch.width * i as i32, pitch.height * i as i32); } } diff --git a/components/layout_thread/Cargo.toml b/components/layout_thread/Cargo.toml index a06cf20e28f..a1e4953c126 100644 --- a/components/layout_thread/Cargo.toml +++ b/components/layout_thread/Cargo.toml @@ -12,7 +12,7 @@ path = "lib.rs" [dependencies] app_units = "0.2.5" azure = {git = "https://github.com/servo/rust-azure", features = ["plugins"]} -euclid = "0.7.1" +euclid = "0.8.2" fnv = "1.0" gfx = {path = "../gfx"} gfx_traits = {path = "../gfx_traits"} diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index da5d2ec5a75..16b3b9e5731 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -113,7 +113,7 @@ use style::stylesheets::{Stylesheet, CSSRuleIteratorExt}; use style::timer::Timer; use style::workqueue::WorkQueue; use url::Url; -use util::geometry::MAX_RECT; +use util::geometry::max_rect; use util::ipc::OptionalIpcSender; use util::opts; use util::prefs::PREFS; @@ -617,7 +617,7 @@ impl LayoutThread { let reflow_info = Reflow { goal: ReflowGoal::ForDisplay, - page_clip_rect: MAX_RECT, + page_clip_rect: max_rect(), }; let mut layout_context = self.build_shared_layout_context(&*rw_data, false, @@ -1076,8 +1076,8 @@ impl LayoutThread { let initial_viewport = data.window_size.initial_viewport; let old_viewport_size = self.viewport_size; - let current_screen_size = Size2D::new(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), + Au::from_f32_px(initial_viewport.height)); // Calculate the actual viewport as per DEVICE-ADAPT § 6 let device = Device::new(MediaType::Screen, initial_viewport); @@ -1089,8 +1089,8 @@ impl LayoutThread { debug!("Viewport constraints: {:?}", constraints); // other rules are evaluated against the actual viewport - Size2D::new(Au::from_f32_px(constraints.size.width.get()), - Au::from_f32_px(constraints.size.height.get())) + Size2D::new(Au::from_f32_px(constraints.size.width), + Au::from_f32_px(constraints.size.height)) } None => current_screen_size, }; @@ -1303,7 +1303,7 @@ impl LayoutThread { // Regenerate the display lists. let reflow_info = Reflow { goal: ReflowGoal::ForDisplay, - page_clip_rect: MAX_RECT, + page_clip_rect: max_rect(), }; let mut layout_context = self.build_shared_layout_context(&*rw_data, @@ -1347,7 +1347,7 @@ impl LayoutThread { fn tick_animations(&mut self, rw_data: &mut LayoutThreadData) { let reflow_info = Reflow { goal: ReflowGoal::ForDisplay, - page_clip_rect: MAX_RECT, + page_clip_rect: max_rect(), }; let mut layout_context = self.build_shared_layout_context(&*rw_data, @@ -1378,7 +1378,7 @@ impl LayoutThread { let reflow_info = Reflow { goal: ReflowGoal::ForDisplay, - page_clip_rect: MAX_RECT, + page_clip_rect: max_rect(), }; let mut layout_context = self.build_shared_layout_context(&*rw_data, diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index 75f8ec886cf..83ae3e6ef91 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -30,7 +30,7 @@ cookie = { version = "0.2.5", features = ["serialize-serde", "serialize-rustc" ] cssparser = {version = "0.5.4", features = ["heap_size", "serde-serialization"]} devtools_traits = {path = "../devtools_traits"} encoding = "0.2" -euclid = "0.7.1" +euclid = "0.8.2" fnv = "1.0" gfx_traits = {path = "../gfx_traits"} heapsize = "0.3.6" @@ -47,7 +47,7 @@ mime_guess = "1.8.0" msg = {path = "../msg"} net_traits = {path = "../net_traits"} num-traits = "0.1.32" -offscreen_gl_context = "0.1.2" +offscreen_gl_context = "0.2.0" open = "1.1.1" phf = "0.7.16" phf_macros = "0.7.16" diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 5f1bf4c45cd..5fca33081eb 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -2807,7 +2807,7 @@ impl DocumentMethods for Document { fn ElementFromPoint(&self, x: Finite<f64>, y: Finite<f64>) -> Option<Root<Element>> { let x = *x as f32; let y = *y as f32; - let point = &Point2D { x: x, y: y }; + let point = &Point2D::new(x, y); let window = window_from_node(self); let viewport = window.window_size().unwrap().visible_viewport; @@ -2815,7 +2815,7 @@ impl DocumentMethods for Document { return None; } - if x < 0.0 || y < 0.0 || x > viewport.width.get() || y > viewport.height.get() { + if x < 0.0 || y < 0.0 || x > viewport.width || y > viewport.height { return None; } @@ -2840,7 +2840,7 @@ impl DocumentMethods for Document { fn ElementsFromPoint(&self, x: Finite<f64>, y: Finite<f64>) -> Vec<Root<Element>> { let x = *x as f32; let y = *y as f32; - let point = &Point2D { x: x, y: y }; + let point = &Point2D::new(x, y); let window = window_from_node(self); let viewport = window.window_size().unwrap().visible_viewport; @@ -2849,7 +2849,7 @@ impl DocumentMethods for Document { } // Step 2 - if x < 0.0 || y < 0.0 || x > viewport.width.get() || y > viewport.height.get() { + if x < 0.0 || y < 0.0 || x > viewport.width || y > viewport.height { return vec!(); } diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index e6e527aea9c..e728e38a451 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -103,7 +103,7 @@ use timers::{IsInterval, OneshotTimerCallback, OneshotTimerHandle, OneshotTimers #[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))] use tinyfiledialogs::{self, MessageBoxIcon}; use url::Url; -use util::geometry::{self, MAX_RECT}; +use util::geometry::{self, max_rect}; use util::opts; use util::prefs::PREFS; use webdriver_handlers::jsval_to_webdriver; @@ -751,7 +751,7 @@ impl WindowMethods for Window { //TODO Include Scrollbar fn InnerHeight(&self) -> i32 { self.window_size.get() - .and_then(|e| e.visible_viewport.height.get().to_i32()) + .and_then(|e| e.visible_viewport.height.to_i32()) .unwrap_or(0) } @@ -759,7 +759,7 @@ impl WindowMethods for Window { //TODO Include Scrollbar fn InnerWidth(&self) -> i32 { self.window_size.get() - .and_then(|e| e.visible_viewport.width.get().to_i32()) + .and_then(|e| e.visible_viewport.width.to_i32()) .unwrap_or(0) } @@ -1529,7 +1529,7 @@ impl Window { return false; } - let had_clip_rect = clip_rect != MAX_RECT; + let had_clip_rect = clip_rect != max_rect(); if had_clip_rect && !should_move_clip_rect(clip_rect, viewport) { return false; } @@ -1537,7 +1537,7 @@ impl Window { self.page_clip_rect.set(proposed_clip_rect); // If we didn't have a clip rect, the previous display doesn't need rebuilding - // because it was built for infinite clip (MAX_RECT). + // because it was built for infinite clip (max_rect()). had_clip_rect } @@ -1721,7 +1721,7 @@ impl Window { resource_threads: resource_threads, bluetooth_thread: bluetooth_thread, constellation_chan: constellation_chan, - page_clip_rect: Cell::new(MAX_RECT), + page_clip_rect: Cell::new(max_rect()), fragment_name: DOMRefCell::new(None), resize_event: Cell::new(None), next_subpage_id: Cell::new(SubpageId(0)), diff --git a/components/script_layout_interface/Cargo.toml b/components/script_layout_interface/Cargo.toml index 0bc63e678ab..6465bdd4e26 100644 --- a/components/script_layout_interface/Cargo.toml +++ b/components/script_layout_interface/Cargo.toml @@ -14,7 +14,7 @@ app_units = "0.2.5" bitflags = "0.7" canvas_traits = {path = "../canvas_traits"} cssparser = {version = "0.5.4", features = ["heap_size", "serde-serialization"]} -euclid = "0.7.1" +euclid = "0.8.2" gfx_traits = {path = "../gfx_traits"} heapsize = "0.3.0" heapsize_plugin = "0.1.2" diff --git a/components/script_traits/Cargo.toml b/components/script_traits/Cargo.toml index 47fc10b95c7..86c0361481d 100644 --- a/components/script_traits/Cargo.toml +++ b/components/script_traits/Cargo.toml @@ -14,7 +14,7 @@ app_units = "0.2.5" canvas_traits = {path = "../canvas_traits"} cookie = { version = "0.2.5", features = ["serialize-rustc", "serialize-serde"]} devtools_traits = {path = "../devtools_traits"} -euclid = "0.7.1" +euclid = "0.8.2" gfx_traits = {path = "../gfx_traits"} heapsize = "0.3.0" heapsize_plugin = "0.1.2" @@ -23,7 +23,7 @@ layers = {git = "https://github.com/servo/rust-layers", features = ["plugins"]} libc = "0.2" msg = {path = "../msg"} net_traits = {path = "../net_traits"} -offscreen_gl_context = "0.1.2" +offscreen_gl_context = "0.2.0" plugins = {path = "../plugins"} profile_traits = {path = "../profile_traits"} rustc-serialize = "0.3.4" diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index 8269ca318ed..0bc9225d42c 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -365,9 +365,9 @@ pub enum Milliseconds {} pub enum Nanoseconds {} /// Amount of milliseconds. -pub type MsDuration = Length<Milliseconds, u64>; +pub type MsDuration = Length<u64, Milliseconds>; /// Amount of nanoseconds. -pub type NsDuration = Length<Nanoseconds, u64>; +pub type NsDuration = Length<u64, Nanoseconds>; /// Returns the duration since an unspecified epoch measured in ms. pub fn precise_time_ms() -> MsDuration { @@ -568,13 +568,13 @@ pub struct StackingContextScrollState { pub struct WindowSizeData { /// The size of the initial layout viewport, before parsing an /// http://www.w3.org/TR/css-device-adapt/#initial-viewport - pub initial_viewport: TypedSize2D<ViewportPx, f32>, + pub initial_viewport: TypedSize2D<f32, ViewportPx>, /// The "viewing area" in page px. See `PagePx` documentation for details. - pub visible_viewport: TypedSize2D<PagePx, f32>, + pub visible_viewport: TypedSize2D<f32, PagePx>, /// The resolution of the window in dppx, not including any "pinch zoom" factor. - pub device_pixel_ratio: ScaleFactor<ViewportPx, DevicePixel, f32>, + pub device_pixel_ratio: ScaleFactor<f32, ViewportPx, DevicePixel>, } /// Messages to the constellation originating from the WebDriver server. diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index 26573a2b5ed..403ce92897f 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -13,7 +13,7 @@ dependencies = [ "devtools 0.0.1", "devtools_traits 0.0.1", "env_logger 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gaol 0.0.1 (git+https://github.com/servo/gaol)", "gfx 0.0.1", "gfx_tests 0.0.1", @@ -46,7 +46,7 @@ dependencies = [ "util_tests 0.0.1", "webdriver_server 0.0.1", "webrender 0.1.0 (git+https://github.com/servo/webrender)", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", ] [[package]] @@ -102,13 +102,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "azure" -version = "0.4.6" -source = "git+https://github.com/servo/rust-azure#4d72934a73820653986d9b11da759f5955a13e44" +version = "0.6.2" +source = "git+https://github.com/servo/rust-azure#6e028b5fafc1dad4cd48e233a9760cb67937d487" dependencies = [ + "cmake 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "freetype 0.1.0 (git+https://github.com/servo/rust-freetype)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -116,8 +117,8 @@ dependencies = [ "serde 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-freetype-sys 2.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-skia 0.20130412.10 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-freetype-sys 4.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-skia 0.20130412.19 (registry+https://github.com/rust-lang/crates.io-index)", "x11 2.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -204,27 +205,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "canvas" version = "0.0.1" dependencies = [ - "azure 0.4.6 (git+https://github.com/servo/rust-azure)", + "azure 0.6.2 (git+https://github.com/servo/rust-azure)", "canvas_traits 0.0.1", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "gleam 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "util 0.0.1", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", ] [[package]] name = "canvas_traits" version = "0.0.1" dependencies = [ - "azure 0.4.6 (git+https://github.com/servo/rust-azure)", + "azure 0.6.2 (git+https://github.com/servo/rust-azure)", "cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -232,7 +233,7 @@ dependencies = [ "plugins 0.0.1", "serde 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", ] [[package]] @@ -302,13 +303,13 @@ name = "compositing" version = "0.0.1" dependencies = [ "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "azure 0.4.6 (git+https://github.com/servo/rust-azure)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "azure 0.6.2 (git+https://github.com/servo/rust-azure)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "gleam 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "layers 0.2.6 (git+https://github.com/servo/rust-layers)", + "layers 0.3.1 (git+https://github.com/servo/rust-layers)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", @@ -322,7 +323,7 @@ dependencies = [ "url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "webrender 0.1.0 (git+https://github.com/servo/webrender)", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", ] [[package]] @@ -334,17 +335,17 @@ dependencies = [ "canvas_traits 0.0.1", "compositing 0.0.1", "devtools_traits 0.0.1", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gaol 0.0.1 (git+https://github.com/servo/gaol)", "gfx 0.0.1", "gfx_traits 0.0.1", "ipc-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "layers 0.2.6 (git+https://github.com/servo/rust-layers)", + "layers 0.3.1 (git+https://github.com/servo/rust-layers)", "layout_traits 0.0.1", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", - "offscreen_gl_context 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "profile_traits 0.0.1", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -354,7 +355,7 @@ dependencies = [ "style_traits 0.0.1", "url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", ] [[package]] @@ -651,7 +652,7 @@ dependencies = [ [[package]] name = "euclid" -version = "0.7.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -745,13 +746,13 @@ name = "gfx" version = "0.0.1" dependencies = [ "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "azure 0.4.6 (git+https://github.com/servo/rust-azure)", + "azure 0.6.2 (git+https://github.com/servo/rust-azure)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "freetype 0.1.0 (git+https://github.com/servo/rust-freetype)", "gfx_traits 0.0.1", @@ -759,7 +760,7 @@ dependencies = [ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "layers 0.2.6 (git+https://github.com/servo/rust-layers)", + "layers 0.3.1 (git+https://github.com/servo/rust-layers)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -774,7 +775,7 @@ dependencies = [ "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-fontconfig 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-fontconfig 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "simd 0.1.0 (git+https://github.com/huonw/simd)", "smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)", @@ -784,7 +785,7 @@ dependencies = [ "unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", "xi-unicode 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -801,11 +802,11 @@ dependencies = [ name = "gfx_traits" version = "0.0.1" dependencies = [ - "azure 0.4.6 (git+https://github.com/servo/rust-azure)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "azure 0.6.2 (git+https://github.com/servo/rust-azure)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "layers 0.2.6 (git+https://github.com/servo/rust-layers)", + "layers 0.3.1 (git+https://github.com/servo/rust-layers)", "msg 0.0.1", "plugins 0.0.1", "profile_traits 0.0.1", @@ -853,10 +854,10 @@ version = "0.0.1" dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "compositing 0.0.1", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", - "layers 0.2.6 (git+https://github.com/servo/rust-layers)", + "layers 0.3.1 (git+https://github.com/servo/rust-layers)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", @@ -1018,12 +1019,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "io-surface" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "leaky-cow 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1085,23 +1086,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "layers" -version = "0.2.6" -source = "git+https://github.com/servo/rust-layers#79fca9ca5f2b7bded94dd34637a251967a9b0247" +version = "0.3.1" +source = "git+https://github.com/servo/rust-layers#c1965cf7a265f758c34e57413506f508969248a0" dependencies = [ - "azure 0.4.6 (git+https://github.com/servo/rust-azure)", "cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "glx 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "io-surface 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "io-surface 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-skia 0.20130412.10 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-skia 0.20130412.19 (registry+https://github.com/rust-lang/crates.io-index)", "x11 2.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1110,11 +1110,11 @@ name = "layout" version = "0.0.1" dependencies = [ "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "azure 0.4.6 (git+https://github.com/servo/rust-azure)", + "azure 0.6.2 (git+https://github.com/servo/rust-azure)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "canvas_traits 0.0.1", "cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "gfx 0.0.1", "gfx_traits 0.0.1", @@ -1142,7 +1142,7 @@ dependencies = [ "unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", ] [[package]] @@ -1157,8 +1157,8 @@ name = "layout_thread" version = "0.0.1" dependencies = [ "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "azure 0.4.6 (git+https://github.com/servo/rust-azure)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "azure 0.6.2 (git+https://github.com/servo/rust-azure)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "gfx 0.0.1", "gfx_traits 0.0.1", @@ -1180,7 +1180,7 @@ dependencies = [ "style 0.0.1", "url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", ] [[package]] @@ -1195,7 +1195,7 @@ dependencies = [ "script_traits 0.0.1", "url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", ] [[package]] @@ -1358,7 +1358,7 @@ dependencies = [ "serde 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", ] [[package]] @@ -1395,7 +1395,7 @@ dependencies = [ "url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "uuid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", "websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1546,12 +1546,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "offscreen_gl_context" -version = "0.1.9" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1873,7 +1873,7 @@ dependencies = [ "cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "devtools_traits 0.0.1", "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1890,7 +1890,7 @@ dependencies = [ "msg 0.0.1", "net_traits 0.0.1", "num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "open 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)", "phf_macros 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1915,7 +1915,7 @@ dependencies = [ "util 0.0.1", "uuid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "video-metadata 0.1.3 (git+https://github.com/GuillaumeGomez/video-metadata-rs)", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", "websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", "xml5ever 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1928,7 +1928,7 @@ dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "canvas_traits 0.0.1", "cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1966,16 +1966,16 @@ dependencies = [ "canvas_traits 0.0.1", "cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "devtools_traits 0.0.1", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "layers 0.2.6 (git+https://github.com/servo/rust-layers)", + "layers 0.3.1 (git+https://github.com/servo/rust-layers)", "libc 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", - "offscreen_gl_context 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "profile_traits 0.0.1", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2056,28 +2056,29 @@ dependencies = [ [[package]] name = "servo-fontconfig" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-fontconfig-sys 2.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-fontconfig-sys 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "servo-fontconfig-sys" -version = "2.11.3" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "expat-sys 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-freetype-sys 2.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-freetype-sys 4.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "servo-freetype-sys" -version = "2.4.11" +version = "4.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "cmake 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2112,19 +2113,20 @@ dependencies = [ [[package]] name = "servo-skia" -version = "0.20130412.10" +version = "0.20130412.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cmake 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "expat-sys 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "glx 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "io-surface 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "io-surface 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-fontconfig 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-freetype-sys 2.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-fontconfig-sys 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-freetype-sys 4.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "servo-glutin 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", "x11 2.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2194,7 +2196,7 @@ dependencies = [ "cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2226,7 +2228,7 @@ version = "0.0.1" dependencies = [ "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2241,7 +2243,7 @@ name = "style_traits" version = "0.0.1" dependencies = [ "cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2423,7 +2425,7 @@ version = "0.0.1" dependencies = [ "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2547,7 +2549,7 @@ name = "webdriver_server" version = "0.0.1" dependencies = [ "cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2566,14 +2568,14 @@ dependencies = [ [[package]] name = "webrender" version = "0.1.0" -source = "git+https://github.com/servo/webrender#e2e8d91f24de961bfd6b53338e2403bc0c675aab" +source = "git+https://github.com/servo/webrender#2c25e910b2a1f0399c57a077085d5cc3451f4499" dependencies = [ "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "freetype 0.1.0 (git+https://github.com/servo/rust-freetype)", "gleam 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2581,25 +2583,25 @@ dependencies = [ "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "scoped_threadpool 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", ] [[package]] name = "webrender_traits" -version = "0.2.0" -source = "git+https://github.com/servo/webrender_traits#a26ebe4da490cc1fb60d830c73cbefb135b768b1" +version = "0.2.1" +source = "git+https://github.com/servo/webrender_traits#75d40708694949a2e092ff4c344f952e3afbaa55" dependencies = [ "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/components/servo/Cargo.toml b/components/servo/Cargo.toml index 7af0f577119..ef1d487c978 100644 --- a/components/servo/Cargo.toml +++ b/components/servo/Cargo.toml @@ -52,7 +52,7 @@ constellation = {path = "../constellation"} devtools = {path = "../devtools"} devtools_traits = {path = "../devtools_traits"} env_logger = "0.3" -euclid = "0.7.1" +euclid = "0.8.2" gfx = {path = "../gfx"} gleam = "0.2" glutin_app = {path = "../../ports/glutin"} diff --git a/components/style/Cargo.toml b/components/style/Cargo.toml index 46f62850e60..db0e441f13d 100644 --- a/components/style/Cargo.toml +++ b/components/style/Cargo.toml @@ -25,7 +25,7 @@ bitflags = "0.7" cssparser = "0.5.5" deque = "0.3.1" encoding = "0.2" -euclid = "0.7.1" +euclid = "0.8.2" fnv = "1.0" gecko_bindings = {path = "../../ports/geckolib/gecko_bindings", optional = true} gecko_string_cache = {path = "../../ports/geckolib/string_cache", optional = true} diff --git a/components/style/logical_geometry.rs b/components/style/logical_geometry.rs index 2b41b512910..71a7dda8bc7 100644 --- a/components/style/logical_geometry.rs +++ b/components/style/logical_geometry.rs @@ -301,9 +301,9 @@ impl<T: Copy> LogicalSize<T> { pub fn to_physical(&self, mode: WritingMode) -> Size2D<T> { self.debug_writing_mode.check(mode); if mode.is_vertical() { - Size2D { width: self.block, height: self.inline } + Size2D::new(self.block, self.inline) } else { - Size2D { width: self.inline, height: self.block } + Size2D::new(self.inline, self.block) } } @@ -450,15 +450,13 @@ impl<T: Copy + Sub<T, Output=T>> LogicalPoint<T> { pub fn to_physical(&self, mode: WritingMode, container_size: Size2D<T>) -> Point2D<T> { self.debug_writing_mode.check(mode); if mode.is_vertical() { - Point2D { - x: if mode.is_vertical_lr() { self.b } else { container_size.width - self.b }, - y: if mode.is_inline_tb() { self.i } else { container_size.height - self.i } - } + Point2D::new( + if mode.is_vertical_lr() { self.b } else { container_size.width - self.b }, + if mode.is_inline_tb() { self.i } else { container_size.height - self.i }) } else { - Point2D { - x: if mode.is_bidi_ltr() { self.i } else { container_size.width - self.i }, - y: self.b - } + Point2D::new( + if mode.is_bidi_ltr() { self.i } else { container_size.width - self.i }, + self.b) } } @@ -953,8 +951,8 @@ impl<T: Copy + Add<T, Output=T> + Sub<T, Output=T>> LogicalRect<T> { } } Rect { - origin: Point2D { x: x, y: y }, - size: Size2D { width: width, height: height }, + origin: Point2D::new(x, y), + size: Size2D::new(width, height), } } diff --git a/components/style/media_queries.rs b/components/style/media_queries.rs index 59c1a24e355..a5a4206a4a1 100644 --- a/components/style/media_queries.rs +++ b/components/style/media_queries.rs @@ -118,11 +118,11 @@ pub enum MediaType { #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct Device { pub media_type: MediaType, - pub viewport_size: TypedSize2D<ViewportPx, f32>, + pub viewport_size: TypedSize2D<f32, ViewportPx>, } impl Device { - pub fn new(media_type: MediaType, viewport_size: TypedSize2D<ViewportPx, f32>) -> Device { + pub fn new(media_type: MediaType, viewport_size: TypedSize2D<f32, ViewportPx>) -> Device { Device { media_type: media_type, viewport_size: viewport_size, @@ -131,8 +131,8 @@ impl Device { #[inline] pub fn au_viewport_size(&self) -> Size2D<Au> { - Size2D::new(Au::from_f32_px(self.viewport_size.width.get()), - Au::from_f32_px(self.viewport_size.height.get())) + Size2D::new(Au::from_f32_px(self.viewport_size.width), + Au::from_f32_px(self.viewport_size.height)) } } diff --git a/components/style/properties/longhand/box.mako.rs b/components/style/properties/longhand/box.mako.rs index c9639ae0a84..492edf3d97b 100644 --- a/components/style/properties/longhand/box.mako.rs +++ b/components/style/properties/longhand/box.mako.rs @@ -369,47 +369,43 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", animatable="False"> use self::computed_value::{StartEnd, TransitionTimingFunction}; - use euclid::point::Point2D; + use euclid::point::{Point2D, TypedPoint2D}; + use std::marker::PhantomData; pub use self::computed_value::SingleComputedValue as SingleSpecifiedValue; pub use self::computed_value::T as SpecifiedValue; - static EASE: TransitionTimingFunction = TransitionTimingFunction::CubicBezier(Point2D { - x: 0.25, - y: 0.1, - }, Point2D { - x: 0.25, - y: 1.0, - }); - static LINEAR: TransitionTimingFunction = TransitionTimingFunction::CubicBezier(Point2D { - x: 0.0, - y: 0.0, - }, Point2D { - x: 1.0, - y: 1.0, - }); - static EASE_IN: TransitionTimingFunction = TransitionTimingFunction::CubicBezier(Point2D { - x: 0.42, - y: 0.0, - }, Point2D { - x: 1.0, - y: 1.0, - }); - static EASE_OUT: TransitionTimingFunction = TransitionTimingFunction::CubicBezier(Point2D { - x: 0.0, - y: 0.0, - }, Point2D { - x: 0.58, - y: 1.0, - }); - static EASE_IN_OUT: TransitionTimingFunction = - TransitionTimingFunction::CubicBezier(Point2D { - x: 0.42, - y: 0.0, - }, Point2D { - x: 0.58, - y: 1.0, - }); + // FIXME: This could use static variables and const functions when they are available. + #[inline(always)] + fn ease() -> TransitionTimingFunction { + TransitionTimingFunction::CubicBezier(TypedPoint2D::new(0.25, 0.1), + TypedPoint2D::new(0.25, 1.0)) + } + + #[inline(always)] + fn linear() -> TransitionTimingFunction { + TransitionTimingFunction::CubicBezier(TypedPoint2D::new(0.0, 0.0), + TypedPoint2D::new(1.0, 1.0)) + } + + #[inline(always)] + fn ease_in() -> TransitionTimingFunction { + TransitionTimingFunction::CubicBezier(TypedPoint2D::new(0.42, 0.0), + TypedPoint2D::new(1.0, 1.0)) + } + + #[inline(always)] + fn ease_out() -> TransitionTimingFunction { + TransitionTimingFunction::CubicBezier(TypedPoint2D::new(0.0, 0.0), + TypedPoint2D::new(0.58, 1.0)) + } + + #[inline(always)] + fn ease_in_out() -> TransitionTimingFunction { + TransitionTimingFunction::CubicBezier(TypedPoint2D::new(0.42, 0.0), + TypedPoint2D::new(0.58, 1.0)) + } + static STEP_START: TransitionTimingFunction = TransitionTimingFunction::Steps(1, StartEnd::Start); static STEP_END: TransitionTimingFunction = @@ -509,7 +505,7 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", #[inline] pub fn get_initial_single_value() -> TransitionTimingFunction { - EASE + ease() } pub fn parse_one(input: &mut Parser) -> Result<SingleSpecifiedValue,()> { @@ -551,11 +547,11 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", } match_ignore_ascii_case! { try!(input.expect_ident()), - "ease" => Ok(EASE), - "linear" => Ok(LINEAR), - "ease-in" => Ok(EASE_IN), - "ease-out" => Ok(EASE_OUT), - "ease-in-out" => Ok(EASE_IN_OUT), + "ease" => Ok(ease()), + "linear" => Ok(linear()), + "ease-in" => Ok(ease_in()), + "ease-out" => Ok(ease_out()), + "ease-in-out" => Ok(ease_in_out()), "step-start" => Ok(STEP_START), "step-end" => Ok(STEP_END), _ => Err(()) diff --git a/components/style/viewport.rs b/components/style/viewport.rs index ebed8cc2600..253c5440a2a 100644 --- a/components/style/viewport.rs +++ b/components/style/viewport.rs @@ -555,13 +555,13 @@ impl<'a, I> ViewportDescriptorDeclarationCascade for I } pub trait MaybeNew { - fn maybe_new(initial_viewport: TypedSize2D<ViewportPx, f32>, + fn maybe_new(initial_viewport: TypedSize2D<f32, ViewportPx>, rule: &ViewportRule) -> Option<ViewportConstraints>; } impl MaybeNew for ViewportConstraints { - fn maybe_new(initial_viewport: TypedSize2D<ViewportPx, f32>, + fn maybe_new(initial_viewport: TypedSize2D<f32, ViewportPx>, rule: &ViewportRule) -> Option<ViewportConstraints> { @@ -639,8 +639,8 @@ impl MaybeNew for ViewportConstraints { // // Note: DEVICE-ADAPT § 5. states that relative length values are // resolved against initial values - let initial_viewport = Size2D::new(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), + Au::from_f32_px(initial_viewport.height)); let context = Context { @@ -749,7 +749,7 @@ impl MaybeNew for ViewportConstraints { }); Some(ViewportConstraints { - size: Size2D::typed(width.to_f32_px(), height.to_f32_px()), + size: TypedSize2D::new(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.)), diff --git a/components/style_traits/Cargo.toml b/components/style_traits/Cargo.toml index 6332f6f6509..d7ee9514580 100644 --- a/components/style_traits/Cargo.toml +++ b/components/style_traits/Cargo.toml @@ -10,12 +10,12 @@ name = "style_traits" path = "lib.rs" [features] -servo = ["heapsize", "heapsize_plugin", "serde", "serde_macros", "euclid/plugins", +servo = ["heapsize", "heapsize_plugin", "serde", "serde_macros", "cssparser/heap_size", "cssparser/serde-serialization"] [dependencies] cssparser = "0.5.4" -euclid = "0.7.1" +euclid = "0.8.2" heapsize = {version = "0.3.0", optional = true} heapsize_plugin = {version = "0.1.2", optional = true} rustc-serialize = "0.3" diff --git a/components/style_traits/viewport.rs b/components/style_traits/viewport.rs index deac9d68905..9e76013934a 100644 --- a/components/style_traits/viewport.rs +++ b/components/style_traits/viewport.rs @@ -23,11 +23,11 @@ define_css_keyword_enum!(Orientation: #[derive(Clone, Debug, PartialEq)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize, HeapSizeOf))] pub struct ViewportConstraints { - pub size: TypedSize2D<ViewportPx, f32>, + pub size: TypedSize2D<f32, ViewportPx>, - pub initial_zoom: ScaleFactor<PagePx, ViewportPx, f32>, - pub min_zoom: Option<ScaleFactor<PagePx, ViewportPx, f32>>, - pub max_zoom: Option<ScaleFactor<PagePx, ViewportPx, f32>>, + pub initial_zoom: ScaleFactor<f32, PagePx, ViewportPx>, + pub min_zoom: Option<ScaleFactor<f32, PagePx, ViewportPx>>, + pub max_zoom: Option<ScaleFactor<f32, PagePx, ViewportPx>>, pub user_zoom: UserZoom, pub orientation: Orientation @@ -38,8 +38,8 @@ impl ToCss for ViewportConstraints { where W: fmt::Write { try!(write!(dest, "@viewport {{")); - try!(write!(dest, " width: {}px;", self.size.width.get())); - try!(write!(dest, " height: {}px;", self.size.height.get())); + try!(write!(dest, " width: {}px;", self.size.width)); + try!(write!(dest, " height: {}px;", self.size.height)); try!(write!(dest, " zoom: {};", self.initial_zoom.get())); if let Some(min_zoom) = self.min_zoom { try!(write!(dest, " min-zoom: {};", min_zoom.get())); diff --git a/components/util/Cargo.toml b/components/util/Cargo.toml index d32c015637f..e03464b7fb9 100644 --- a/components/util/Cargo.toml +++ b/components/util/Cargo.toml @@ -12,12 +12,12 @@ path = "lib.rs" [features] # servo as opposed to geckolib servo = ["serde", "serde_macros", "ipc-channel", "app_units/plugins", - "euclid/plugins", "euclid/unstable", "url/heap_size", "url/serde", "plugins"] + "euclid/unstable", "url/heap_size", "url/serde", "plugins"] [dependencies] app_units = "0.2.5" bitflags = "0.7" -euclid = "0.7.1" +euclid = "0.8.2" getopts = "0.2.11" heapsize = "0.3.0" ipc-channel = {version = "0.4.0", optional = true} diff --git a/components/util/geometry.rs b/components/util/geometry.rs index 95b6194a14e..84d3761b92c 100644 --- a/components/util/geometry.rs +++ b/components/util/geometry.rs @@ -32,16 +32,10 @@ known_heap_size!(0, ScreenPx); // originally proposed in 2002 as a standard unit of measure in Gecko. // See https://bugzilla.mozilla.org/show_bug.cgi?id=177805 for more info. -pub static MAX_RECT: Rect<Au> = Rect { - origin: Point2D { - x: Au(i32::MIN / 2), - y: Au(i32::MIN / 2), - }, - size: Size2D { - width: MAX_AU, - height: MAX_AU, - } -}; +#[inline(always)] +pub fn max_rect() -> Rect<Au> { + Rect::new(Point2D::new(Au(i32::MIN / 2), Au(i32::MIN / 2)), Size2D::new(MAX_AU, MAX_AU)) +} /// 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> { diff --git a/components/util/lib.rs b/components/util/lib.rs index 13e763b9cbc..abb02adb440 100644 --- a/components/util/lib.rs +++ b/components/util/lib.rs @@ -14,7 +14,7 @@ extern crate app_units; #[allow(unused_extern_crates)] #[macro_use] extern crate bitflags; extern crate core; -extern crate euclid; +#[macro_use] extern crate euclid; extern crate getopts; #[macro_use] extern crate heapsize; #[cfg(feature = "servo")] extern crate ipc_channel; diff --git a/components/util/opts.rs b/components/util/opts.rs index 81b83d2b273..6395e134147 100644 --- a/components/util/opts.rs +++ b/components/util/opts.rs @@ -5,7 +5,7 @@ //! Configuration options for a single run of the servo application. Created //! from command line arguments. -use euclid::size::{Size2D, TypedSize2D}; +use euclid::size::TypedSize2D; use geometry::ScreenPx; use getopts::Options; use num_cpus; @@ -136,7 +136,7 @@ pub struct Opts { pub webdriver_port: Option<u16>, /// The initial requested size of the window. - pub initial_window_size: TypedSize2D<ScreenPx, u32>, + pub initial_window_size: TypedSize2D<u32, ScreenPx>, /// An optional string allowing the user agent to be set for testing. pub user_agent: String, @@ -494,7 +494,7 @@ pub fn default_opts() -> Opts { trace_layout: false, devtools_port: None, webdriver_port: None, - initial_window_size: Size2D::typed(1024, 740), + initial_window_size: TypedSize2D::new(1024, 740), user_agent: default_user_agent_string(DEFAULT_USER_AGENT), multiprocess: false, random_pipeline_closure_probability: None, @@ -722,10 +722,10 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult { let res: Vec<u32> = res_string.split('x').map(|r| { r.parse().unwrap_or_else(|err| args_fail(&format!("Error parsing option: --resolution ({})", err))) }).collect(); - Size2D::typed(res[0], res[1]) + TypedSize2D::new(res[0], res[1]) } None => { - Size2D::typed(1024, 740) + TypedSize2D::new(1024, 740) } }; diff --git a/components/webdriver_server/Cargo.toml b/components/webdriver_server/Cargo.toml index 9a1b8e5c600..5265dddc010 100644 --- a/components/webdriver_server/Cargo.toml +++ b/components/webdriver_server/Cargo.toml @@ -10,7 +10,7 @@ name = "webdriver_server" path = "lib.rs" [dependencies] -euclid = "0.7.1" +euclid = "0.8.2" hyper = "0.9.9" image = "0.10" ipc-channel = "0.4.0" diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index 1119eace7d9..eaa76dca177 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -389,7 +389,7 @@ impl Handler { let window_size = receiver.recv().unwrap(); let vp = window_size.visible_viewport; - let window_size_response = WindowSizeResponse::new(vp.width.get() as u64, vp.height.get() as u64); + let window_size_response = WindowSizeResponse::new(vp.width as u64, vp.height as u64); Ok(WebDriverResponse::WindowSize(window_size_response)) } @@ -413,7 +413,7 @@ impl Handler { let window_size = receiver.recv().unwrap(); let vp = window_size.visible_viewport; - let window_size_response = WindowSizeResponse::new(vp.width.get() as u64, vp.height.get() as u64); + let window_size_response = WindowSizeResponse::new(vp.width as u64, vp.height as u64); Ok(WebDriverResponse::WindowSize(window_size_response)) } diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index 89ea662774f..15436157ce9 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -5,10 +5,10 @@ dependencies = [ "cocoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "compositing 0.0.1", "devtools 0.0.1", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "glutin_app 0.0.1", - "layers 0.2.6 (git+https://github.com/servo/rust-layers)", + "layers 0.3.1 (git+https://github.com/servo/rust-layers)", "libc 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", @@ -76,13 +76,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "azure" -version = "0.4.6" -source = "git+https://github.com/servo/rust-azure#4d72934a73820653986d9b11da759f5955a13e44" +version = "0.6.2" +source = "git+https://github.com/servo/rust-azure#6e028b5fafc1dad4cd48e233a9760cb67937d487" dependencies = [ + "cmake 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "freetype 0.1.0 (git+https://github.com/servo/rust-freetype)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -90,8 +91,8 @@ dependencies = [ "serde 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-freetype-sys 2.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-skia 0.20130412.10 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-freetype-sys 4.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-skia 0.20130412.19 (registry+https://github.com/rust-lang/crates.io-index)", "x11 2.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -178,27 +179,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "canvas" version = "0.0.1" dependencies = [ - "azure 0.4.6 (git+https://github.com/servo/rust-azure)", + "azure 0.6.2 (git+https://github.com/servo/rust-azure)", "canvas_traits 0.0.1", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "gleam 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "util 0.0.1", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", ] [[package]] name = "canvas_traits" version = "0.0.1" dependencies = [ - "azure 0.4.6 (git+https://github.com/servo/rust-azure)", + "azure 0.6.2 (git+https://github.com/servo/rust-azure)", "cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -206,7 +207,7 @@ dependencies = [ "plugins 0.0.1", "serde 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", ] [[package]] @@ -261,13 +262,13 @@ name = "compositing" version = "0.0.1" dependencies = [ "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "azure 0.4.6 (git+https://github.com/servo/rust-azure)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "azure 0.6.2 (git+https://github.com/servo/rust-azure)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "gleam 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "layers 0.2.6 (git+https://github.com/servo/rust-layers)", + "layers 0.3.1 (git+https://github.com/servo/rust-layers)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", @@ -281,7 +282,7 @@ dependencies = [ "url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "webrender 0.1.0 (git+https://github.com/servo/webrender)", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", ] [[package]] @@ -293,17 +294,17 @@ dependencies = [ "canvas_traits 0.0.1", "compositing 0.0.1", "devtools_traits 0.0.1", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gaol 0.0.1 (git+https://github.com/servo/gaol)", "gfx 0.0.1", "gfx_traits 0.0.1", "ipc-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "layers 0.2.6 (git+https://github.com/servo/rust-layers)", + "layers 0.3.1 (git+https://github.com/servo/rust-layers)", "layout_traits 0.0.1", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", - "offscreen_gl_context 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "profile_traits 0.0.1", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -313,7 +314,7 @@ dependencies = [ "style_traits 0.0.1", "url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", ] [[package]] @@ -569,7 +570,7 @@ dependencies = [ [[package]] name = "euclid" -version = "0.7.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -663,13 +664,13 @@ name = "gfx" version = "0.0.1" dependencies = [ "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "azure 0.4.6 (git+https://github.com/servo/rust-azure)", + "azure 0.6.2 (git+https://github.com/servo/rust-azure)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "freetype 0.1.0 (git+https://github.com/servo/rust-freetype)", "gfx_traits 0.0.1", @@ -677,7 +678,7 @@ dependencies = [ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "layers 0.2.6 (git+https://github.com/servo/rust-layers)", + "layers 0.3.1 (git+https://github.com/servo/rust-layers)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -692,7 +693,7 @@ dependencies = [ "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-fontconfig 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-fontconfig 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "simd 0.1.0 (git+https://github.com/huonw/simd)", "smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)", @@ -702,7 +703,7 @@ dependencies = [ "unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", "xi-unicode 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -710,11 +711,11 @@ dependencies = [ name = "gfx_traits" version = "0.0.1" dependencies = [ - "azure 0.4.6 (git+https://github.com/servo/rust-azure)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "azure 0.6.2 (git+https://github.com/servo/rust-azure)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "layers 0.2.6 (git+https://github.com/servo/rust-layers)", + "layers 0.3.1 (git+https://github.com/servo/rust-layers)", "msg 0.0.1", "plugins 0.0.1", "profile_traits 0.0.1", @@ -762,10 +763,10 @@ version = "0.0.1" dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "compositing 0.0.1", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", - "layers 0.2.6 (git+https://github.com/servo/rust-layers)", + "layers 0.3.1 (git+https://github.com/servo/rust-layers)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", @@ -927,12 +928,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "io-surface" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "leaky-cow 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -994,23 +995,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "layers" -version = "0.2.6" -source = "git+https://github.com/servo/rust-layers#79fca9ca5f2b7bded94dd34637a251967a9b0247" +version = "0.3.1" +source = "git+https://github.com/servo/rust-layers#c1965cf7a265f758c34e57413506f508969248a0" dependencies = [ - "azure 0.4.6 (git+https://github.com/servo/rust-azure)", "cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "glx 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "io-surface 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "io-surface 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", "servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-skia 0.20130412.10 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-skia 0.20130412.19 (registry+https://github.com/rust-lang/crates.io-index)", "x11 2.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1019,11 +1019,11 @@ name = "layout" version = "0.0.1" dependencies = [ "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "azure 0.4.6 (git+https://github.com/servo/rust-azure)", + "azure 0.6.2 (git+https://github.com/servo/rust-azure)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "canvas_traits 0.0.1", "cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "gfx 0.0.1", "gfx_traits 0.0.1", @@ -1051,7 +1051,7 @@ dependencies = [ "unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", ] [[package]] @@ -1059,8 +1059,8 @@ name = "layout_thread" version = "0.0.1" dependencies = [ "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "azure 0.4.6 (git+https://github.com/servo/rust-azure)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "azure 0.6.2 (git+https://github.com/servo/rust-azure)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "gfx 0.0.1", "gfx_traits 0.0.1", @@ -1082,7 +1082,7 @@ dependencies = [ "style 0.0.1", "url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", ] [[package]] @@ -1097,7 +1097,7 @@ dependencies = [ "script_traits 0.0.1", "url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", ] [[package]] @@ -1260,7 +1260,7 @@ dependencies = [ "serde 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", ] [[package]] @@ -1297,7 +1297,7 @@ dependencies = [ "url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "util 0.0.1", "uuid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", "websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1420,12 +1420,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "offscreen_gl_context" -version = "0.1.9" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1727,7 +1727,7 @@ dependencies = [ "cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "devtools_traits 0.0.1", "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1744,7 +1744,7 @@ dependencies = [ "msg 0.0.1", "net_traits 0.0.1", "num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "open 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)", "phf_macros 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1769,7 +1769,7 @@ dependencies = [ "util 0.0.1", "uuid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "video-metadata 0.1.3 (git+https://github.com/GuillaumeGomez/video-metadata-rs)", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", "websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", "xml5ever 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1782,7 +1782,7 @@ dependencies = [ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "canvas_traits 0.0.1", "cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1810,16 +1810,16 @@ dependencies = [ "canvas_traits 0.0.1", "cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "devtools_traits 0.0.1", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "layers 0.2.6 (git+https://github.com/servo/rust-layers)", + "layers 0.3.1 (git+https://github.com/servo/rust-layers)", "libc 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "net_traits 0.0.1", - "offscreen_gl_context 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "plugins 0.0.1", "profile_traits 0.0.1", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1904,7 +1904,7 @@ dependencies = [ "devtools 0.0.1", "devtools_traits 0.0.1", "env_logger 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gaol 0.0.1 (git+https://github.com/servo/gaol)", "gfx 0.0.1", "gleam 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1928,7 +1928,7 @@ dependencies = [ "util 0.0.1", "webdriver_server 0.0.1", "webrender 0.1.0 (git+https://github.com/servo/webrender)", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", ] [[package]] @@ -1941,28 +1941,29 @@ dependencies = [ [[package]] name = "servo-fontconfig" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-fontconfig-sys 2.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-fontconfig-sys 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "servo-fontconfig-sys" -version = "2.11.3" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "expat-sys 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-freetype-sys 2.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-freetype-sys 4.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "servo-freetype-sys" -version = "2.4.11" +version = "4.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "cmake 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1997,19 +1998,20 @@ dependencies = [ [[package]] name = "servo-skia" -version = "0.20130412.10" +version = "0.20130412.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cmake 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "expat-sys 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "glx 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "io-surface 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "io-surface 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-fontconfig 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-freetype-sys 2.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-fontconfig-sys 4.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-freetype-sys 4.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "servo-glutin 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", "x11 2.6.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2079,7 +2081,7 @@ dependencies = [ "cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2110,7 +2112,7 @@ name = "style_traits" version = "0.0.1" dependencies = [ "cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2292,7 +2294,7 @@ version = "0.0.1" dependencies = [ "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2409,7 +2411,7 @@ name = "webdriver_server" version = "0.0.1" dependencies = [ "cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2428,14 +2430,14 @@ dependencies = [ [[package]] name = "webrender" version = "0.1.0" -source = "git+https://github.com/servo/webrender#e2e8d91f24de961bfd6b53338e2403bc0c675aab" +source = "git+https://github.com/servo/webrender#2c25e910b2a1f0399c57a077085d5cc3451f4499" dependencies = [ "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "freetype 0.1.0 (git+https://github.com/servo/rust-freetype)", "gleam 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2443,25 +2445,25 @@ dependencies = [ "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "scoped_threadpool 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_traits 0.2.0 (git+https://github.com/servo/webrender_traits)", + "webrender_traits 0.2.1 (git+https://github.com/servo/webrender_traits)", ] [[package]] name = "webrender_traits" -version = "0.2.0" -source = "git+https://github.com/servo/webrender_traits#a26ebe4da490cc1fb60d830c73cbefb135b768b1" +version = "0.2.1" +source = "git+https://github.com/servo/webrender_traits#75d40708694949a2e092ff4c344f952e3afbaa55" dependencies = [ "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.15 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/ports/cef/Cargo.toml b/ports/cef/Cargo.toml index a199fb8f1a8..884dc604ae7 100644 --- a/ports/cef/Cargo.toml +++ b/ports/cef/Cargo.toml @@ -17,7 +17,7 @@ opt-level = 3 [dependencies] compositing = {path = "../../components/compositing"} devtools = {path = "../../components/devtools"} -euclid = "0.7.1" +euclid = "0.8.2" gleam = "0.2.8" glutin_app = {path = "../glutin"} layers = {git = "https://github.com/servo/rust-layers"} diff --git a/ports/cef/browser_host.rs b/ports/cef/browser_host.rs index fce7c6c5735..cf272f3e10b 100644 --- a/ports/cef/browser_host.rs +++ b/ports/cef/browser_host.rs @@ -11,8 +11,8 @@ use types::{cef_mouse_button_type_t, cef_mouse_event, cef_rect_t, cef_key_event, use wrappers::CefWrap; use compositing::windowing::{WindowEvent, MouseWindowEvent}; -use euclid::point::Point2D; -use euclid::size::Size2D; +use euclid::point::TypedPoint2D; +use euclid::size::TypedSize2D; use libc::{c_double, c_int}; use msg::constellation_msg::{self, KeyModifiers, KeyState}; use script_traits::{MouseButton, TouchEventType}; @@ -384,7 +384,7 @@ full_cef_class_impl! { .get_render_handler() .get_view_rect(this.downcast().browser.borrow().clone().unwrap(), &mut rect); } - let size = Size2D::typed(rect.width as u32, rect.height as u32); + let size = TypedSize2D::new(rect.width as u32, rect.height as u32); this.downcast().send_window_event(WindowEvent::Resize(size)); }} @@ -443,7 +443,7 @@ full_cef_class_impl! { cef_mouse_button_type_t::MBT_MIDDLE => MouseButton::Middle, cef_mouse_button_type_t::MBT_RIGHT => MouseButton::Right, }; - let point = Point2D::typed((*event).x as f32, (*event).y as f32); + let point = TypedPoint2D::new((*event).x as f32, (*event).y as f32); if mouse_up != 0 { this.downcast().send_window_event(WindowEvent::MouseWindowEventClass( MouseWindowEvent::Click(button_type, point))) @@ -457,7 +457,7 @@ full_cef_class_impl! { _mouse_exited: c_int [c_int],) -> () {{ let event: &cef_mouse_event = event; - let point = Point2D::typed((*event).x as f32, (*event).y as f32); + let point = TypedPoint2D::new((*event).x as f32, (*event).y as f32); this.downcast().send_window_event(WindowEvent::MouseWindowMoveEventClass(point)) }} @@ -469,8 +469,8 @@ full_cef_class_impl! { let event: &cef_mouse_event = event; let delta_x: c_int = delta_x; let delta_y: c_int = delta_y; - let delta = Point2D::typed(delta_x as f32, delta_y as f32); - let origin = Point2D::typed((*event).x as i32, (*event).y as i32); + let delta = TypedPoint2D::new(delta_x as f32, delta_y as f32); + let origin = TypedPoint2D::new((*event).x as i32, (*event).y as i32); this.downcast().send_window_event(WindowEvent::Scroll(delta, origin, TouchEventType::Move)) diff --git a/ports/cef/window.rs b/ports/cef/window.rs index 4e0b67a96b0..062f239bcdd 100644 --- a/ports/cef/window.rs +++ b/ports/cef/window.rs @@ -49,7 +49,7 @@ pub static mut DISPLAY: *mut c_void = 0 as *mut c_void; #[derive(Clone)] pub struct Window { cef_browser: RefCell<Option<CefBrowser>>, - size: TypedSize2D<DevicePixel,u32> + size: TypedSize2D<u32, DevicePixel> } #[cfg(target_os="macos")] @@ -89,7 +89,7 @@ impl Window { Rc::new(Window { cef_browser: RefCell::new(None), - size: Size2D::typed(width, height) + size: TypedSize2D::new(width, height) }) } @@ -171,7 +171,7 @@ impl Window { } impl WindowMethods for Window { - fn framebuffer_size(&self) -> TypedSize2D<DevicePixel,u32> { + fn framebuffer_size(&self) -> TypedSize2D<u32, DevicePixel> { let browser = self.cef_browser.borrow(); match *browser { None => self.size, @@ -180,8 +180,8 @@ impl WindowMethods for Window { self.size } else { let mut rect = cef_rect_t::zero(); - rect.width = self.size.width.get() as i32; - rect.height = self.size.height.get() as i32; + rect.width = self.size.width as i32; + rect.height = self.size.height as i32; if cfg!(target_os="macos") { // osx relies on virtual pixel scaling to provide sizes different from actual // pixel size on screen. other platforms are just 1.0 unless the desktop/toolkit says otherwise @@ -202,23 +202,23 @@ impl WindowMethods for Window { } } - Size2D::typed(rect.width as u32, rect.height as u32) + TypedSize2D::new(rect.width as u32, rect.height as u32) } } } } - fn size(&self) -> TypedSize2D<ScreenPx,f32> { + fn size(&self) -> TypedSize2D<f32, ScreenPx> { let browser = self.cef_browser.borrow(); match *browser { - None => Size2D::typed(400.0, 300.0), + None => TypedSize2D::new(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); - Size2D::typed(rect.width as f32, rect.height as f32) + TypedSize2D::new(rect.width as f32, rect.height as f32) } } } @@ -252,7 +252,7 @@ impl WindowMethods for Window { } } - fn scale_factor(&self) -> ScaleFactor<ScreenPx,DevicePixel,f32> { + fn scale_factor(&self) -> ScaleFactor<f32, ScreenPx, DevicePixel> { if cfg!(target_os="macos") { let browser = self.cef_browser.borrow(); match *browser { diff --git a/ports/geckolib/Cargo.lock b/ports/geckolib/Cargo.lock index 146ff5e4aec..66625474174 100644 --- a/ports/geckolib/Cargo.lock +++ b/ports/geckolib/Cargo.lock @@ -4,7 +4,7 @@ version = "0.0.1" dependencies = [ "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "gecko_bindings 0.0.1", "gecko_string_cache 0.2.20", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -140,7 +140,7 @@ dependencies = [ [[package]] name = "euclid" -version = "0.7.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -354,7 +354,7 @@ dependencies = [ "cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "gecko_bindings 0.0.1", "gecko_string_cache 0.2.20", @@ -381,7 +381,7 @@ name = "style_traits" version = "0.0.1" dependencies = [ "cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -453,7 +453,7 @@ version = "0.0.1" dependencies = [ "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/ports/geckolib/Cargo.toml b/ports/geckolib/Cargo.toml index 10a9f55d264..c27446c4f8b 100644 --- a/ports/geckolib/Cargo.toml +++ b/ports/geckolib/Cargo.toml @@ -12,7 +12,7 @@ crate-type = ["staticlib"] [dependencies] app_units = "0.2.5" env_logger = "0.3" -euclid = "0.7.1" +euclid = "0.8.2" gecko_bindings = {version = "0.0.1", path = "gecko_bindings"} gecko_string_cache = {path = "string_cache"} lazy_static = "0.2" diff --git a/ports/geckolib/data.rs b/ports/geckolib/data.rs index be287d66a98..235fa8094f0 100644 --- a/ports/geckolib/data.rs +++ b/ports/geckolib/data.rs @@ -2,7 +2,6 @@ * 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 euclid::Size2D; use euclid::size::TypedSize2D; use gecko_bindings::bindings::RawServoStyleSet; use num_cpus; @@ -56,7 +55,7 @@ lazy_static! { impl PerDocumentStyleData { pub fn new() -> PerDocumentStyleData { // FIXME(bholley): Real window size. - let window_size: TypedSize2D<ViewportPx, f32> = Size2D::typed(800.0, 600.0); + let window_size: TypedSize2D<f32, ViewportPx> = TypedSize2D::new(800.0, 600.0); let device = Device::new(MediaType::Screen, window_size); let (new_anims_sender, new_anims_receiver) = channel(); diff --git a/ports/glutin/Cargo.toml b/ports/glutin/Cargo.toml index 22e3a41c526..1e9cbac3642 100644 --- a/ports/glutin/Cargo.toml +++ b/ports/glutin/Cargo.toml @@ -11,7 +11,7 @@ path = "lib.rs" [dependencies] bitflags = "0.7" compositing = {path = "../../components/compositing"} -euclid = "0.7.1" +euclid = "0.8.2" gleam = "0.2.8" layers = {git = "https://github.com/servo/rust-layers", features = ["plugins"]} log = "0.3.5" diff --git a/ports/glutin/window.rs b/ports/glutin/window.rs index 46b2a16e921..c88755b3277 100644 --- a/ports/glutin/window.rs +++ b/ports/glutin/window.rs @@ -10,7 +10,7 @@ use compositing::windowing::{MouseWindowEvent, WindowNavigateMsg}; use compositing::windowing::{WindowEvent, WindowMethods}; use euclid::scale_factor::ScaleFactor; use euclid::size::TypedSize2D; -use euclid::{Size2D, Point2D}; +use euclid::{Size2D, Point2D, TypedPoint2D}; #[cfg(target_os = "windows")] use gdi32; use gleam::gl; use glutin; @@ -108,12 +108,12 @@ pub struct Window { } #[cfg(not(target_os = "windows"))] -fn window_creation_scale_factor() -> ScaleFactor<ScreenPx, DevicePixel, f32> { +fn window_creation_scale_factor() -> ScaleFactor<f32, ScreenPx, DevicePixel> { ScaleFactor::new(1.0) } #[cfg(target_os = "windows")] -fn window_creation_scale_factor() -> ScaleFactor<ScreenPx, DevicePixel, f32> { +fn window_creation_scale_factor() -> ScaleFactor<f32, ScreenPx, DevicePixel> { let hdc = unsafe { user32::GetDC(::std::ptr::null_mut()) }; let ppi = unsafe { gdi32::GetDeviceCaps(hdc, winapi::wingdi::LOGPIXELSY) }; ScaleFactor::new(ppi as f32 / 96.0) @@ -122,9 +122,9 @@ fn window_creation_scale_factor() -> ScaleFactor<ScreenPx, DevicePixel, f32> { impl Window { pub fn new(is_foreground: bool, - window_size: TypedSize2D<ScreenPx, u32>, + window_size: TypedSize2D<u32, ScreenPx>, parent: Option<glutin::WindowID>) -> Rc<Window> { - let win_size: TypedSize2D<DevicePixel, u32> = + let win_size: TypedSize2D<u32, DevicePixel> = (window_size.as_f32() * window_creation_scale_factor()) .as_uint().cast().expect("Window size should fit in u32"); let width = win_size.to_untyped().width; @@ -203,7 +203,7 @@ impl Window { None => {} Some(listener) => { (*listener).handle_event_from_nested_event_loop( - WindowEvent::Resize(Size2D::typed(width, height))); + WindowEvent::Resize(TypedSize2D::new(width, height))); } } } @@ -297,7 +297,7 @@ impl Window { debug!("Keyboard input without virtual key."); } Event::Resized(width, height) => { - self.event_queue.borrow_mut().push(WindowEvent::Resize(Size2D::typed(width, height))); + self.event_queue.borrow_mut().push(WindowEvent::Resize(TypedSize2D::new(width, height))); } Event::MouseInput(element_state, mouse_button, pos) => { if mouse_button == MouseButton::Left || @@ -306,7 +306,7 @@ impl Window { Some((x, y)) => { self.mouse_pos.set(Point2D::new(x, y)); self.event_queue.borrow_mut().push( - WindowEvent::MouseWindowMoveEventClass(Point2D::typed(x as f32, y as f32))); + WindowEvent::MouseWindowMoveEventClass(TypedPoint2D::new(x as f32, y as f32))); self.handle_mouse(mouse_button, element_state, x, y); } None => { @@ -319,7 +319,7 @@ impl Window { Event::MouseMoved(x, y) => { self.mouse_pos.set(Point2D::new(x, y)); self.event_queue.borrow_mut().push( - WindowEvent::MouseWindowMoveEventClass(Point2D::typed(x as f32, y as f32))); + WindowEvent::MouseWindowMoveEventClass(TypedPoint2D::new(x as f32, y as f32))); } Event::MouseWheel(delta, phase) => { let (dx, dy) = match delta { @@ -334,12 +334,12 @@ impl Window { let phase = glutin_phase_to_touch_event_type(touch.phase); let id = TouchId(touch.id as i32); - let point = Point2D::typed(touch.location.0 as f32, touch.location.1 as f32); + let point = TypedPoint2D::new(touch.location.0 as f32, touch.location.1 as f32); self.event_queue.borrow_mut().push(WindowEvent::Touch(phase, id, point)); } Event::TouchpadPressure(pressure, stage) => { let m = self.mouse_pos.get(); - let point = Point2D::typed(m.x as f32, m.y as f32); + let point = TypedPoint2D::new(m.x as f32, m.y as f32); let phase = glutin_pressure_stage_to_touchpad_pressure_phase(stage); self.event_queue.borrow_mut().push(WindowEvent::TouchpadPressure(point, pressure, phase)); } @@ -371,8 +371,8 @@ impl Window { dy = 0.0; } let mouse_pos = self.mouse_pos.get(); - let event = WindowEvent::Scroll(Point2D::typed(dx as f32, dy as f32), - Point2D::typed(mouse_pos.x as i32, mouse_pos.y as i32), + let event = WindowEvent::Scroll(TypedPoint2D::new(dx as f32, dy as f32), + TypedPoint2D::new(mouse_pos.x as i32, mouse_pos.y as i32), phase); self.event_queue.borrow_mut().push(event); } @@ -387,10 +387,11 @@ impl Window { ElementState::Pressed => { self.mouse_down_point.set(Point2D::new(x, y)); self.mouse_down_button.set(Some(button)); - MouseWindowEvent::MouseDown(MouseButton::Left, Point2D::typed(x as f32, y as f32)) + MouseWindowEvent::MouseDown(MouseButton::Left, TypedPoint2D::new(x as f32, y as f32)) } ElementState::Released => { - let mouse_up_event = MouseWindowEvent::MouseUp(MouseButton::Left, Point2D::typed(x as f32, y as f32)); + let mouse_up_event = MouseWindowEvent::MouseUp(MouseButton::Left, + TypedPoint2D::new(x as f32, y as f32)); match self.mouse_down_button.get() { None => mouse_up_event, Some(but) if button == but => { @@ -399,7 +400,7 @@ impl Window { 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, Point2D::typed(x as f32, y as f32)) + MouseWindowEvent::Click(MouseButton::Left, TypedPoint2D::new(x as f32, y as f32)) } else { mouse_up_event } @@ -671,17 +672,17 @@ fn create_window_proxy(window: &Window) -> Option<glutin::WindowProxy> { } impl WindowMethods for Window { - fn framebuffer_size(&self) -> TypedSize2D<DevicePixel, u32> { + fn framebuffer_size(&self) -> TypedSize2D<u32, DevicePixel> { let scale_factor = self.window.hidpi_factor() as u32; // TODO(ajeffrey): can this fail? let (width, height) = self.window.get_inner_size().expect("Failed to get window inner size."); - Size2D::typed(width * scale_factor, height * scale_factor) + TypedSize2D::new(width * scale_factor, height * scale_factor) } - fn size(&self) -> TypedSize2D<ScreenPx, f32> { + fn size(&self) -> TypedSize2D<f32, ScreenPx> { // TODO(ajeffrey): can this fail? let (width, height) = self.window.get_inner_size().expect("Failed to get window inner size."); - Size2D::typed(width as f32, height as f32) + TypedSize2D::new(width as f32, height as f32) } fn client_window(&self) -> (Size2D<u32>, Point2D<i32>) { @@ -722,12 +723,12 @@ impl WindowMethods for Window { } #[cfg(not(target_os = "windows"))] - fn scale_factor(&self) -> ScaleFactor<ScreenPx, DevicePixel, f32> { + fn scale_factor(&self) -> ScaleFactor<f32, ScreenPx, DevicePixel> { ScaleFactor::new(self.window.hidpi_factor()) } #[cfg(target_os = "windows")] - fn scale_factor(&self) -> ScaleFactor<ScreenPx, DevicePixel, f32> { + fn scale_factor(&self) -> ScaleFactor<f32, ScreenPx, DevicePixel> { let hdc = unsafe { user32::GetDC(::std::ptr::null_mut()) }; let ppi = unsafe { gdi32::GetDeviceCaps(hdc, winapi::wingdi::LOGPIXELSY) }; ScaleFactor::new(ppi as f32 / 96.0) diff --git a/tests/unit/style/Cargo.toml b/tests/unit/style/Cargo.toml index 844b8ad31b9..ee1465af0a7 100644 --- a/tests/unit/style/Cargo.toml +++ b/tests/unit/style/Cargo.toml @@ -12,7 +12,7 @@ doctest = false [dependencies] app_units = "0.2.5" cssparser = {version = "0.5.4", features = ["heap_size"]} -euclid = "0.7.1" +euclid = "0.8.2" rustc-serialize = "0.3" selectors = {version = "0.8", features = ["heap_size"]} string_cache = {version = "0.2", features = ["heap_size"]} diff --git a/tests/unit/style/media_queries.rs b/tests/unit/style/media_queries.rs index 3a52245a818..480503b8835 100644 --- a/tests/unit/style/media_queries.rs +++ b/tests/unit/style/media_queries.rs @@ -4,7 +4,7 @@ use app_units::Au; use cssparser::{Parser, SourcePosition}; -use euclid::size::Size2D; +use euclid::size::TypedSize2D; use std::borrow::ToOwned; use style::error_reporting::ParseErrorReporter; use style::media_queries::*; @@ -362,7 +362,7 @@ fn test_mq_malformed_expressions() { fn test_matching_simple() { let device = Device { media_type: MediaType::Screen, - viewport_size: Size2D::typed(200.0, 100.0), + viewport_size: TypedSize2D::new(200.0, 100.0), }; media_query_test(&device, "@media not all { a { color: red; } }", 0); @@ -381,7 +381,7 @@ fn test_matching_simple() { fn test_matching_width() { let device = Device { media_type: MediaType::Screen, - viewport_size: Size2D::typed(200.0, 100.0), + viewport_size: TypedSize2D::new(200.0, 100.0), }; media_query_test(&device, "@media { a { color: red; } }", 1); @@ -425,7 +425,7 @@ fn test_matching_width() { fn test_matching_invalid() { let device = Device { media_type: MediaType::Screen, - viewport_size: Size2D::typed(200.0, 100.0), + viewport_size: TypedSize2D::new(200.0, 100.0), }; media_query_test(&device, "@media fridge { a { color: red; } }", 0); diff --git a/tests/unit/style/viewport.rs b/tests/unit/style/viewport.rs index 76da4f51576..2fcfc217b2f 100644 --- a/tests/unit/style/viewport.rs +++ b/tests/unit/style/viewport.rs @@ -4,7 +4,7 @@ use cssparser::Parser; use euclid::scale_factor::ScaleFactor; -use euclid::size::Size2D; +use euclid::size::TypedSize2D; use media_queries::CSSErrorReporterTest; use style::error_reporting::ParseErrorReporter; use style::media_queries::{Device, MediaType}; @@ -84,7 +84,7 @@ macro_rules! viewport_length { #[test] fn empty_viewport_rule() { - let device = Device::new(MediaType::Screen, Size2D::typed(800., 600.)); + let device = Device::new(MediaType::Screen, TypedSize2D::new(800., 600.)); test_viewport_rule("@viewport {}", &device, |declarations, css| { println!("{}", css); @@ -107,7 +107,7 @@ macro_rules! assert_decl_eq { #[test] fn simple_viewport_rules() { - let device = Device::new(MediaType::Screen, Size2D::typed(800., 600.)); + let device = Device::new(MediaType::Screen, TypedSize2D::new(800., 600.)); test_viewport_rule("@viewport { width: auto; height: auto;\ zoom: auto; min-zoom: 0; max-zoom: 200%;\ @@ -179,7 +179,7 @@ fn simple_meta_viewport_contents() { #[test] fn cascading_within_viewport_rule() { - let device = Device::new(MediaType::Screen, Size2D::typed(800., 600.)); + let device = Device::new(MediaType::Screen, TypedSize2D::new(800., 600.)); // normal order of appearance test_viewport_rule("@viewport { min-width: 200px; min-width: auto; }", @@ -246,7 +246,7 @@ fn cascading_within_viewport_rule() { fn multiple_stylesheets_cascading() { ::util::prefs::PREFS.set("layout.viewport.enabled", ::util::prefs::PrefValue::Boolean(true)); - let device = Device::new(MediaType::Screen, Size2D::typed(800., 600.)); + let device = Device::new(MediaType::Screen, TypedSize2D::new(800., 600.)); let error_reporter = CSSErrorReporterTest; let stylesheets = vec![ stylesheet!("@viewport { min-width: 100px; min-height: 100px; zoom: 1; }", UserAgent, error_reporter.clone()), @@ -289,11 +289,11 @@ fn constrain_viewport() { } } - let initial_viewport = Size2D::typed(800., 600.); + let initial_viewport = TypedSize2D::new(800., 600.); assert_eq!(ViewportConstraints::maybe_new(initial_viewport, from_css!("")), None); - let initial_viewport = Size2D::typed(800., 600.); + let initial_viewport = TypedSize2D::new(800., 600.); assert_eq!(ViewportConstraints::maybe_new(initial_viewport, from_css!("width: 320px auto")), Some(ViewportConstraints { size: initial_viewport, @@ -306,10 +306,10 @@ fn constrain_viewport() { orientation: Orientation::Auto })); - let initial_viewport = Size2D::typed(200., 150.); + let initial_viewport = TypedSize2D::new(200., 150.); assert_eq!(ViewportConstraints::maybe_new(initial_viewport, from_css!("width: 320px auto")), Some(ViewportConstraints { - size: Size2D::typed(320., 240.), + size: TypedSize2D::new(320., 240.), initial_zoom: ScaleFactor::new(1.), min_zoom: None, @@ -319,7 +319,7 @@ fn constrain_viewport() { orientation: Orientation::Auto })); - let initial_viewport = Size2D::typed(800., 600.); + let initial_viewport = TypedSize2D::new(800., 600.); assert_eq!(ViewportConstraints::maybe_new(initial_viewport, from_css!("width: 320px auto")), Some(ViewportConstraints { size: initial_viewport, @@ -332,7 +332,7 @@ fn constrain_viewport() { orientation: Orientation::Auto })); - let initial_viewport = Size2D::typed(800., 600.); + let initial_viewport = TypedSize2D::new(800., 600.); assert_eq!(ViewportConstraints::maybe_new(initial_viewport, from_css!("width: 800px; height: 600px;\ zoom: 1;\ user-zoom: zoom;\ |