mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
FMT
This commit is contained in:
parent
3c267d7fdd
commit
2151a1f459
1 changed files with 30 additions and 21 deletions
|
@ -24,7 +24,7 @@ pub use style::sequential::traverse_dom;
|
|||
pub fn resolve_generated_content(root: &mut Flow, layout_context: &LayoutContext) {
|
||||
fn doit(flow: &mut Flow, level: u32, traversal: &mut ResolveGeneratedContent) {
|
||||
if !traversal.should_process(flow) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
|
||||
traversal.process(flow, level);
|
||||
|
@ -38,9 +38,7 @@ pub fn resolve_generated_content(root: &mut Flow, layout_context: &LayoutContext
|
|||
doit(root, 0, &mut traversal)
|
||||
}
|
||||
|
||||
pub fn traverse_flow_tree_preorder(root: &mut Flow,
|
||||
layout_context: &LayoutContext,
|
||||
relayout_mode: RelayoutMode) {
|
||||
pub fn traverse_flow_tree_preorder(root: &mut Flow, layout_context: &LayoutContext, relayout_mode: RelayoutMode) {
|
||||
fn doit(flow: &mut Flow,
|
||||
assign_inline_sizes: AssignISizes,
|
||||
assign_block_sizes: AssignBSizes,
|
||||
|
@ -48,7 +46,9 @@ pub fn traverse_flow_tree_preorder(root: &mut Flow,
|
|||
// Force reflow children during this traversal. This is needed when we failed
|
||||
// the float speculation of a block formatting context and need to fix it.
|
||||
if relayout_mode == RelayoutMode::Force {
|
||||
flow::mut_base(flow).restyle_damage.insert(REFLOW_OUT_OF_FLOW | REFLOW);
|
||||
flow::mut_base(flow)
|
||||
.restyle_damage
|
||||
.insert(REFLOW_OUT_OF_FLOW | REFLOW);
|
||||
}
|
||||
|
||||
if assign_inline_sizes.should_process(flow) {
|
||||
|
@ -65,15 +65,21 @@ pub fn traverse_flow_tree_preorder(root: &mut Flow,
|
|||
}
|
||||
|
||||
if opts::get().bubble_inline_sizes_separately {
|
||||
let bubble_inline_sizes = BubbleISizes { layout_context: &layout_context };
|
||||
let bubble_inline_sizes = BubbleISizes {
|
||||
layout_context: &layout_context,
|
||||
};
|
||||
{
|
||||
let root: &mut Flow = root;
|
||||
root.traverse_postorder(&bubble_inline_sizes);
|
||||
}
|
||||
}
|
||||
|
||||
let assign_inline_sizes = AssignISizes { layout_context: &layout_context };
|
||||
let assign_block_sizes = AssignBSizes { layout_context: &layout_context };
|
||||
let assign_inline_sizes = AssignISizes {
|
||||
layout_context: &layout_context,
|
||||
};
|
||||
let assign_block_sizes = AssignBSizes {
|
||||
layout_context: &layout_context,
|
||||
};
|
||||
|
||||
doit(root, assign_inline_sizes, assign_block_sizes, relayout_mode);
|
||||
}
|
||||
|
@ -84,13 +90,14 @@ pub fn build_display_list_for_subtree<'a>(flow_root: &mut Flow,
|
|||
let mut state = DisplayListBuildState::new(layout_context);
|
||||
flow_root.collect_stacking_contexts(&mut state);
|
||||
|
||||
let mut build_display_list = BuildDisplayList { state: state };
|
||||
let mut build_display_list = BuildDisplayList {
|
||||
state: state,
|
||||
};
|
||||
build_display_list.traverse(flow_root);
|
||||
build_display_list.state
|
||||
}
|
||||
|
||||
pub fn iterate_through_flow_tree_fragment_border_boxes(root: &mut Flow,
|
||||
iterator: &mut FragmentBorderBoxIterator) {
|
||||
pub fn iterate_through_flow_tree_fragment_border_boxes(root: &mut Flow, iterator: &mut FragmentBorderBoxIterator) {
|
||||
fn doit(flow: &mut Flow,
|
||||
level: i32,
|
||||
iterator: &mut FragmentBorderBoxIterator,
|
||||
|
@ -98,13 +105,13 @@ pub fn iterate_through_flow_tree_fragment_border_boxes(root: &mut Flow,
|
|||
flow.iterate_through_fragment_border_boxes(iterator, level, stacking_context_position);
|
||||
|
||||
for kid in flow::mut_base(flow).child_iter_mut() {
|
||||
let stacking_context_position =
|
||||
if kid.is_block_flow() && kid.as_block().fragment.establishes_stacking_context() {
|
||||
let margin = Point2D::new(kid.as_block().fragment.margin.inline_start, Au(0));
|
||||
*stacking_context_position + flow::base(kid).stacking_relative_position + margin
|
||||
} else {
|
||||
*stacking_context_position
|
||||
};
|
||||
let stacking_context_position = if kid.is_block_flow() &&
|
||||
kid.as_block().fragment.establishes_stacking_context() {
|
||||
let margin = Point2D::new(kid.as_block().fragment.margin.inline_start, Au(0));
|
||||
*stacking_context_position + flow::base(kid).stacking_relative_position + margin
|
||||
} else {
|
||||
*stacking_context_position
|
||||
};
|
||||
|
||||
// FIXME(#2795): Get the real container size.
|
||||
doit(kid, level + 1, iterator, &stacking_context_position);
|
||||
|
@ -116,7 +123,7 @@ pub fn iterate_through_flow_tree_fragment_border_boxes(root: &mut Flow,
|
|||
|
||||
pub fn store_overflow(layout_context: &LayoutContext, flow: &mut Flow) {
|
||||
if !flow::base(flow).restyle_damage.contains(STORE_OVERFLOW) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
|
||||
for mut kid in flow::mut_base(flow).child_iter_mut() {
|
||||
|
@ -125,7 +132,9 @@ pub fn store_overflow(layout_context: &LayoutContext, flow: &mut Flow) {
|
|||
|
||||
flow.store_overflow(layout_context);
|
||||
|
||||
flow::mut_base(flow).restyle_damage.remove(STORE_OVERFLOW);
|
||||
flow::mut_base(flow)
|
||||
.restyle_damage
|
||||
.remove(STORE_OVERFLOW);
|
||||
}
|
||||
|
||||
/// Guesses how much inline size will be taken up by floats on the left and right sides of the
|
||||
|
@ -133,7 +142,7 @@ pub fn store_overflow(layout_context: &LayoutContext, flow: &mut Flow) {
|
|||
/// contexts. The speculation typically succeeds, but if it doesn't we have to lay it out again.
|
||||
pub fn guess_float_placement(flow: &mut Flow) {
|
||||
if !flow::base(flow).restyle_damage.intersects(REFLOW) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
|
||||
let mut floats_in = SpeculatedFloatPlacement::compute_floats_in_for_first_child(flow);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue