aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/flow
diff options
context:
space:
mode:
authoratbrakhi <atbrakhi@igalia.com>2024-01-15 15:31:21 +0100
committerGitHub <noreply@github.com>2024-01-15 14:31:21 +0000
commit1b847c3166d17a957f5ab5e4aae3a3fcb10d875c (patch)
tree6ff386ce681e3be3406eace72af574305dcd4b14 /components/layout_2020/flow
parentefa38c67fe6bdec751739bb3a0a6d159f2b695c8 (diff)
downloadservo-1b847c3166d17a957f5ab5e4aae3a3fcb10d875c.tar.gz
servo-1b847c3166d17a957f5ab5e4aae3a3fcb10d875c.zip
layout: Switch `IndependentLayout` to use `Au` instead of `Length` (#31083)
* use au in layout * fmt * review fix
Diffstat (limited to 'components/layout_2020/flow')
-rw-r--r--components/layout_2020/flow/float.rs2
-rw-r--r--components/layout_2020/flow/inline.rs6
-rw-r--r--components/layout_2020/flow/mod.rs33
3 files changed, 28 insertions, 13 deletions
diff --git a/components/layout_2020/flow/float.rs b/components/layout_2020/flow/float.rs
index a6f8f06ddf3..1de87a59eb2 100644
--- a/components/layout_2020/flow/float.rs
+++ b/components/layout_2020/flow/float.rs
@@ -930,7 +930,7 @@ impl FloatBox {
inline: inline_size,
block: box_size
.block
- .auto_is(|| independent_layout.content_block_size),
+ .auto_is(|| independent_layout.content_block_size.into()),
};
children = independent_layout.fragments;
},
diff --git a/components/layout_2020/flow/inline.rs b/components/layout_2020/flow/inline.rs
index e980983552a..c5b9bbd6c5c 100644
--- a/components/layout_2020/flow/inline.rs
+++ b/components/layout_2020/flow/inline.rs
@@ -1949,7 +1949,7 @@ impl IndependentFormattingContext {
// https://drafts.csswg.org/css2/visudet.html#block-root-margin
let tentative_block_size = box_size
.block
- .auto_is(|| independent_layout.content_block_size);
+ .auto_is(|| independent_layout.content_block_size.into());
// https://drafts.csswg.org/css2/visudet.html#min-max-heights
// In this case “applying the rules above again” with a non-auto block-size
@@ -1974,7 +1974,9 @@ impl IndependentFormattingContext {
pbm.border,
margin,
None,
- independent_layout.last_inflow_baseline_offset,
+ independent_layout
+ .last_inflow_baseline_offset
+ .map(|t| t.into()),
CollapsedBlockMargins::zero(),
)
},
diff --git a/components/layout_2020/flow/mod.rs b/components/layout_2020/flow/mod.rs
index 95c03655980..acdfa59ab26 100644
--- a/components/layout_2020/flow/mod.rs
+++ b/components/layout_2020/flow/mod.rs
@@ -30,7 +30,7 @@ use crate::geom::{LogicalRect, LogicalSides, LogicalVec2};
use crate::positioned::{AbsolutelyPositionedBox, PositioningContext, PositioningContextLength};
use crate::replaced::ReplacedContent;
use crate::sizing::{self, ContentSizes};
-use crate::style_ext::{ComputedValuesExt, PaddingBorderMargin};
+use crate::style_ext::{Clamp, ComputedValuesExt, PaddingBorderMargin};
use crate::ContainingBlock;
mod construct;
@@ -240,10 +240,11 @@ impl BlockFormattingContext {
IndependentLayout {
fragments: flow_layout.fragments,
- content_block_size: flow_layout.content_block_size +
+ content_block_size: (flow_layout.content_block_size +
flow_layout.collapsible_margins_in_children.end.solve() +
- clearance.unwrap_or_else(Length::zero),
- last_inflow_baseline_offset: flow_layout.last_inflow_baseline_offset,
+ clearance.unwrap_or_else(Length::zero))
+ .into(),
+ last_inflow_baseline_offset: flow_layout.last_inflow_baseline_offset.map(|t| t.into()),
}
}
}
@@ -858,7 +859,11 @@ impl NonReplacedFormattingContext {
let block_size = containing_block_for_children.block_size.auto_is(|| {
layout
.content_block_size
- .clamp_between_extremums(min_box_size.block, max_box_size.block)
+ .clamp_between_extremums(
+ min_box_size.block.into(),
+ max_box_size.block.map(|t| t.into()),
+ )
+ .into()
});
let content_rect = LogicalRect {
@@ -882,7 +887,7 @@ impl NonReplacedFormattingContext {
pbm.border,
margin,
None, /* clearance */
- layout.last_inflow_baseline_offset,
+ layout.last_inflow_baseline_offset.map(|t| t.into()),
block_margins_collapsed_with_children,
)
}
@@ -939,12 +944,17 @@ impl NonReplacedFormattingContext {
style: &self.style,
},
);
+
content_size = LogicalVec2 {
inline: inline_size,
block: block_size.auto_is(|| {
layout
.content_block_size
- .clamp_between_extremums(min_box_size.block, max_box_size.block)
+ .clamp_between_extremums(
+ min_box_size.block.into(),
+ max_box_size.block.map(|t| t.into()),
+ )
+ .into()
}),
};
@@ -1002,13 +1012,16 @@ impl NonReplacedFormattingContext {
style: &self.style,
},
);
-
content_size = LogicalVec2 {
inline: proposed_inline_size,
block: block_size.auto_is(|| {
layout
.content_block_size
- .clamp_between_extremums(min_box_size.block, max_box_size.block)
+ .clamp_between_extremums(
+ min_box_size.block.into(),
+ max_box_size.block.map(|t| t.into()),
+ )
+ .into()
}),
};
@@ -1092,7 +1105,7 @@ impl NonReplacedFormattingContext {
pbm.border,
margin,
clearance,
- layout.last_inflow_baseline_offset,
+ layout.last_inflow_baseline_offset.map(|t| t.into()),
block_margins_collapsed_with_children,
)
}