mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Upgrade Stylo to 2024-10-04 (#33767)
* Upgrade Stylo to 2024-10-04 Signed-off-by: Oriol Brufau <obrufau@igalia.com> * Fixup for https://phabricator.services.mozilla.com/D220285 Signed-off-by: Oriol Brufau <obrufau@igalia.com> * Fixup for https://bugzilla.mozilla.org/show_bug.cgi?id=1918093 Signed-off-by: Oriol Brufau <obrufau@igalia.com> * Fixup for https://phabricator.services.mozilla.com/D222817 Signed-off-by: Oriol Brufau <obrufau@igalia.com> * Fixup for https://phabricator.services.mozilla.com/D222856 Signed-off-by: Oriol Brufau <obrufau@igalia.com> * Fixup for https://phabricator.services.mozilla.com/D222532 Signed-off-by: Oriol Brufau <obrufau@igalia.com> * Fixup for https://phabricator.services.mozilla.com/D222533 Signed-off-by: Oriol Brufau <obrufau@igalia.com> * Fixup for https://phabricator.services.mozilla.com/D222534 Signed-off-by: Oriol Brufau <obrufau@igalia.com> * Fixup for https://phabricator.services.mozilla.com/D223878 Signed-off-by: Oriol Brufau <obrufau@igalia.com> --------- Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
65c866285f
commit
c75f6627ba
16 changed files with 156 additions and 121 deletions
48
Cargo.lock
generated
48
Cargo.lock
generated
|
@ -1431,18 +1431,6 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_common"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-09-02#a8cc501222fed1050b0a042736a3630720e9b996"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_more"
|
||||
version = "0.99.18"
|
||||
|
@ -1624,7 +1612,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "dom"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-09-02#a8cc501222fed1050b0a042736a3630720e9b996"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-10-04#8f9898c7766b8f8abe14ab81051fda057f9fcda3"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
]
|
||||
|
@ -4249,7 +4237,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "malloc_size_of"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-09-02#a8cc501222fed1050b0a042736a3630720e9b996"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-10-04#8f9898c7766b8f8abe14ab81051fda057f9fcda3"
|
||||
dependencies = [
|
||||
"accountable-refcell",
|
||||
"app_units",
|
||||
|
@ -6245,8 +6233,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "selectors"
|
||||
version = "0.24.0"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-09-02#a8cc501222fed1050b0a042736a3630720e9b996"
|
||||
version = "0.25.0"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-10-04#8f9898c7766b8f8abe14ab81051fda057f9fcda3"
|
||||
dependencies = [
|
||||
"bitflags 2.6.0",
|
||||
"cssparser",
|
||||
|
@ -6533,8 +6521,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "servo_arc"
|
||||
version = "0.2.0"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-09-02#a8cc501222fed1050b0a042736a3630720e9b996"
|
||||
version = "0.4.0"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-10-04#8f9898c7766b8f8abe14ab81051fda057f9fcda3"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"stable_deref_trait",
|
||||
|
@ -6543,7 +6531,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "servo_atoms"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-09-02#a8cc501222fed1050b0a042736a3630720e9b996"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-10-04#8f9898c7766b8f8abe14ab81051fda057f9fcda3"
|
||||
dependencies = [
|
||||
"string_cache",
|
||||
"string_cache_codegen",
|
||||
|
@ -6763,7 +6751,7 @@ checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
|
|||
[[package]]
|
||||
name = "size_of_test"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-09-02#a8cc501222fed1050b0a042736a3630720e9b996"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-10-04#8f9898c7766b8f8abe14ab81051fda057f9fcda3"
|
||||
dependencies = [
|
||||
"static_assertions",
|
||||
]
|
||||
|
@ -6904,7 +6892,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
|||
[[package]]
|
||||
name = "static_prefs"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-09-02#a8cc501222fed1050b0a042736a3630720e9b996"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-10-04#8f9898c7766b8f8abe14ab81051fda057f9fcda3"
|
||||
|
||||
[[package]]
|
||||
name = "strck"
|
||||
|
@ -6957,7 +6945,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "style"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-09-02#a8cc501222fed1050b0a042736a3630720e9b996"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-10-04#8f9898c7766b8f8abe14ab81051fda057f9fcda3"
|
||||
dependencies = [
|
||||
"app_units",
|
||||
"arrayvec",
|
||||
|
@ -7015,7 +7003,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "style_config"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-09-02#a8cc501222fed1050b0a042736a3630720e9b996"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-10-04#8f9898c7766b8f8abe14ab81051fda057f9fcda3"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
]
|
||||
|
@ -7023,10 +7011,9 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "style_derive"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-09-02#a8cc501222fed1050b0a042736a3630720e9b996"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-10-04#8f9898c7766b8f8abe14ab81051fda057f9fcda3"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"derive_common",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
|
@ -7054,7 +7041,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "style_traits"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-09-02#a8cc501222fed1050b0a042736a3630720e9b996"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-10-04#8f9898c7766b8f8abe14ab81051fda057f9fcda3"
|
||||
dependencies = [
|
||||
"app_units",
|
||||
"bitflags 2.6.0",
|
||||
|
@ -7422,8 +7409,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "to_shmem"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-09-02#a8cc501222fed1050b0a042736a3630720e9b996"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-10-04#8f9898c7766b8f8abe14ab81051fda057f9fcda3"
|
||||
dependencies = [
|
||||
"cssparser",
|
||||
"servo_arc",
|
||||
|
@ -7435,11 +7422,10 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "to_shmem_derive"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-09-02#a8cc501222fed1050b0a042736a3630720e9b996"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/stylo?branch=2024-10-04#8f9898c7766b8f8abe14ab81051fda057f9fcda3"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"derive_common",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
|
|
21
Cargo.toml
21
Cargo.toml
|
@ -79,7 +79,7 @@ keyboard-types = "0.7"
|
|||
libc = "0.2"
|
||||
log = "0.4"
|
||||
mach2 = "0.4"
|
||||
malloc_size_of = { git = "https://github.com/servo/stylo", branch = "2024-09-02", features = ["servo"] }
|
||||
malloc_size_of = { git = "https://github.com/servo/stylo", branch = "2024-10-04", features = ["servo"] }
|
||||
malloc_size_of_derive = "0.1"
|
||||
memmap2 = "0.9.5"
|
||||
mime = "0.3.13"
|
||||
|
@ -103,31 +103,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-09-02" }
|
||||
selectors = { git = "https://github.com/servo/stylo", branch = "2024-10-04" }
|
||||
serde = "1.0.210"
|
||||
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-09-02", features = ["servo"] }
|
||||
servo_atoms = { git = "https://github.com/servo/stylo", branch = "2024-09-02" }
|
||||
size_of_test = { git = "https://github.com/servo/stylo", branch = "2024-09-02" }
|
||||
servo_arc = { git = "https://github.com/servo/stylo", branch = "2024-10-04", features = ["servo"] }
|
||||
servo_atoms = { git = "https://github.com/servo/stylo", branch = "2024-10-04" }
|
||||
size_of_test = { git = "https://github.com/servo/stylo", branch = "2024-10-04" }
|
||||
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-09-02", features = ["servo"] }
|
||||
style_config = { git = "https://github.com/servo/stylo", branch = "2024-09-02" }
|
||||
style_dom = { git = "https://github.com/servo/stylo", package = "dom", branch = "2024-09-02" }
|
||||
style_traits = { git = "https://github.com/servo/stylo", branch = "2024-09-02", features = ["servo"] }
|
||||
style = { git = "https://github.com/servo/stylo", branch = "2024-10-04", features = ["servo"] }
|
||||
style_config = { git = "https://github.com/servo/stylo", branch = "2024-10-04" }
|
||||
style_dom = { git = "https://github.com/servo/stylo", package = "dom", branch = "2024-10-04" }
|
||||
style_traits = { git = "https://github.com/servo/stylo", branch = "2024-10-04", features = ["servo"] }
|
||||
surfman = { git = "https://github.com/servo/surfman", rev = "e0c34af64f2860bc56bc8a56e1c169a915b16aa3", features = ["chains"] }
|
||||
syn = { version = "2", default-features = false, features = ["clone-impls", "derive", "parsing"] }
|
||||
synstructure = "0.13"
|
||||
thin-vec = "0.2.13"
|
||||
time_03 = { package = "time", version = "0.3", features = ["large-dates", "local-offset", "serde"] }
|
||||
to_shmem = { git = "https://github.com/servo/stylo", branch = "2024-09-02" }
|
||||
to_shmem = { git = "https://github.com/servo/stylo", branch = "2024-10-04" }
|
||||
tokio = "1"
|
||||
tokio-rustls = "0.24"
|
||||
tungstenite = "0.20"
|
||||
|
@ -184,7 +184,6 @@ codegen-units = 1
|
|||
# Or for Stylo:
|
||||
#
|
||||
# [patch."https://github.com/servo/stylo"]
|
||||
# derive_common = { path = "../stylo/derive_common" }
|
||||
# dom = { path = "../stylo/dom" }
|
||||
# malloc_size_of = { path = "../stylo/malloc_size_of" }
|
||||
# selectors = { path = "../stylo/selectors" }
|
||||
|
|
|
@ -46,7 +46,7 @@ use style::context::SharedStyleContext;
|
|||
use style::logical_geometry::{LogicalMargin, LogicalPoint, LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::servo::restyle_damage::ServoRestyleDamage;
|
||||
use style::values::computed::{LengthPercentageOrAuto, MaxSize, Size};
|
||||
use style::values::computed::{Margin, MaxSize, Size};
|
||||
|
||||
use crate::context::LayoutContext;
|
||||
use crate::display_list::items::DisplayListSection;
|
||||
|
@ -1408,8 +1408,8 @@ impl BlockFlow {
|
|||
let (block_start, block_end) = {
|
||||
let position = self.fragment.style().logical_position();
|
||||
(
|
||||
MaybeAuto::from_style(position.block_start, container_size),
|
||||
MaybeAuto::from_style(position.block_end, container_size),
|
||||
MaybeAuto::from_inset(position.block_start, container_size),
|
||||
MaybeAuto::from_inset(position.block_end, container_size),
|
||||
)
|
||||
};
|
||||
|
||||
|
@ -1422,11 +1422,11 @@ impl BlockFlow {
|
|||
// calculated during assign-inline-size.
|
||||
let margin = self.fragment.style().logical_margin();
|
||||
let margin_block_start = match margin.block_start {
|
||||
LengthPercentageOrAuto::Auto => MaybeAuto::Auto,
|
||||
Margin::Auto => MaybeAuto::Auto,
|
||||
_ => MaybeAuto::Specified(self.fragment.margin.block_start),
|
||||
};
|
||||
let margin_block_end = match margin.block_end {
|
||||
LengthPercentageOrAuto::Auto => MaybeAuto::Auto,
|
||||
Margin::Auto => MaybeAuto::Auto,
|
||||
_ => MaybeAuto::Specified(self.fragment.margin.block_end),
|
||||
};
|
||||
|
||||
|
@ -1456,11 +1456,11 @@ impl BlockFlow {
|
|||
// calculated during assign-inline-size.
|
||||
let margin = self.fragment.style().logical_margin();
|
||||
let margin_block_start = match margin.block_start {
|
||||
LengthPercentageOrAuto::Auto => MaybeAuto::Auto,
|
||||
Margin::Auto => MaybeAuto::Auto,
|
||||
_ => MaybeAuto::Specified(self.fragment.margin.block_start),
|
||||
};
|
||||
let margin_block_end = match margin.block_end {
|
||||
LengthPercentageOrAuto::Auto => MaybeAuto::Auto,
|
||||
Margin::Auto => MaybeAuto::Auto,
|
||||
_ => MaybeAuto::Specified(self.fragment.margin.block_end),
|
||||
};
|
||||
|
||||
|
@ -1469,8 +1469,8 @@ impl BlockFlow {
|
|||
{
|
||||
let position = self.fragment.style().logical_position();
|
||||
block_start =
|
||||
MaybeAuto::from_style(position.block_start, containing_block_block_size);
|
||||
block_end = MaybeAuto::from_style(position.block_end, containing_block_block_size);
|
||||
MaybeAuto::from_inset(position.block_start, containing_block_block_size);
|
||||
block_end = MaybeAuto::from_inset(position.block_end, containing_block_block_size);
|
||||
}
|
||||
|
||||
let available_block_size =
|
||||
|
@ -2117,10 +2117,10 @@ impl BlockFlow {
|
|||
let offsets = self.fragment.style().logical_position();
|
||||
let as_margins = LogicalMargin::new(
|
||||
writing_mode,
|
||||
MaybeAuto::from_style(offsets.block_start, containing_block_size.inline),
|
||||
MaybeAuto::from_style(offsets.inline_end, containing_block_size.inline),
|
||||
MaybeAuto::from_style(offsets.block_end, containing_block_size.inline),
|
||||
MaybeAuto::from_style(offsets.inline_start, containing_block_size.inline),
|
||||
MaybeAuto::from_inset(offsets.block_start, containing_block_size.inline),
|
||||
MaybeAuto::from_inset(offsets.inline_end, containing_block_size.inline),
|
||||
MaybeAuto::from_inset(offsets.block_end, containing_block_size.inline),
|
||||
MaybeAuto::from_inset(offsets.inline_start, containing_block_size.inline),
|
||||
);
|
||||
as_margins.to_physical(writing_mode)
|
||||
}
|
||||
|
@ -2789,10 +2789,10 @@ pub trait ISizeAndMarginsComputer {
|
|||
containing_block_inline_size - block.fragment.border_padding.inline_start_end();
|
||||
ISizeConstraintInput::new(
|
||||
computed_inline_size,
|
||||
MaybeAuto::from_style(margin.inline_start, containing_block_inline_size),
|
||||
MaybeAuto::from_style(margin.inline_end, containing_block_inline_size),
|
||||
MaybeAuto::from_style(position.inline_start, containing_block_inline_size),
|
||||
MaybeAuto::from_style(position.inline_end, containing_block_inline_size),
|
||||
MaybeAuto::from_margin(margin.inline_start, containing_block_inline_size),
|
||||
MaybeAuto::from_margin(margin.inline_end, containing_block_inline_size),
|
||||
MaybeAuto::from_inset(position.inline_start, containing_block_inline_size),
|
||||
MaybeAuto::from_inset(position.inline_end, containing_block_inline_size),
|
||||
available_inline_size,
|
||||
)
|
||||
}
|
||||
|
|
|
@ -671,9 +671,9 @@ impl FlexFlow {
|
|||
} else {
|
||||
line.free_space / line.auto_margin_count
|
||||
};
|
||||
let margin_inline_start = MaybeAuto::from_style(margin.inline_start, inline_size)
|
||||
let margin_inline_start = MaybeAuto::from_margin(margin.inline_start, inline_size)
|
||||
.specified_or_default(auto_len);
|
||||
let margin_inline_end = MaybeAuto::from_style(margin.inline_end, inline_size)
|
||||
let margin_inline_end = MaybeAuto::from_margin(margin.inline_end, inline_size)
|
||||
.specified_or_default(auto_len);
|
||||
let item_inline_size = item.main_size -
|
||||
block.fragment.box_sizing_boundary(self.main_mode) +
|
||||
|
|
|
@ -962,8 +962,8 @@ impl Fragment {
|
|||
QuantitiesIncludedInIntrinsicInlineSizes::INTRINSIC_INLINE_SIZE_INCLUDES_MARGINS,
|
||||
) {
|
||||
let margin = style.logical_margin();
|
||||
MaybeAuto::from_style(margin.inline_start, Au(0)).specified_or_zero() +
|
||||
MaybeAuto::from_style(margin.inline_end, Au(0)).specified_or_zero()
|
||||
MaybeAuto::from_margin(margin.inline_start, Au(0)).specified_or_zero() +
|
||||
MaybeAuto::from_margin(margin.inline_end, Au(0)).specified_or_zero()
|
||||
} else {
|
||||
Au(0)
|
||||
};
|
||||
|
@ -1274,10 +1274,10 @@ impl Fragment {
|
|||
let logical_padding = self.style.logical_padding();
|
||||
let border_width = self.border_width();
|
||||
SpeculatedInlineContentEdgeOffsets {
|
||||
start: MaybeAuto::from_style(logical_margin.inline_start, Au(0)).specified_or_zero() +
|
||||
start: MaybeAuto::from_margin(logical_margin.inline_start, Au(0)).specified_or_zero() +
|
||||
logical_padding.inline_start.to_used_value(Au(0)) +
|
||||
border_width.inline_start,
|
||||
end: MaybeAuto::from_style(logical_margin.inline_end, Au(0)).specified_or_zero() +
|
||||
end: MaybeAuto::from_margin(logical_margin.inline_end, Au(0)).specified_or_zero() +
|
||||
logical_padding.inline_end.to_used_value(Au(0)) +
|
||||
border_width.inline_end,
|
||||
}
|
||||
|
@ -1349,9 +1349,9 @@ impl Fragment {
|
|||
let (inline_start, inline_end) = {
|
||||
let margin = self.style().logical_margin();
|
||||
(
|
||||
MaybeAuto::from_style(margin.inline_start, containing_block_inline_size)
|
||||
MaybeAuto::from_margin(margin.inline_start, containing_block_inline_size)
|
||||
.specified_or_zero(),
|
||||
MaybeAuto::from_style(margin.inline_end, containing_block_inline_size)
|
||||
MaybeAuto::from_margin(margin.inline_end, containing_block_inline_size)
|
||||
.specified_or_zero(),
|
||||
)
|
||||
};
|
||||
|
@ -1369,7 +1369,7 @@ impl Fragment {
|
|||
{
|
||||
Au(0)
|
||||
} else {
|
||||
MaybeAuto::from_style(margin.inline_start, containing_block_inline_size)
|
||||
MaybeAuto::from_margin(margin.inline_start, containing_block_inline_size)
|
||||
.specified_or_zero()
|
||||
};
|
||||
let this_inline_end_margin = if !node
|
||||
|
@ -1378,7 +1378,7 @@ impl Fragment {
|
|||
{
|
||||
Au(0)
|
||||
} else {
|
||||
MaybeAuto::from_style(margin.inline_end, containing_block_inline_size)
|
||||
MaybeAuto::from_margin(margin.inline_end, containing_block_inline_size)
|
||||
.specified_or_zero()
|
||||
};
|
||||
|
||||
|
@ -1408,9 +1408,9 @@ impl Fragment {
|
|||
let (block_start, block_end) = {
|
||||
let margin = self.style().logical_margin();
|
||||
(
|
||||
MaybeAuto::from_style(margin.block_start, containing_block_inline_size)
|
||||
MaybeAuto::from_margin(margin.block_start, containing_block_inline_size)
|
||||
.specified_or_zero(),
|
||||
MaybeAuto::from_style(margin.block_end, containing_block_inline_size)
|
||||
MaybeAuto::from_margin(margin.block_end, containing_block_inline_size)
|
||||
.specified_or_zero(),
|
||||
)
|
||||
};
|
||||
|
@ -1484,16 +1484,16 @@ impl Fragment {
|
|||
fn from_style(style: &ComputedValues, container_size: &LogicalSize<Au>) -> LogicalSize<Au> {
|
||||
let offsets = style.logical_position();
|
||||
let offset_i = if !offsets.inline_start.is_auto() {
|
||||
MaybeAuto::from_style(offsets.inline_start, container_size.inline)
|
||||
MaybeAuto::from_inset(offsets.inline_start, container_size.inline)
|
||||
.specified_or_zero()
|
||||
} else {
|
||||
-MaybeAuto::from_style(offsets.inline_end, container_size.inline)
|
||||
-MaybeAuto::from_inset(offsets.inline_end, container_size.inline)
|
||||
.specified_or_zero()
|
||||
};
|
||||
let offset_b = if !offsets.block_start.is_auto() {
|
||||
MaybeAuto::from_style(offsets.block_start, container_size.block).specified_or_zero()
|
||||
let offset_b = if offsets.block_start.is_auto() {
|
||||
MaybeAuto::from_inset(offsets.block_start, container_size.block).specified_or_zero()
|
||||
} else {
|
||||
-MaybeAuto::from_style(offsets.block_end, container_size.block).specified_or_zero()
|
||||
-MaybeAuto::from_inset(offsets.block_end, container_size.block).specified_or_zero()
|
||||
};
|
||||
LogicalSize::new(style.writing_mode, offset_i, offset_b)
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ use euclid::SideOffsets2D;
|
|||
use serde::Serialize;
|
||||
use style::logical_geometry::{LogicalMargin, WritingMode};
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::{LengthPercentageOrAuto, MaxSize, Size};
|
||||
use style::values::computed::{Inset, LengthPercentageOrAuto, Margin, MaxSize, Size};
|
||||
|
||||
use crate::fragment::Fragment;
|
||||
|
||||
|
@ -467,6 +467,29 @@ impl MaybeAuto {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn from_inset(length: &Inset, containing_length: Au) -> MaybeAuto {
|
||||
match length {
|
||||
Inset::Auto => MaybeAuto::Auto,
|
||||
Inset::LengthPercentage(ref lp) => {
|
||||
MaybeAuto::Specified(lp.to_used_value(containing_length))
|
||||
},
|
||||
Inset::AnchorFunction(_) => unreachable!("anchor() should be disabled"),
|
||||
Inset::AnchorSizeFunction(_) => unreachable!("anchor-size() should be disabled"),
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn from_margin(length: &Margin, containing_length: Au) -> MaybeAuto {
|
||||
match length {
|
||||
Margin::Auto => MaybeAuto::Auto,
|
||||
Margin::LengthPercentage(ref lp) => {
|
||||
MaybeAuto::Specified(lp.to_used_value(containing_length))
|
||||
},
|
||||
Margin::AnchorSizeFunction(_) => unreachable!("anchor-size() should be disabled"),
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn from_option(au: Option<Au>) -> MaybeAuto {
|
||||
match au {
|
||||
|
@ -562,10 +585,10 @@ pub fn specified_margin_from_style(
|
|||
LogicalMargin::from_physical(
|
||||
writing_mode,
|
||||
SideOffsets2D::new(
|
||||
MaybeAuto::from_style(&margin_style.margin_top, Au(0)).specified_or_zero(),
|
||||
MaybeAuto::from_style(&margin_style.margin_right, Au(0)).specified_or_zero(),
|
||||
MaybeAuto::from_style(&margin_style.margin_bottom, Au(0)).specified_or_zero(),
|
||||
MaybeAuto::from_style(&margin_style.margin_left, Au(0)).specified_or_zero(),
|
||||
MaybeAuto::from_margin(&margin_style.margin_top, Au(0)).specified_or_zero(),
|
||||
MaybeAuto::from_margin(&margin_style.margin_right, Au(0)).specified_or_zero(),
|
||||
MaybeAuto::from_margin(&margin_style.margin_bottom, Au(0)).specified_or_zero(),
|
||||
MaybeAuto::from_margin(&margin_style.margin_left, Au(0)).specified_or_zero(),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ use style::properties::ComputedValues;
|
|||
use style::values::computed::image::Image;
|
||||
use style::values::computed::{
|
||||
BorderImageSideWidth, BorderImageWidth, BorderStyle, Color, LengthPercentage,
|
||||
LengthPercentageOrAuto, NonNegativeLengthOrNumber, NumberOrPercentage, OutlineStyle,
|
||||
NonNegativeLengthOrNumber, NumberOrPercentage, OutlineStyle,
|
||||
};
|
||||
use style::values::generics::rect::Rect;
|
||||
use style::values::generics::NonNegative;
|
||||
|
@ -49,7 +49,7 @@ use crate::display_list::stacking_context::StackingContextSection;
|
|||
use crate::fragment_tree::{
|
||||
BackgroundMode, BoxFragment, Fragment, FragmentFlags, FragmentTree, Tag, TextFragment,
|
||||
};
|
||||
use crate::geom::{PhysicalPoint, PhysicalRect};
|
||||
use crate::geom::{LengthPercentageOrAuto, PhysicalPoint, PhysicalRect};
|
||||
use crate::replaced::NaturalSizes;
|
||||
use crate::style_ext::ComputedValuesExt;
|
||||
|
||||
|
@ -1332,7 +1332,7 @@ pub(super) fn compute_margin_box_radius(
|
|||
layout_rect: LayoutSize,
|
||||
fragment: &BoxFragment,
|
||||
) -> wr::BorderRadius {
|
||||
let margin = fragment.style.get_margin();
|
||||
let margin = fragment.style.physical_margin();
|
||||
let adjust_radius = |radius: f32, margin: f32| -> f32 {
|
||||
if margin <= 0. || (radius / margin) >= 1. {
|
||||
(radius + margin).max(0.)
|
||||
|
@ -1344,13 +1344,14 @@ pub(super) fn compute_margin_box_radius(
|
|||
layout_rect: LayoutSize,
|
||||
margin: Size2D<LengthPercentageOrAuto, UnknownUnit>|
|
||||
-> LayoutSize {
|
||||
let zero = LengthPercentage::zero();
|
||||
let width = margin
|
||||
.width
|
||||
.auto_is(LengthPercentage::zero)
|
||||
.auto_is(|| &zero)
|
||||
.to_used_value(Au::from_f32_px(layout_rect.width));
|
||||
let height = margin
|
||||
.height
|
||||
.auto_is(LengthPercentage::zero)
|
||||
.auto_is(|| &zero)
|
||||
.to_used_value(Au::from_f32_px(layout_rect.height));
|
||||
LayoutSize::new(
|
||||
adjust_radius(radius.width, width.to_f32_px()),
|
||||
|
@ -1361,22 +1362,22 @@ pub(super) fn compute_margin_box_radius(
|
|||
top_left: compute_margin_radius(
|
||||
radius.top_left,
|
||||
layout_rect,
|
||||
Size2D::new(margin.margin_left.clone(), margin.margin_top.clone()),
|
||||
Size2D::new(margin.left.clone(), margin.top.clone()),
|
||||
),
|
||||
top_right: compute_margin_radius(
|
||||
radius.top_right,
|
||||
layout_rect,
|
||||
Size2D::new(margin.margin_right.clone(), margin.margin_top.clone()),
|
||||
Size2D::new(margin.right.clone(), margin.top.clone()),
|
||||
),
|
||||
bottom_left: compute_margin_radius(
|
||||
radius.bottom_left,
|
||||
layout_rect,
|
||||
Size2D::new(margin.margin_left.clone(), margin.margin_bottom.clone()),
|
||||
Size2D::new(margin.left.clone(), margin.bottom.clone()),
|
||||
),
|
||||
bottom_right: compute_margin_radius(
|
||||
radius.bottom_right,
|
||||
layout_rect,
|
||||
Size2D::new(margin.margin_right.clone(), margin.margin_bottom.clone()),
|
||||
Size2D::new(margin.right.clone(), margin.bottom.clone()),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1364,16 +1364,14 @@ impl BoxFragment {
|
|||
// Percentages sticky positions offsets are resovled against the size of the
|
||||
// nearest scroll frame instead of the containing block like for other types
|
||||
// of positioning.
|
||||
let position = self.style.get_position();
|
||||
let scroll_frame_height = Au::from_f32_px(scroll_frame_size_for_resolve.height);
|
||||
let scroll_frame_width = Au::from_f32_px(scroll_frame_size_for_resolve.width);
|
||||
let offsets = self.style.physical_box_offsets();
|
||||
let offsets = PhysicalSides::<AuOrAuto>::new(
|
||||
position.top.map(|v| v.to_used_value(scroll_frame_height)),
|
||||
position.right.map(|v| v.to_used_value(scroll_frame_width)),
|
||||
position
|
||||
.bottom
|
||||
.map(|v| v.to_used_value(scroll_frame_height)),
|
||||
position.left.map(|v| v.to_used_value(scroll_frame_width)),
|
||||
offsets.top.map(|v| v.to_used_value(scroll_frame_height)),
|
||||
offsets.right.map(|v| v.to_used_value(scroll_frame_width)),
|
||||
offsets.bottom.map(|v| v.to_used_value(scroll_frame_height)),
|
||||
offsets.left.map(|v| v.to_used_value(scroll_frame_width)),
|
||||
);
|
||||
self.resolved_sticky_insets = Some(offsets);
|
||||
|
||||
|
|
|
@ -1929,6 +1929,7 @@ fn block_size_is_zero_or_intrinsic(size: &StyleSize, containing_block: &Containi
|
|||
lp.is_definitely_zero() ||
|
||||
(lp.0.has_percentage() && containing_block.block_size.is_auto())
|
||||
},
|
||||
StyleSize::AnchorSizeFunction(_) => unreachable!("anchor-size() should be disabled"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,13 +10,14 @@ use style::computed_values::overflow_x::T as ComputedOverflow;
|
|||
use style::computed_values::position::T as ComputedPosition;
|
||||
use style::logical_geometry::WritingMode;
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::computed::LengthPercentageOrAuto;
|
||||
use style::Zero;
|
||||
|
||||
use super::{BaseFragment, BaseFragmentInfo, CollapsedBlockMargins, Fragment};
|
||||
use crate::cell::ArcRefCell;
|
||||
use crate::formatting_contexts::Baselines;
|
||||
use crate::geom::{AuOrAuto, PhysicalPoint, PhysicalRect, PhysicalSides, ToLogical};
|
||||
use crate::geom::{
|
||||
AuOrAuto, LengthPercentageOrAuto, PhysicalPoint, PhysicalRect, PhysicalSides, ToLogical,
|
||||
};
|
||||
use crate::style_ext::ComputedValuesExt;
|
||||
|
||||
/// Describes how a [`BoxFragment`] paints its background.
|
||||
|
@ -277,7 +278,7 @@ impl BoxFragment {
|
|||
// the property is not over-constrained, then the resolved value is the
|
||||
// used value. Otherwise the resolved value is the computed value."
|
||||
// https://drafts.csswg.org/cssom/#resolved-values
|
||||
let insets = self.style.get_position();
|
||||
let insets = self.style.physical_box_offsets();
|
||||
let (cb_width, cb_height) = (containing_block.width(), containing_block.height());
|
||||
if position == ComputedPosition::Relative {
|
||||
let get_resolved_axis = |start: &LengthPercentageOrAuto,
|
||||
|
|
|
@ -708,6 +708,7 @@ impl From<StyleSize> for Size<LengthPercentage> {
|
|||
StyleSize::MaxContent => Size::MaxContent,
|
||||
StyleSize::FitContent => Size::FitContent,
|
||||
StyleSize::Stretch => Size::Stretch,
|
||||
StyleSize::AnchorSizeFunction(_) => unreachable!("anchor-size() should be disabled"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -721,6 +722,7 @@ impl From<StyleMaxSize> for Size<LengthPercentage> {
|
|||
StyleMaxSize::MaxContent => Size::MaxContent,
|
||||
StyleMaxSize::FitContent => Size::FitContent,
|
||||
StyleMaxSize::Stretch => Size::Stretch,
|
||||
StyleMaxSize::AnchorSizeFunction(_) => unreachable!("anchor-size() should be disabled"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ use style::properties::ComputedValues;
|
|||
use style::servo::selector_parser::PseudoElement;
|
||||
use style::values::computed::basic_shape::ClipPath;
|
||||
use style::values::computed::image::Image as ComputedImageLayer;
|
||||
use style::values::computed::{AlignItems, BorderStyle, LengthPercentage};
|
||||
use style::values::computed::{AlignItems, BorderStyle, Inset, LengthPercentage, Margin};
|
||||
use style::values::generics::box_::Perspective;
|
||||
use style::values::generics::position::{GenericAspectRatio, PreferredRatio};
|
||||
use style::values::specified::align::AlignFlags;
|
||||
|
@ -180,6 +180,7 @@ impl AspectRatio {
|
|||
}
|
||||
|
||||
pub(crate) trait ComputedValuesExt {
|
||||
fn physical_box_offsets(&self) -> PhysicalSides<LengthPercentageOrAuto<'_>>;
|
||||
fn box_offsets(
|
||||
&self,
|
||||
containing_block: &ContainingBlock,
|
||||
|
@ -279,6 +280,7 @@ pub(crate) trait ComputedValuesExt {
|
|||
fn border_style(&self, containing_block_writing_mode: WritingMode)
|
||||
-> LogicalSides<BorderStyle>;
|
||||
fn border_width(&self, containing_block_writing_mode: WritingMode) -> LogicalSides<Au>;
|
||||
fn physical_margin(&self) -> PhysicalSides<LengthPercentageOrAuto<'_>>;
|
||||
fn margin(
|
||||
&self,
|
||||
containing_block_writing_mode: WritingMode,
|
||||
|
@ -314,18 +316,30 @@ pub(crate) trait ComputedValuesExt {
|
|||
}
|
||||
|
||||
impl ComputedValuesExt for ComputedValues {
|
||||
fn physical_box_offsets(&self) -> PhysicalSides<LengthPercentageOrAuto<'_>> {
|
||||
fn convert<'a>(inset: &'a Inset) -> LengthPercentageOrAuto<'a> {
|
||||
match inset {
|
||||
Inset::LengthPercentage(ref v) => LengthPercentageOrAuto::LengthPercentage(v),
|
||||
Inset::Auto => LengthPercentageOrAuto::Auto,
|
||||
Inset::AnchorFunction(_) => unreachable!("anchor() should be disabled"),
|
||||
Inset::AnchorSizeFunction(_) => unreachable!("anchor-size() should be disabled"),
|
||||
}
|
||||
}
|
||||
let position = self.get_position();
|
||||
PhysicalSides::new(
|
||||
convert(&position.top),
|
||||
convert(&position.right),
|
||||
convert(&position.bottom),
|
||||
convert(&position.left),
|
||||
)
|
||||
}
|
||||
|
||||
fn box_offsets(
|
||||
&self,
|
||||
containing_block: &ContainingBlock,
|
||||
) -> LogicalSides<LengthPercentageOrAuto<'_>> {
|
||||
let position = self.get_position();
|
||||
LogicalSides::from_physical(
|
||||
&PhysicalSides::new(
|
||||
position.top.as_ref(),
|
||||
position.right.as_ref(),
|
||||
position.bottom.as_ref(),
|
||||
position.left.as_ref(),
|
||||
),
|
||||
&self.physical_box_offsets(),
|
||||
containing_block.style.writing_mode,
|
||||
)
|
||||
}
|
||||
|
@ -681,20 +695,28 @@ impl ComputedValuesExt for ComputedValues {
|
|||
)
|
||||
}
|
||||
|
||||
fn physical_margin(&self) -> PhysicalSides<LengthPercentageOrAuto<'_>> {
|
||||
fn convert<'a>(inset: &'a Margin) -> LengthPercentageOrAuto<'a> {
|
||||
match inset {
|
||||
Margin::LengthPercentage(ref v) => LengthPercentageOrAuto::LengthPercentage(v),
|
||||
Margin::Auto => LengthPercentageOrAuto::Auto,
|
||||
Margin::AnchorSizeFunction(_) => unreachable!("anchor-size() should be disabled"),
|
||||
}
|
||||
}
|
||||
let margin = self.get_margin();
|
||||
PhysicalSides::new(
|
||||
convert(&margin.margin_top),
|
||||
convert(&margin.margin_right),
|
||||
convert(&margin.margin_bottom),
|
||||
convert(&margin.margin_left),
|
||||
)
|
||||
}
|
||||
|
||||
fn margin(
|
||||
&self,
|
||||
containing_block_writing_mode: WritingMode,
|
||||
) -> LogicalSides<LengthPercentageOrAuto<'_>> {
|
||||
let margin = self.get_margin();
|
||||
LogicalSides::from_physical(
|
||||
&PhysicalSides::new(
|
||||
margin.margin_top.as_ref(),
|
||||
margin.margin_right.as_ref(),
|
||||
margin.margin_bottom.as_ref(),
|
||||
margin.margin_left.as_ref(),
|
||||
),
|
||||
containing_block_writing_mode,
|
||||
)
|
||||
LogicalSides::from_physical(&self.physical_margin(), containing_block_writing_mode)
|
||||
}
|
||||
|
||||
/// Returns true if this style has a transform, or perspective property set and
|
||||
|
|
|
@ -120,6 +120,7 @@ impl CSSRule {
|
|||
StyleCssRule::Scope(_) => unimplemented!(), // TODO
|
||||
StyleCssRule::StartingStyle(_) => unimplemented!(), // TODO
|
||||
StyleCssRule::PositionTry(_) => unimplemented!(), // TODO
|
||||
StyleCssRule::NestedDeclarations(_) => unimplemented!(), // TODO
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ fn cascade(
|
|||
let mut input = ParserInput::new(value);
|
||||
let mut parser = Parser::new(&mut input);
|
||||
let name = Name::from(name);
|
||||
let value = CustomDeclarationValue::Value(Arc::new(
|
||||
let value = CustomDeclarationValue::Unparsed(Arc::new(
|
||||
SpecifiedValue::parse(&mut parser, &dummy_url_data).unwrap(),
|
||||
));
|
||||
CustomDeclaration { name, value }
|
||||
|
|
|
@ -83,7 +83,7 @@ fn parse_rules(lock: &SharedRwLock, css: &str) -> Vec<(StyleSource, CascadeLevel
|
|||
.iter()
|
||||
.filter_map(|rule| match *rule {
|
||||
CssRule::Style(ref style_rule) => Some((
|
||||
StyleSource::from_rule(style_rule.clone()),
|
||||
StyleSource::from_declarations(style_rule.read_with(&guard).block.clone()),
|
||||
CascadeLevel::UserNormal,
|
||||
)),
|
||||
_ => None,
|
||||
|
|
|
@ -14,6 +14,7 @@ use style::properties::style_structs::Font;
|
|||
use style::properties::{
|
||||
longhands, ComputedValues, Importance, PropertyDeclaration, PropertyDeclarationBlock,
|
||||
};
|
||||
use style::rule_tree::StyleSource;
|
||||
use style::selector_map::SelectorMap;
|
||||
use style::selector_parser::{SelectorImpl, SelectorParser};
|
||||
use style::servo::media_queries::FontMetricsProvider;
|
||||
|
@ -79,7 +80,7 @@ fn get_mock_rules(css_selectors: &[&str]) -> (Vec<Vec<Rule>>, SharedRwLock) {
|
|||
Rule::new(
|
||||
s.clone(),
|
||||
AncestorHashes::new(s, QuirksMode::NoQuirks),
|
||||
locked.clone(),
|
||||
StyleSource::from_declarations(rule.block.clone()),
|
||||
i as u32,
|
||||
LayerId::root(),
|
||||
ContainerConditionId::none(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue