diff options
Diffstat (limited to 'src/components/main/layout')
-rw-r--r-- | src/components/main/layout/box.rs | 6 | ||||
-rw-r--r-- | src/components/main/layout/box_builder.rs | 10 | ||||
-rw-r--r-- | src/components/main/layout/float_context.rs | 4 | ||||
-rw-r--r-- | src/components/main/layout/inline.rs | 25 | ||||
-rw-r--r-- | src/components/main/layout/layout_task.rs | 2 | ||||
-rw-r--r-- | src/components/main/layout/text.rs | 2 |
6 files changed, 25 insertions, 24 deletions
diff --git a/src/components/main/layout/box.rs b/src/components/main/layout/box.rs index 38f422a1dff..658b52726c8 100644 --- a/src/components/main/layout/box.rs +++ b/src/components/main/layout/box.rs @@ -38,7 +38,7 @@ use script::dom::node::{AbstractNode, LayoutView}; use servo_net::image::holder::ImageHolder; use servo_net::local_image_cache::LocalImageCache; use servo_util::range::*; -use extra::net::url::Url; +use extra::url::Url; /// Render boxes (`struct RenderBox`) are the leaves of the layout tree. They cannot position /// themselves. In general, render boxes do not have a simple correspondence with CSS boxes as in @@ -433,7 +433,7 @@ impl RenderBox { ImageRenderBoxClass(image_box) => { // TODO: Consult the CSS `width` property as well as margins and borders. // TODO: If the image isn't available, consult `width`. - Au::from_px(image_box.image.get_size().get_or_default(Size2D(0, 0)).width) + Au::from_px(image_box.image.get_size().unwrap_or_default(Size2D(0, 0)).width) } TextRenderBoxClass(text_box) => { @@ -454,7 +454,7 @@ impl RenderBox { GenericRenderBoxClass(*) => Au(0), ImageRenderBoxClass(image_box) => { - Au::from_px(image_box.image.get_size().get_or_default(Size2D(0, 0)).width) + Au::from_px(image_box.image.get_size().unwrap_or_default(Size2D(0, 0)).width) } TextRenderBoxClass(text_box) => { diff --git a/src/components/main/layout/box_builder.rs b/src/components/main/layout/box_builder.rs index cd11e948ed0..5ea78c8a0fe 100644 --- a/src/components/main/layout/box_builder.rs +++ b/src/components/main/layout/box_builder.rs @@ -403,22 +403,22 @@ impl LayoutTreeBuilder { // Floats (CSSDisplayBlock, BlockFlow(_), _) | (CSSDisplayBlock, FloatFlow(_), _) if !is_float.is_none() => { - self.create_child_generator(node, parent_generator, Flow_Float(is_float.get())) + self.create_child_generator(node, parent_generator, Flow_Float(is_float.unwrap())) } // If we're placing a float after an inline, append the float to the inline flow, // then continue building from the inline flow in case there are more inlines // afterward. (CSSDisplayBlock, _, Some(InlineFlow(_))) if !is_float.is_none() => { let float_generator = self.create_child_generator(node, - sibling_generator.get(), - Flow_Float(is_float.get())); - return Some((float_generator, sibling_generator.get())); + sibling_generator.unwrap(), + Flow_Float(is_float.unwrap())); + return Some((float_generator, sibling_generator.unwrap())); } // This is a catch-all case for when: // a) sibling_flow is None // b) sibling_flow is a BlockFlow (CSSDisplayBlock, InlineFlow(_), _) if !is_float.is_none() => { - self.create_child_generator(node, parent_generator, Flow_Float(is_float.get())) + self.create_child_generator(node, parent_generator, Flow_Float(is_float.unwrap())) } (CSSDisplayBlock, BlockFlow(info), _) => match (info.is_root, node.parent_node()) { diff --git a/src/components/main/layout/float_context.rs b/src/components/main/layout/float_context.rs index 60bb9595615..c24277465cc 100644 --- a/src/components/main/layout/float_context.rs +++ b/src/components/main/layout/float_context.rs @@ -300,7 +300,7 @@ impl FloatContextBase{ f_data.bounds.origin.x + f_data.bounds.size.width > left && f_data.bounds.origin.x < left + width { let new_y = f_data.bounds.origin.y; - max_height = Some(min(max_height.get_or_default(new_y), new_y)); + max_height = Some(min(max_height.unwrap_or_default(new_y), new_y)); } } } @@ -340,7 +340,7 @@ impl FloatContextBase{ let height = self.max_height_for_bounds(rect.origin.x, rect.origin.y, rect.size.width); - let height = height.get_or_default(Au(max_value)); + let height = height.unwrap_or_default(Au(max_value)); return match info.f_type { FloatLeft => Rect(Point2D(rect.origin.x, float_y), Size2D(rect.size.width, height)), diff --git a/src/components/main/layout/inline.rs b/src/components/main/layout/inline.rs index 3886695c4d3..3a4f8122dfe 100644 --- a/src/components/main/layout/inline.rs +++ b/src/components/main/layout/inline.rs @@ -22,7 +22,8 @@ use newcss::units::{Em, Px, Pt}; use newcss::values::{CSSLineHeightNormal, CSSLineHeightNumber, CSSLineHeightLength, CSSLineHeightPercentage}; use servo_util::range::Range; use servo_util::tree::{TreeNodeRef, TreeUtils}; -use extra::deque::Deque; +use extra::container::Deque; +use extra::ringbuf::RingBuf; /* Lineboxes are represented as offsets into the child list, rather than @@ -62,7 +63,7 @@ struct LineboxScanner { flow: FlowContext, floats: FloatContext, new_boxes: ~[RenderBox], - work_list: @mut Deque<RenderBox>, + work_list: @mut RingBuf<RenderBox>, pending_line: LineBox, lines: ~[LineBox], cur_y: Au, @@ -76,7 +77,7 @@ impl LineboxScanner { flow: inline, floats: float_ctx, new_boxes: ~[], - work_list: @mut Deque::new(), + work_list: @mut RingBuf::new(), pending_line: LineBox { range: Range::empty(), bounds: Rect(Point2D(Au(0), Au(0)), Size2D(Au(0), Au(0))), @@ -122,7 +123,7 @@ impl LineboxScanner { debug!("LineboxScanner: Working with box from box list: b%d", box.id()); box } else { - let box = self.work_list.pop_front(); + let box = self.work_list.pop_front().unwrap(); debug!("LineboxScanner: Working with box from work list: b%d", box.id()); box }; @@ -176,7 +177,7 @@ impl LineboxScanner { match box { ImageRenderBoxClass(image_box) => { let size = image_box.image.get_size(); - let height = Au::from_px(size.get_or_default(Size2D(0, 0)).height); + let height = Au::from_px(size.unwrap_or_default(Size2D(0, 0)).height); image_box.base.position.size.height = height; debug!("box_height: found image height: %?", height); height @@ -360,11 +361,11 @@ impl LineboxScanner { self.pending_line.green_zone = next_green_zone; assert!(!line_is_empty, "Non-terminating line breaking"); - self.work_list.add_front(in_box); + self.work_list.push_front(in_box); return true; } else { debug!("LineboxScanner: case=adding box collides vertically with floats: breaking line"); - self.work_list.add_front(in_box); + self.work_list.push_front(in_box); return false; } } @@ -407,7 +408,7 @@ impl LineboxScanner { match (left, right) { (Some(left_box), Some(right_box)) => { self.push_box_to_line(left_box); - self.work_list.add_front(right_box); + self.work_list.push_front(right_box); } (Some(left_box), None) => self.push_box_to_line(left_box), (None, Some(right_box)) => self.push_box_to_line(right_box), @@ -423,7 +424,7 @@ impl LineboxScanner { match (left, right) { (Some(left_box), Some(right_box)) => { self.push_box_to_line(left_box); - self.work_list.add_front(right_box); + self.work_list.push_front(right_box); } (Some(left_box), None) => { self.push_box_to_line(left_box); @@ -438,7 +439,7 @@ impl LineboxScanner { return true; } else { debug!("LineboxScanner: case=split box didn't fit, not appending and deferring original box."); - self.work_list.add_front(in_box); + self.work_list.push_front(in_box); return false; } } @@ -553,7 +554,7 @@ impl InlineFlowData { match box { ImageRenderBoxClass(image_box) => { let size = image_box.image.get_size(); - let width = Au::from_px(size.get_or_default(Size2D(0, 0)).width); + let width = Au::from_px(size.unwrap_or_default(Size2D(0, 0)).width); image_box.base.position.size.width = width; } TextRenderBoxClass(_) => { @@ -671,7 +672,7 @@ impl InlineFlowData { match cur_box { ImageRenderBoxClass(image_box) => { let size = image_box.image.get_size(); - let height = Au::from_px(size.get_or_default(Size2D(0, 0)).height); + let height = Au::from_px(size.unwrap_or_default(Size2D(0, 0)).height); image_box.base.position.size.height = height; image_box.base.position.translate(&Point2D(Au(0), -height)) diff --git a/src/components/main/layout/layout_task.rs b/src/components/main/layout/layout_task.rs index 48c9b347e71..73f9e5c9556 100644 --- a/src/components/main/layout/layout_task.rs +++ b/src/components/main/layout/layout_task.rs @@ -44,7 +44,7 @@ use servo_net::local_image_cache::LocalImageCache; use servo_util::tree::{TreeNodeRef, TreeUtils}; use servo_util::time::{ProfilerChan, profile}; use servo_util::time; -use extra::net::url::Url; +use extra::url::Url; struct LayoutTask { id: PipelineId, diff --git a/src/components/main/layout/text.rs b/src/components/main/layout/text.rs index 525e6239320..d0eb65937d6 100644 --- a/src/components/main/layout/text.rs +++ b/src/components/main/layout/text.rs @@ -241,7 +241,7 @@ impl TextRunScanner { } do in_boxes[i].with_base |base| { - let new_box = @mut adapt_textbox_with_range(*base, run.get(), range); + let new_box = @mut adapt_textbox_with_range(*base, run.unwrap(), range); out_boxes.push(TextRenderBoxClass(new_box)); } } |