Upgrade stylo to 2024-07-16 (#32812)

* Upgrade stylo to 2024-07-16

Signed-off-by: Martin Robinson <mrobinson@igalia.com>

* Use the new `dom` crate from stylo

Signed-off-by: Martin Robinson <mrobinson@igalia.com>

---------

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Martin Robinson 2024-07-24 16:37:08 +02:00 committed by GitHub
parent 60e65c175d
commit 569fd5d8b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 70 additions and 106 deletions

44
Cargo.lock generated
View file

@ -1285,7 +1285,7 @@ dependencies = [
[[package]]
name = "derive_common"
version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2024-05-31#f6cb33f86468ba272d5329f64f78a75df8e9fcbe"
source = "git+https://github.com/servo/stylo?branch=2024-07-16#eceb838e855e3b73a28df602b69494899f6d168b"
dependencies = [
"darling",
"proc-macro2",
@ -1414,6 +1414,14 @@ dependencies = [
"litrs",
]
[[package]]
name = "dom"
version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2024-07-16#eceb838e855e3b73a28df602b69494899f6d168b"
dependencies = [
"bitflags 2.6.0",
]
[[package]]
name = "dom_struct"
version = "0.0.1"
@ -3727,13 +3735,14 @@ dependencies = [
[[package]]
name = "malloc_size_of"
version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2024-05-31#f6cb33f86468ba272d5329f64f78a75df8e9fcbe"
source = "git+https://github.com/servo/stylo?branch=2024-07-16#eceb838e855e3b73a28df602b69494899f6d168b"
dependencies = [
"accountable-refcell",
"app_units",
"content-security-policy",
"crossbeam-channel",
"cssparser",
"dom",
"euclid",
"http",
"indexmap",
@ -4216,12 +4225,6 @@ dependencies = [
"libc",
]
[[package]]
name = "nodrop"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
[[package]]
name = "nohash-hasher"
version = "0.2.0"
@ -5199,6 +5202,7 @@ dependencies = [
"data-url",
"deny_public_fields",
"devtools_traits",
"dom",
"dom_struct",
"domobject_derive",
"embedder_traits",
@ -5388,7 +5392,7 @@ dependencies = [
[[package]]
name = "selectors"
version = "0.24.0"
source = "git+https://github.com/servo/stylo?branch=2024-05-31#f6cb33f86468ba272d5329f64f78a75df8e9fcbe"
source = "git+https://github.com/servo/stylo?branch=2024-07-16#eceb838e855e3b73a28df602b69494899f6d168b"
dependencies = [
"bitflags 2.6.0",
"cssparser",
@ -5676,9 +5680,8 @@ dependencies = [
[[package]]
name = "servo_arc"
version = "0.2.0"
source = "git+https://github.com/servo/stylo?branch=2024-05-31#f6cb33f86468ba272d5329f64f78a75df8e9fcbe"
source = "git+https://github.com/servo/stylo?branch=2024-07-16#eceb838e855e3b73a28df602b69494899f6d168b"
dependencies = [
"nodrop",
"serde",
"stable_deref_trait",
]
@ -5686,7 +5689,7 @@ dependencies = [
[[package]]
name = "servo_atoms"
version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2024-05-31#f6cb33f86468ba272d5329f64f78a75df8e9fcbe"
source = "git+https://github.com/servo/stylo?branch=2024-07-16#eceb838e855e3b73a28df602b69494899f6d168b"
dependencies = [
"string_cache",
"string_cache_codegen",
@ -5874,7 +5877,7 @@ checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
[[package]]
name = "size_of_test"
version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2024-05-31#f6cb33f86468ba272d5329f64f78a75df8e9fcbe"
source = "git+https://github.com/servo/stylo?branch=2024-07-16#eceb838e855e3b73a28df602b69494899f6d168b"
dependencies = [
"static_assertions",
]
@ -6015,7 +6018,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "static_prefs"
version = "0.1.0"
source = "git+https://github.com/servo/stylo?branch=2024-05-31#f6cb33f86468ba272d5329f64f78a75df8e9fcbe"
source = "git+https://github.com/servo/stylo?branch=2024-07-16#eceb838e855e3b73a28df602b69494899f6d168b"
[[package]]
name = "strict-num"
@ -6052,7 +6055,7 @@ dependencies = [
[[package]]
name = "style"
version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2024-05-31#f6cb33f86468ba272d5329f64f78a75df8e9fcbe"
source = "git+https://github.com/servo/stylo?branch=2024-07-16#eceb838e855e3b73a28df602b69494899f6d168b"
dependencies = [
"app_units",
"arrayvec",
@ -6061,6 +6064,7 @@ dependencies = [
"byteorder",
"cssparser",
"derive_more",
"dom",
"encoding_rs",
"euclid",
"fxhash",
@ -6110,7 +6114,7 @@ dependencies = [
[[package]]
name = "style_config"
version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2024-05-31#f6cb33f86468ba272d5329f64f78a75df8e9fcbe"
source = "git+https://github.com/servo/stylo?branch=2024-07-16#eceb838e855e3b73a28df602b69494899f6d168b"
dependencies = [
"lazy_static",
]
@ -6118,7 +6122,7 @@ dependencies = [
[[package]]
name = "style_derive"
version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2024-05-31#f6cb33f86468ba272d5329f64f78a75df8e9fcbe"
source = "git+https://github.com/servo/stylo?branch=2024-07-16#eceb838e855e3b73a28df602b69494899f6d168b"
dependencies = [
"darling",
"derive_common",
@ -6149,7 +6153,7 @@ dependencies = [
[[package]]
name = "style_traits"
version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2024-05-31#f6cb33f86468ba272d5329f64f78a75df8e9fcbe"
source = "git+https://github.com/servo/stylo?branch=2024-07-16#eceb838e855e3b73a28df602b69494899f6d168b"
dependencies = [
"app_units",
"bitflags 2.6.0",
@ -6519,7 +6523,7 @@ dependencies = [
[[package]]
name = "to_shmem"
version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2024-05-31#f6cb33f86468ba272d5329f64f78a75df8e9fcbe"
source = "git+https://github.com/servo/stylo?branch=2024-07-16#eceb838e855e3b73a28df602b69494899f6d168b"
dependencies = [
"cssparser",
"servo_arc",
@ -6532,7 +6536,7 @@ dependencies = [
[[package]]
name = "to_shmem_derive"
version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2024-05-31#f6cb33f86468ba272d5329f64f78a75df8e9fcbe"
source = "git+https://github.com/servo/stylo?branch=2024-07-16#eceb838e855e3b73a28df602b69494899f6d168b"
dependencies = [
"darling",
"derive_common",

View file

@ -75,7 +75,7 @@ keyboard-types = "0.7"
lazy_static = "1.5"
libc = "0.2"
log = "0.4"
malloc_size_of = { git = "https://github.com/servo/stylo", branch = "2024-05-31", features = ["servo"] }
malloc_size_of = { git = "https://github.com/servo/stylo", branch = "2024-07-16", features = ["servo"] }
malloc_size_of_derive = "0.1"
mime = "0.3.13"
mime_guess = "2.0.5"
@ -97,30 +97,31 @@ rustls = { version = "0.21.12", features = ["dangerous_configuration"] }
rustls-pemfile = "1.0.4"
script_layout_interface = { path = "components/shared/script_layout" }
script_traits = { path = "components/shared/script" }
selectors = { git = "https://github.com/servo/stylo", branch = "2024-05-31" }
selectors = { git = "https://github.com/servo/stylo", branch = "2024-07-16" }
serde = "1.0.204"
serde_bytes = "0.11"
serde_json = "1.0"
servo-media = { git = "https://github.com/servo/media" }
servo-media-dummy = { git = "https://github.com/servo/media" }
servo-media-gstreamer = { git = "https://github.com/servo/media" }
servo_arc = { git = "https://github.com/servo/stylo", branch = "2024-05-31" }
servo_atoms = { git = "https://github.com/servo/stylo", branch = "2024-05-31" }
size_of_test = { git = "https://github.com/servo/stylo", branch = "2024-05-31" }
servo_arc = { git = "https://github.com/servo/stylo", branch = "2024-07-16" }
servo_atoms = { git = "https://github.com/servo/stylo", branch = "2024-07-16" }
size_of_test = { git = "https://github.com/servo/stylo", branch = "2024-07-16" }
smallbitvec = "2.5.3"
smallvec = "1.13"
sparkle = "0.1.26"
string_cache = "0.8"
string_cache_codegen = "0.5"
style = { git = "https://github.com/servo/stylo", branch = "2024-05-31", features = ["servo"] }
style_config = { git = "https://github.com/servo/stylo", branch = "2024-05-31" }
style_traits = { git = "https://github.com/servo/stylo", branch = "2024-05-31", features = ["servo"] }
style = { git = "https://github.com/servo/stylo", branch = "2024-07-16", features = ["servo"] }
style_config = { git = "https://github.com/servo/stylo", branch = "2024-07-16" }
style_dom = { git = "https://github.com/servo/stylo", package = "dom", branch = "2024-07-16" }
style_traits = { git = "https://github.com/servo/stylo", branch = "2024-07-16", features = ["servo"] }
surfman = { version = "0.9", features = ["chains"] }
syn = { version = "2", default-features = false, features = ["clone-impls", "derive", "parsing"] }
synstructure = "0.13"
thin-vec = "0.2.13"
time = "0.1.41"
to_shmem = { git = "https://github.com/servo/stylo", branch = "2024-05-31" }
to_shmem = { git = "https://github.com/servo/stylo", branch = "2024-07-16" }
tokio = "1"
tokio-rustls = "0.24"
tungstenite = "0.20"

View file

@ -3007,15 +3007,15 @@ pub trait ISizeAndMarginsComputer {
) => {
// servo_left, servo_right, and servo_center are used to implement
// the "align descendants" rule in HTML5 § 14.2.
if block_align == TextAlign::ServoCenter {
if block_align == TextAlign::MozCenter {
// Ignore any existing margins, and make the inline-start and
// inline-end margins equal.
let margin = (available_inline_size - inline_size).scale_by(0.5);
(margin, inline_size, margin)
} else {
let ignore_end_margin = match block_align {
TextAlign::ServoLeft => block_mode.is_bidi_ltr(),
TextAlign::ServoRight => !block_mode.is_bidi_ltr(),
TextAlign::MozLeft => block_mode.is_bidi_ltr(),
TextAlign::MozRight => !block_mode.is_bidi_ltr(),
_ => parent_has_same_direction,
};
if ignore_end_margin {

View file

@ -1035,13 +1035,13 @@ impl InlineFlow {
let is_ltr = fragments.fragments[0].style().writing_mode.is_bidi_ltr();
let line_align = match (line_align, is_ltr) {
(TextAlign::Left, true) |
(TextAlign::ServoLeft, true) |
(TextAlign::MozLeft, true) |
(TextAlign::Right, false) |
(TextAlign::ServoRight, false) => TextAlign::Start,
(TextAlign::MozRight, false) => TextAlign::Start,
(TextAlign::Left, false) |
(TextAlign::ServoLeft, false) |
(TextAlign::MozLeft, false) |
(TextAlign::Right, true) |
(TextAlign::ServoRight, true) => TextAlign::End,
(TextAlign::MozRight, true) => TextAlign::End,
_ => line_align,
};
@ -1053,11 +1053,11 @@ impl InlineFlow {
InlineFlow::justify_inline_fragments(fragments, line, slack_inline_size)
},
TextAlign::Justify | TextAlign::Start => {},
TextAlign::Center | TextAlign::ServoCenter => {
TextAlign::Center | TextAlign::MozCenter => {
inline_start_position_for_fragment += slack_inline_size.scale_by(0.5)
},
TextAlign::End => inline_start_position_for_fragment += slack_inline_size,
TextAlign::Left | TextAlign::ServoLeft | TextAlign::Right | TextAlign::ServoRight => {
TextAlign::Left | TextAlign::MozLeft | TextAlign::Right | TextAlign::MozRight => {
unreachable!()
},
}

View file

@ -932,16 +932,16 @@ impl<'a, 'b> InlineFormattingContextState<'a, 'b> {
let text_align = match text_align_keyword {
TextAlignKeyword::Start => TextAlign::Start,
TextAlignKeyword::Center | TextAlignKeyword::ServoCenter => TextAlign::Center,
TextAlignKeyword::Center | TextAlignKeyword::MozCenter => TextAlign::Center,
TextAlignKeyword::End => TextAlign::End,
TextAlignKeyword::Left | TextAlignKeyword::ServoLeft => {
TextAlignKeyword::Left | TextAlignKeyword::MozLeft => {
if style.writing_mode.line_left_is_inline_start() {
TextAlign::Start
} else {
TextAlign::End
}
},
TextAlignKeyword::Right | TextAlignKeyword::ServoRight => {
TextAlignKeyword::Right | TextAlignKeyword::MozRight => {
if style.writing_mode.line_left_is_inline_start() {
TextAlign::End
} else {

View file

@ -1478,13 +1478,9 @@ fn justify_self_alignment(containing_block: &ContainingBlock, free_space: Au) ->
let style = containing_block.style;
debug_assert!(free_space >= Au::zero());
match style.clone_text_align() {
TextAlignKeyword::ServoCenter => free_space / 2,
TextAlignKeyword::ServoLeft if !style.writing_mode.line_left_is_inline_start() => {
free_space
},
TextAlignKeyword::ServoRight if style.writing_mode.line_left_is_inline_start() => {
free_space
},
TextAlignKeyword::MozCenter => free_space / 2,
TextAlignKeyword::MozLeft if !style.writing_mode.line_left_is_inline_start() => free_space,
TextAlignKeyword::MozRight if style.writing_mode.line_left_is_inline_start() => free_space,
_ => Au::zero(),
}
}

View file

@ -718,6 +718,7 @@ impl From<stylo::Display> for Display {
is_list_item: packed.is_list_item(),
},
stylo::DisplayInside::Flex => DisplayInside::Flex,
stylo::DisplayInside::Grid => todo!("Grid support is not yet implemented."),
// These should not be values of DisplayInside, but oh well
stylo::DisplayInside::None => return Display::None,

View file

@ -102,6 +102,7 @@ servo_url = { path = "../url" }
smallvec = { workspace = true, features = ["union"] }
sparkle = { workspace = true }
style = { workspace = true }
style_dom = { workspace = true }
style_traits = { workspace = true }
swapper = "0.1"
tempfile = "3"

View file

@ -58,7 +58,7 @@ use style::stylesheets::{CssRuleType, UrlExtraData};
use style::values::generics::NonNegative;
use style::values::{computed, specified, AtomIdent, AtomString, CSSFloat};
use style::{dom_apis, thread_state, CaseSensitivityExt};
use style_traits::dom::ElementState;
use style_dom::ElementState;
use xml5ever::serialize as xmlSerialize;
use xml5ever::serialize::TraversalScope::{
ChildrenOnly as XmlChildrenOnly, IncludeNode as XmlIncludeNode,

View file

@ -8,7 +8,7 @@ use std::default::Default;
use dom_struct::dom_struct;
use html5ever::{local_name, namespace_url, LocalName, Prefix};
use js::rust::HandleObject;
use style_traits::dom::ElementState;
use style_dom::ElementState;
use crate::dom::activation::Activatable;
use crate::dom::attr::Attr;

View file

@ -11,7 +11,7 @@ use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
use script_layout_interface::QueryMsg;
use style::attr::AttrValue;
use style_traits::dom::ElementState;
use style_dom::ElementState;
use crate::dom::activation::Activatable;
use crate::dom::attr::Attr;

View file

@ -7,7 +7,7 @@ use std::default::Default;
use dom_struct::dom_struct;
use html5ever::{local_name, LocalName, Prefix};
use js::rust::HandleObject;
use style_traits::dom::ElementState;
use style_dom::ElementState;
use crate::dom::attr::Attr;
use crate::dom::bindings::codegen::Bindings::HTMLFieldSetElementBinding::HTMLFieldSetElementMethods;

View file

@ -20,7 +20,7 @@ use servo_atoms::Atom;
use servo_rand::random;
use style::attr::AttrValue;
use style::str::split_html_space_chars;
use style_traits::dom::ElementState;
use style_dom::ElementState;
use super::bindings::trace::{HashMapTracedValues, NoTrace};
use crate::body::Extractable;

View file

@ -29,7 +29,7 @@ use script_traits::ScriptToConstellationChan;
use servo_atoms::Atom;
use style::attr::AttrValue;
use style::str::{split_commas, str_join};
use style_traits::dom::ElementState;
use style_dom::ElementState;
use unicode_bidi::{bidi_class, BidiClass};
use url::Url;

View file

@ -5,7 +5,7 @@
use dom_struct::dom_struct;
use html5ever::{local_name, LocalName, Prefix};
use js::rust::HandleObject;
use style_traits::dom::ElementState;
use style_dom::ElementState;
use crate::dom::attr::Attr;
use crate::dom::bindings::codegen::Bindings::HTMLOptGroupElementBinding::HTMLOptGroupElementMethods;

View file

@ -9,7 +9,7 @@ use dom_struct::dom_struct;
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix, QualName};
use js::rust::HandleObject;
use style::str::{split_html_space_chars, str_join};
use style_traits::dom::ElementState;
use style_dom::ElementState;
use crate::dom::attr::Attr;
use crate::dom::bindings::codegen::Bindings::CharacterDataBinding::CharacterDataMethods;

View file

@ -9,7 +9,7 @@ use dom_struct::dom_struct;
use html5ever::{local_name, LocalName, Prefix};
use js::rust::HandleObject;
use style::attr::AttrValue;
use style_traits::dom::ElementState;
use style_dom::ElementState;
use crate::dom::attr::Attr;
use crate::dom::bindings::codegen::Bindings::ElementBinding::ElementMethods;

View file

@ -11,7 +11,7 @@ use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
use script_traits::ScriptToConstellationChan;
use style::attr::AttrValue;
use style_traits::dom::ElementState;
use style_dom::ElementState;
use crate::dom::attr::Attr;
use crate::dom::bindings::cell::DomRefCell;

View file

@ -5,7 +5,7 @@
use dom_struct::dom_struct;
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
use js::rust::HandleObject;
use style_traits::dom::ElementState;
use style_dom::ElementState;
use crate::dom::bindings::codegen::Bindings::SVGElementBinding::SVGElementMethods;
use crate::dom::bindings::inheritance::Castable;

View file

@ -4,7 +4,7 @@
use dom_struct::dom_struct;
use html5ever::{LocalName, Prefix};
use style_traits::dom::ElementState;
use style_dom::ElementState;
use crate::dom::bindings::inheritance::Castable;
use crate::dom::document::Document;

View file

@ -8,7 +8,7 @@ use std::fmt;
use bitflags::bitflags;
use dom_struct::dom_struct;
use itertools::Itertools;
use style_traits::dom::ElementState;
use style_dom::ElementState;
use super::bindings::codegen::Bindings::ElementInternalsBinding::ValidityStateFlags;
use crate::dom::bindings::cell::{DomRefCell, Ref};

View file

@ -34,7 +34,7 @@ use style::shared_lock::Locked as StyleLocked;
use style::values::computed::Display;
use style::values::{AtomIdent, AtomString};
use style::CaseSensitivityExt;
use style_traits::dom::ElementState;
use style_dom::ElementState;
use crate::dom::attr::AttrHelpersForLayout;
use crate::dom::bindings::inheritance::{

View file

@ -7,9 +7,9 @@ https://html.spec.whatwg.org/multipage/#presentational-hints
pre[wrap] { white-space: pre-wrap; }
div[align=left i] { text-align: -servo-left; }
div[align=right i] { text-align: -servo-right; }
div[align=center i], div[align=middle i] { text-align: -servo-center; }
div[align=left i] { text-align: -moz-left; }
div[align=right i] { text-align: -moz-right; }
div[align=center i], div[align=middle i] { text-align: -moz-center; }
div[align=justify i] { text-align: justify; }

View file

@ -25,7 +25,7 @@ table {
/*
* FIXME(pcwalton): Actually saying `text-align: initial` above breaks `<table>` inside `<center>`
* in quirks mode. This is because we (following Gecko, WebKit, and Blink) implement the HTML5
* align-descendants rules with a special `text-align: -servo-center`. `text-align: initial`, if
* align-descendants rules with a special `text-align: -moz-center`. `text-align: initial`, if
* placed on the `<table>` element per the spec, would break this behavior. So we place it on
* `<tbody>` instead.
*/

View file

@ -112,7 +112,7 @@ td[align="left"] { text-align: left; }
td[align="center"] { text-align: center; }
td[align="right"] { text-align: right; }
center { text-align: -servo-center; }
center { text-align: -moz-center; }
label { cursor: default; }

View file

@ -1,2 +0,0 @@
[rlh-unit-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[scope-featureless.html]
expected: FAIL

View file

@ -1,6 +0,0 @@
[fixed-layout-2.html]
[Table-layout:fixed reports fixed when width is auto]
expected: FAIL
[Table-layout:fixed reports fixed when width is max-content]
expected: FAIL

View file

@ -1,9 +1,3 @@
[inheritance.html]
[Property border-spacing has initial value 0px 0px]
expected: FAIL
[Property table-layout has initial value auto]
expected: FAIL
[Property table-layout does not inherit]
expected: FAIL

View file

@ -1,6 +0,0 @@
[table-layout-computed.html]
[Property table-layout value 'auto']
expected: FAIL
[Property table-layout value 'fixed']
expected: FAIL

View file

@ -1,6 +0,0 @@
[table-layout-valid.html]
[e.style['table-layout'\] = "auto" should set the property value]
expected: FAIL
[e.style['table-layout'\] = "fixed" should set the property value]
expected: FAIL

View file

@ -1,2 +0,0 @@
[rlh-unit-001.html]
expected: FAIL

View file

@ -92,15 +92,6 @@
[direction: inherit]
expected: FAIL
[table-layout: auto]
expected: FAIL
[table-layout: fixed]
expected: FAIL
[table-layout: inherit]
expected: FAIL
[unicode-bidi: normal]
expected: FAIL