mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #25033 - servo:intrinsic, r=nox
Add support for inline-block and for computing min/max-content
This commit is contained in:
commit
e70397d90a
19 changed files with 823 additions and 272 deletions
|
@ -45,6 +45,9 @@ pub(crate) enum DisplayInside {
|
|||
|
||||
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_non_auto(&self) -> bool;
|
||||
fn box_offsets(&self) -> flow_relative::Sides<LengthPercentageOrAuto>;
|
||||
fn box_size(&self) -> flow_relative::Vec2<LengthPercentageOrAuto>;
|
||||
fn min_box_size(&self) -> flow_relative::Vec2<LengthPercentageOrAuto>;
|
||||
|
@ -62,6 +65,39 @@ impl ComputedValuesExt for ComputedValues {
|
|||
(writing_mode, direction)
|
||||
}
|
||||
|
||||
fn writing_mode_is_horizontal(&self) -> bool {
|
||||
match self.get_inherited_box().writing_mode {
|
||||
WritingMode::HorizontalTb => true,
|
||||
WritingMode::VerticalLr | WritingMode::VerticalRl => false,
|
||||
}
|
||||
}
|
||||
|
||||
fn inline_size_is_auto(&self) -> bool {
|
||||
let position = self.get_position();
|
||||
let size = if self.writing_mode_is_horizontal() {
|
||||
position.width
|
||||
} else {
|
||||
position.height
|
||||
};
|
||||
matches!(size, Size::Auto)
|
||||
}
|
||||
|
||||
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)
|
||||
} else {
|
||||
(position.top, position.bottom)
|
||||
};
|
||||
matches!(
|
||||
offsets,
|
||||
(
|
||||
LengthPercentageOrAuto::LengthPercentage(_),
|
||||
LengthPercentageOrAuto::LengthPercentage(_),
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn box_offsets(&self) -> flow_relative::Sides<LengthPercentageOrAuto> {
|
||||
let position = self.get_position();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue