Remove trailing whitespace.

This commit is contained in:
Ms2ger 2014-04-07 11:41:58 +02:00
parent 86c83f7bfc
commit 4e34fcd264
39 changed files with 117 additions and 117 deletions

View file

@ -74,7 +74,7 @@ impl<T: Tile> BufferMap<T> {
counter: 0u, counter: 0u,
} }
} }
/// Insert a new buffer into the map. /// Insert a new buffer into the map.
pub fn insert(&mut self, graphics_context: &NativePaintingGraphicsContext, new_buffer: T) { pub fn insert(&mut self, graphics_context: &NativePaintingGraphicsContext, new_buffer: T) {
let new_key = BufferKey::get(new_buffer.get_size_2d()); let new_key = BufferKey::get(new_buffer.get_size_2d());
@ -129,7 +129,7 @@ impl<T: Tile> BufferMap<T> {
Some(ref mut buffer_val) => { Some(ref mut buffer_val) => {
buffer_val.last_action = self.counter; buffer_val.last_action = self.counter;
self.counter += 1; self.counter += 1;
let buffer = buffer_val.buffers.pop().take_unwrap(); let buffer = buffer_val.buffers.pop().take_unwrap();
self.mem -= buffer.get_mem(); self.mem -= buffer.get_mem();
if buffer_val.buffers.is_empty() { if buffer_val.buffers.is_empty() {
@ -139,7 +139,7 @@ impl<T: Tile> BufferMap<T> {
} }
None => None, None => None,
}; };
if flag { if flag {
self.map.pop(&key); // Don't store empty vectors! self.map.pop(&key); // Don't store empty vectors!
} }

View file

@ -273,9 +273,9 @@ impl<'a> Font {
fn make_shaper(&'a mut self) -> &'a Shaper { fn make_shaper(&'a mut self) -> &'a Shaper {
// fast path: already created a shaper // fast path: already created a shaper
match self.shaper { match self.shaper {
Some(ref shaper) => { Some(ref shaper) => {
let s: &'a Shaper = shaper; let s: &'a Shaper = shaper;
return s; return s;
}, },
None => {} None => {}
} }
@ -385,7 +385,7 @@ impl Font {
let glyphbuf = struct__AzGlyphBuffer { let glyphbuf = struct__AzGlyphBuffer {
mGlyphs: azglyphs.as_ptr(), mGlyphs: azglyphs.as_ptr(),
mNumGlyphs: azglyph_buf_len as uint32_t mNumGlyphs: azglyph_buf_len as uint32_t
}; };
unsafe { unsafe {

View file

@ -53,7 +53,7 @@ impl FontList {
} }
pub fn find_font_in_family<'a>(&'a mut self, pub fn find_font_in_family<'a>(&'a mut self,
family_name: &~str, family_name: &~str,
style: &SpecifiedFontStyle) -> Option<&'a FontEntry> { style: &SpecifiedFontStyle) -> Option<&'a FontEntry> {
// TODO(Issue #188): look up localized font family names if canonical name not found // TODO(Issue #188): look up localized font family names if canonical name not found
// look up canonical name // 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 { pub struct FontFamily {
family_name: ~str, family_name: ~str,
entries: ~[FontEntry], entries: ~[FontEntry],

View file

@ -10,7 +10,7 @@ use self::freetype::freetype::{
FT_Library, FT_Library,
}; };
use self::freetype::freetype::bindgen::{ use self::freetype::freetype::bindgen::{
FT_Init_FreeType, FT_Init_FreeType,
FT_Done_FreeType FT_Done_FreeType
}; };
use fontconfig::font_list::path_from_identifier; use fontconfig::font_list::path_from_identifier;
@ -43,7 +43,7 @@ pub impl FreeTypeFontContextHandle {
let result = FT_Init_FreeType(ptr::to_unsafe_ptr(&ctx)); let result = FT_Init_FreeType(ptr::to_unsafe_ptr(&ctx));
if !result.succeeded() { fail!(); } if !result.succeeded() { fail!(); }
FreeTypeFontContextHandle { FreeTypeFontContextHandle {
ctx: @FreeTypeLibraryHandle { ctx: ctx }, ctx: @FreeTypeLibraryHandle { ctx: ctx },
} }
} }

View file

@ -94,7 +94,7 @@ impl FontHandleMethods for FontHandle {
fn family_name(&self) -> ~str { fn family_name(&self) -> ~str {
self.ctfont.family_name() self.ctfont.family_name()
} }
fn face_name(&self) -> ~str { fn face_name(&self) -> ~str {
self.ctfont.face_name() self.ctfont.face_name()
} }

View file

@ -87,11 +87,11 @@ impl<'a> RenderContext<'a> {
let path = path_builder.finish(); let path = path_builder.finish();
self.draw_target.push_clip(&path); self.draw_target.push_clip(&path);
} }
pub fn draw_pop_clip(&self) { pub fn draw_pop_clip(&self) {
self.draw_target.pop_clip(); self.draw_target.pop_clip();
} }
pub fn draw_image(&self, bounds: Rect<Au>, image: Arc<~Image>) { pub fn draw_image(&self, bounds: Rect<Au>, image: Arc<~Image>) {
let image = image.get(); let image = image.get();

View file

@ -61,7 +61,7 @@ pub enum Msg {
pub struct BufferRequest { pub struct BufferRequest {
// The rect in pixels that will be drawn to the screen // The rect in pixels that will be drawn to the screen
screen_rect: Rect<uint>, screen_rect: Rect<uint>,
// The rect in page coordinates that this tile represents // The rect in page coordinates that this tile represents
page_rect: Rect<f32>, page_rect: Rect<f32>,
} }

View file

@ -146,7 +146,7 @@ static GLYPH_COUNT_SHIFT: u32 = 8;
static FLAG_NOT_MISSING: u32 = 0x00000001; static FLAG_NOT_MISSING: u32 = 0x00000001;
static FLAG_NOT_CLUSTER_START: u32 = 0x00000002; static FLAG_NOT_CLUSTER_START: u32 = 0x00000002;
static FLAG_NOT_LIGATURE_GROUP_START: u32 = 0x00000004; static FLAG_NOT_LIGATURE_GROUP_START: u32 = 0x00000004;
static FLAG_CHAR_IS_TAB: u32 = 0x00000008; static FLAG_CHAR_IS_TAB: u32 = 0x00000008;
static FLAG_CHAR_IS_NEWLINE: u32 = 0x00000010; static FLAG_CHAR_IS_NEWLINE: u32 = 0x00000010;
//static FLAG_CHAR_IS_LOW_SURROGATE: u32 = 0x00000020; //static FLAG_CHAR_IS_LOW_SURROGATE: u32 = 0x00000020;
@ -183,7 +183,7 @@ impl GlyphEntry {
fn is_cluster_start(&self) -> bool { fn is_cluster_start(&self) -> bool {
self.has_flag(!FLAG_NOT_CLUSTER_START) self.has_flag(!FLAG_NOT_CLUSTER_START)
} }
// True if original char was normal (U+0020) space. Other chars may // True if original char was normal (U+0020) space. Other chars may
// map to space glyph, but this does not account for them. // map to space glyph, but this does not account for them.
fn char_is_space(&self) -> bool { fn char_is_space(&self) -> bool {

View file

@ -4,7 +4,7 @@
/* This file exists just to make it easier to import things inside of /* This file exists just to make it easier to import things inside of
./text/ without specifying the file they came out of imports. ./text/ without specifying the file they came out of imports.
Note that you still must define each of the files as a module in 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. */ servo.rc. This is not ideal and may be changed in the future. */

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * 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. /// Uniscribe, Pango, or Coretext.
/// ///
/// Currently, only harfbuzz bindings are implemented. /// Currently, only harfbuzz bindings are implemented.

View file

@ -10,12 +10,12 @@ enum CompressionMode {
DiscardNewline DiscardNewline
} }
// ported from Gecko's nsTextFrameUtils::TransformText. // ported from Gecko's nsTextFrameUtils::TransformText.
// //
// High level TODOs: // High level TODOs:
// //
// * Issue #113: consider incoming text state (arabic, etc) // * 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 // * 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' { if ch != '\n' {
new_line_index += 1; 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) 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() { for ch in text.chars() {
// TODO: discard newlines between CJK chars // TODO: discard newlines between CJK chars
let mut next_in_whitespace: bool = is_in_whitespace(ch, mode); let mut next_in_whitespace: bool = is_in_whitespace(ch, mode);
if !next_in_whitespace { if !next_in_whitespace {
if is_always_discardable_char(ch) { if is_always_discardable_char(ch) {
// revert whitespace setting, since this char was discarded // 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; in_whitespace = next_in_whitespace;
} /* /for str::each_char */ } /* /for str::each_char */
in_whitespace in_whitespace
} }
}; };
return (out_str, out_whitespace); return (out_str, out_whitespace);

View file

@ -107,7 +107,7 @@ pub struct IOCompositor {
/// The channel on which messages can be sent to the profiler. /// The channel on which messages can be sent to the profiler.
profiler_chan: ProfilerChan, profiler_chan: ProfilerChan,
/// Pending scroll to fragment event, if any /// Pending scroll to fragment event, if any
fragment_point: Option<Point2D<f32>> fragment_point: Option<Point2D<f32>>
} }
@ -751,7 +751,7 @@ impl IOCompositor {
// Render to PNG. We must read from the back buffer (ie, before // Render to PNG. We must read from the back buffer (ie, before
// self.window.present()) as OpenGL ES 2 does not have glReadBuffer(). // 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() { && self.opts.output_file.is_some() {
let (width, height) = (self.window_size.width as uint, self.window_size.height as uint); 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(); let path = from_str::<Path>(*self.opts.output_file.get_ref()).unwrap();

View file

@ -82,7 +82,7 @@ pub struct CompositorLayer {
/// add_buffer() calls that don't match the current epoch will be ignored. /// add_buffer() calls that don't match the current epoch will be ignored.
epoch: Epoch, 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, wants_scroll_events: WantsScrollEventsFlag,
/// Whether an ancestor layer that receives scroll events moves this layer. /// 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), 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 /// 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 /// size. If no page size is given, the layer is initially hidden and initialized without a
/// quadtree. /// quadtree.
@ -379,7 +379,7 @@ impl CompositorLayer {
result 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 // sends the event off to the appropriate pipeline. NB: the cursor position is in
// page coordinates. // page coordinates.
pub fn send_mouse_event(&self, event: MouseWindowEvent, cursor: Point2D<f32>) { pub fn send_mouse_event(&self, event: MouseWindowEvent, cursor: Point2D<f32>) {
@ -398,7 +398,7 @@ impl CompositorLayer {
} }
} }
} }
// This mouse event is mine! // This mouse event is mine!
let message = match event { let message = match event {
MouseWindowClickEvent(button, _) => ClickEvent(button, cursor), MouseWindowClickEvent(button, _) => ClickEvent(button, cursor),
@ -518,7 +518,7 @@ impl CompositorLayer {
true true
} }
None => { 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) // descendents (including hidden children)
self.children self.children
.mut_iter() .mut_iter()
@ -634,7 +634,7 @@ impl CompositorLayer {
fn texture_flip_and_target(_: bool, _: Size2D<uint>) -> (Flip, TextureTarget) { fn texture_flip_and_target(_: bool, _: Size2D<uint>) -> (Flip, TextureTarget) {
(NoFlip, TextureTarget2D) (NoFlip, TextureTarget2D)
} }
// A helper method to resize sublayers. // A helper method to resize sublayers.
fn resize_helper(&mut self, fn resize_helper(&mut self,
pipeline_id: PipelineId, pipeline_id: PipelineId,
@ -679,8 +679,8 @@ impl CompositorLayer {
true true
} }
None => false, None => false,
}; };
if found { // Boolean flag to get around double borrow of self if found { // Boolean flag to get around double borrow of self
self.set_occlusions(); self.set_occlusions();
return true return true
@ -790,7 +790,7 @@ impl CompositorLayer {
}; };
} }
} }
// Add LayerBuffers to the specified layer. Returns the layer buffer set back if the layer that // 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 // matches the given pipeline ID was not found; otherwise returns None and consumes the layer
// buffer set. // buffer set.
@ -910,7 +910,7 @@ impl CompositorLayer {
.any(|kid| kid.invalidate_rect(pipeline_id, layer_id, rect)) .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 // 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. // tile requests. If layers are moved, resized, or deleted, these portions may be updated.
fn set_occlusions(&mut self) { fn set_occlusions(&mut self) {

View file

@ -90,7 +90,7 @@ impl<T: Tile> Quadtree<T> {
let num_tiles = div_ceil(longer, tile_size); let num_tiles = div_ceil(longer, tile_size);
let power_of_two = next_power_of_two(num_tiles); let power_of_two = next_power_of_two(num_tiles);
let size = power_of_two * tile_size; let size = power_of_two * tile_size;
Quadtree { Quadtree {
root: ~QuadtreeNode { root: ~QuadtreeNode {
tile: None, tile: None,
@ -255,14 +255,14 @@ impl<T: Tile> QuadtreeNode<T> {
/// Determine which child contains a given point in page coords. /// Determine which child contains a given point in page coords.
fn get_quadrant(&self, x: f32, y: f32) -> Quadrant { fn get_quadrant(&self, x: f32, y: f32) -> Quadrant {
if x < self.origin.x + self.size / 2.0 { 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 TL
} else { } else {
BL BL
} }
} else if y < self.origin.y + self.size / 2.0 { } else if y < self.origin.y + self.size / 2.0 {
TR TR
} else { } else {
BR BR
} }
} }
@ -282,7 +282,7 @@ impl<T: Tile> QuadtreeNode<T> {
None => {} None => {}
} }
} }
return ret; return ret;
} }
@ -297,7 +297,7 @@ impl<T: Tile> QuadtreeNode<T> {
|| y >= self.origin.y + self.size || y < self.origin.y { || y >= self.origin.y + self.size || y < self.origin.y {
fail!("Quadtree: Tried to add tile to invalid region"); fail!("Quadtree: Tried to add tile to invalid region");
} }
if self.size <= tile_size { // We are the child if self.size <= tile_size { // We are the child
let old_size = self.tile_mem; let old_size = self.tile_mem;
self.tile_mem = tile.get_mem(); self.tile_mem = tile.get_mem();
@ -316,7 +316,7 @@ impl<T: Tile> QuadtreeNode<T> {
} }
self.status = Normal; self.status = Normal;
(self.tile_mem as int - old_size as int, unused_tiles) (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); let quad = self.get_quadrant(x, y);
match self.quadrants[quad as int] { match self.quadrants[quad as int] {
Some(ref mut child) => { Some(ref mut child) => {
@ -324,7 +324,7 @@ impl<T: Tile> QuadtreeNode<T> {
self.tile_mem = (self.tile_mem as int + delta) as uint; self.tile_mem = (self.tile_mem as int + delta) as uint;
(delta, unused) (delta, unused)
} }
None => { // Make new child None => { // Make new child
let new_size = self.size / 2.0; let new_size = self.size / 2.0;
let new_x = match quad { let new_x = match quad {
TL | BL => self.origin.x, 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 mut c = ~QuadtreeNode::new_child(new_x, new_y, new_size);
let (delta, unused) = c.add_tile(x, y, tile, tile_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); self.quadrants[quad as int] = Some(c);
(delta, unused) (delta, unused)
} }
@ -351,7 +351,7 @@ impl<T: Tile> QuadtreeNode<T> {
|| y >= self.origin.y + self.size || y < self.origin.y { || y >= self.origin.y + self.size || y < self.origin.y {
fail!("Quadtree: Tried to query a tile rect outside of range"); fail!("Quadtree: Tried to query a tile rect outside of range");
} }
if self.size <= tile_size { if self.size <= tile_size {
let pix_x = (self.origin.x * scale).ceil() as uint; let pix_x = (self.origin.x * scale).ceil() as uint;
let pix_y = (self.origin.y * 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)), 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))); Rect(Point2D(self.origin.x, self.origin.y), Size2D(page_width, page_height)));
} }
let quad = self.get_quadrant(x,y); let quad = self.get_quadrant(x,y);
match self.quadrants[quad as int] { match self.quadrants[quad as int] {
None => { None => {
@ -394,7 +394,7 @@ impl<T: Tile> QuadtreeNode<T> {
if self.tile.is_some() { if self.tile.is_some() {
let ret = replace(&mut(self.tile), None); let ret = replace(&mut(self.tile), None);
return match (ret, &self.quadrants) { return match (ret, &self.quadrants) {
(Some(tile), &[None, None, None, None]) => { (Some(tile), &[None, None, None, None]) => {
let size = -(tile.get_mem() as int); let size = -(tile.get_mem() as int);
(Some(tile), true, size) (Some(tile), true, size)
} }
@ -405,19 +405,19 @@ impl<T: Tile> QuadtreeNode<T> {
_ => fail!("Quadtree: tile query failure in remove_tile"), _ => 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. // 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 quad = self.get_quadrant(x, y);
let queue = match quad { let queue = match quad {
TL => [BR, BL, TR, TL], TL => [BR, BL, TR, TL],
TR => [BL, BR, TL, TR], TR => [BL, BR, TL, TR],
BL => [TR, TL, BR, BL], BL => [TR, TL, BR, BL],
BR => [TL, TR, BL, BR], BR => [TL, TR, BL, BR],
}; };
let mut del_quad: Option<Quadrant> = None; let mut del_quad: Option<Quadrant> = None;
let mut ret = (None, false, 0); let mut ret = (None, false, 0);
for quad in queue.iter() { for quad in queue.iter() {
match self.quadrants[*quad as int] { match self.quadrants[*quad as int] {
Some(ref mut child) => { Some(ref mut child) => {
@ -440,7 +440,7 @@ impl<T: Tile> QuadtreeNode<T> {
None => {}, None => {},
} }
} }
match del_quad { match del_quad {
Some(quad) => { Some(quad) => {
self.quadrants[quad as int] = None; self.quadrants[quad as int] = None;
@ -453,7 +453,7 @@ impl<T: Tile> QuadtreeNode<T> {
None => ret, None => ret,
} }
} }
/// Given a window rect in page coordinates, returns a BufferRequest array, /// 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. /// 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 /// 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 { || w_x >= clip.width || w_y >= clip.height {
return (~[], ~[], 0); return (~[], ~[], 0);
} }
// clip window to visible region // clip window to visible region
let w_width = w_width.min(clip.width - w_x); let w_width = w_width.min(clip.width - w_x);
let w_height = w_height.min(clip.height - w_y); let w_height = w_height.min(clip.height - w_y);
if s_size <= tile_size { // We are the child if s_size <= tile_size { // We are the child
return match self.tile { return match self.tile {
_ if self.status == Rendering || self.status == Hidden => (~[], ~[], 0), _ 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), _ => (~[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 // Otherwise, we either have children or will have children
let w_tl_quad = self.get_quadrant(w_x, w_y); 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); let w_br_quad = self.get_quadrant(w_x + w_width, w_y + w_height);
// Figure out which quadrants the window is in // Figure out which quadrants the window is in
let builder = |push: |Quadrant|| { let builder = |push: |Quadrant|| {
match (w_tl_quad, w_br_quad) { 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 quads_to_check = slice::build(Some(4), builder);
let mut request = ~[]; let mut request = ~[];
let mut unused = ~[]; let mut unused = ~[];
let mut delta = 0; let mut delta = 0;
for quad in quads_to_check.iter() { for quad in quads_to_check.iter() {
// Recurse into child // Recurse into child
let new_window = match *quad { let new_window = match *quad {
@ -570,7 +570,7 @@ impl<T: Tile> QuadtreeNode<T> {
w_y.max(s_y + s_size / 2.0)), w_y.max(s_y + s_size / 2.0)),
Size2D(w_width.min(w_x + w_width - (s_x + 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)))), w_height.min(w_y + w_height - (s_y + s_size / 2.0)))),
}; };
let override = override || self.status == Invalid; let override = override || self.status == Invalid;
@ -594,11 +594,11 @@ impl<T: Tile> QuadtreeNode<T> {
ret ret
} }
}; };
delta = delta + c_delta; delta = delta + c_delta;
request = request + c_request; request = request + c_request;
unused.push_all_move(c_unused); unused.push_all_move(c_unused);
} }
self.tile_mem = (self.tile_mem as int + delta) as uint; self.tile_mem = (self.tile_mem as int + delta) as uint;
(request, unused, delta) (request, unused, delta)
} }
@ -662,12 +662,12 @@ pub fn test_resize() {
struct T { struct T {
a: int, a: int,
} }
impl Tile for T { impl Tile for T {
fn get_mem(&self) -> uint { fn get_mem(&self) -> uint {
1 1
} }
fn is_valid(&self, _: f32) -> bool { fn is_valid(&self, _: f32) -> bool {
true true
} }
@ -677,7 +677,7 @@ pub fn test_resize() {
fn mark_wont_leak(&mut self) {} fn mark_wont_leak(&mut self) {}
fn destroy(self, _: &NativePaintingGraphicsContext) {} fn destroy(self, _: &NativePaintingGraphicsContext) {}
} }
let mut q = Quadtree::new(Size2D(6u, 6), 1, None); let mut q = Quadtree::new(Size2D(6u, 6), 1, None);
q.add_tile_pixel(0, 0, 1f32, T{a: 0}); q.add_tile_pixel(0, 0, 1f32, T{a: 0});
q.add_tile_pixel(5, 5, 1f32, T{a: 1}); q.add_tile_pixel(5, 5, 1f32, T{a: 1});
@ -697,12 +697,12 @@ pub fn test() {
struct T { struct T {
a: int, a: int,
} }
impl Tile for T { impl Tile for T {
fn get_mem(&self) -> uint { fn get_mem(&self) -> uint {
1 1
} }
fn is_valid(&self, _: f32) -> bool { fn is_valid(&self, _: f32) -> bool {
true true
} }
@ -712,9 +712,9 @@ pub fn test() {
fn mark_wont_leak(&mut self) {} fn mark_wont_leak(&mut self) {}
fn destroy(self, _: &NativePaintingGraphicsContext) {} fn destroy(self, _: &NativePaintingGraphicsContext) {}
} }
let mut q = Quadtree::new(Size2D(8u, 8), 2, Some(4)); 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: 1});
q.add_tile_pixel(0, 0, 2f32, T{a: 2}); q.add_tile_pixel(0, 0, 2f32, T{a: 2});
q.add_tile_pixel(2, 0, 2f32, T{a: 3}); q.add_tile_pixel(2, 0, 2f32, T{a: 3});

View file

@ -349,7 +349,7 @@ impl Constellation {
self.handle_load_url_msg(source_id, url); self.handle_load_url_msg(source_id, url);
} }
// A page loaded through one of several methods above has completed all parsing, // 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) => { LoadCompleteMsg(pipeline_id, url) => {
debug!("constellation got load complete message"); debug!("constellation got load complete message");
self.compositor_chan.send(LoadComplete(pipeline_id, url)); 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, // 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. // resize happens immediately.
let update_child_rect = |child_frame_tree: &mut ChildFrameTree, is_active: bool| { let update_child_rect = |child_frame_tree: &mut ChildFrameTree, is_active: bool| {
child_frame_tree.rect = Some(rect.clone()); child_frame_tree.rect = Some(rect.clone());

View file

@ -4,7 +4,7 @@
/* This file exists just to make it easier to import things inside of /* This file exists just to make it easier to import things inside of
./images/ without specifying the file they came out of imports. ./images/ without specifying the file they came out of imports.
Note that you still must define each of the files as a module in 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. */ servo.rc. This is not ideal and may be changed in the future. */

View file

@ -185,17 +185,17 @@ impl Floats {
debug!("float_pos: {}, float_size: {}", float_pos, float_size); debug!("float_pos: {}, float_size: {}", float_pos, float_size);
match float.kind { 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 => { float_pos.y + float_size.height > top && float_pos.y < top + height => {
max_left = float_pos.x + float_size.width; max_left = float_pos.x + float_size.width;
l_top = Some(float_pos.y); l_top = Some(float_pos.y);
l_bottom = Some(float_pos.y + float_size.height); l_bottom = Some(float_pos.y + float_size.height);
debug!("available_rect: collision with left float: new max_left is {}", debug!("available_rect: collision with left float: new max_left is {}",
max_left); 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 => { float_pos.y + float_size.height > top && float_pos.y < top + height => {
min_right = float_pos.x; min_right = float_pos.x;
@ -213,7 +213,7 @@ impl Floats {
// two areas. Also make sure we never return a top smaller than the // two areas. Also make sure we never return a top smaller than the
// given upper bound. // given upper bound.
let (top, bottom) = match (r_top, r_bottom, l_top, l_bottom) { 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), 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), (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 // 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 // return negative widths since we check against that right away, but we should still
// undersrtand why they occur and add a stronger assertion here. // 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"); assert!(top <= bottom, "Float position error");
Some(Rect { Some(Rect {
@ -317,25 +317,25 @@ impl Floats {
// If there are no floats blocking us, return the current location // If there are no floats blocking us, return the current location
// TODO(eatkinson): integrate with overflow // TODO(eatkinson): integrate with overflow
None => { None => {
return match info.kind { return match info.kind {
FloatLeft => { FloatLeft => {
Rect(Point2D(Au(0), float_y), Rect(Point2D(Au(0), float_y),
Size2D(info.max_width, Au(i32::MAX))) Size2D(info.max_width, Au(i32::MAX)))
} }
FloatRight => { 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))) Size2D(info.max_width, Au(i32::MAX)))
} }
} }
} }
Some(rect) => { Some(rect) => {
assert!(rect.origin.y + rect.size.height != float_y, assert!(rect.origin.y + rect.size.height != float_y,
"Non-terminating float placement"); "Non-terminating float placement");
// Place here if there is enough room // Place here if there is enough room
if rect.size.width >= info.size.width { if rect.size.width >= info.size.width {
let height = self.max_height_for_bounds(rect.origin.x, let height = self.max_height_for_bounds(rect.origin.x,
rect.origin.y, rect.origin.y,
rect.size.width); rect.size.width);
let height = height.unwrap_or(Au(i32::MAX)); let height = height.unwrap_or(Au(i32::MAX));
return match info.kind { return match info.kind {

View file

@ -21,7 +21,7 @@ use std::cell::RefCell;
use std::rc::Rc; use std::rc::Rc;
use url::Url; 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 { pub struct Pipeline {
id: PipelineId, id: PipelineId,
subpage_id: Option<SubpageId>, subpage_id: Option<SubpageId>,

View file

@ -148,7 +148,7 @@ impl WindowMethods<Application> for Window {
fn present(&self) { fn present(&self) {
glut::swap_buffers(); glut::swap_buffers();
} }
fn recv(&self) -> WindowEvent { fn recv(&self) -> WindowEvent {
if !self.event_queue.with_mut(|queue| queue.is_empty()) { if !self.event_queue.with_mut(|queue| queue.is_empty()) {
return self.event_queue.with_mut(|queue| queue.shift().unwrap()) return self.event_queue.with_mut(|queue| queue.shift().unwrap())

View file

@ -61,7 +61,7 @@ pub trait WindowMethods<A> {
fn size(&self) -> Size2D<f32>; fn size(&self) -> Size2D<f32>;
/// Presents the window to the screen (perhaps by page flipping). /// Presents the window to the screen (perhaps by page flipping).
fn present(&self); fn present(&self);
/// Spins the event loop and returns the next event. /// Spins the event loop and returns the next event.
fn recv(&self) -> WindowEvent; fn recv(&self) -> WindowEvent;

View file

@ -442,7 +442,7 @@ impl ImageCacheTask {
pub fn send(&self, msg: Msg) { pub fn send(&self, msg: Msg) {
self.chan.send(msg); self.chan.send(msg);
} }
#[cfg(test)] #[cfg(test)]
fn wait_for_store(&self) -> Receiver<()> { fn wait_for_store(&self) -> Receiver<()> {
let (chan, port) = channel(); let (chan, port) = channel();

View file

@ -37,7 +37,7 @@ impl CharacterData {
data: data data: data
} }
} }
pub fn Data(&self) -> DOMString { pub fn Data(&self) -> DOMString {
self.data.clone() self.data.clone()
} }

View file

@ -14,7 +14,7 @@ use servo_util::str::DOMString;
use geom::point::Point2D; use geom::point::Point2D;
pub enum Event_ { pub enum Event_ {
ResizeEvent(uint, uint), ResizeEvent(uint, uint),
ReflowEvent, ReflowEvent,
ClickEvent(uint, Point2D<f32>), ClickEvent(uint, Point2D<f32>),
MouseDownEvent(uint, Point2D<f32>), MouseDownEvent(uint, Point2D<f32>),

View file

@ -110,7 +110,7 @@ impl HTMLButtonElement {
pub fn SetName(&mut self, _name: DOMString) -> ErrorResult { pub fn SetName(&mut self, _name: DOMString) -> ErrorResult {
Ok(()) Ok(())
} }
pub fn Type(&self) -> DOMString { pub fn Type(&self) -> DOMString {
~"" ~""
} }

View file

@ -56,7 +56,7 @@ impl HTMLFontElement {
pub fn SetFace(&mut self, _face: DOMString) -> ErrorResult { pub fn SetFace(&mut self, _face: DOMString) -> ErrorResult {
Ok(()) Ok(())
} }
pub fn Size(&self) -> DOMString { pub fn Size(&self) -> DOMString {
~"" ~""
} }

View file

@ -124,7 +124,7 @@ impl HTMLFormElement {
pub fn Length(&self) -> i32 { pub fn Length(&self) -> i32 {
0 0
} }
pub fn Submit(&self) -> ErrorResult { pub fn Submit(&self) -> ErrorResult {
Ok(()) Ok(())
} }

View file

@ -44,7 +44,7 @@ impl HTMLSourceElement {
pub fn Src(&self) -> DOMString { pub fn Src(&self) -> DOMString {
~"" ~""
} }
pub fn SetSrc(&mut self, _src: DOMString) -> ErrorResult { pub fn SetSrc(&mut self, _src: DOMString) -> ErrorResult {
Ok(()) Ok(())
} }
@ -52,7 +52,7 @@ impl HTMLSourceElement {
pub fn Type(&self) -> DOMString { pub fn Type(&self) -> DOMString {
~"" ~""
} }
pub fn SetType(&mut self, _type: DOMString) -> ErrorResult { pub fn SetType(&mut self, _type: DOMString) -> ErrorResult {
Ok(()) Ok(())
} }
@ -60,7 +60,7 @@ impl HTMLSourceElement {
pub fn Media(&self) -> DOMString { pub fn Media(&self) -> DOMString {
~"" ~""
} }
pub fn SetMedia(&mut self, _media: DOMString) -> ErrorResult { pub fn SetMedia(&mut self, _media: DOMString) -> ErrorResult {
Ok(()) Ok(())
} }

View file

@ -44,7 +44,7 @@ impl HTMLTableCaptionElement {
pub fn Align(&self) -> DOMString { pub fn Align(&self) -> DOMString {
~"" ~""
} }
pub fn SetAlign(&mut self, _align: DOMString) -> ErrorResult { pub fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
Ok(()) Ok(())
} }

View file

@ -44,7 +44,7 @@ impl HTMLTimeElement {
pub fn DateTime(&self) -> DOMString { pub fn DateTime(&self) -> DOMString {
~"" ~""
} }
pub fn SetDateTime(&mut self, _dateTime: DOMString) -> ErrorResult { pub fn SetDateTime(&mut self, _dateTime: DOMString) -> ErrorResult {
Ok(()) Ok(())
} }

View file

@ -44,7 +44,7 @@ impl HTMLUListElement {
pub fn Compact(&self) -> bool { pub fn Compact(&self) -> bool {
false false
} }
pub fn SetCompact(&mut self, _compact: bool) -> ErrorResult { pub fn SetCompact(&mut self, _compact: bool) -> ErrorResult {
Ok(()) Ok(())
} }

View file

@ -54,7 +54,7 @@ type JSResult = ~[JSFile];
enum CSSMessage { enum CSSMessage {
CSSTaskNewFile(StylesheetProvenance), CSSTaskNewFile(StylesheetProvenance),
CSSTaskExit CSSTaskExit
} }
enum JSMessage { enum JSMessage {

View file

@ -73,7 +73,7 @@ pub struct ContentBoxesResponse(~[Rect<Au>]);
pub struct HitTestResponse(UntrustedNodeAddress); pub struct HitTestResponse(UntrustedNodeAddress);
pub struct MouseOverResponse(~[UntrustedNodeAddress]); pub struct MouseOverResponse(~[UntrustedNodeAddress]);
/// Determines which part of the /// Determines which part of the
#[deriving(Eq, Ord, TotalEq, TotalOrd)] #[deriving(Eq, Ord, TotalEq, TotalOrd)]
pub enum DocumentDamageLevel { pub enum DocumentDamageLevel {
/// Reflow, but do not perform CSS selector matching. /// Reflow, but do not perform CSS selector matching.

View file

@ -742,7 +742,7 @@ impl ScriptTask {
// needs to be smarter about exiting pipelines. // needs to be smarter about exiting pipelines.
None => false, None => false,
} }
} }
/// The entry point to document loading. Defines bindings, sets up the window and document /// The entry point to document loading. Defines bindings, sets up the window and document
@ -1096,7 +1096,7 @@ impl ScriptTask {
} }
None => { target_compare = true; } None => { target_compare = true; }
} }
if target_compare { if target_compare {
if mouse_over_targets.is_some() { if mouse_over_targets.is_some() {
page.damage(MatchSelectorsDocumentDamage); page.damage(MatchSelectorsDocumentDamage);

View file

@ -55,7 +55,7 @@ pub mod specified {
} }
pub fn parse_dimension(value: CSSFloat, unit: &str) -> Option<Length> { pub fn parse_dimension(value: CSSFloat, unit: &str) -> Option<Length> {
// FIXME: Workaround for https://github.com/mozilla/rust/issues/10683 // 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() { match unit_lower.as_slice() {
"px" => Some(Length::from_px(value)), "px" => Some(Length::from_px(value)),
"in" => Some(Au_(Au((value * AU_PER_IN) as i32))), "in" => Some(Au_(Au((value * AU_PER_IN) as i32))),

View file

@ -84,7 +84,7 @@ pub fn parse_media_query_list(input: &[ComponentValue]) -> MediaQueryList {
let mq = match next { let mq = match next {
Some(&Ident(ref value)) => { Some(&Ident(ref value)) => {
// FIXME: Workaround for https://github.com/mozilla/rust/issues/10683 // 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() { match value_lower.as_slice() {
"screen" => Some(MediaQuery{ media_type: MediaType(Screen) }), "screen" => Some(MediaQuery{ media_type: MediaType(Screen) }),
"print" => Some(MediaQuery{ media_type: MediaType(Print) }), "print" => Some(MediaQuery{ media_type: MediaType(Print) }),

View file

@ -72,17 +72,17 @@ impl Range {
} }
#[inline] #[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; self.off = ((self.off as int) + i) as uint;
} }
#[inline] #[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; self.len = ((self.len as int) + i) as uint;
} }
#[inline] #[inline]
pub fn extend_to(&mut self, i: uint) { pub fn extend_to(&mut self, i: uint) {
self.len = i - self.off; self.len = i - self.off;
} }
@ -120,7 +120,7 @@ impl Range {
} }
if self.begin() > other.end() { if self.begin() > other.end() {
return EntirelyAfter; return EntirelyAfter;
} }
if self.begin() == other.begin() && self.end() == other.end() { if self.begin() == other.begin() && self.end() == other.end() {
return Coincides; return Coincides;
} }

View file

@ -212,7 +212,7 @@ impl Profiler {
} }
pub fn profile<T>(category: ProfilerCategory, pub fn profile<T>(category: ProfilerCategory,
profiler_chan: ProfilerChan, profiler_chan: ProfilerChan,
callback: || -> T) callback: || -> T)
-> T { -> T {

View file

@ -65,7 +65,7 @@ fn test_match<T: Eq>(b: &T, a: Option<&T>) -> bool {
None => false, None => false,
Some(t) => t == b Some(t) => t == b
} }
} }
pub fn zip_copies<A: Clone, B: Clone>(avec: &[A], bvec: &[B]) -> ~[(A,B)] { pub fn zip_copies<A: Clone, B: Clone>(avec: &[A], bvec: &[B]) -> ~[(A,B)] {
avec.iter().map(|x| x.clone()) avec.iter().map(|x| x.clone())

View file

@ -99,7 +99,7 @@ fn parse_lists(filenames: &[~str], servo_args: &[~str]) -> Vec<TestDescAndFn> {
let src_dir = src_path.display().to_str(); let src_dir = src_path.display().to_str();
let file_left = src_dir + "/" + parts[1]; let file_left = src_dir + "/" + parts[1];
let file_right = src_dir + "/" + parts[2]; let file_right = src_dir + "/" + parts[2];
let reftest = Reftest { let reftest = Reftest {
name: parts[1] + " / " + parts[2], name: parts[1] + " / " + parts[2],
kind: kind, kind: kind,
@ -151,7 +151,7 @@ fn check_reftest(reftest: Reftest) {
let pixels: ~[u8] = left.pixels.iter().zip(right.pixels.iter()).map(|(&a, &b)| { let pixels: ~[u8] = left.pixels.iter().zip(right.pixels.iter()).map(|(&a, &b)| {
if a as i8 - b as i8 == 0 { if a as i8 - b as i8 == 0 {
// White for correct // White for correct
0xFF 0xFF
} else { } else {
// "1100" in the RGBA channel with an error for an incorrect value // "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 // This results in some number of C0 and FFs, which is much more