mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Add inline_size_is_auto
This commit is contained in:
parent
6a5b8337a1
commit
2c124b9d0b
2 changed files with 20 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
#![deny(unsafe_code)]
|
||||
#![feature(exact_size_is_empty)]
|
||||
#![feature(matches_macro)]
|
||||
|
||||
pub mod context;
|
||||
pub mod data;
|
||||
|
|
|
@ -43,6 +43,8 @@ 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 box_offsets(&self) -> flow_relative::Sides<LengthPercentageOrAuto>;
|
||||
fn box_size(&self) -> flow_relative::Vec2<LengthPercentageOrAuto>;
|
||||
fn padding(&self) -> flow_relative::Sides<LengthPercentage>;
|
||||
|
@ -58,6 +60,23 @@ 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)
|
||||
}
|
||||
|
||||
#[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