Upgrade stylo to 2024-05-31 (#32474)

* Upgrade stylo to 2024-05-31

* Fixup for https://phabricator.services.mozilla.com/D211731

* Fixup for https://phabricator.services.mozilla.com/D207779

* Fixup for https://phabricator.services.mozilla.com/D207781

* Update test expectations
This commit is contained in:
Oriol Brufau 2024-06-24 22:03:50 +02:00 committed by GitHub
parent 680735ed73
commit b1fdfb88bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 45 additions and 49 deletions

26
Cargo.lock generated
View file

@ -1270,7 +1270,7 @@ dependencies = [
[[package]] [[package]]
name = "derive_common" name = "derive_common"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2024-05-15#71b0b0ac1d42b221fccee9034da06bfbf481f0d0" source = "git+https://github.com/servo/stylo?branch=2024-05-31#e8a14bce9453ad5939eb0c34de150ad2f10d1bc2"
dependencies = [ dependencies = [
"darling", "darling",
"proc-macro2", "proc-macro2",
@ -3725,7 +3725,7 @@ dependencies = [
[[package]] [[package]]
name = "malloc_size_of" name = "malloc_size_of"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2024-05-15#71b0b0ac1d42b221fccee9034da06bfbf481f0d0" source = "git+https://github.com/servo/stylo?branch=2024-05-31#e8a14bce9453ad5939eb0c34de150ad2f10d1bc2"
dependencies = [ dependencies = [
"accountable-refcell", "accountable-refcell",
"app_units", "app_units",
@ -5321,7 +5321,7 @@ dependencies = [
[[package]] [[package]]
name = "selectors" name = "selectors"
version = "0.24.0" version = "0.24.0"
source = "git+https://github.com/servo/stylo?branch=2024-05-15#71b0b0ac1d42b221fccee9034da06bfbf481f0d0" source = "git+https://github.com/servo/stylo?branch=2024-05-31#e8a14bce9453ad5939eb0c34de150ad2f10d1bc2"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 2.5.0",
"cssparser", "cssparser",
@ -5609,7 +5609,7 @@ dependencies = [
[[package]] [[package]]
name = "servo_arc" name = "servo_arc"
version = "0.2.0" version = "0.2.0"
source = "git+https://github.com/servo/stylo?branch=2024-05-15#71b0b0ac1d42b221fccee9034da06bfbf481f0d0" source = "git+https://github.com/servo/stylo?branch=2024-05-31#e8a14bce9453ad5939eb0c34de150ad2f10d1bc2"
dependencies = [ dependencies = [
"nodrop", "nodrop",
"serde", "serde",
@ -5619,7 +5619,7 @@ dependencies = [
[[package]] [[package]]
name = "servo_atoms" name = "servo_atoms"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2024-05-15#71b0b0ac1d42b221fccee9034da06bfbf481f0d0" source = "git+https://github.com/servo/stylo?branch=2024-05-31#e8a14bce9453ad5939eb0c34de150ad2f10d1bc2"
dependencies = [ dependencies = [
"string_cache", "string_cache",
"string_cache_codegen", "string_cache_codegen",
@ -5802,7 +5802,7 @@ checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
[[package]] [[package]]
name = "size_of_test" name = "size_of_test"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2024-05-15#71b0b0ac1d42b221fccee9034da06bfbf481f0d0" source = "git+https://github.com/servo/stylo?branch=2024-05-31#e8a14bce9453ad5939eb0c34de150ad2f10d1bc2"
dependencies = [ dependencies = [
"static_assertions", "static_assertions",
] ]
@ -5943,7 +5943,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]] [[package]]
name = "static_prefs" name = "static_prefs"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/servo/stylo?branch=2024-05-15#71b0b0ac1d42b221fccee9034da06bfbf481f0d0" source = "git+https://github.com/servo/stylo?branch=2024-05-31#e8a14bce9453ad5939eb0c34de150ad2f10d1bc2"
[[package]] [[package]]
name = "strict-num" name = "strict-num"
@ -5980,7 +5980,7 @@ dependencies = [
[[package]] [[package]]
name = "style" name = "style"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2024-05-15#71b0b0ac1d42b221fccee9034da06bfbf481f0d0" source = "git+https://github.com/servo/stylo?branch=2024-05-31#e8a14bce9453ad5939eb0c34de150ad2f10d1bc2"
dependencies = [ dependencies = [
"app_units", "app_units",
"arrayvec", "arrayvec",
@ -6038,7 +6038,7 @@ dependencies = [
[[package]] [[package]]
name = "style_config" name = "style_config"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2024-05-15#71b0b0ac1d42b221fccee9034da06bfbf481f0d0" source = "git+https://github.com/servo/stylo?branch=2024-05-31#e8a14bce9453ad5939eb0c34de150ad2f10d1bc2"
dependencies = [ dependencies = [
"lazy_static", "lazy_static",
] ]
@ -6046,7 +6046,7 @@ dependencies = [
[[package]] [[package]]
name = "style_derive" name = "style_derive"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2024-05-15#71b0b0ac1d42b221fccee9034da06bfbf481f0d0" source = "git+https://github.com/servo/stylo?branch=2024-05-31#e8a14bce9453ad5939eb0c34de150ad2f10d1bc2"
dependencies = [ dependencies = [
"darling", "darling",
"derive_common", "derive_common",
@ -6077,7 +6077,7 @@ dependencies = [
[[package]] [[package]]
name = "style_traits" name = "style_traits"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2024-05-15#71b0b0ac1d42b221fccee9034da06bfbf481f0d0" source = "git+https://github.com/servo/stylo?branch=2024-05-31#e8a14bce9453ad5939eb0c34de150ad2f10d1bc2"
dependencies = [ dependencies = [
"app_units", "app_units",
"bitflags 2.5.0", "bitflags 2.5.0",
@ -6427,7 +6427,7 @@ dependencies = [
[[package]] [[package]]
name = "to_shmem" name = "to_shmem"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2024-05-15#71b0b0ac1d42b221fccee9034da06bfbf481f0d0" source = "git+https://github.com/servo/stylo?branch=2024-05-31#e8a14bce9453ad5939eb0c34de150ad2f10d1bc2"
dependencies = [ dependencies = [
"cssparser", "cssparser",
"servo_arc", "servo_arc",
@ -6440,7 +6440,7 @@ dependencies = [
[[package]] [[package]]
name = "to_shmem_derive" name = "to_shmem_derive"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/servo/stylo?branch=2024-05-15#71b0b0ac1d42b221fccee9034da06bfbf481f0d0" source = "git+https://github.com/servo/stylo?branch=2024-05-31#e8a14bce9453ad5939eb0c34de150ad2f10d1bc2"
dependencies = [ dependencies = [
"darling", "darling",
"derive_common", "derive_common",

View file

@ -73,7 +73,7 @@ keyboard-types = "0.7"
lazy_static = "1.4" lazy_static = "1.4"
libc = "0.2" libc = "0.2"
log = "0.4" log = "0.4"
malloc_size_of = { git = "https://github.com/servo/stylo", branch = "2024-05-15", features = ["servo"] } malloc_size_of = { git = "https://github.com/servo/stylo", branch = "2024-05-31", features = ["servo"] }
malloc_size_of_derive = "0.1" malloc_size_of_derive = "0.1"
mime = "0.3.13" mime = "0.3.13"
mime_guess = "2.0.3" mime_guess = "2.0.3"
@ -95,31 +95,31 @@ rustls = { version = "0.21.12", features = ["dangerous_configuration"] }
rustls-pemfile = "1.0.4" rustls-pemfile = "1.0.4"
script_layout_interface = { path = "components/shared/script_layout" } script_layout_interface = { path = "components/shared/script_layout" }
script_traits = { path = "components/shared/script" } script_traits = { path = "components/shared/script" }
selectors = { git = "https://github.com/servo/stylo", branch = "2024-05-15" } selectors = { git = "https://github.com/servo/stylo", branch = "2024-05-31" }
serde = "1.0.203" serde = "1.0.203"
serde_bytes = "0.11" serde_bytes = "0.11"
serde_json = "1.0" serde_json = "1.0"
servo-media = { git = "https://github.com/servo/media" } servo-media = { git = "https://github.com/servo/media" }
servo-media-dummy = { 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-media-gstreamer = { git = "https://github.com/servo/media" }
servo_arc = { git = "https://github.com/servo/stylo", branch = "2024-05-15" } servo_arc = { git = "https://github.com/servo/stylo", branch = "2024-05-31" }
servo_atoms = { git = "https://github.com/servo/stylo", branch = "2024-05-15" } servo_atoms = { git = "https://github.com/servo/stylo", branch = "2024-05-31" }
size_of_test = { git = "https://github.com/servo/stylo", branch = "2024-05-15" } size_of_test = { git = "https://github.com/servo/stylo", branch = "2024-05-31" }
smallbitvec = "2.5.3" smallbitvec = "2.5.3"
smallvec = "1.13" smallvec = "1.13"
sparkle = "0.1.26" sparkle = "0.1.26"
string_cache = "0.8" string_cache = "0.8"
string_cache_codegen = "0.5" string_cache_codegen = "0.5"
style = { git = "https://github.com/servo/stylo", branch = "2024-05-15", features = ["servo"] } style = { git = "https://github.com/servo/stylo", branch = "2024-05-31", features = ["servo"] }
style_config = { git = "https://github.com/servo/stylo", branch = "2024-05-15" } style_config = { git = "https://github.com/servo/stylo", branch = "2024-05-31" }
style_traits = { git = "https://github.com/servo/stylo", branch = "2024-05-15", features = ["servo"] } style_traits = { git = "https://github.com/servo/stylo", branch = "2024-05-31", features = ["servo"] }
# NOTE: the sm-angle feature only enables ANGLE on Windows, not other platforms! # NOTE: the sm-angle feature only enables ANGLE on Windows, not other platforms!
surfman = { version = "0.9", features = ["chains", "sm-angle", "sm-angle-default"] } surfman = { version = "0.9", features = ["chains", "sm-angle", "sm-angle-default"] }
syn = { version = "2", default-features = false, features = ["clone-impls", "derive", "parsing"] } syn = { version = "2", default-features = false, features = ["clone-impls", "derive", "parsing"] }
synstructure = "0.13" synstructure = "0.13"
thin-vec = "0.2.13" thin-vec = "0.2.13"
time = "0.1.41" time = "0.1.41"
to_shmem = { git = "https://github.com/servo/stylo", branch = "2024-05-15" } to_shmem = { git = "https://github.com/servo/stylo", branch = "2024-05-31" }
tokio = "1" tokio = "1"
tokio-rustls = "0.24" tokio-rustls = "0.24"
tungstenite = "0.20" tungstenite = "0.20"

View file

@ -773,7 +773,7 @@ fn apply_style_transform_if_necessary(
last_whitespace: bool, last_whitespace: bool,
is_first_run: bool, is_first_run: bool,
) { ) {
match text_transform.case_ { match text_transform.case() {
TextTransformCase::None => {}, TextTransformCase::None => {},
TextTransformCase::Uppercase => { TextTransformCase::Uppercase => {
let original = string[first_character_position..].to_owned(); let original = string[first_character_position..].to_owned();

View file

@ -6,7 +6,7 @@ use std::borrow::Cow;
use std::char::{ToLowercase, ToUppercase}; use std::char::{ToLowercase, ToUppercase};
use style::computed_values::white_space_collapse::T as WhiteSpaceCollapse; use style::computed_values::white_space_collapse::T as WhiteSpaceCollapse;
use style::values::computed::{TextDecorationLine, TextTransform}; use style::values::computed::TextDecorationLine;
use style::values::specified::text::TextTransformCase; use style::values::specified::text::TextTransformCase;
use unicode_segmentation::UnicodeSegmentation; use unicode_segmentation::UnicodeSegmentation;
@ -185,10 +185,13 @@ impl InlineFormattingContextBuilder {
self.last_inline_box_ended_with_collapsible_white_space, self.last_inline_box_ended_with_collapsible_white_space,
); );
let text_transform = info.style.clone_text_transform(); // TODO: Not all text transforms are about case, this logic should stop ignoring
// TextTransform::FULL_WIDTH and TextTransform::FULL_SIZE_KANA.
let text_transform = info.style.clone_text_transform().case();
let capitalized_text: String; let capitalized_text: String;
let char_iterator: Box<dyn Iterator<Item = char>> = let char_iterator: Box<dyn Iterator<Item = char>> = match text_transform {
if text_transform.case_ == TextTransformCase::Capitalize { TextTransformCase::None => Box::new(collapsed),
TextTransformCase::Capitalize => {
// `TextTransformation` doesn't support capitalization, so we must capitalize the whole // `TextTransformation` doesn't support capitalization, so we must capitalize the whole
// string at once and make a copy. Here `on_word_boundary` indicates whether or not the // string at once and make a copy. Here `on_word_boundary` indicates whether or not the
// inline formatting context as a whole is on a word boundary. This is different from // inline formatting context as a whole is on a word boundary. This is different from
@ -198,13 +201,13 @@ impl InlineFormattingContextBuilder {
let collapsed_string: String = collapsed.collect(); let collapsed_string: String = collapsed.collect();
capitalized_text = capitalize_string(&collapsed_string, self.on_word_boundary); capitalized_text = capitalize_string(&collapsed_string, self.on_word_boundary);
Box::new(capitalized_text.chars()) Box::new(capitalized_text.chars())
} else if !text_transform.is_none() { },
_ => {
// If `text-transform` is active, wrap the `WhitespaceCollapse` iterator in // If `text-transform` is active, wrap the `WhitespaceCollapse` iterator in
// a `TextTransformation` iterator. // a `TextTransformation` iterator.
Box::new(TextTransformation::new(collapsed, text_transform)) Box::new(TextTransformation::new(collapsed, text_transform))
} else { },
Box::new(collapsed) };
};
let white_space_collapse = info.style.clone_white_space_collapse(); let white_space_collapse = info.style.clone_white_space_collapse();
let new_text: String = char_iterator let new_text: String = char_iterator
@ -509,14 +512,14 @@ pub struct TextTransformation<InputIterator> {
/// The input character iterator. /// The input character iterator.
char_iterator: InputIterator, char_iterator: InputIterator,
/// The `text-transform` value to use. /// The `text-transform` value to use.
text_transform: TextTransform, text_transform: TextTransformCase,
/// If an uppercasing or lowercasing produces more than one character, this /// If an uppercasing or lowercasing produces more than one character, this
/// caches them so that they can be returned in subsequent iterator calls. /// caches them so that they can be returned in subsequent iterator calls.
pending_case_conversion_result: Option<PendingCaseConversionResult>, pending_case_conversion_result: Option<PendingCaseConversionResult>,
} }
impl<InputIterator> TextTransformation<InputIterator> { impl<InputIterator> TextTransformation<InputIterator> {
pub fn new(char_iterator: InputIterator, text_transform: TextTransform) -> Self { pub fn new(char_iterator: InputIterator, text_transform: TextTransformCase) -> Self {
Self { Self {
char_iterator, char_iterator,
text_transform, text_transform,
@ -542,7 +545,7 @@ where
self.pending_case_conversion_result = None; self.pending_case_conversion_result = None;
for character in self.char_iterator.by_ref() { for character in self.char_iterator.by_ref() {
match self.text_transform.case_ { match self.text_transform {
TextTransformCase::None => return Some(character), TextTransformCase::None => return Some(character),
TextTransformCase::Uppercase => { TextTransformCase::Uppercase => {
let mut pending_result = let mut pending_result =
@ -562,8 +565,7 @@ where
}, },
// `text-transform: capitalize` currently cannot work on a per-character basis, // `text-transform: capitalize` currently cannot work on a per-character basis,
// so must be handled outside of this iterator. // so must be handled outside of this iterator.
// TODO: Add support for `full-width` and `full-size-kana`. TextTransformCase::Capitalize => return Some(character),
_ => return Some(character),
} }
} }
None None

View file

@ -12,6 +12,7 @@ use servo_atoms::Atom;
use style::invalidation::media_queries::{MediaListKey, ToMediaListKey}; use style::invalidation::media_queries::{MediaListKey, ToMediaListKey};
use style::media_queries::MediaList; use style::media_queries::MediaList;
use style::shared_lock::{SharedRwLock as StyleSharedRwLock, SharedRwLockReadGuard}; use style::shared_lock::{SharedRwLock as StyleSharedRwLock, SharedRwLockReadGuard};
use style::stylesheets::scope_rule::ImplicitScopeRoot;
use style::stylesheets::{Stylesheet, StylesheetContents}; use style::stylesheets::{Stylesheet, StylesheetContents};
use super::bindings::trace::HashMapTracedValues; use super::bindings::trace::HashMapTracedValues;
@ -65,6 +66,10 @@ impl ::style::stylesheets::StylesheetInDocument for StyleSheetInDocument {
fn contents(&self) -> &StylesheetContents { fn contents(&self) -> &StylesheetContents {
self.sheet.contents() self.sheet.contents()
} }
fn implicit_scope_root(&self) -> Option<ImplicitScopeRoot> {
None
}
} }
// https://w3c.github.io/webcomponents/spec/shadow/#extensions-to-the-documentorshadowroot-mixin // https://w3c.github.io/webcomponents/spec/shadow/#extensions-to-the-documentorshadowroot-mixin

View file

@ -18,7 +18,7 @@ use style::servo::media_queries::FontMetricsProvider;
use style::shared_lock::SharedRwLock; use style::shared_lock::SharedRwLock;
use style::stylesheets::StyleRule; use style::stylesheets::StyleRule;
use style::stylist::{ use style::stylist::{
needs_revalidation_for_testing, ContainerConditionId, LayerId, Rule, Stylist, needs_revalidation_for_testing, ContainerConditionId, LayerId, Rule, ScopeConditionId, Stylist,
}; };
use style::thread_state::{self, ThreadState}; use style::thread_state::{self, ThreadState};
use style::values::computed::Length; use style::values::computed::Length;
@ -78,6 +78,7 @@ fn get_mock_rules(css_selectors: &[&str]) -> (Vec<Vec<Rule>>, SharedRwLock) {
LayerId::root(), LayerId::root(),
ContainerConditionId::none(), ContainerConditionId::none(),
/* in_starting_style = */ false, /* in_starting_style = */ false,
ScopeConditionId::none(),
) )
}) })
.collect() .collect()

View file

@ -382,9 +382,3 @@
[Property color value 'color-mix(in oklch, oklch(10 20 120deg / 0) 10%, oklch(30 40 30deg))'] [Property color value 'color-mix(in oklch, oklch(10 20 120deg / 0) 10%, oklch(30 40 30deg))']
expected: FAIL expected: FAIL
[Property color value 'color-mix(in lch, white, blue)']
expected: FAIL
[Property color value 'color-mix(in lch, white 10%, blue)']
expected: FAIL

View file

@ -382,9 +382,3 @@
[Property color value 'color-mix(in oklch, oklch(10 20 120deg / 0) 10%, oklch(30 40 30deg))'] [Property color value 'color-mix(in oklch, oklch(10 20 120deg / 0) 10%, oklch(30 40 30deg))']
expected: FAIL expected: FAIL
[Property color value 'color-mix(in lch, white, blue)']
expected: FAIL
[Property color value 'color-mix(in lch, white 10%, blue)']
expected: FAIL