mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Remove trailing whitespace.
This commit is contained in:
parent
86c83f7bfc
commit
4e34fcd264
39 changed files with 117 additions and 117 deletions
|
@ -74,7 +74,7 @@ impl<T: Tile> BufferMap<T> {
|
|||
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<T: Tile> BufferMap<T> {
|
|||
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<T: Tile> BufferMap<T> {
|
|||
}
|
||||
None => None,
|
||||
};
|
||||
|
||||
|
||||
if flag {
|
||||
self.map.pop(&key); // Don't store empty vectors!
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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 },
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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<Au>, image: Arc<~Image>) {
|
||||
let image = image.get();
|
||||
|
|
|
@ -61,7 +61,7 @@ pub enum Msg {
|
|||
pub struct BufferRequest {
|
||||
// The rect in pixels that will be drawn to the screen
|
||||
screen_rect: Rect<uint>,
|
||||
|
||||
|
||||
// The rect in page coordinates that this tile represents
|
||||
page_rect: Rect<f32>,
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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. */
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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});
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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. */
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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>,
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -37,7 +37,7 @@ impl CharacterData {
|
|||
data: data
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub fn Data(&self) -> DOMString {
|
||||
self.data.clone()
|
||||
}
|
||||
|
|
|
@ -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<f32>),
|
||||
MouseDownEvent(uint, Point2D<f32>),
|
||||
|
|
|
@ -110,7 +110,7 @@ impl HTMLButtonElement {
|
|||
pub fn SetName(&mut self, _name: DOMString) -> ErrorResult {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
pub fn Type(&self) -> DOMString {
|
||||
~""
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ impl HTMLFontElement {
|
|||
pub fn SetFace(&mut self, _face: DOMString) -> ErrorResult {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
pub fn Size(&self) -> DOMString {
|
||||
~""
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ impl HTMLFormElement {
|
|||
pub fn Length(&self) -> i32 {
|
||||
0
|
||||
}
|
||||
|
||||
|
||||
pub fn Submit(&self) -> ErrorResult {
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -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(())
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ impl HTMLTableCaptionElement {
|
|||
pub fn Align(&self) -> DOMString {
|
||||
~""
|
||||
}
|
||||
|
||||
|
||||
pub fn SetAlign(&mut self, _align: DOMString) -> ErrorResult {
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ impl HTMLTimeElement {
|
|||
pub fn DateTime(&self) -> DOMString {
|
||||
~""
|
||||
}
|
||||
|
||||
|
||||
pub fn SetDateTime(&mut self, _dateTime: DOMString) -> ErrorResult {
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ impl HTMLUListElement {
|
|||
pub fn Compact(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
|
||||
pub fn SetCompact(&mut self, _compact: bool) -> ErrorResult {
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ type JSResult = ~[JSFile];
|
|||
|
||||
enum CSSMessage {
|
||||
CSSTaskNewFile(StylesheetProvenance),
|
||||
CSSTaskExit
|
||||
CSSTaskExit
|
||||
}
|
||||
|
||||
enum JSMessage {
|
||||
|
|
|
@ -73,7 +73,7 @@ pub struct ContentBoxesResponse(~[Rect<Au>]);
|
|||
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.
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -55,7 +55,7 @@ pub mod specified {
|
|||
}
|
||||
pub fn parse_dimension(value: CSSFloat, unit: &str) -> Option<Length> {
|
||||
// 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))),
|
||||
|
|
|
@ -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) }),
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@ impl Profiler {
|
|||
}
|
||||
|
||||
|
||||
pub fn profile<T>(category: ProfilerCategory,
|
||||
pub fn profile<T>(category: ProfilerCategory,
|
||||
profiler_chan: ProfilerChan,
|
||||
callback: || -> T)
|
||||
-> T {
|
||||
|
|
|
@ -65,7 +65,7 @@ fn test_match<T: Eq>(b: &T, a: Option<&T>) -> bool {
|
|||
None => false,
|
||||
Some(t) => t == b
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn zip_copies<A: Clone, B: Clone>(avec: &[A], bvec: &[B]) -> ~[(A,B)] {
|
||||
avec.iter().map(|x| x.clone())
|
||||
|
|
|
@ -99,7 +99,7 @@ fn parse_lists(filenames: &[~str], servo_args: &[~str]) -> Vec<TestDescAndFn> {
|
|||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue