Implementation of baseline-source (#31904)

Updating Stylo and test expectations.
This commit is contained in:
Munish Mummadi 2024-04-02 05:20:13 -05:00 committed by GitHub
parent da3991c8f3
commit 2a517f786b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 25 additions and 244 deletions

View file

@ -85,6 +85,7 @@ use style::properties::ComputedValues;
use style::values::computed::Length;
use style::values::generics::box_::VerticalAlignKeyword;
use style::values::generics::font::LineHeight;
use style::values::specified::box_::BaselineSource;
use style::values::specified::text::{TextAlignKeyword, TextDecorationLine};
use style::values::specified::{TextAlignLast, TextJustify};
use style::Zero;
@ -2143,13 +2144,18 @@ impl IndependentFormattingContext {
/// Picks either the first or the last baseline, depending on `baseline-source`.
/// <https://drafts.csswg.org/css-inline/#baseline-source>
fn pick_baseline(&self, baselines: &Baselines) -> Option<Au> {
// TODO: Currently this only supports the initial `baseline-source: auto`.
if let Self::NonReplaced(non_replaced) = self {
if let NonReplacedFormattingContextContents::Flow(_) = non_replaced.contents {
return baselines.last;
}
match self.style().clone_baseline_source() {
BaselineSource::First => baselines.first,
BaselineSource::Last => baselines.last,
BaselineSource::Auto => {
if let Self::NonReplaced(non_replaced) = self {
if let NonReplacedFormattingContextContents::Flow(_) = non_replaced.contents {
return baselines.last;
}
}
baselines.first
},
}
baselines.first
}
fn get_block_sizes_and_baseline_offset(