diff options
author | Ms2ger <ms2ger@gmail.com> | 2014-04-07 11:41:58 +0200 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2014-04-07 11:41:58 +0200 |
commit | 4e34fcd26451a09912bb53db61f4a04da8173dbb (patch) | |
tree | 10113bcce656b1058a2fe9f6cc3b3972feeb9e83 /src/components/main | |
parent | 86c83f7bfc2c748047dbd9b2d4b788e77714c980 (diff) | |
download | servo-4e34fcd26451a09912bb53db61f4a04da8173dbb.tar.gz servo-4e34fcd26451a09912bb53db61f4a04da8173dbb.zip |
Remove trailing whitespace.
Diffstat (limited to 'src/components/main')
-rw-r--r-- | src/components/main/compositing/compositor.rs | 4 | ||||
-rw-r--r-- | src/components/main/compositing/compositor_layer.rs | 20 | ||||
-rw-r--r-- | src/components/main/compositing/quadtree.rs | 72 | ||||
-rw-r--r-- | src/components/main/constellation.rs | 4 | ||||
-rw-r--r-- | src/components/main/image.rs | 2 | ||||
-rw-r--r-- | src/components/main/layout/floats.rs | 24 | ||||
-rw-r--r-- | src/components/main/pipeline.rs | 2 | ||||
-rw-r--r-- | src/components/main/platform/common/glut_windowing.rs | 2 | ||||
-rw-r--r-- | src/components/main/windowing.rs | 2 |
9 files changed, 66 insertions, 66 deletions
diff --git a/src/components/main/compositing/compositor.rs b/src/components/main/compositing/compositor.rs index 486c2256f6a..9ae6520c38a 100644 --- a/src/components/main/compositing/compositor.rs +++ b/src/components/main/compositing/compositor.rs @@ -107,7 +107,7 @@ pub struct IOCompositor { /// The channel on which messages can be sent to the profiler. profiler_chan: ProfilerChan, - /// Pending scroll to fragment event, if any + /// Pending scroll to fragment event, if any fragment_point: Option<Point2D<f32>> } @@ -751,7 +751,7 @@ impl IOCompositor { // Render to PNG. We must read from the back buffer (ie, before // self.window.present()) as OpenGL ES 2 does not have glReadBuffer(). - if self.load_complete && self.ready_state == FinishedLoading + if self.load_complete && self.ready_state == FinishedLoading && self.opts.output_file.is_some() { let (width, height) = (self.window_size.width as uint, self.window_size.height as uint); let path = from_str::<Path>(*self.opts.output_file.get_ref()).unwrap(); diff --git a/src/components/main/compositing/compositor_layer.rs b/src/components/main/compositing/compositor_layer.rs index c0477048e9f..678c8c03bd5 100644 --- a/src/components/main/compositing/compositor_layer.rs +++ b/src/components/main/compositing/compositor_layer.rs @@ -82,7 +82,7 @@ pub struct CompositorLayer { /// add_buffer() calls that don't match the current epoch will be ignored. epoch: Epoch, - /// The behavior of this layer when a scroll message is received. + /// The behavior of this layer when a scroll message is received. wants_scroll_events: WantsScrollEventsFlag, /// Whether an ancestor layer that receives scroll events moves this layer. @@ -188,7 +188,7 @@ impl CompositorLayer { unrendered_color: gfx::color::rgba(0.0, 0.0, 0.0, 0.0), } } - + /// Creates a new root `CompositorLayer` bound to a composition pipeline with an optional page /// size. If no page size is given, the layer is initially hidden and initialized without a /// quadtree. @@ -379,7 +379,7 @@ impl CompositorLayer { result } - // Takes in a MouseWindowEvent, determines if it should be passed to children, and + // Takes in a MouseWindowEvent, determines if it should be passed to children, and // sends the event off to the appropriate pipeline. NB: the cursor position is in // page coordinates. pub fn send_mouse_event(&self, event: MouseWindowEvent, cursor: Point2D<f32>) { @@ -398,7 +398,7 @@ impl CompositorLayer { } } } - + // This mouse event is mine! let message = match event { MouseWindowClickEvent(button, _) => ClickEvent(button, cursor), @@ -518,7 +518,7 @@ impl CompositorLayer { true } None => { - // ID does not match any of our immediate children, so recurse on + // ID does not match any of our immediate children, so recurse on // descendents (including hidden children) self.children .mut_iter() @@ -634,7 +634,7 @@ impl CompositorLayer { fn texture_flip_and_target(_: bool, _: Size2D<uint>) -> (Flip, TextureTarget) { (NoFlip, TextureTarget2D) } - + // A helper method to resize sublayers. fn resize_helper(&mut self, pipeline_id: PipelineId, @@ -679,8 +679,8 @@ impl CompositorLayer { true } None => false, - }; - + }; + if found { // Boolean flag to get around double borrow of self self.set_occlusions(); return true @@ -790,7 +790,7 @@ impl CompositorLayer { }; } } - + // Add LayerBuffers to the specified layer. Returns the layer buffer set back if the layer that // matches the given pipeline ID was not found; otherwise returns None and consumes the layer // buffer set. @@ -910,7 +910,7 @@ impl CompositorLayer { .any(|kid| kid.invalidate_rect(pipeline_id, layer_id, rect)) } } - + // Recursively sets occluded portions of quadtrees to Hidden, so that they do not ask for // tile requests. If layers are moved, resized, or deleted, these portions may be updated. fn set_occlusions(&mut self) { diff --git a/src/components/main/compositing/quadtree.rs b/src/components/main/compositing/quadtree.rs index f3570384095..6dbc65932b7 100644 --- a/src/components/main/compositing/quadtree.rs +++ b/src/components/main/compositing/quadtree.rs @@ -90,7 +90,7 @@ impl<T: Tile> Quadtree<T> { let num_tiles = div_ceil(longer, tile_size); let power_of_two = next_power_of_two(num_tiles); let size = power_of_two * tile_size; - + Quadtree { root: ~QuadtreeNode { tile: None, @@ -255,14 +255,14 @@ impl<T: Tile> QuadtreeNode<T> { /// Determine which child contains a given point in page coords. fn get_quadrant(&self, x: f32, y: f32) -> Quadrant { if x < self.origin.x + self.size / 2.0 { - if y < self.origin.y + self.size / 2.0 { + if y < self.origin.y + self.size / 2.0 { TL - } else { + } else { BL } - } else if y < self.origin.y + self.size / 2.0 { + } else if y < self.origin.y + self.size / 2.0 { TR - } else { + } else { BR } } @@ -282,7 +282,7 @@ impl<T: Tile> QuadtreeNode<T> { None => {} } } - + return ret; } @@ -297,7 +297,7 @@ impl<T: Tile> QuadtreeNode<T> { || y >= self.origin.y + self.size || y < self.origin.y { fail!("Quadtree: Tried to add tile to invalid region"); } - + if self.size <= tile_size { // We are the child let old_size = self.tile_mem; self.tile_mem = tile.get_mem(); @@ -316,7 +316,7 @@ impl<T: Tile> QuadtreeNode<T> { } self.status = Normal; (self.tile_mem as int - old_size as int, unused_tiles) - } else { // Send tile to children + } else { // Send tile to children let quad = self.get_quadrant(x, y); match self.quadrants[quad as int] { Some(ref mut child) => { @@ -324,7 +324,7 @@ impl<T: Tile> QuadtreeNode<T> { self.tile_mem = (self.tile_mem as int + delta) as uint; (delta, unused) } - None => { // Make new child + None => { // Make new child let new_size = self.size / 2.0; let new_x = match quad { TL | BL => self.origin.x, @@ -336,7 +336,7 @@ impl<T: Tile> QuadtreeNode<T> { }; let mut c = ~QuadtreeNode::new_child(new_x, new_y, new_size); let (delta, unused) = c.add_tile(x, y, tile, tile_size); - self.tile_mem = (self.tile_mem as int + delta) as uint; + self.tile_mem = (self.tile_mem as int + delta) as uint; self.quadrants[quad as int] = Some(c); (delta, unused) } @@ -351,7 +351,7 @@ impl<T: Tile> QuadtreeNode<T> { || y >= self.origin.y + self.size || y < self.origin.y { fail!("Quadtree: Tried to query a tile rect outside of range"); } - + if self.size <= tile_size { let pix_x = (self.origin.x * scale).ceil() as uint; let pix_y = (self.origin.y * scale).ceil() as uint; @@ -363,7 +363,7 @@ impl<T: Tile> QuadtreeNode<T> { return BufferRequest(Rect(Point2D(pix_x, pix_y), Size2D(pix_width, pix_height)), Rect(Point2D(self.origin.x, self.origin.y), Size2D(page_width, page_height))); } - + let quad = self.get_quadrant(x,y); match self.quadrants[quad as int] { None => { @@ -394,7 +394,7 @@ impl<T: Tile> QuadtreeNode<T> { if self.tile.is_some() { let ret = replace(&mut(self.tile), None); return match (ret, &self.quadrants) { - (Some(tile), &[None, None, None, None]) => { + (Some(tile), &[None, None, None, None]) => { let size = -(tile.get_mem() as int); (Some(tile), true, size) } @@ -405,19 +405,19 @@ impl<T: Tile> QuadtreeNode<T> { _ => fail!("Quadtree: tile query failure in remove_tile"), } } - + // This is a hacky heuristic to find a tile that is "far away". There are better methods. let quad = self.get_quadrant(x, y); let queue = match quad { - TL => [BR, BL, TR, TL], + TL => [BR, BL, TR, TL], TR => [BL, BR, TL, TR], - BL => [TR, TL, BR, BL], + BL => [TR, TL, BR, BL], BR => [TL, TR, BL, BR], }; let mut del_quad: Option<Quadrant> = None; let mut ret = (None, false, 0); - + for quad in queue.iter() { match self.quadrants[*quad as int] { Some(ref mut child) => { @@ -440,7 +440,7 @@ impl<T: Tile> QuadtreeNode<T> { None => {}, } } - + match del_quad { Some(quad) => { self.quadrants[quad as int] = None; @@ -453,7 +453,7 @@ impl<T: Tile> QuadtreeNode<T> { None => ret, } } - + /// Given a window rect in page coordinates, returns a BufferRequest array, /// an unused tile array, and the difference in tile memory between the new and old quadtree nodes. /// The override bool will be true if a parent node was marked as invalid; child nodes will be @@ -481,11 +481,11 @@ impl<T: Tile> QuadtreeNode<T> { || w_x >= clip.width || w_y >= clip.height { return (~[], ~[], 0); } - + // clip window to visible region let w_width = w_width.min(clip.width - w_x); let w_height = w_height.min(clip.height - w_y); - + if s_size <= tile_size { // We are the child return match self.tile { _ if self.status == Rendering || self.status == Hidden => (~[], ~[], 0), @@ -517,11 +517,11 @@ impl<T: Tile> QuadtreeNode<T> { _ => (~[self.get_tile_rect(s_x, s_y, clip.width, clip.height, scale, tile_size)], ~[], 0), } } - + // Otherwise, we either have children or will have children let w_tl_quad = self.get_quadrant(w_x, w_y); let w_br_quad = self.get_quadrant(w_x + w_width, w_y + w_height); - + // Figure out which quadrants the window is in let builder = |push: |Quadrant|| { match (w_tl_quad, w_br_quad) { @@ -545,13 +545,13 @@ impl<T: Tile> QuadtreeNode<T> { } } }; - + let quads_to_check = slice::build(Some(4), builder); - + let mut request = ~[]; let mut unused = ~[]; let mut delta = 0; - + for quad in quads_to_check.iter() { // Recurse into child let new_window = match *quad { @@ -570,7 +570,7 @@ impl<T: Tile> QuadtreeNode<T> { w_y.max(s_y + s_size / 2.0)), Size2D(w_width.min(w_x + w_width - (s_x + s_size / 2.0)), w_height.min(w_y + w_height - (s_y + s_size / 2.0)))), - + }; let override = override || self.status == Invalid; @@ -594,11 +594,11 @@ impl<T: Tile> QuadtreeNode<T> { ret } }; - + delta = delta + c_delta; request = request + c_request; unused.push_all_move(c_unused); - } + } self.tile_mem = (self.tile_mem as int + delta) as uint; (request, unused, delta) } @@ -662,12 +662,12 @@ pub fn test_resize() { struct T { a: int, } - + impl Tile for T { fn get_mem(&self) -> uint { 1 } - + fn is_valid(&self, _: f32) -> bool { true } @@ -677,7 +677,7 @@ pub fn test_resize() { fn mark_wont_leak(&mut self) {} fn destroy(self, _: &NativePaintingGraphicsContext) {} } - + let mut q = Quadtree::new(Size2D(6u, 6), 1, None); q.add_tile_pixel(0, 0, 1f32, T{a: 0}); q.add_tile_pixel(5, 5, 1f32, T{a: 1}); @@ -697,12 +697,12 @@ pub fn test() { struct T { a: int, } - + impl Tile for T { fn get_mem(&self) -> uint { 1 } - + fn is_valid(&self, _: f32) -> bool { true } @@ -712,9 +712,9 @@ pub fn test() { fn mark_wont_leak(&mut self) {} fn destroy(self, _: &NativePaintingGraphicsContext) {} } - + let mut q = Quadtree::new(Size2D(8u, 8), 2, Some(4)); - q.add_tile_pixel(0, 0, 1f32, T{a: 0}); + q.add_tile_pixel(0, 0, 1f32, T{a: 0}); q.add_tile_pixel(0, 0, 2f32, T{a: 1}); q.add_tile_pixel(0, 0, 2f32, T{a: 2}); q.add_tile_pixel(2, 0, 2f32, T{a: 3}); diff --git a/src/components/main/constellation.rs b/src/components/main/constellation.rs index 38efb084963..85fbc5eaf30 100644 --- a/src/components/main/constellation.rs +++ b/src/components/main/constellation.rs @@ -349,7 +349,7 @@ impl Constellation { self.handle_load_url_msg(source_id, url); } // A page loaded through one of several methods above has completed all parsing, - // script, and reflow messages have been sent. + // script, and reflow messages have been sent. LoadCompleteMsg(pipeline_id, url) => { debug!("constellation got load complete message"); self.compositor_chan.send(LoadComplete(pipeline_id, url)); @@ -473,7 +473,7 @@ impl Constellation { { // Update a child's frame rect and inform its script task of the change, - // if it hasn't been already. Optionally inform the compositor if + // if it hasn't been already. Optionally inform the compositor if // resize happens immediately. let update_child_rect = |child_frame_tree: &mut ChildFrameTree, is_active: bool| { child_frame_tree.rect = Some(rect.clone()); diff --git a/src/components/main/image.rs b/src/components/main/image.rs index d03b93b1a11..99d07a0f4ee 100644 --- a/src/components/main/image.rs +++ b/src/components/main/image.rs @@ -4,7 +4,7 @@ /* This file exists just to make it easier to import things inside of ./images/ without specifying the file they came out of imports. - + Note that you still must define each of the files as a module in servo.rc. This is not ideal and may be changed in the future. */ diff --git a/src/components/main/layout/floats.rs b/src/components/main/layout/floats.rs index e3cdf4f8b65..1ee060c2679 100644 --- a/src/components/main/layout/floats.rs +++ b/src/components/main/layout/floats.rs @@ -185,17 +185,17 @@ impl Floats { debug!("float_pos: {}, float_size: {}", float_pos, float_size); match float.kind { - FloatLeft if float_pos.x + float_size.width > max_left && + FloatLeft if float_pos.x + float_size.width > max_left && float_pos.y + float_size.height > top && float_pos.y < top + height => { max_left = float_pos.x + float_size.width; - + l_top = Some(float_pos.y); l_bottom = Some(float_pos.y + float_size.height); debug!("available_rect: collision with left float: new max_left is {}", max_left); } - FloatRight if float_pos.x < min_right && + FloatRight if float_pos.x < min_right && float_pos.y + float_size.height > top && float_pos.y < top + height => { min_right = float_pos.x; @@ -213,7 +213,7 @@ impl Floats { // two areas. Also make sure we never return a top smaller than the // given upper bound. let (top, bottom) = match (r_top, r_bottom, l_top, l_bottom) { - (Some(r_top), Some(r_bottom), Some(l_top), Some(l_bottom)) => + (Some(r_top), Some(r_bottom), Some(l_top), Some(l_bottom)) => range_intersect(max(top, r_top), r_bottom, max(top, l_top), l_bottom), (None, None, Some(l_top), Some(l_bottom)) => (max(top, l_top), l_bottom), @@ -225,8 +225,8 @@ impl Floats { // FIXME(eatkinson): This assertion is too strong and fails in some cases. It is OK to // return negative widths since we check against that right away, but we should still // undersrtand why they occur and add a stronger assertion here. - // assert!(max_left < min_right); - + // assert!(max_left < min_right); + assert!(top <= bottom, "Float position error"); Some(Rect { @@ -317,25 +317,25 @@ impl Floats { // If there are no floats blocking us, return the current location // TODO(eatkinson): integrate with overflow None => { - return match info.kind { + return match info.kind { FloatLeft => { Rect(Point2D(Au(0), float_y), Size2D(info.max_width, Au(i32::MAX))) } FloatRight => { - Rect(Point2D(info.max_width - info.size.width, float_y), + Rect(Point2D(info.max_width - info.size.width, float_y), Size2D(info.max_width, Au(i32::MAX))) } } } Some(rect) => { - assert!(rect.origin.y + rect.size.height != float_y, + assert!(rect.origin.y + rect.size.height != float_y, "Non-terminating float placement"); - + // Place here if there is enough room if rect.size.width >= info.size.width { - let height = self.max_height_for_bounds(rect.origin.x, - rect.origin.y, + let height = self.max_height_for_bounds(rect.origin.x, + rect.origin.y, rect.size.width); let height = height.unwrap_or(Au(i32::MAX)); return match info.kind { diff --git a/src/components/main/pipeline.rs b/src/components/main/pipeline.rs index f61de1deba3..4c9af26edb8 100644 --- a/src/components/main/pipeline.rs +++ b/src/components/main/pipeline.rs @@ -21,7 +21,7 @@ use std::cell::RefCell; use std::rc::Rc; use url::Url; -/// A uniquely-identifiable pipeline of script task, layout task, and render task. +/// A uniquely-identifiable pipeline of script task, layout task, and render task. pub struct Pipeline { id: PipelineId, subpage_id: Option<SubpageId>, diff --git a/src/components/main/platform/common/glut_windowing.rs b/src/components/main/platform/common/glut_windowing.rs index 6a344e7f74b..2d59539a8d1 100644 --- a/src/components/main/platform/common/glut_windowing.rs +++ b/src/components/main/platform/common/glut_windowing.rs @@ -148,7 +148,7 @@ impl WindowMethods<Application> for Window { fn present(&self) { glut::swap_buffers(); } - + fn recv(&self) -> WindowEvent { if !self.event_queue.with_mut(|queue| queue.is_empty()) { return self.event_queue.with_mut(|queue| queue.shift().unwrap()) diff --git a/src/components/main/windowing.rs b/src/components/main/windowing.rs index 370cb48ae49..b376eb90d24 100644 --- a/src/components/main/windowing.rs +++ b/src/components/main/windowing.rs @@ -61,7 +61,7 @@ pub trait WindowMethods<A> { fn size(&self) -> Size2D<f32>; /// Presents the window to the screen (perhaps by page flipping). fn present(&self); - + /// Spins the event loop and returns the next event. fn recv(&self) -> WindowEvent; |