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

26
Cargo.lock generated
View file

@ -1198,7 +1198,7 @@ dependencies = [
[[package]]
name = "derive_common"
version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#c22dd97c7a826c04a8fb18f99fde5921ec2eea82"
dependencies = [
"darling",
"proc-macro2",
@ -3448,7 +3448,7 @@ dependencies = [
[[package]]
name = "malloc_size_of"
version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#c22dd97c7a826c04a8fb18f99fde5921ec2eea82"
dependencies = [
"accountable-refcell",
"app_units",
@ -5061,7 +5061,7 @@ dependencies = [
[[package]]
name = "selectors"
version = "0.24.0"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#c22dd97c7a826c04a8fb18f99fde5921ec2eea82"
dependencies = [
"bitflags 2.5.0",
"cssparser",
@ -5349,7 +5349,7 @@ dependencies = [
[[package]]
name = "servo_arc"
version = "0.2.0"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#c22dd97c7a826c04a8fb18f99fde5921ec2eea82"
dependencies = [
"nodrop",
"serde",
@ -5359,7 +5359,7 @@ dependencies = [
[[package]]
name = "servo_atoms"
version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#c22dd97c7a826c04a8fb18f99fde5921ec2eea82"
dependencies = [
"string_cache",
"string_cache_codegen",
@ -5557,7 +5557,7 @@ checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
[[package]]
name = "size_of_test"
version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#c22dd97c7a826c04a8fb18f99fde5921ec2eea82"
dependencies = [
"static_assertions",
]
@ -5683,7 +5683,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "static_prefs"
version = "0.1.0"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#c22dd97c7a826c04a8fb18f99fde5921ec2eea82"
[[package]]
name = "strict-num"
@ -5720,7 +5720,7 @@ dependencies = [
[[package]]
name = "style"
version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#c22dd97c7a826c04a8fb18f99fde5921ec2eea82"
dependencies = [
"app_units",
"arrayvec",
@ -5779,7 +5779,7 @@ dependencies = [
[[package]]
name = "style_config"
version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#c22dd97c7a826c04a8fb18f99fde5921ec2eea82"
dependencies = [
"lazy_static",
]
@ -5787,7 +5787,7 @@ dependencies = [
[[package]]
name = "style_derive"
version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#c22dd97c7a826c04a8fb18f99fde5921ec2eea82"
dependencies = [
"darling",
"derive_common",
@ -5818,7 +5818,7 @@ dependencies = [
[[package]]
name = "style_traits"
version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#c22dd97c7a826c04a8fb18f99fde5921ec2eea82"
dependencies = [
"app_units",
"bitflags 2.5.0",
@ -6172,7 +6172,7 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "to_shmem"
version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#c22dd97c7a826c04a8fb18f99fde5921ec2eea82"
dependencies = [
"cssparser",
"servo_arc",
@ -6185,7 +6185,7 @@ dependencies = [
[[package]]
name = "to_shmem_derive"
version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
source = "git+https://github.com/servo/stylo?branch=2023-10-16#c22dd97c7a826c04a8fb18f99fde5921ec2eea82"
dependencies = [
"darling",
"derive_common",

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`.
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
},
}
}
fn get_block_sizes_and_baseline_offset(

View file

@ -1,9 +0,0 @@
[baseline-source-computed.html]
[Property baseline-source value 'auto']
expected: FAIL
[Property baseline-source value 'first']
expected: FAIL
[Property baseline-source value 'last']
expected: FAIL

View file

@ -37,90 +37,3 @@
[Web Animations: property <baseline-source> from [initial\] to [last\] at (1.5) should be [last\]]
expected: FAIL
[CSS Transitions with transition-behavior:allow-discrete: property <baseline-source> from [initial\] to [last\] at (0.5) should be [last\]]
expected: FAIL
[CSS Transitions with transition-behavior:allow-discrete: property <baseline-source> from [initial\] to [last\] at (0.6) should be [last\]]
expected: FAIL
[CSS Transitions with transition-behavior:allow-discrete: property <baseline-source> from [initial\] to [last\] at (1) should be [last\]]
expected: FAIL
[CSS Transitions with transition-behavior:allow-discrete: property <baseline-source> from [initial\] to [last\] at (1.5) should be [last\]]
expected: FAIL
[CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <baseline-source> from [initial\] to [last\] at (0.5) should be [last\]]
expected: FAIL
[CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <baseline-source> from [initial\] to [last\] at (0.6) should be [last\]]
expected: FAIL
[CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <baseline-source> from [initial\] to [last\] at (1) should be [last\]]
expected: FAIL
[CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <baseline-source> from [initial\] to [last\] at (1.5) should be [last\]]
expected: FAIL
[CSS Transitions: property <baseline-source> from [initial\] to [last\] at (-0.3) should be [last\]]
expected: FAIL
[CSS Transitions: property <baseline-source> from [initial\] to [last\] at (0) should be [last\]]
expected: FAIL
[CSS Transitions: property <baseline-source> from [initial\] to [last\] at (0.3) should be [last\]]
expected: FAIL
[CSS Transitions: property <baseline-source> from [initial\] to [last\] at (0.5) should be [last\]]
expected: FAIL
[CSS Transitions: property <baseline-source> from [initial\] to [last\] at (0.6) should be [last\]]
expected: FAIL
[CSS Transitions: property <baseline-source> from [initial\] to [last\] at (1) should be [last\]]
expected: FAIL
[CSS Transitions: property <baseline-source> from [initial\] to [last\] at (1.5) should be [last\]]
expected: FAIL
[CSS Transitions with transition: all: property <baseline-source> from [initial\] to [last\] at (-0.3) should be [last\]]
expected: FAIL
[CSS Transitions with transition: all: property <baseline-source> from [initial\] to [last\] at (0) should be [last\]]
expected: FAIL
[CSS Transitions with transition: all: property <baseline-source> from [initial\] to [last\] at (0.3) should be [last\]]
expected: FAIL
[CSS Transitions with transition: all: property <baseline-source> from [initial\] to [last\] at (0.5) should be [last\]]
expected: FAIL
[CSS Transitions with transition: all: property <baseline-source> from [initial\] to [last\] at (0.6) should be [last\]]
expected: FAIL
[CSS Transitions with transition: all: property <baseline-source> from [initial\] to [last\] at (1) should be [last\]]
expected: FAIL
[CSS Transitions with transition: all: property <baseline-source> from [initial\] to [last\] at (1.5) should be [last\]]
expected: FAIL
[CSS Animations: property <baseline-source> from [initial\] to [last\] at (-0.3) should be [initial\]]
expected: FAIL
[CSS Animations: property <baseline-source> from [initial\] to [last\] at (0) should be [initial\]]
expected: FAIL
[CSS Animations: property <baseline-source> from [initial\] to [last\] at (0.3) should be [initial\]]
expected: FAIL
[CSS Animations: property <baseline-source> from [initial\] to [last\] at (0.5) should be [last\]]
expected: FAIL
[CSS Animations: property <baseline-source> from [initial\] to [last\] at (0.6) should be [last\]]
expected: FAIL
[CSS Animations: property <baseline-source> from [initial\] to [last\] at (1) should be [last\]]
expected: FAIL
[CSS Animations: property <baseline-source> from [initial\] to [last\] at (1.5) should be [last\]]
expected: FAIL

View file

@ -1,9 +0,0 @@
[baseline-source-valid.html]
[e.style['baseline-source'\] = "auto" should set the property value]
expected: FAIL
[e.style['baseline-source'\] = "first" should set the property value]
expected: FAIL
[e.style['baseline-source'\] = "last" should set the property value]
expected: FAIL

View file

@ -1,9 +0,0 @@
[baseline-source-computed.html]
[Property baseline-source value 'auto']
expected: FAIL
[Property baseline-source value 'first']
expected: FAIL
[Property baseline-source value 'last']
expected: FAIL

View file

@ -1,16 +1,4 @@
[baseline-source-first-001.html]
[.target > * 1]
expected: FAIL
[.target > * 3]
expected: FAIL
[.target > * 5]
expected: FAIL
[.target > * 7]
expected: FAIL
[.target > * 9]
expected: FAIL

View file

@ -2,9 +2,6 @@
[.target > * 1]
expected: FAIL
[.target > * 3]
expected: FAIL
[.target > * 5]
expected: FAIL

View file

@ -37,90 +37,3 @@
[Web Animations: property <baseline-source> from [initial\] to [last\] at (1.5) should be [last\]]
expected: FAIL
[CSS Transitions with transition-behavior:allow-discrete: property <baseline-source> from [initial\] to [last\] at (0.5) should be [last\]]
expected: FAIL
[CSS Transitions with transition-behavior:allow-discrete: property <baseline-source> from [initial\] to [last\] at (0.6) should be [last\]]
expected: FAIL
[CSS Transitions with transition-behavior:allow-discrete: property <baseline-source> from [initial\] to [last\] at (1) should be [last\]]
expected: FAIL
[CSS Transitions with transition-behavior:allow-discrete: property <baseline-source> from [initial\] to [last\] at (1.5) should be [last\]]
expected: FAIL
[CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <baseline-source> from [initial\] to [last\] at (0.5) should be [last\]]
expected: FAIL
[CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <baseline-source> from [initial\] to [last\] at (0.6) should be [last\]]
expected: FAIL
[CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <baseline-source> from [initial\] to [last\] at (1) should be [last\]]
expected: FAIL
[CSS Transitions with transition-property:all and transition-behavor:allow-discrete: property <baseline-source> from [initial\] to [last\] at (1.5) should be [last\]]
expected: FAIL
[CSS Transitions: property <baseline-source> from [initial\] to [last\] at (-0.3) should be [last\]]
expected: FAIL
[CSS Transitions: property <baseline-source> from [initial\] to [last\] at (0) should be [last\]]
expected: FAIL
[CSS Transitions: property <baseline-source> from [initial\] to [last\] at (0.3) should be [last\]]
expected: FAIL
[CSS Transitions: property <baseline-source> from [initial\] to [last\] at (0.5) should be [last\]]
expected: FAIL
[CSS Transitions: property <baseline-source> from [initial\] to [last\] at (0.6) should be [last\]]
expected: FAIL
[CSS Transitions: property <baseline-source> from [initial\] to [last\] at (1) should be [last\]]
expected: FAIL
[CSS Transitions: property <baseline-source> from [initial\] to [last\] at (1.5) should be [last\]]
expected: FAIL
[CSS Transitions with transition: all: property <baseline-source> from [initial\] to [last\] at (-0.3) should be [last\]]
expected: FAIL
[CSS Transitions with transition: all: property <baseline-source> from [initial\] to [last\] at (0) should be [last\]]
expected: FAIL
[CSS Transitions with transition: all: property <baseline-source> from [initial\] to [last\] at (0.3) should be [last\]]
expected: FAIL
[CSS Transitions with transition: all: property <baseline-source> from [initial\] to [last\] at (0.5) should be [last\]]
expected: FAIL
[CSS Transitions with transition: all: property <baseline-source> from [initial\] to [last\] at (0.6) should be [last\]]
expected: FAIL
[CSS Transitions with transition: all: property <baseline-source> from [initial\] to [last\] at (1) should be [last\]]
expected: FAIL
[CSS Transitions with transition: all: property <baseline-source> from [initial\] to [last\] at (1.5) should be [last\]]
expected: FAIL
[CSS Animations: property <baseline-source> from [initial\] to [last\] at (-0.3) should be [initial\]]
expected: FAIL
[CSS Animations: property <baseline-source> from [initial\] to [last\] at (0) should be [initial\]]
expected: FAIL
[CSS Animations: property <baseline-source> from [initial\] to [last\] at (0.3) should be [initial\]]
expected: FAIL
[CSS Animations: property <baseline-source> from [initial\] to [last\] at (0.5) should be [last\]]
expected: FAIL
[CSS Animations: property <baseline-source> from [initial\] to [last\] at (0.6) should be [last\]]
expected: FAIL
[CSS Animations: property <baseline-source> from [initial\] to [last\] at (1) should be [last\]]
expected: FAIL
[CSS Animations: property <baseline-source> from [initial\] to [last\] at (1.5) should be [last\]]
expected: FAIL

View file

@ -1,9 +0,0 @@
[baseline-source-valid.html]
[e.style['baseline-source'\] = "auto" should set the property value]
expected: FAIL
[e.style['baseline-source'\] = "first" should set the property value]
expected: FAIL
[e.style['baseline-source'\] = "last" should set the property value]
expected: FAIL