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