layout: Split LineItem layout into a new file (#31039)

This is just a bit of code movement that trims down the size of the
`inline.rs` file in order to make it a bit more manageable. It leads the
way to more refactoring and cleanup in the future.
This commit is contained in:
Martin Robinson 2024-01-10 06:42:11 +01:00 committed by GitHub
parent bfa853a1cc
commit 3555671864
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 658 additions and 603 deletions

View file

@ -13,8 +13,9 @@ use style::properties::longhands::column_span::computed_value::T as ColumnSpan;
use style::properties::ComputedValues;
use style::values::computed::image::Image as ComputedImageLayer;
use style::values::computed::{Length, LengthPercentage, NonNegativeLengthPercentage, Size};
use style::values::generics::box_::Perspective;
use style::values::generics::box_::{GenericVerticalAlign, Perspective, VerticalAlignKeyword};
use style::values::generics::length::MaxSize;
use style::values::specified::box_::DisplayOutside as StyloDisplayOutside;
use style::values::specified::{box_ as stylo, Overflow};
use style::Zero;
use webrender_api as wr;
@ -168,6 +169,7 @@ pub(crate) trait ComputedValuesExt {
fn establishes_containing_block_for_all_descendants(&self) -> bool;
fn background_is_transparent(&self) -> bool;
fn get_webrender_primitive_flags(&self) -> wr::PrimitiveFlags;
fn effective_vertical_align_for_inline_layout(&self) -> GenericVerticalAlign<LengthPercentage>;
}
impl ComputedValuesExt for ComputedValues {
@ -533,6 +535,18 @@ impl ComputedValuesExt for ComputedValues {
BackfaceVisiblity::Hidden => wr::PrimitiveFlags::empty(),
}
}
/// Get the effective `vertical-align` property for inline layout. Essentially, if this style
/// has outside block display, this is the inline formatting context root and `vertical-align`
/// doesn't come into play for inline layout.
fn effective_vertical_align_for_inline_layout(&self) -> GenericVerticalAlign<LengthPercentage> {
match self.clone_display().outside() {
StyloDisplayOutside::Block => {
GenericVerticalAlign::Keyword(VerticalAlignKeyword::Baseline)
},
_ => self.clone_vertical_align(),
}
}
}
impl From<stylo::Display> for Display {