servo: Merge #4309 - Simple cleanups in layout code (from mbrubeck:float-cleanup); r=pcwalton

r? @SimonSapin or @pcwalton

Source-Repo: https://github.com/servo/servo
Source-Revision: d8a5199ba847bb46733eb4794d0bf93966964499
This commit is contained in:
Matt Brubeck 2014-12-09 17:01:12 -07:00
parent eba21f3745
commit 9cb76dbf45
2 changed files with 11 additions and 15 deletions

View File

@ -908,12 +908,8 @@ impl BlockFlow {
} }
// Lay the child out if this was an in-order traversal. // Lay the child out if this was an in-order traversal.
let need_to_process_child_floats = if flow::base(kid).flags.is_float() { let need_to_process_child_floats =
kid.place_float_if_applicable(layout_context); kid.assign_block_size_for_inorder_child_if_necessary(layout_context);
true
} else {
kid.assign_block_size_for_inorder_child_if_necessary(layout_context)
};
// Mark flows for layerization if necessary to handle painting order correctly. // Mark flows for layerization if necessary to handle painting order correctly.
propagate_layer_flag_from_child(&mut layers_needed_for_descendants, kid); propagate_layer_flag_from_child(&mut layers_needed_for_descendants, kid);

View File

@ -169,16 +169,16 @@ enum WrapMode {
} }
struct LineBreaker { struct LineBreaker {
pub floats: Floats, floats: Floats,
pub new_fragments: Vec<Fragment>, new_fragments: Vec<Fragment>,
pub work_list: RingBuf<Fragment>, work_list: RingBuf<Fragment>,
pub pending_line: Line, pending_line: Line,
pub lines: Vec<Line>, lines: Vec<Line>,
pub cur_b: Au, // Current position on the block direction cur_b: Au, // Current position on the block direction
} }
impl LineBreaker { impl LineBreaker {
pub fn new(float_context: Floats) -> LineBreaker { fn new(float_context: Floats) -> LineBreaker {
LineBreaker { LineBreaker {
new_fragments: Vec::new(), new_fragments: Vec::new(),
work_list: RingBuf::new(), work_list: RingBuf::new(),
@ -193,7 +193,7 @@ impl LineBreaker {
} }
} }
pub fn floats(&mut self) -> Floats { fn floats(&mut self) -> Floats {
self.floats.clone() self.floats.clone()
} }
@ -215,7 +215,7 @@ impl LineBreaker {
self.pending_line.green_zone = LogicalSize::zero(self.floats.writing_mode) self.pending_line.green_zone = LogicalSize::zero(self.floats.writing_mode)
} }
pub fn scan_for_lines(&mut self, flow: &mut InlineFlow, layout_context: &LayoutContext) { fn scan_for_lines(&mut self, flow: &mut InlineFlow, layout_context: &LayoutContext) {
self.reset_scanner(); self.reset_scanner();
let mut old_fragments = mem::replace(&mut flow.fragments, InlineFragments::new()); let mut old_fragments = mem::replace(&mut flow.fragments, InlineFragments::new());