mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
layout_2020: Add an optional box size parameter to ReplacedContent::used_size_as_if_inline_element
This allow us to specify the used size when calculating size of replaced content.
This commit is contained in:
parent
867326c46a
commit
1dbd74f389
5 changed files with 6 additions and 2 deletions
|
@ -1006,6 +1006,7 @@ impl<'a> FlexItem<'a> {
|
||||||
let size = replaced.contents.used_size_as_if_inline_element(
|
let size = replaced.contents.used_size_as_if_inline_element(
|
||||||
flex_context.containing_block,
|
flex_context.containing_block,
|
||||||
&replaced.style,
|
&replaced.style,
|
||||||
|
None,
|
||||||
&pbm,
|
&pbm,
|
||||||
);
|
);
|
||||||
let cross_size = flex_context.vec2_to_flex_relative(size.clone()).cross;
|
let cross_size = flex_context.vec2_to_flex_relative(size.clone()).cross;
|
||||||
|
|
|
@ -573,6 +573,7 @@ fn layout_atomic(
|
||||||
let size = replaced.contents.used_size_as_if_inline_element(
|
let size = replaced.contents.used_size_as_if_inline_element(
|
||||||
ifc.containing_block,
|
ifc.containing_block,
|
||||||
&replaced.style,
|
&replaced.style,
|
||||||
|
None,
|
||||||
&pbm,
|
&pbm,
|
||||||
);
|
);
|
||||||
let fragments = replaced
|
let fragments = replaced
|
||||||
|
|
|
@ -581,7 +581,7 @@ fn layout_in_flow_replaced_block_level<'a>(
|
||||||
replaced: &ReplacedContent,
|
replaced: &ReplacedContent,
|
||||||
) -> BoxFragment {
|
) -> BoxFragment {
|
||||||
let pbm = style.padding_border_margin(containing_block);
|
let pbm = style.padding_border_margin(containing_block);
|
||||||
let size = replaced.used_size_as_if_inline_element(containing_block, style, &pbm);
|
let size = replaced.used_size_as_if_inline_element(containing_block, style, None, &pbm);
|
||||||
|
|
||||||
let (margin_inline_start, margin_inline_end) =
|
let (margin_inline_start, margin_inline_end) =
|
||||||
solve_inline_margins_for_in_flow_block_level(containing_block, &pbm, size.inline);
|
solve_inline_margins_for_in_flow_block_level(containing_block, &pbm, size.inline);
|
||||||
|
|
|
@ -439,6 +439,7 @@ impl HoistedAbsolutelyPositionedBox {
|
||||||
let used_size = replaced.contents.used_size_as_if_inline_element(
|
let used_size = replaced.contents.used_size_as_if_inline_element(
|
||||||
&containing_block.into(),
|
&containing_block.into(),
|
||||||
&replaced.style,
|
&replaced.style,
|
||||||
|
None,
|
||||||
&pbm,
|
&pbm,
|
||||||
);
|
);
|
||||||
Vec2 {
|
Vec2 {
|
||||||
|
|
|
@ -309,13 +309,14 @@ impl ReplacedContent {
|
||||||
&self,
|
&self,
|
||||||
containing_block: &ContainingBlock,
|
containing_block: &ContainingBlock,
|
||||||
style: &ComputedValues,
|
style: &ComputedValues,
|
||||||
|
box_size: Option<Vec2<LengthOrAuto>>,
|
||||||
pbm: &PaddingBorderMargin,
|
pbm: &PaddingBorderMargin,
|
||||||
) -> Vec2<Length> {
|
) -> Vec2<Length> {
|
||||||
let mode = style.writing_mode;
|
let mode = style.writing_mode;
|
||||||
let intrinsic_size = self.flow_relative_intrinsic_size(style);
|
let intrinsic_size = self.flow_relative_intrinsic_size(style);
|
||||||
let intrinsic_ratio = self.inline_size_over_block_size_intrinsic_ratio(style);
|
let intrinsic_ratio = self.inline_size_over_block_size_intrinsic_ratio(style);
|
||||||
|
|
||||||
let box_size = style.content_box_size(containing_block, &pbm);
|
let box_size = box_size.unwrap_or(style.content_box_size(containing_block, &pbm));
|
||||||
let max_box_size = style.content_max_box_size(containing_block, &pbm);
|
let max_box_size = style.content_max_box_size(containing_block, &pbm);
|
||||||
let min_box_size = style
|
let min_box_size = style
|
||||||
.content_min_box_size(containing_block, &pbm)
|
.content_min_box_size(containing_block, &pbm)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue