mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Refactor positioned layout (#33922)
This unifies the size resolution into AbsoluteAxisSolver, since it needs to know the size in order to resolve auto margins correctly anyways. This will allow adding support for sizing keywords in a follow-up patch. Also, this avoids doing multiple layouts due to min and max constraints, improving performance. Additionally, tables may end up having a custom size, different than what we would expect by just looking at the sizing properties. This patch ensures that we resolve margins correctly with the final size, resulting in 2 tests now passing. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
fee927475b
commit
2319764a1e
4 changed files with 195 additions and 256 deletions
|
@ -30,7 +30,6 @@ pub use flow::BoxTree;
|
|||
pub use fragment_tree::FragmentTree;
|
||||
use geom::AuOrAuto;
|
||||
use style::properties::ComputedValues;
|
||||
use style_ext::{Clamp, ComputedValuesExt};
|
||||
|
||||
use crate::geom::LogicalVec2;
|
||||
|
||||
|
@ -59,22 +58,6 @@ impl<'a> IndefiniteContainingBlock<'a> {
|
|||
style,
|
||||
}
|
||||
}
|
||||
|
||||
fn new_for_intrinsic_inline_size_of_child(
|
||||
&self,
|
||||
style: &'a ComputedValues,
|
||||
auto_minimum: &LogicalVec2<Au>,
|
||||
) -> Self {
|
||||
let (content_box_size, content_min_size, content_max_size, _, _) =
|
||||
style.content_box_sizes_and_padding_border_margin_deprecated(self);
|
||||
let block_size = content_box_size.block.map(|v| {
|
||||
v.clamp_between_extremums(
|
||||
content_min_size.block.auto_is(|| auto_minimum.block),
|
||||
content_max_size.block,
|
||||
)
|
||||
});
|
||||
IndefiniteContainingBlock::new_for_style_and_block_size(style, block_size)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'_ ContainingBlock<'a>> for IndefiniteContainingBlock<'a> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue