mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Store abspos boxes in a RefCell too
We want to mutate them when lazily computing their content sizes, but they are behind an Arc for the hoisting infra, so it also needs its own layer of inner mutability.
This commit is contained in:
parent
e044d8582c
commit
e975d24c4b
7 changed files with 65 additions and 53 deletions
|
@ -15,7 +15,6 @@ use crate::sizing::{BoxContentSizes, ContentSizes, ContentSizesRequest};
|
||||||
use crate::style_ext::DisplayGeneratingBox;
|
use crate::style_ext::DisplayGeneratingBox;
|
||||||
use crate::ContainingBlock;
|
use crate::ContainingBlock;
|
||||||
use rayon::iter::{IntoParallelIterator, ParallelIterator};
|
use rayon::iter::{IntoParallelIterator, ParallelIterator};
|
||||||
use servo_arc::Arc;
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use style::values::computed::Length;
|
use style::values::computed::Length;
|
||||||
use style::values::specified::text::TextDecorationLine;
|
use style::values::specified::text::TextDecorationLine;
|
||||||
|
@ -31,7 +30,7 @@ pub(crate) struct FlexContainer {
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
pub(crate) enum FlexLevelBox {
|
pub(crate) enum FlexLevelBox {
|
||||||
FlexItem(IndependentFormattingContext),
|
FlexItem(IndependentFormattingContext),
|
||||||
OutOfFlowAbsolutelyPositionedBox(Arc<AbsolutelyPositionedBox>),
|
OutOfFlowAbsolutelyPositionedBox(ArcRefCell<AbsolutelyPositionedBox>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FlexContainer {
|
impl FlexContainer {
|
||||||
|
@ -192,14 +191,14 @@ where
|
||||||
};
|
};
|
||||||
let box_ = if info.style.get_box().position.is_absolutely_positioned() {
|
let box_ = if info.style.get_box().position.is_absolutely_positioned() {
|
||||||
// https://drafts.csswg.org/css-flexbox/#abspos-items
|
// https://drafts.csswg.org/css-flexbox/#abspos-items
|
||||||
ArcRefCell::new(FlexLevelBox::OutOfFlowAbsolutelyPositionedBox(Arc::new(
|
ArcRefCell::new(FlexLevelBox::OutOfFlowAbsolutelyPositionedBox(
|
||||||
AbsolutelyPositionedBox::construct(
|
ArcRefCell::new(AbsolutelyPositionedBox::construct(
|
||||||
self.context,
|
self.context,
|
||||||
&info,
|
&info,
|
||||||
display_inside,
|
display_inside,
|
||||||
contents,
|
contents,
|
||||||
),
|
)),
|
||||||
)))
|
))
|
||||||
} else {
|
} else {
|
||||||
ArcRefCell::new(FlexLevelBox::FlexItem(
|
ArcRefCell::new(FlexLevelBox::FlexItem(
|
||||||
IndependentFormattingContext::construct(
|
IndependentFormattingContext::construct(
|
||||||
|
|
|
@ -571,9 +571,14 @@ where
|
||||||
kind,
|
kind,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
let box_ = ArcRefCell::new(InlineLevelBox::OutOfFlowAbsolutelyPositionedBox(Arc::new(
|
let box_ = ArcRefCell::new(InlineLevelBox::OutOfFlowAbsolutelyPositionedBox(
|
||||||
AbsolutelyPositionedBox::construct(self.context, info, display_inside, contents),
|
ArcRefCell::new(AbsolutelyPositionedBox::construct(
|
||||||
)));
|
self.context,
|
||||||
|
info,
|
||||||
|
display_inside,
|
||||||
|
contents,
|
||||||
|
)),
|
||||||
|
));
|
||||||
self.current_inline_level_boxes().push(box_.clone());
|
self.current_inline_level_boxes().push(box_.clone());
|
||||||
box_slot.set(LayoutBox::InlineLevel(box_))
|
box_slot.set(LayoutBox::InlineLevel(box_))
|
||||||
}
|
}
|
||||||
|
@ -722,10 +727,11 @@ where
|
||||||
display_inside,
|
display_inside,
|
||||||
contents,
|
contents,
|
||||||
} => {
|
} => {
|
||||||
let block_level_box =
|
let block_level_box = ArcRefCell::new(
|
||||||
ArcRefCell::new(BlockLevelBox::OutOfFlowAbsolutelyPositionedBox(Arc::new(
|
BlockLevelBox::OutOfFlowAbsolutelyPositionedBox(ArcRefCell::new(
|
||||||
AbsolutelyPositionedBox::construct(context, info, display_inside, contents),
|
AbsolutelyPositionedBox::construct(context, info, display_inside, contents),
|
||||||
)));
|
)),
|
||||||
|
);
|
||||||
(block_level_box, ContainsFloats::No)
|
(block_level_box, ContainsFloats::No)
|
||||||
},
|
},
|
||||||
BlockLevelCreator::OutOfFlowFloatBox {
|
BlockLevelCreator::OutOfFlowFloatBox {
|
||||||
|
|
|
@ -20,6 +20,7 @@ use crate::sizing::ContentSizes;
|
||||||
use crate::style_ext::{ComputedValuesExt, Display, DisplayGeneratingBox, DisplayOutside};
|
use crate::style_ext::{ComputedValuesExt, Display, DisplayGeneratingBox, DisplayOutside};
|
||||||
use crate::ContainingBlock;
|
use crate::ContainingBlock;
|
||||||
use app_units::Au;
|
use app_units::Au;
|
||||||
|
use atomic_refcell::AtomicRef;
|
||||||
use gfx::text::text_run::GlyphRun;
|
use gfx::text::text_run::GlyphRun;
|
||||||
use servo_arc::Arc;
|
use servo_arc::Arc;
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
|
@ -39,7 +40,7 @@ pub(crate) struct InlineFormattingContext {
|
||||||
pub(crate) enum InlineLevelBox {
|
pub(crate) enum InlineLevelBox {
|
||||||
InlineBox(InlineBox),
|
InlineBox(InlineBox),
|
||||||
TextRun(TextRun),
|
TextRun(TextRun),
|
||||||
OutOfFlowAbsolutelyPositionedBox(Arc<AbsolutelyPositionedBox>),
|
OutOfFlowAbsolutelyPositionedBox(ArcRefCell<AbsolutelyPositionedBox>),
|
||||||
OutOfFlowFloatBox(FloatBox),
|
OutOfFlowFloatBox(FloatBox),
|
||||||
Atomic(IndependentFormattingContext),
|
Atomic(IndependentFormattingContext),
|
||||||
}
|
}
|
||||||
|
@ -283,8 +284,9 @@ impl InlineFormattingContext {
|
||||||
InlineLevelBox::TextRun(run) => run.layout(layout_context, &mut ifc),
|
InlineLevelBox::TextRun(run) => run.layout(layout_context, &mut ifc),
|
||||||
InlineLevelBox::Atomic(a) => layout_atomic(layout_context, &mut ifc, a),
|
InlineLevelBox::Atomic(a) => layout_atomic(layout_context, &mut ifc, a),
|
||||||
InlineLevelBox::OutOfFlowAbsolutelyPositionedBox(box_) => {
|
InlineLevelBox::OutOfFlowAbsolutelyPositionedBox(box_) => {
|
||||||
|
let style = AtomicRef::map(box_.borrow(), |box_| &box_.contents.style);
|
||||||
let initial_start_corner =
|
let initial_start_corner =
|
||||||
match Display::from(box_.contents.style.get_box().original_display) {
|
match Display::from(style.get_box().original_display) {
|
||||||
Display::GeneratingBox(DisplayGeneratingBox::OutsideInside {
|
Display::GeneratingBox(DisplayGeneratingBox::OutsideInside {
|
||||||
outside,
|
outside,
|
||||||
inside: _,
|
inside: _,
|
||||||
|
@ -313,7 +315,7 @@ impl InlineFormattingContext {
|
||||||
Fragment::AbsoluteOrFixedPositioned(
|
Fragment::AbsoluteOrFixedPositioned(
|
||||||
AbsoluteOrFixedPositionedFragment {
|
AbsoluteOrFixedPositionedFragment {
|
||||||
hoisted_fragment,
|
hoisted_fragment,
|
||||||
position: box_.contents.style.clone_position(),
|
position: style.clone_position(),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -52,7 +52,7 @@ pub(crate) enum BlockLevelBox {
|
||||||
style: Arc<ComputedValues>,
|
style: Arc<ComputedValues>,
|
||||||
contents: BlockContainer,
|
contents: BlockContainer,
|
||||||
},
|
},
|
||||||
OutOfFlowAbsolutelyPositionedBox(Arc<AbsolutelyPositionedBox>),
|
OutOfFlowAbsolutelyPositionedBox(ArcRefCell<AbsolutelyPositionedBox>),
|
||||||
OutOfFlowFloatBox(FloatBox),
|
OutOfFlowFloatBox(FloatBox),
|
||||||
Independent(IndependentFormattingContext),
|
Independent(IndependentFormattingContext),
|
||||||
}
|
}
|
||||||
|
@ -322,7 +322,7 @@ impl BlockLevelBox {
|
||||||
positioning_context.push(hoisted_box);
|
positioning_context.push(hoisted_box);
|
||||||
Fragment::AbsoluteOrFixedPositioned(AbsoluteOrFixedPositionedFragment {
|
Fragment::AbsoluteOrFixedPositioned(AbsoluteOrFixedPositionedFragment {
|
||||||
hoisted_fragment,
|
hoisted_fragment,
|
||||||
position: box_.contents.style.clone_position(),
|
position: box_.borrow().contents.style.clone_position(),
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
BlockLevelBox::OutOfFlowFloatBox(_box_) => {
|
BlockLevelBox::OutOfFlowFloatBox(_box_) => {
|
||||||
|
|
|
@ -207,7 +207,7 @@ impl BoxTree {
|
||||||
let contents = ReplacedContent::for_element(dirty_node)
|
let contents = ReplacedContent::for_element(dirty_node)
|
||||||
.map_or(Contents::OfElement, Contents::Replaced);
|
.map_or(Contents::OfElement, Contents::Replaced);
|
||||||
let info = NodeAndStyleInfo::new(dirty_node, Arc::clone(&primary_style));
|
let info = NodeAndStyleInfo::new(dirty_node, Arc::clone(&primary_style));
|
||||||
let out_of_flow_absolutely_positioned_box = Arc::new(
|
let out_of_flow_absolutely_positioned_box = ArcRefCell::new(
|
||||||
AbsolutelyPositionedBox::construct(context, &info, display_inside, contents),
|
AbsolutelyPositionedBox::construct(context, &info, display_inside, contents),
|
||||||
);
|
);
|
||||||
match update_point {
|
match update_point {
|
||||||
|
@ -267,7 +267,7 @@ fn construct_for_root_element<'dom>(
|
||||||
let (contains_floats, root_box) = if box_style.position.is_absolutely_positioned() {
|
let (contains_floats, root_box) = if box_style.position.is_absolutely_positioned() {
|
||||||
(
|
(
|
||||||
ContainsFloats::No,
|
ContainsFloats::No,
|
||||||
BlockLevelBox::OutOfFlowAbsolutelyPositionedBox(Arc::new(
|
BlockLevelBox::OutOfFlowAbsolutelyPositionedBox(ArcRefCell::new(
|
||||||
AbsolutelyPositionedBox::construct(context, &info, display_inside, contents),
|
AbsolutelyPositionedBox::construct(context, &info, display_inside, contents),
|
||||||
)),
|
)),
|
||||||
)
|
)
|
||||||
|
|
|
@ -12,9 +12,8 @@ use crate::geom::{LengthOrAuto, LengthPercentageOrAuto};
|
||||||
use crate::sizing::ContentSizesRequest;
|
use crate::sizing::ContentSizesRequest;
|
||||||
use crate::style_ext::{ComputedValuesExt, DisplayInside};
|
use crate::style_ext::{ComputedValuesExt, DisplayInside};
|
||||||
use crate::{ContainingBlock, DefiniteContainingBlock};
|
use crate::{ContainingBlock, DefiniteContainingBlock};
|
||||||
use rayon::iter::{IntoParallelRefIterator, ParallelExtend};
|
use rayon::iter::{IntoParallelRefMutIterator, ParallelExtend};
|
||||||
use rayon_croissant::ParallelIteratorExt;
|
use rayon_croissant::ParallelIteratorExt;
|
||||||
use servo_arc::Arc;
|
|
||||||
use style::computed_values::position::T as Position;
|
use style::computed_values::position::T as Position;
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::values::computed::{Length, LengthPercentage};
|
use style::values::computed::{Length, LengthPercentage};
|
||||||
|
@ -36,7 +35,7 @@ pub(crate) struct PositioningContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) struct HoistedAbsolutelyPositionedBox {
|
pub(crate) struct HoistedAbsolutelyPositionedBox {
|
||||||
absolutely_positioned_box: Arc<AbsolutelyPositionedBox>,
|
absolutely_positioned_box: ArcRefCell<AbsolutelyPositionedBox>,
|
||||||
|
|
||||||
/// The rank of the child from which this absolutely positioned fragment
|
/// The rank of the child from which this absolutely positioned fragment
|
||||||
/// came from, when doing the layout of a block container. Used to compute
|
/// came from, when doing the layout of a block container. Used to compute
|
||||||
|
@ -98,14 +97,14 @@ impl AbsolutelyPositionedBox {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn to_hoisted(
|
pub(crate) fn to_hoisted(
|
||||||
self_: Arc<Self>,
|
self_: ArcRefCell<Self>,
|
||||||
initial_start_corner: Vec2<Length>,
|
initial_start_corner: Vec2<Length>,
|
||||||
tree_rank: usize,
|
tree_rank: usize,
|
||||||
) -> HoistedAbsolutelyPositionedBox {
|
) -> HoistedAbsolutelyPositionedBox {
|
||||||
fn absolute_box_offsets(
|
fn absolute_box_offsets(
|
||||||
initial_static_start: Length,
|
initial_static_start: Length,
|
||||||
start: LengthPercentageOrAuto,
|
start: LengthPercentageOrAuto<'_>,
|
||||||
end: LengthPercentageOrAuto,
|
end: LengthPercentageOrAuto<'_>,
|
||||||
) -> AbsoluteBoxOffsets {
|
) -> AbsoluteBoxOffsets {
|
||||||
match (start.non_auto(), end.non_auto()) {
|
match (start.non_auto(), end.non_auto()) {
|
||||||
(None, None) => AbsoluteBoxOffsets::StaticStart {
|
(None, None) => AbsoluteBoxOffsets::StaticStart {
|
||||||
|
@ -122,10 +121,10 @@ impl AbsolutelyPositionedBox {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let box_offsets = self_.contents.style.box_offsets();
|
let box_offsets = {
|
||||||
HoistedAbsolutelyPositionedBox {
|
let box_ = self_.borrow();
|
||||||
tree_rank,
|
let box_offsets = box_.contents.style.box_offsets();
|
||||||
box_offsets: Vec2 {
|
Vec2 {
|
||||||
inline: absolute_box_offsets(
|
inline: absolute_box_offsets(
|
||||||
initial_start_corner.inline,
|
initial_start_corner.inline,
|
||||||
box_offsets.inline_start,
|
box_offsets.inline_start,
|
||||||
|
@ -136,7 +135,11 @@ impl AbsolutelyPositionedBox {
|
||||||
box_offsets.block_start,
|
box_offsets.block_start,
|
||||||
box_offsets.block_end,
|
box_offsets.block_end,
|
||||||
),
|
),
|
||||||
},
|
}
|
||||||
|
};
|
||||||
|
HoistedAbsolutelyPositionedBox {
|
||||||
|
tree_rank,
|
||||||
|
box_offsets,
|
||||||
fragment: ArcRefCell::new(None),
|
fragment: ArcRefCell::new(None),
|
||||||
absolutely_positioned_box: self_,
|
absolutely_positioned_box: self_,
|
||||||
}
|
}
|
||||||
|
@ -268,7 +271,7 @@ impl PositioningContext {
|
||||||
while !hoisted_boxes.is_empty() {
|
while !hoisted_boxes.is_empty() {
|
||||||
HoistedAbsolutelyPositionedBox::layout_many(
|
HoistedAbsolutelyPositionedBox::layout_many(
|
||||||
layout_context,
|
layout_context,
|
||||||
&hoisted_boxes,
|
&mut hoisted_boxes,
|
||||||
&mut laid_out_child_fragments,
|
&mut laid_out_child_fragments,
|
||||||
&mut self.for_nearest_containing_block_for_all_descendants,
|
&mut self.for_nearest_containing_block_for_all_descendants,
|
||||||
&containing_block,
|
&containing_block,
|
||||||
|
@ -281,12 +284,13 @@ impl PositioningContext {
|
||||||
|
|
||||||
pub(crate) fn push(&mut self, box_: HoistedAbsolutelyPositionedBox) {
|
pub(crate) fn push(&mut self, box_: HoistedAbsolutelyPositionedBox) {
|
||||||
if let Some(nearest) = &mut self.for_nearest_positioned_ancestor {
|
if let Some(nearest) = &mut self.for_nearest_positioned_ancestor {
|
||||||
match box_
|
let position = box_
|
||||||
.absolutely_positioned_box
|
.absolutely_positioned_box
|
||||||
|
.borrow()
|
||||||
.contents
|
.contents
|
||||||
.style
|
.style
|
||||||
.clone_position()
|
.clone_position();
|
||||||
{
|
match position {
|
||||||
Position::Fixed => {}, // fall through
|
Position::Fixed => {}, // fall through
|
||||||
Position::Absolute => return nearest.push(box_),
|
Position::Absolute => return nearest.push(box_),
|
||||||
Position::Static | Position::Relative => unreachable!(),
|
Position::Static | Position::Relative => unreachable!(),
|
||||||
|
@ -357,7 +361,7 @@ impl PositioningContext {
|
||||||
{
|
{
|
||||||
HoistedAbsolutelyPositionedBox::layout_many(
|
HoistedAbsolutelyPositionedBox::layout_many(
|
||||||
layout_context,
|
layout_context,
|
||||||
&std::mem::take(&mut self.for_nearest_containing_block_for_all_descendants),
|
&mut std::mem::take(&mut self.for_nearest_containing_block_for_all_descendants),
|
||||||
fragments,
|
fragments,
|
||||||
&mut self.for_nearest_containing_block_for_all_descendants,
|
&mut self.for_nearest_containing_block_for_all_descendants,
|
||||||
initial_containing_block,
|
initial_containing_block,
|
||||||
|
@ -369,13 +373,13 @@ impl PositioningContext {
|
||||||
impl HoistedAbsolutelyPositionedBox {
|
impl HoistedAbsolutelyPositionedBox {
|
||||||
pub(crate) fn layout_many(
|
pub(crate) fn layout_many(
|
||||||
layout_context: &LayoutContext,
|
layout_context: &LayoutContext,
|
||||||
boxes: &[Self],
|
boxes: &mut [Self],
|
||||||
fragments: &mut Vec<ArcRefCell<Fragment>>,
|
fragments: &mut Vec<ArcRefCell<Fragment>>,
|
||||||
for_nearest_containing_block_for_all_descendants: &mut Vec<HoistedAbsolutelyPositionedBox>,
|
for_nearest_containing_block_for_all_descendants: &mut Vec<HoistedAbsolutelyPositionedBox>,
|
||||||
containing_block: &DefiniteContainingBlock,
|
containing_block: &DefiniteContainingBlock,
|
||||||
) {
|
) {
|
||||||
if layout_context.use_rayon {
|
if layout_context.use_rayon {
|
||||||
fragments.par_extend(boxes.par_iter().mapfold_reduce_into(
|
fragments.par_extend(boxes.par_iter_mut().mapfold_reduce_into(
|
||||||
for_nearest_containing_block_for_all_descendants,
|
for_nearest_containing_block_for_all_descendants,
|
||||||
|for_nearest_containing_block_for_all_descendants, box_| {
|
|for_nearest_containing_block_for_all_descendants, box_| {
|
||||||
let new_fragment = ArcRefCell::new(Fragment::Box(box_.layout(
|
let new_fragment = ArcRefCell::new(Fragment::Box(box_.layout(
|
||||||
|
@ -391,7 +395,7 @@ impl HoistedAbsolutelyPositionedBox {
|
||||||
vec_append_owned,
|
vec_append_owned,
|
||||||
))
|
))
|
||||||
} else {
|
} else {
|
||||||
fragments.extend(boxes.iter().map(|box_| {
|
fragments.extend(boxes.iter_mut().map(|box_| {
|
||||||
let new_fragment = ArcRefCell::new(Fragment::Box(box_.layout(
|
let new_fragment = ArcRefCell::new(Fragment::Box(box_.layout(
|
||||||
layout_context,
|
layout_context,
|
||||||
for_nearest_containing_block_for_all_descendants,
|
for_nearest_containing_block_for_all_descendants,
|
||||||
|
@ -404,19 +408,20 @@ impl HoistedAbsolutelyPositionedBox {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn layout(
|
pub(crate) fn layout(
|
||||||
&self,
|
&mut self,
|
||||||
layout_context: &LayoutContext,
|
layout_context: &LayoutContext,
|
||||||
for_nearest_containing_block_for_all_descendants: &mut Vec<HoistedAbsolutelyPositionedBox>,
|
for_nearest_containing_block_for_all_descendants: &mut Vec<HoistedAbsolutelyPositionedBox>,
|
||||||
containing_block: &DefiniteContainingBlock,
|
containing_block: &DefiniteContainingBlock,
|
||||||
) -> BoxFragment {
|
) -> BoxFragment {
|
||||||
let cbis = containing_block.size.inline;
|
let cbis = containing_block.size.inline;
|
||||||
let cbbs = containing_block.size.block;
|
let cbbs = containing_block.size.block;
|
||||||
let style = &self.absolutely_positioned_box.contents.style;
|
let absolutely_positioned_box = self.absolutely_positioned_box.borrow_mut();
|
||||||
|
let style = &absolutely_positioned_box.contents.style;
|
||||||
let pbm = style.padding_border_margin(&containing_block.into());
|
let pbm = style.padding_border_margin(&containing_block.into());
|
||||||
|
|
||||||
let size;
|
let size;
|
||||||
let replaced_used_size;
|
let replaced_used_size;
|
||||||
match self.absolutely_positioned_box.contents.as_replaced() {
|
match absolutely_positioned_box.contents.as_replaced() {
|
||||||
Ok(replaced) => {
|
Ok(replaced) => {
|
||||||
// https://drafts.csswg.org/css2/visudet.html#abs-replaced-width
|
// https://drafts.csswg.org/css2/visudet.html#abs-replaced-width
|
||||||
// https://drafts.csswg.org/css2/visudet.html#abs-replaced-height
|
// https://drafts.csswg.org/css2/visudet.html#abs-replaced-height
|
||||||
|
@ -468,11 +473,11 @@ impl HoistedAbsolutelyPositionedBox {
|
||||||
|positioning_context| {
|
|positioning_context| {
|
||||||
let size;
|
let size;
|
||||||
let fragments;
|
let fragments;
|
||||||
match self.absolutely_positioned_box.contents.as_replaced() {
|
match absolutely_positioned_box.contents.as_replaced() {
|
||||||
Ok(replaced) => {
|
Ok(replaced) => {
|
||||||
// https://drafts.csswg.org/css2/visudet.html#abs-replaced-width
|
// https://drafts.csswg.org/css2/visudet.html#abs-replaced-width
|
||||||
// https://drafts.csswg.org/css2/visudet.html#abs-replaced-height
|
// https://drafts.csswg.org/css2/visudet.html#abs-replaced-height
|
||||||
let style = &self.absolutely_positioned_box.contents.style;
|
let style = &absolutely_positioned_box.contents.style;
|
||||||
size = replaced_used_size.unwrap();
|
size = replaced_used_size.unwrap();
|
||||||
fragments = replaced.make_fragments(style, size.clone());
|
fragments = replaced.make_fragments(style, size.clone());
|
||||||
},
|
},
|
||||||
|
@ -488,7 +493,7 @@ impl HoistedAbsolutelyPositionedBox {
|
||||||
anchor -
|
anchor -
|
||||||
pbm.padding_border_sums.inline -
|
pbm.padding_border_sums.inline -
|
||||||
margin.inline_sum();
|
margin.inline_sum();
|
||||||
self.absolutely_positioned_box
|
absolutely_positioned_box
|
||||||
.contents
|
.contents
|
||||||
.content_sizes
|
.content_sizes
|
||||||
.shrink_to_fit(available_size)
|
.shrink_to_fit(available_size)
|
||||||
|
@ -544,7 +549,7 @@ impl HoistedAbsolutelyPositionedBox {
|
||||||
};
|
};
|
||||||
|
|
||||||
BoxFragment::new(
|
BoxFragment::new(
|
||||||
self.absolutely_positioned_box.contents.tag,
|
absolutely_positioned_box.contents.tag,
|
||||||
style.clone(),
|
style.clone(),
|
||||||
fragments,
|
fragments,
|
||||||
content_rect,
|
content_rect,
|
||||||
|
|
|
@ -64,9 +64,9 @@ pub(crate) struct PaddingBorderMargin {
|
||||||
pub(crate) trait ComputedValuesExt {
|
pub(crate) trait ComputedValuesExt {
|
||||||
fn inline_size_is_length(&self) -> bool;
|
fn inline_size_is_length(&self) -> bool;
|
||||||
fn inline_box_offsets_are_both_non_auto(&self) -> bool;
|
fn inline_box_offsets_are_both_non_auto(&self) -> bool;
|
||||||
fn box_offsets(&self) -> flow_relative::Sides<LengthPercentageOrAuto>;
|
fn box_offsets(&self) -> flow_relative::Sides<LengthPercentageOrAuto<'_>>;
|
||||||
fn box_size(&self) -> flow_relative::Vec2<LengthPercentageOrAuto>;
|
fn box_size(&self) -> flow_relative::Vec2<LengthPercentageOrAuto<'_>>;
|
||||||
fn min_box_size(&self) -> flow_relative::Vec2<LengthPercentageOrAuto>;
|
fn min_box_size(&self) -> flow_relative::Vec2<LengthPercentageOrAuto<'_>>;
|
||||||
fn max_box_size(&self) -> flow_relative::Vec2<Option<&LengthPercentage>>;
|
fn max_box_size(&self) -> flow_relative::Vec2<Option<&LengthPercentage>>;
|
||||||
fn content_box_size(
|
fn content_box_size(
|
||||||
&self,
|
&self,
|
||||||
|
@ -86,7 +86,7 @@ pub(crate) trait ComputedValuesExt {
|
||||||
fn padding_border_margin(&self, containing_block: &ContainingBlock) -> PaddingBorderMargin;
|
fn padding_border_margin(&self, containing_block: &ContainingBlock) -> PaddingBorderMargin;
|
||||||
fn padding(&self) -> flow_relative::Sides<&LengthPercentage>;
|
fn padding(&self) -> flow_relative::Sides<&LengthPercentage>;
|
||||||
fn border_width(&self) -> flow_relative::Sides<Length>;
|
fn border_width(&self) -> flow_relative::Sides<Length>;
|
||||||
fn margin(&self) -> flow_relative::Sides<LengthPercentageOrAuto>;
|
fn margin(&self) -> flow_relative::Sides<LengthPercentageOrAuto<'_>>;
|
||||||
fn has_transform_or_perspective(&self) -> bool;
|
fn has_transform_or_perspective(&self) -> bool;
|
||||||
fn effective_z_index(&self) -> i32;
|
fn effective_z_index(&self) -> i32;
|
||||||
fn establishes_stacking_context(&self) -> bool;
|
fn establishes_stacking_context(&self) -> bool;
|
||||||
|
@ -117,7 +117,7 @@ impl ComputedValuesExt for ComputedValues {
|
||||||
!a.is_auto() && !b.is_auto()
|
!a.is_auto() && !b.is_auto()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn box_offsets(&self) -> flow_relative::Sides<LengthPercentageOrAuto> {
|
fn box_offsets(&self) -> flow_relative::Sides<LengthPercentageOrAuto<'_>> {
|
||||||
let position = self.get_position();
|
let position = self.get_position();
|
||||||
flow_relative::Sides::from_physical(
|
flow_relative::Sides::from_physical(
|
||||||
&PhysicalSides::new(
|
&PhysicalSides::new(
|
||||||
|
@ -130,7 +130,7 @@ impl ComputedValuesExt for ComputedValues {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn box_size(&self) -> flow_relative::Vec2<LengthPercentageOrAuto> {
|
fn box_size(&self) -> flow_relative::Vec2<LengthPercentageOrAuto<'_>> {
|
||||||
let position = self.get_position();
|
let position = self.get_position();
|
||||||
flow_relative::Vec2::from_physical_size(
|
flow_relative::Vec2::from_physical_size(
|
||||||
&PhysicalSize::new(
|
&PhysicalSize::new(
|
||||||
|
@ -141,7 +141,7 @@ impl ComputedValuesExt for ComputedValues {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn min_box_size(&self) -> flow_relative::Vec2<LengthPercentageOrAuto> {
|
fn min_box_size(&self) -> flow_relative::Vec2<LengthPercentageOrAuto<'_>> {
|
||||||
let position = self.get_position();
|
let position = self.get_position();
|
||||||
flow_relative::Vec2::from_physical_size(
|
flow_relative::Vec2::from_physical_size(
|
||||||
&PhysicalSize::new(
|
&PhysicalSize::new(
|
||||||
|
@ -271,7 +271,7 @@ impl ComputedValuesExt for ComputedValues {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn margin(&self) -> flow_relative::Sides<LengthPercentageOrAuto> {
|
fn margin(&self) -> flow_relative::Sides<LengthPercentageOrAuto<'_>> {
|
||||||
let margin = self.get_margin();
|
let margin = self.get_margin();
|
||||||
flow_relative::Sides::from_physical(
|
flow_relative::Sides::from_physical(
|
||||||
&PhysicalSides::new(
|
&PhysicalSides::new(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue