Implement shrink-to-fit for abspos

This commit is contained in:
Simon Sapin 2019-12-03 13:12:40 +01:00
parent efa1885e1b
commit 46f0f7d7e2
5 changed files with 48 additions and 15 deletions

View file

@ -45,7 +45,7 @@ pub(crate) trait ComputedValuesExt {
fn writing_mode(&self) -> (WritingMode, Direction);
fn writing_mode_is_horizontal(&self) -> bool;
fn inline_size_is_auto(&self) -> bool;
fn inline_box_offsets_are_both_auto(&self) -> bool;
fn inline_box_offsets_are_both_non_auto(&self) -> bool;
fn box_offsets(&self) -> flow_relative::Sides<LengthPercentageOrAuto>;
fn box_size(&self) -> flow_relative::Vec2<LengthPercentageOrAuto>;
fn padding(&self) -> flow_relative::Sides<LengthPercentage>;
@ -78,7 +78,7 @@ impl ComputedValuesExt for ComputedValues {
matches!(size, Size::Auto)
}
fn inline_box_offsets_are_both_auto(&self) -> bool {
fn inline_box_offsets_are_both_non_auto(&self) -> bool {
let position = self.get_position();
let offsets = if self.writing_mode_is_horizontal() {
(position.left, position.right)
@ -87,7 +87,10 @@ impl ComputedValuesExt for ComputedValues {
};
matches!(
offsets,
(LengthPercentageOrAuto::Auto, LengthPercentageOrAuto::Auto)
(
LengthPercentageOrAuto::LengthPercentage(_),
LengthPercentageOrAuto::LengthPercentage(_),
)
)
}