From 4e34fcd26451a09912bb53db61f4a04da8173dbb Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 7 Apr 2014 11:41:58 +0200 Subject: [PATCH] Remove trailing whitespace. --- src/components/gfx/buffer_map.rs | 6 +- src/components/gfx/font.rs | 6 +- src/components/gfx/font_list.rs | 4 +- .../gfx/freetype_impl/font_context.rs | 4 +- src/components/gfx/platform/macos/font.rs | 2 +- src/components/gfx/render_context.rs | 6 +- src/components/gfx/render_task.rs | 2 +- src/components/gfx/text/glyph.rs | 4 +- src/components/gfx/text/mod.rs | 2 +- src/components/gfx/text/shaping/mod.rs | 2 +- src/components/gfx/text/util.rs | 12 ++-- src/components/main/compositing/compositor.rs | 4 +- .../main/compositing/compositor_layer.rs | 20 +++--- src/components/main/compositing/quadtree.rs | 72 +++++++++---------- src/components/main/constellation.rs | 4 +- src/components/main/image.rs | 2 +- src/components/main/layout/floats.rs | 24 +++---- src/components/main/pipeline.rs | 2 +- .../main/platform/common/glut_windowing.rs | 2 +- src/components/main/windowing.rs | 2 +- src/components/net/image_cache_task.rs | 2 +- src/components/script/dom/characterdata.rs | 2 +- src/components/script/dom/event.rs | 2 +- .../script/dom/htmlbuttonelement.rs | 2 +- src/components/script/dom/htmlfontelement.rs | 2 +- src/components/script/dom/htmlformelement.rs | 2 +- .../script/dom/htmlsourceelement.rs | 6 +- .../script/dom/htmltablecaptionelement.rs | 2 +- src/components/script/dom/htmltimeelement.rs | 2 +- src/components/script/dom/htmlulistelement.rs | 2 +- .../script/html/hubbub_html_parser.rs | 2 +- src/components/script/layout_interface.rs | 2 +- src/components/script/script_task.rs | 4 +- src/components/style/common_types.rs | 2 +- src/components/style/media_queries.rs | 2 +- src/components/util/range.rs | 8 +-- src/components/util/time.rs | 2 +- src/components/util/vec.rs | 2 +- src/test/harness/reftest/reftest.rs | 4 +- 39 files changed, 117 insertions(+), 117 deletions(-) diff --git a/src/components/gfx/buffer_map.rs b/src/components/gfx/buffer_map.rs index b061362829cb..4c9b8950d945 100644 --- a/src/components/gfx/buffer_map.rs +++ b/src/components/gfx/buffer_map.rs @@ -74,7 +74,7 @@ impl BufferMap { counter: 0u, } } - + /// Insert a new buffer into the map. pub fn insert(&mut self, graphics_context: &NativePaintingGraphicsContext, new_buffer: T) { let new_key = BufferKey::get(new_buffer.get_size_2d()); @@ -129,7 +129,7 @@ impl BufferMap { Some(ref mut buffer_val) => { buffer_val.last_action = self.counter; self.counter += 1; - + let buffer = buffer_val.buffers.pop().take_unwrap(); self.mem -= buffer.get_mem(); if buffer_val.buffers.is_empty() { @@ -139,7 +139,7 @@ impl BufferMap { } None => None, }; - + if flag { self.map.pop(&key); // Don't store empty vectors! } diff --git a/src/components/gfx/font.rs b/src/components/gfx/font.rs index 6149588d002a..470e1bb49bbd 100644 --- a/src/components/gfx/font.rs +++ b/src/components/gfx/font.rs @@ -273,9 +273,9 @@ impl<'a> Font { fn make_shaper(&'a mut self) -> &'a Shaper { // fast path: already created a shaper match self.shaper { - Some(ref shaper) => { + Some(ref shaper) => { let s: &'a Shaper = shaper; - return s; + return s; }, None => {} } @@ -385,7 +385,7 @@ impl Font { let glyphbuf = struct__AzGlyphBuffer { mGlyphs: azglyphs.as_ptr(), - mNumGlyphs: azglyph_buf_len as uint32_t + mNumGlyphs: azglyph_buf_len as uint32_t }; unsafe { diff --git a/src/components/gfx/font_list.rs b/src/components/gfx/font_list.rs index ae149918b2ce..699d87e70635 100644 --- a/src/components/gfx/font_list.rs +++ b/src/components/gfx/font_list.rs @@ -53,7 +53,7 @@ impl FontList { } pub fn find_font_in_family<'a>(&'a mut self, - family_name: &~str, + family_name: &~str, style: &SpecifiedFontStyle) -> Option<&'a FontEntry> { // TODO(Issue #188): look up localized font family names if canonical name not found // look up canonical name @@ -81,7 +81,7 @@ impl FontList { } } -// Holds a specific font family, and the various +// Holds a specific font family, and the various pub struct FontFamily { family_name: ~str, entries: ~[FontEntry], diff --git a/src/components/gfx/freetype_impl/font_context.rs b/src/components/gfx/freetype_impl/font_context.rs index fd501cbed66b..4ae11ea9ade2 100644 --- a/src/components/gfx/freetype_impl/font_context.rs +++ b/src/components/gfx/freetype_impl/font_context.rs @@ -10,7 +10,7 @@ use self::freetype::freetype::{ FT_Library, }; use self::freetype::freetype::bindgen::{ - FT_Init_FreeType, + FT_Init_FreeType, FT_Done_FreeType }; use fontconfig::font_list::path_from_identifier; @@ -43,7 +43,7 @@ pub impl FreeTypeFontContextHandle { let result = FT_Init_FreeType(ptr::to_unsafe_ptr(&ctx)); if !result.succeeded() { fail!(); } - FreeTypeFontContextHandle { + FreeTypeFontContextHandle { ctx: @FreeTypeLibraryHandle { ctx: ctx }, } } diff --git a/src/components/gfx/platform/macos/font.rs b/src/components/gfx/platform/macos/font.rs index b294e8d3e593..38250651c24e 100644 --- a/src/components/gfx/platform/macos/font.rs +++ b/src/components/gfx/platform/macos/font.rs @@ -94,7 +94,7 @@ impl FontHandleMethods for FontHandle { fn family_name(&self) -> ~str { self.ctfont.family_name() } - + fn face_name(&self) -> ~str { self.ctfont.face_name() } diff --git a/src/components/gfx/render_context.rs b/src/components/gfx/render_context.rs index 44529c057e36..e556c04d0208 100644 --- a/src/components/gfx/render_context.rs +++ b/src/components/gfx/render_context.rs @@ -87,11 +87,11 @@ impl<'a> RenderContext<'a> { let path = path_builder.finish(); self.draw_target.push_clip(&path); - } - + } + pub fn draw_pop_clip(&self) { self.draw_target.pop_clip(); - } + } pub fn draw_image(&self, bounds: Rect, image: Arc<~Image>) { let image = image.get(); diff --git a/src/components/gfx/render_task.rs b/src/components/gfx/render_task.rs index 03c49adcd1f7..c5cb216c1db5 100644 --- a/src/components/gfx/render_task.rs +++ b/src/components/gfx/render_task.rs @@ -61,7 +61,7 @@ pub enum Msg { pub struct BufferRequest { // The rect in pixels that will be drawn to the screen screen_rect: Rect, - + // The rect in page coordinates that this tile represents page_rect: Rect, } diff --git a/src/components/gfx/text/glyph.rs b/src/components/gfx/text/glyph.rs index b9008d3e5893..da3a58f6b05e 100644 --- a/src/components/gfx/text/glyph.rs +++ b/src/components/gfx/text/glyph.rs @@ -146,7 +146,7 @@ static GLYPH_COUNT_SHIFT: u32 = 8; static FLAG_NOT_MISSING: u32 = 0x00000001; static FLAG_NOT_CLUSTER_START: u32 = 0x00000002; static FLAG_NOT_LIGATURE_GROUP_START: u32 = 0x00000004; - + static FLAG_CHAR_IS_TAB: u32 = 0x00000008; static FLAG_CHAR_IS_NEWLINE: u32 = 0x00000010; //static FLAG_CHAR_IS_LOW_SURROGATE: u32 = 0x00000020; @@ -183,7 +183,7 @@ impl GlyphEntry { fn is_cluster_start(&self) -> bool { self.has_flag(!FLAG_NOT_CLUSTER_START) } - + // True if original char was normal (U+0020) space. Other chars may // map to space glyph, but this does not account for them. fn char_is_space(&self) -> bool { diff --git a/src/components/gfx/text/mod.rs b/src/components/gfx/text/mod.rs index 13a07fa9dba8..f705347c4410 100644 --- a/src/components/gfx/text/mod.rs +++ b/src/components/gfx/text/mod.rs @@ -4,7 +4,7 @@ /* This file exists just to make it easier to import things inside of ./text/ 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/gfx/text/shaping/mod.rs b/src/components/gfx/text/shaping/mod.rs index db3267271273..9dd15aa03c14 100644 --- a/src/components/gfx/text/shaping/mod.rs +++ b/src/components/gfx/text/shaping/mod.rs @@ -2,7 +2,7 @@ * 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/. */ -//! Shaper encapsulates a specific shaper, such as Harfbuzz, +//! Shaper encapsulates a specific shaper, such as Harfbuzz, /// Uniscribe, Pango, or Coretext. /// /// Currently, only harfbuzz bindings are implemented. diff --git a/src/components/gfx/text/util.rs b/src/components/gfx/text/util.rs index e80596bde870..76a1d669f20b 100644 --- a/src/components/gfx/text/util.rs +++ b/src/components/gfx/text/util.rs @@ -10,12 +10,12 @@ enum CompressionMode { DiscardNewline } -// ported from Gecko's nsTextFrameUtils::TransformText. -// +// ported from Gecko's nsTextFrameUtils::TransformText. +// // High level TODOs: // // * Issue #113: consider incoming text state (arabic, etc) -// and propogate outgoing text state (dual of above) +// and propogate outgoing text state (dual of above) // // * Issue #114: record skipped and kept chars for mapping original to new text // @@ -42,7 +42,7 @@ pub fn transform_text(text: &str, mode: CompressionMode, incoming_whitespace: bo if ch != '\n' { new_line_index += 1; } - out_str.push_char(ch); + out_str.push_char(ch); } } text.len() > 0 && is_in_whitespace(text.char_at_reverse(0), mode) @@ -53,7 +53,7 @@ pub fn transform_text(text: &str, mode: CompressionMode, incoming_whitespace: bo for ch in text.chars() { // TODO: discard newlines between CJK chars let mut next_in_whitespace: bool = is_in_whitespace(ch, mode); - + if !next_in_whitespace { if is_always_discardable_char(ch) { // revert whitespace setting, since this char was discarded @@ -75,7 +75,7 @@ pub fn transform_text(text: &str, mode: CompressionMode, incoming_whitespace: bo in_whitespace = next_in_whitespace; } /* /for str::each_char */ in_whitespace - } + } }; return (out_str, out_whitespace); diff --git a/src/components/main/compositing/compositor.rs b/src/components/main/compositing/compositor.rs index 486c2256f6ae..9ae6520c38ac 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> } @@ -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::(*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 c0477048e9f0..678c8c03bd5a 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) { @@ -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) -> (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 f35703840956..6dbc65932b78 100644 --- a/src/components/main/compositing/quadtree.rs +++ b/src/components/main/compositing/quadtree.rs @@ -90,7 +90,7 @@ impl Quadtree { 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 QuadtreeNode { /// 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 QuadtreeNode { None => {} } } - + return ret; } @@ -297,7 +297,7 @@ impl QuadtreeNode { || 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 QuadtreeNode { } 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 QuadtreeNode { 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 QuadtreeNode { }; 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 QuadtreeNode { || 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 QuadtreeNode { 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 QuadtreeNode { 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 QuadtreeNode { _ => 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 = 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 QuadtreeNode { None => {}, } } - + match del_quad { Some(quad) => { self.quadrants[quad as int] = None; @@ -453,7 +453,7 @@ impl QuadtreeNode { 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 QuadtreeNode { || 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 QuadtreeNode { _ => (~[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 QuadtreeNode { } } }; - + 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 QuadtreeNode { 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 QuadtreeNode { 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 38efb0849635..85fbc5eaf301 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 d03b93b1a118..99d07a0f4eeb 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 e3cdf4f8b65a..1ee060c2679d 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 f61de1deba31..4c9af26edb89 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, diff --git a/src/components/main/platform/common/glut_windowing.rs b/src/components/main/platform/common/glut_windowing.rs index 6a344e7f74b6..2d59539a8d1f 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 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 370cb48ae498..b376eb90d244 100644 --- a/src/components/main/windowing.rs +++ b/src/components/main/windowing.rs @@ -61,7 +61,7 @@ pub trait WindowMethods { fn size(&self) -> Size2D; /// 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; diff --git a/src/components/net/image_cache_task.rs b/src/components/net/image_cache_task.rs index 1544ce05f3b7..622443ab2d87 100644 --- a/src/components/net/image_cache_task.rs +++ b/src/components/net/image_cache_task.rs @@ -442,7 +442,7 @@ impl ImageCacheTask { pub fn send(&self, msg: Msg) { self.chan.send(msg); } - + #[cfg(test)] fn wait_for_store(&self) -> Receiver<()> { let (chan, port) = channel(); diff --git a/src/components/script/dom/characterdata.rs b/src/components/script/dom/characterdata.rs index 40b72f18faf0..6bb25f6b5cb0 100644 --- a/src/components/script/dom/characterdata.rs +++ b/src/components/script/dom/characterdata.rs @@ -37,7 +37,7 @@ impl CharacterData { data: data } } - + pub fn Data(&self) -> DOMString { self.data.clone() } diff --git a/src/components/script/dom/event.rs b/src/components/script/dom/event.rs index c54688626d33..dcd4fbe9ed57 100644 --- a/src/components/script/dom/event.rs +++ b/src/components/script/dom/event.rs @@ -14,7 +14,7 @@ use servo_util::str::DOMString; use geom::point::Point2D; pub enum Event_ { - ResizeEvent(uint, uint), + ResizeEvent(uint, uint), ReflowEvent, ClickEvent(uint, Point2D), MouseDownEvent(uint, Point2D), diff --git a/src/components/script/dom/htmlbuttonelement.rs b/src/components/script/dom/htmlbuttonelement.rs index 06614bd48f8c..6e6a84bfb361 100644 --- a/src/components/script/dom/htmlbuttonelement.rs +++ b/src/components/script/dom/htmlbuttonelement.rs @@ -110,7 +110,7 @@ impl HTMLButtonElement { pub fn SetName(&mut self, _name: DOMString) -> ErrorResult { Ok(()) } - + pub fn Type(&self) -> DOMString { ~"" } diff --git a/src/components/script/dom/htmlfontelement.rs b/src/components/script/dom/htmlfontelement.rs index b0c67b585c9b..aad93fb79e79 100644 --- a/src/components/script/dom/htmlfontelement.rs +++ b/src/components/script/dom/htmlfontelement.rs @@ -56,7 +56,7 @@ impl HTMLFontElement { pub fn SetFace(&mut self, _face: DOMString) -> ErrorResult { Ok(()) } - + pub fn Size(&self) -> DOMString { ~"" } diff --git a/src/components/script/dom/htmlformelement.rs b/src/components/script/dom/htmlformelement.rs index cabb71cc1ea9..9bbbb8089db5 100644 --- a/src/components/script/dom/htmlformelement.rs +++ b/src/components/script/dom/htmlformelement.rs @@ -124,7 +124,7 @@ impl HTMLFormElement { pub fn Length(&self) -> i32 { 0 } - + pub fn Submit(&self) -> ErrorResult { Ok(()) } diff --git a/src/components/script/dom/htmlsourceelement.rs b/src/components/script/dom/htmlsourceelement.rs index ecaa2d5f8dfd..5542d5bf038b 100644 --- a/src/components/script/dom/htmlsourceelement.rs +++ b/src/components/script/dom/htmlsourceelement.rs @@ -44,7 +44,7 @@ impl HTMLSourceElement { pub fn Src(&self) -> DOMString { ~"" } - + pub fn SetSrc(&mut self, _src: DOMString) -> ErrorResult { Ok(()) } @@ -52,7 +52,7 @@ impl HTMLSourceElement { pub fn Type(&self) -> DOMString { ~"" } - + pub fn SetType(&mut self, _type: DOMString) -> ErrorResult { Ok(()) } @@ -60,7 +60,7 @@ impl HTMLSourceElement { pub fn Media(&self) -> DOMString { ~"" } - + pub fn SetMedia(&mut self, _media: DOMString) -> ErrorResult { Ok(()) } diff --git a/src/components/script/dom/htmltablecaptionelement.rs b/src/components/script/dom/htmltablecaptionelement.rs index 980fb4199f62..d92e87dd1999 100644 --- a/src/components/script/dom/htmltablecaptionelement.rs +++ b/src/components/script/dom/htmltablecaptionelement.rs @@ -44,7 +44,7 @@ impl HTMLTableCaptionElement { pub fn Align(&self) -> DOMString { ~"" } - + pub fn SetAlign(&mut self, _align: DOMString) -> ErrorResult { Ok(()) } diff --git a/src/components/script/dom/htmltimeelement.rs b/src/components/script/dom/htmltimeelement.rs index d41916b7afb0..5e6f3113842d 100644 --- a/src/components/script/dom/htmltimeelement.rs +++ b/src/components/script/dom/htmltimeelement.rs @@ -44,7 +44,7 @@ impl HTMLTimeElement { pub fn DateTime(&self) -> DOMString { ~"" } - + pub fn SetDateTime(&mut self, _dateTime: DOMString) -> ErrorResult { Ok(()) } diff --git a/src/components/script/dom/htmlulistelement.rs b/src/components/script/dom/htmlulistelement.rs index e99dd6a7c440..207b0866b7cf 100644 --- a/src/components/script/dom/htmlulistelement.rs +++ b/src/components/script/dom/htmlulistelement.rs @@ -44,7 +44,7 @@ impl HTMLUListElement { pub fn Compact(&self) -> bool { false } - + pub fn SetCompact(&mut self, _compact: bool) -> ErrorResult { Ok(()) } diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs index e2a870c2bc99..438d28a4898e 100644 --- a/src/components/script/html/hubbub_html_parser.rs +++ b/src/components/script/html/hubbub_html_parser.rs @@ -54,7 +54,7 @@ type JSResult = ~[JSFile]; enum CSSMessage { CSSTaskNewFile(StylesheetProvenance), - CSSTaskExit + CSSTaskExit } enum JSMessage { diff --git a/src/components/script/layout_interface.rs b/src/components/script/layout_interface.rs index 9dce53fc36e0..197bd123e3fd 100644 --- a/src/components/script/layout_interface.rs +++ b/src/components/script/layout_interface.rs @@ -73,7 +73,7 @@ pub struct ContentBoxesResponse(~[Rect]); pub struct HitTestResponse(UntrustedNodeAddress); pub struct MouseOverResponse(~[UntrustedNodeAddress]); -/// Determines which part of the +/// Determines which part of the #[deriving(Eq, Ord, TotalEq, TotalOrd)] pub enum DocumentDamageLevel { /// Reflow, but do not perform CSS selector matching. diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs index c1c3a717f1a6..90d0025d237d 100644 --- a/src/components/script/script_task.rs +++ b/src/components/script/script_task.rs @@ -742,7 +742,7 @@ impl ScriptTask { // needs to be smarter about exiting pipelines. None => false, } - + } /// The entry point to document loading. Defines bindings, sets up the window and document @@ -1096,7 +1096,7 @@ impl ScriptTask { } None => { target_compare = true; } } - + if target_compare { if mouse_over_targets.is_some() { page.damage(MatchSelectorsDocumentDamage); diff --git a/src/components/style/common_types.rs b/src/components/style/common_types.rs index 655646790bbb..40bea8f7c709 100644 --- a/src/components/style/common_types.rs +++ b/src/components/style/common_types.rs @@ -55,7 +55,7 @@ pub mod specified { } pub fn parse_dimension(value: CSSFloat, unit: &str) -> Option { // FIXME: Workaround for https://github.com/mozilla/rust/issues/10683 - let unit_lower = unit.to_ascii_lower(); + let unit_lower = unit.to_ascii_lower(); match unit_lower.as_slice() { "px" => Some(Length::from_px(value)), "in" => Some(Au_(Au((value * AU_PER_IN) as i32))), diff --git a/src/components/style/media_queries.rs b/src/components/style/media_queries.rs index d939bf4d9a9a..ebc19b0c80d1 100644 --- a/src/components/style/media_queries.rs +++ b/src/components/style/media_queries.rs @@ -84,7 +84,7 @@ pub fn parse_media_query_list(input: &[ComponentValue]) -> MediaQueryList { let mq = match next { Some(&Ident(ref value)) => { // FIXME: Workaround for https://github.com/mozilla/rust/issues/10683 - let value_lower = value.to_ascii_lower(); + let value_lower = value.to_ascii_lower(); match value_lower.as_slice() { "screen" => Some(MediaQuery{ media_type: MediaType(Screen) }), "print" => Some(MediaQuery{ media_type: MediaType(Print) }), diff --git a/src/components/util/range.rs b/src/components/util/range.rs index 59e298769099..94c3e783df13 100644 --- a/src/components/util/range.rs +++ b/src/components/util/range.rs @@ -72,17 +72,17 @@ impl Range { } #[inline] - pub fn shift_by(&mut self, i: int) { + pub fn shift_by(&mut self, i: int) { self.off = ((self.off as int) + i) as uint; } #[inline] - pub fn extend_by(&mut self, i: int) { + pub fn extend_by(&mut self, i: int) { self.len = ((self.len as int) + i) as uint; } #[inline] - pub fn extend_to(&mut self, i: uint) { + pub fn extend_to(&mut self, i: uint) { self.len = i - self.off; } @@ -120,7 +120,7 @@ impl Range { } if self.begin() > other.end() { return EntirelyAfter; - } + } if self.begin() == other.begin() && self.end() == other.end() { return Coincides; } diff --git a/src/components/util/time.rs b/src/components/util/time.rs index 721befef7549..0f5802c4d8b5 100644 --- a/src/components/util/time.rs +++ b/src/components/util/time.rs @@ -212,7 +212,7 @@ impl Profiler { } -pub fn profile(category: ProfilerCategory, +pub fn profile(category: ProfilerCategory, profiler_chan: ProfilerChan, callback: || -> T) -> T { diff --git a/src/components/util/vec.rs b/src/components/util/vec.rs index 2fabf8455ef8..aad8da7d04e4 100644 --- a/src/components/util/vec.rs +++ b/src/components/util/vec.rs @@ -65,7 +65,7 @@ fn test_match(b: &T, a: Option<&T>) -> bool { None => false, Some(t) => t == b } -} +} pub fn zip_copies(avec: &[A], bvec: &[B]) -> ~[(A,B)] { avec.iter().map(|x| x.clone()) diff --git a/src/test/harness/reftest/reftest.rs b/src/test/harness/reftest/reftest.rs index 3b2a09eff88e..e8f548323d7f 100644 --- a/src/test/harness/reftest/reftest.rs +++ b/src/test/harness/reftest/reftest.rs @@ -99,7 +99,7 @@ fn parse_lists(filenames: &[~str], servo_args: &[~str]) -> Vec { let src_dir = src_path.display().to_str(); let file_left = src_dir + "/" + parts[1]; let file_right = src_dir + "/" + parts[2]; - + let reftest = Reftest { name: parts[1] + " / " + parts[2], kind: kind, @@ -151,7 +151,7 @@ fn check_reftest(reftest: Reftest) { let pixels: ~[u8] = left.pixels.iter().zip(right.pixels.iter()).map(|(&a, &b)| { if a as i8 - b as i8 == 0 { // White for correct - 0xFF + 0xFF } else { // "1100" in the RGBA channel with an error for an incorrect value // This results in some number of C0 and FFs, which is much more