Add a request_content_sizes parameter to IndependentFormattingContext::construct

This commit is contained in:
Simon Sapin 2019-12-03 00:45:29 +01:00
parent 2c124b9d0b
commit cfdd23ac16
8 changed files with 101 additions and 52 deletions

View file

@ -45,6 +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 box_offsets(&self) -> flow_relative::Sides<LengthPercentageOrAuto>;
fn box_size(&self) -> flow_relative::Vec2<LengthPercentageOrAuto>;
fn padding(&self) -> flow_relative::Sides<LengthPercentage>;
@ -77,6 +78,19 @@ impl ComputedValuesExt for ComputedValues {
matches!(size, Size::Auto)
}
fn inline_box_offsets_are_both_auto(&self) -> bool {
let position = self.get_position();
let offsets = if self.writing_mode_is_horizontal() {
(position.left, position.right)
} else {
(position.top, position.bottom)
};
matches!(
offsets,
(LengthPercentageOrAuto::Auto, LengthPercentageOrAuto::Auto)
)
}
#[inline]
fn box_offsets(&self) -> flow_relative::Sides<LengthPercentageOrAuto> {
let position = self.get_position();