mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Fix vertical alignment at the root of an IFC (#31636)
At the root of an inline formatting context, we used its vertical-align in order to compute the strut. That was wrong, since vertical-align on a block container shouldn't affect the contents, it should only affect the alignment of the block container (if it's inline-level) within the parent IFC. This was only working well if the block container was block-level, since effective_vertical_align_for_inline_layout returned `baseline` for block-level boxes. Instead of the outer display type, this patch changes the logic to check whether we are at the root of the IFC.
This commit is contained in:
parent
63527f56ca
commit
0860deba05
7 changed files with 223 additions and 58 deletions
|
@ -13,9 +13,8 @@ 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_::{GenericVerticalAlign, Perspective, VerticalAlignKeyword};
|
||||
use style::values::generics::box_::Perspective;
|
||||
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;
|
||||
|
@ -189,7 +188,6 @@ 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 {
|
||||
|
@ -560,18 +558,6 @@ 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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue