aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/main/layout/construct.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/main/layout/construct.rs')
-rw-r--r--src/components/main/layout/construct.rs51
1 files changed, 26 insertions, 25 deletions
diff --git a/src/components/main/layout/construct.rs b/src/components/main/layout/construct.rs
index ef6d737f2d9..0aa2acb1e94 100644
--- a/src/components/main/layout/construct.rs
+++ b/src/components/main/layout/construct.rs
@@ -60,6 +60,7 @@ use servo_util::range::Range;
use servo_util::str::is_whitespace;
use servo_util::url::{is_image_data, parse_url};
use std::mem;
+use std::owned;
use style::ComputedValues;
use style::computed_values::{display, position, float, white_space};
use sync::Arc;
@@ -74,7 +75,7 @@ pub enum ConstructionResult {
/// This node contributed a flow at the proper position in the tree.
/// Nothing more needs to be done for this node. It has bubbled up fixed
/// and absolute descendant flows that have a CB above it.
- FlowConstructionResult(~Flow:Share, AbsDescendants),
+ FlowConstructionResult(owned::Box<Flow:Share>, AbsDescendants),
/// This node contributed some object or objects that will be needed to construct a proper flow
/// later up the tree, but these objects have not yet found their home.
@@ -156,7 +157,7 @@ pub struct InlineBlockSplit {
pub predecessors: InlineBoxes,
/// The flow that caused this {ib} split.
- pub flow: ~Flow:Share,
+ pub flow: owned::Box<Flow:Share>,
}
impl InlineBlockSplit {
@@ -222,12 +223,12 @@ pub struct FlowConstructor<'a> {
///
/// FIXME(pcwalton): This is pretty bogus and is basically just a workaround for libgreen
/// having slow TLS.
- pub font_context: Option<~FontContext>,
+ pub font_context: Option<owned::Box<FontContext>>,
}
impl<'a> FlowConstructor<'a> {
/// Creates a new flow constructor.
- pub fn new(layout_context: &'a mut LayoutContext, font_context: Option<~FontContext>)
+ pub fn new(layout_context: &'a mut LayoutContext, font_context: Option<owned::Box<FontContext>>)
-> FlowConstructor<'a> {
FlowConstructor {
layout_context: layout_context,
@@ -246,7 +247,7 @@ impl<'a> FlowConstructor<'a> {
}
/// Destroys this flow constructor and retrieves the font context.
- pub fn unwrap_font_context(self) -> Option<~FontContext> {
+ pub fn unwrap_font_context(self) -> Option<owned::Box<FontContext>> {
let FlowConstructor {
font_context,
..
@@ -302,8 +303,8 @@ impl<'a> FlowConstructor<'a> {
#[inline(always)]
fn flush_inline_boxes_to_flow_or_list(&mut self,
box_accumulator: InlineBoxAccumulator,
- flow: &mut ~Flow:Share,
- flow_list: &mut Vec<~Flow:Share>,
+ flow: &mut owned::Box<Flow:Share>,
+ flow_list: &mut Vec<owned::Box<Flow:Share>>,
whitespace_stripping: WhitespaceStrippingMode,
node: &ThreadSafeLayoutNode) {
let mut boxes = box_accumulator.finish();
@@ -327,9 +328,9 @@ impl<'a> FlowConstructor<'a> {
}
}
- let mut inline_flow = ~InlineFlow::from_boxes((*node).clone(), boxes);
+ let mut inline_flow = box InlineFlow::from_boxes((*node).clone(), boxes);
inline_flow.compute_minimum_ascent_and_descent(self.font_context(), &**node.style());
- let mut inline_flow = inline_flow as ~Flow:Share;
+ let mut inline_flow = inline_flow as owned::Box<Flow:Share>;
TextRunScanner::new().scan_for_runs(self.font_context(), inline_flow);
inline_flow.finish(self.layout_context);
@@ -341,9 +342,9 @@ impl<'a> FlowConstructor<'a> {
}
fn build_block_flow_using_children_construction_result(&mut self,
- flow: &mut ~Flow:Share,
+ flow: &mut owned::Box<Flow:Share>,
consecutive_siblings:
- &mut Vec<~Flow:Share>,
+ &mut Vec<owned::Box<Flow:Share>>,
node: &ThreadSafeLayoutNode,
kid: ThreadSafeLayoutNode,
inline_box_accumulator:
@@ -458,7 +459,7 @@ impl<'a> FlowConstructor<'a> {
/// Also, deal with the absolute and fixed descendants bubbled up by
/// children nodes.
fn build_flow_using_children(&mut self,
- mut flow: ~Flow:Share,
+ mut flow: owned::Box<Flow:Share>,
node: &ThreadSafeLayoutNode)
-> ConstructionResult {
// Gather up boxes for the inline flows we might need to create.
@@ -516,7 +517,7 @@ impl<'a> FlowConstructor<'a> {
/// other `BlockFlow`s or `InlineFlow`s underneath it, depending on whether {ib} splits needed
/// to happen.
fn build_flow_for_block(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
- let flow = ~BlockFlow::from_node(self, node) as ~Flow:Share;
+ let flow = box BlockFlow::from_node(self, node) as owned::Box<Flow:Share>;
self.build_flow_using_children(flow, node)
}
@@ -524,7 +525,7 @@ impl<'a> FlowConstructor<'a> {
/// a `BlockFlow` underneath it.
fn build_flow_for_floated_block(&mut self, node: &ThreadSafeLayoutNode, float_kind: FloatKind)
-> ConstructionResult {
- let flow = ~BlockFlow::float_from_node(self, node, float_kind) as ~Flow:Share;
+ let flow = box BlockFlow::float_from_node(self, node, float_kind) as owned::Box<Flow:Share>;
self.build_flow_using_children(flow, node)
}
@@ -660,7 +661,7 @@ impl<'a> FlowConstructor<'a> {
/// TableCaptionFlow is populated underneath TableWrapperFlow
fn place_table_caption_under_table_wrapper(&mut self,
- table_wrapper_flow: &mut ~Flow:Share,
+ table_wrapper_flow: &mut owned::Box<Flow:Share>,
node: &ThreadSafeLayoutNode) {
for kid in node.children() {
match kid.swap_out_construction_result() {
@@ -677,8 +678,8 @@ impl<'a> FlowConstructor<'a> {
/// Generates an anonymous table flow according to CSS 2.1 § 17.2.1, step 2.
/// If necessary, generate recursively another anonymous table flow.
fn generate_anonymous_missing_child(&mut self,
- child_flows: Vec<~Flow:Share>,
- flow: &mut ~Flow:Share,
+ child_flows: Vec<owned::Box<Flow:Share>>,
+ flow: &mut owned::Box<Flow:Share>,
node: &ThreadSafeLayoutNode) {
let mut anonymous_flow = flow.generate_missing_child_flow(node);
let mut consecutive_siblings = vec!();
@@ -705,10 +706,10 @@ impl<'a> FlowConstructor<'a> {
/// other `TableCaptionFlow`s or `TableFlow`s underneath it.
fn build_flow_for_table_wrapper(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
let box_ = Box::new_from_specific_info(node, TableWrapperBox);
- let mut wrapper_flow = ~TableWrapperFlow::from_node_and_box(node, box_) as ~Flow:Share;
+ let mut wrapper_flow = box TableWrapperFlow::from_node_and_box(node, box_) as owned::Box<Flow:Share>;
let table_box_ = Box::new_from_specific_info(node, TableBox);
- let table_flow = ~TableFlow::from_node_and_box(node, table_box_) as ~Flow:Share;
+ let table_flow = box TableFlow::from_node_and_box(node, table_box_) as owned::Box<Flow:Share>;
// We first populate the TableFlow with other flows than TableCaptionFlow.
// We then populate the TableWrapperFlow with TableCaptionFlow, and attach
@@ -754,7 +755,7 @@ impl<'a> FlowConstructor<'a> {
/// Builds a flow for a node with `display: table-caption`. This yields a `TableCaptionFlow`
/// with possibly other `BlockFlow`s or `InlineFlow`s underneath it.
fn build_flow_for_table_caption(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
- let flow = ~TableCaptionFlow::from_node(self, node) as ~Flow:Share;
+ let flow = box TableCaptionFlow::from_node(self, node) as owned::Box<Flow:Share>;
self.build_flow_using_children(flow, node)
}
@@ -762,7 +763,7 @@ impl<'a> FlowConstructor<'a> {
/// with possibly other `TableRowFlow`s underneath it.
fn build_flow_for_table_rowgroup(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
let box_ = Box::new_from_specific_info(node, TableRowBox);
- let flow = ~TableRowGroupFlow::from_node_and_box(node, box_) as ~Flow:Share;
+ let flow = box TableRowGroupFlow::from_node_and_box(node, box_) as owned::Box<Flow:Share>;
self.build_flow_using_children(flow, node)
}
@@ -770,7 +771,7 @@ impl<'a> FlowConstructor<'a> {
/// possibly other `TableCellFlow`s underneath it.
fn build_flow_for_table_row(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
let box_ = Box::new_from_specific_info(node, TableRowBox);
- let flow = ~TableRowFlow::from_node_and_box(node, box_) as ~Flow:Share;
+ let flow = box TableRowFlow::from_node_and_box(node, box_) as owned::Box<Flow:Share>;
self.build_flow_using_children(flow, node)
}
@@ -778,7 +779,7 @@ impl<'a> FlowConstructor<'a> {
/// possibly other `BlockFlow`s or `InlineFlow`s underneath it.
fn build_flow_for_table_cell(&mut self, node: &ThreadSafeLayoutNode) -> ConstructionResult {
let box_ = Box::new_from_specific_info(node, TableCellBox);
- let flow = ~TableCellFlow::from_node_and_box(node, box_) as ~Flow:Share;
+ let flow = box TableCellFlow::from_node_and_box(node, box_) as owned::Box<Flow:Share>;
self.build_flow_using_children(flow, node)
}
@@ -817,8 +818,8 @@ impl<'a> FlowConstructor<'a> {
let specific = TableColumnBox(TableColumnBoxInfo::new(node));
col_boxes.push( Box::new_from_specific_info(node, specific) );
}
- let mut flow = ~TableColGroupFlow::from_node_and_boxes(node, box_, col_boxes) as
- ~Flow:Share;
+ let mut flow = box TableColGroupFlow::from_node_and_boxes(node, box_, col_boxes) as
+ owned::Box<Flow:Share>;
flow.finish(self.layout_context);
FlowConstructionResult(flow, Descendants::new())