Make AbsolutelyPositionedBox be 'static

This commit is contained in:
Anthony Ramine 2020-03-13 12:22:32 +01:00 committed by Patrick Walton
parent 7ade924683
commit c3932185ec
7 changed files with 42 additions and 48 deletions

View file

@ -525,7 +525,7 @@ where
kind,
});
} else {
let box_ = Arc::new(InlineLevelBox::OutOfFlowAbsolutelyPositionedBox(
let box_ = Arc::new(InlineLevelBox::OutOfFlowAbsolutelyPositionedBox(Arc::new(
AbsolutelyPositionedBox::construct(
self.context,
node,
@ -533,7 +533,7 @@ where
display_inside,
contents,
),
));
)));
self.current_inline_level_boxes().push(box_.clone());
box_slot.set(LayoutBox::InlineLevel(box_))
}
@ -687,13 +687,13 @@ where
contents,
} => {
let block_level_box = Arc::new(BlockLevelBox::OutOfFlowAbsolutelyPositionedBox(
AbsolutelyPositionedBox::construct(
Arc::new(AbsolutelyPositionedBox::construct(
context,
node,
style,
display_inside,
contents,
),
)),
));
(block_level_box, ContainsFloats::No)
},

View file

@ -34,7 +34,7 @@ pub(crate) struct InlineFormattingContext {
pub(crate) enum InlineLevelBox {
InlineBox(InlineBox),
TextRun(TextRun),
OutOfFlowAbsolutelyPositionedBox(AbsolutelyPositionedBox),
OutOfFlowAbsolutelyPositionedBox(Arc<AbsolutelyPositionedBox>),
OutOfFlowFloatBox(FloatBox),
Atomic(IndependentFormattingContext),
}
@ -77,7 +77,7 @@ struct PartialInlineBoxFragment<'box_tree> {
}
struct InlineFormattingContextState<'box_tree, 'a, 'b> {
positioning_context: &'a mut PositioningContext<'box_tree>,
positioning_context: &'a mut PositioningContext,
containing_block: &'b ContainingBlock<'b>,
lines: Lines,
inline_position: Length,
@ -204,10 +204,10 @@ impl InlineFormattingContext {
computation.paragraph
}
pub(super) fn layout<'a>(
&'a self,
pub(super) fn layout(
&self,
layout_context: &LayoutContext,
positioning_context: &mut PositioningContext<'a>,
positioning_context: &mut PositioningContext,
containing_block: &ContainingBlock,
tree_rank: usize,
) -> FlowLayout {

View file

@ -50,7 +50,7 @@ pub(crate) enum BlockLevelBox {
style: Arc<ComputedValues>,
contents: BlockContainer,
},
OutOfFlowAbsolutelyPositionedBox(AbsolutelyPositionedBox),
OutOfFlowAbsolutelyPositionedBox(Arc<AbsolutelyPositionedBox>),
OutOfFlowFloatBox(FloatBox),
Independent(IndependentFormattingContext),
}
@ -65,10 +65,10 @@ struct FlowLayout {
struct CollapsibleWithParentStartMargin(bool);
impl BlockFormattingContext {
pub(super) fn layout<'a>(
&'a self,
pub(super) fn layout(
&self,
layout_context: &LayoutContext,
positioning_context: &mut PositioningContext<'a>,
positioning_context: &mut PositioningContext,
containing_block: &ContainingBlock,
tree_rank: usize,
) -> IndependentLayout {
@ -101,10 +101,10 @@ impl BlockFormattingContext {
}
impl BlockContainer {
fn layout<'a>(
&'a self,
fn layout(
&self,
layout_context: &LayoutContext,
positioning_context: &mut PositioningContext<'a>,
positioning_context: &mut PositioningContext,
containing_block: &ContainingBlock,
tree_rank: usize,
float_context: Option<&mut FloatContext>,
@ -130,10 +130,10 @@ impl BlockContainer {
}
}
fn layout_block_level_children<'a>(
fn layout_block_level_children(
layout_context: &LayoutContext,
positioning_context: &mut PositioningContext<'a>,
child_boxes: &'a [Arc<BlockLevelBox>],
positioning_context: &mut PositioningContext,
child_boxes: &[Arc<BlockLevelBox>],
containing_block: &ContainingBlock,
tree_rank: usize,
mut float_context: Option<&mut FloatContext>,
@ -256,10 +256,10 @@ fn layout_block_level_children<'a>(
}
impl BlockLevelBox {
fn layout<'a>(
&'a self,
fn layout(
&self,
layout_context: &LayoutContext,
positioning_context: &mut PositioningContext<'a>,
positioning_context: &mut PositioningContext,
containing_block: &ContainingBlock,
tree_rank: usize,
float_context: Option<&mut FloatContext>,
@ -338,13 +338,13 @@ enum NonReplacedContents<'a> {
/// https://drafts.csswg.org/css2/visudet.html#blockwidth
/// https://drafts.csswg.org/css2/visudet.html#normal-block
fn layout_in_flow_non_replaced_block_level<'a>(
fn layout_in_flow_non_replaced_block_level(
layout_context: &LayoutContext,
positioning_context: &mut PositioningContext<'a>,
positioning_context: &mut PositioningContext,
containing_block: &ContainingBlock,
tag: OpaqueNode,
style: &Arc<ComputedValues>,
block_level_kind: NonReplacedContents<'a>,
block_level_kind: NonReplacedContents,
tree_rank: usize,
float_context: Option<&mut FloatContext>,
) -> BoxFragment {

View file

@ -84,13 +84,13 @@ fn construct_for_root_element<'dom>(
(
ContainsFloats::No,
vec![Arc::new(BlockLevelBox::OutOfFlowAbsolutelyPositionedBox(
AbsolutelyPositionedBox::construct(
Arc::new(AbsolutelyPositionedBox::construct(
context,
root_element,
style,
display_inside,
contents,
),
)),
))],
)
} else if box_style.float.is_floating() {