mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
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:
parent
60e65c175d
commit
569fd5d8b5
33 changed files with 70 additions and 106 deletions
|
@ -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 {
|
||||
|
|
|
@ -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!()
|
||||
},
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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::{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue