Skip to content

Commit

Permalink
Upgrade stylo to 2024-07-16 (servo#32812)
Browse files Browse the repository at this point in the history
* Upgrade stylo to 2024-07-16

Signed-off-by: Martin Robinson <[email protected]>

* Use the new `dom` crate from stylo

Signed-off-by: Martin Robinson <[email protected]>

---------

Signed-off-by: Martin Robinson <[email protected]>
Co-authored-by: Oriol Brufau <[email protected]>
  • Loading branch information
mrobinson and Loirooriol authored Jul 24, 2024
1 parent 60e65c1 commit 569fd5d
Show file tree
Hide file tree
Showing 33 changed files with 70 additions and 106 deletions.
44 changes: 24 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 10 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions components/layout/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 6 additions & 6 deletions components/layout/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand All @@ -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!()
},
}
Expand Down
6 changes: 3 additions & 3 deletions components/layout_2020/flow/inline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 3 additions & 7 deletions components/layout_2020/flow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
}
Expand Down
1 change: 1 addition & 0 deletions components/layout_2020/style_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions components/script/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/htmlbuttonelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/htmlelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/htmlfieldsetelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/htmlformelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/htmlinputelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/htmloptgroupelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/htmloptionelement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 569fd5d

Please sign in to comment.