mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Updated fixes to some clippy warnings in components/script
This commit is contained in:
parent
e74a03724f
commit
2a37c3dec8
58 changed files with 156 additions and 265 deletions
46
Cargo.lock
generated
46
Cargo.lock
generated
|
@ -329,7 +329,7 @@ dependencies = [
|
||||||
"bitflags 2.5.0",
|
"bitflags 2.5.0",
|
||||||
"cexpr",
|
"cexpr",
|
||||||
"clang-sys",
|
"clang-sys",
|
||||||
"itertools 0.10.5",
|
"itertools 0.12.1",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"lazycell",
|
"lazycell",
|
||||||
"log",
|
"log",
|
||||||
|
@ -572,7 +572,6 @@ dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"canvas_traits",
|
"canvas_traits",
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
"cssparser",
|
|
||||||
"euclid",
|
"euclid",
|
||||||
"fnv",
|
"fnv",
|
||||||
"font-kit",
|
"font-kit",
|
||||||
|
@ -603,7 +602,6 @@ name = "canvas_traits"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
"cssparser",
|
|
||||||
"euclid",
|
"euclid",
|
||||||
"ipc-channel",
|
"ipc-channel",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
@ -1081,9 +1079,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cssparser"
|
name = "cssparser"
|
||||||
version = "0.32.0"
|
version = "0.33.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2d54fe63cb80af11947c98a880393db44448d0b512f9b6c318398ae355794cb9"
|
checksum = "9be934d936a0fbed5bcdc01042b770de1398bf79d0e192f49fa7faea0e99281e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cssparser-macros",
|
"cssparser-macros",
|
||||||
"dtoa-short",
|
"dtoa-short",
|
||||||
|
@ -1110,7 +1108,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e16e44ab292b1dddfdaf7be62cfd8877df52f2f3fde5858d95bab606be259f20"
|
checksum = "e16e44ab292b1dddfdaf7be62cfd8877df52f2f3fde5858d95bab606be259f20"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.5.0",
|
"bitflags 2.5.0",
|
||||||
"libloading 0.7.4",
|
"libloading 0.8.3",
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1200,7 +1198,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "derive_common"
|
name = "derive_common"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
source = "git+https://github.com/servo/stylo?branch=2023-09-01#bcdebc41b2a2222e9fa5ae6d7d1572025c32dc47"
|
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"darling",
|
"darling",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
|
@ -1306,7 +1304,7 @@ version = "0.5.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
|
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libloading 0.7.4",
|
"libloading 0.8.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -3450,7 +3448,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=2023-09-01#bcdebc41b2a2222e9fa5ae6d7d1572025c32dc47"
|
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"accountable-refcell",
|
"accountable-refcell",
|
||||||
"app_units",
|
"app_units",
|
||||||
|
@ -5063,9 +5061,9 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "selectors"
|
name = "selectors"
|
||||||
version = "0.24.0"
|
version = "0.24.0"
|
||||||
source = "git+https://github.com/servo/stylo?branch=2023-09-01#bcdebc41b2a2222e9fa5ae6d7d1572025c32dc47"
|
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.3.2",
|
"bitflags 2.5.0",
|
||||||
"cssparser",
|
"cssparser",
|
||||||
"derive_more",
|
"derive_more",
|
||||||
"fxhash",
|
"fxhash",
|
||||||
|
@ -5351,7 +5349,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "servo_arc"
|
name = "servo_arc"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
source = "git+https://github.com/servo/stylo?branch=2023-09-01#bcdebc41b2a2222e9fa5ae6d7d1572025c32dc47"
|
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"nodrop",
|
"nodrop",
|
||||||
"serde",
|
"serde",
|
||||||
|
@ -5361,7 +5359,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=2023-09-01#bcdebc41b2a2222e9fa5ae6d7d1572025c32dc47"
|
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"string_cache",
|
"string_cache",
|
||||||
"string_cache_codegen",
|
"string_cache_codegen",
|
||||||
|
@ -5559,7 +5557,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=2023-09-01#bcdebc41b2a2222e9fa5ae6d7d1572025c32dc47"
|
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
]
|
]
|
||||||
|
@ -5685,7 +5683,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=2023-09-01#bcdebc41b2a2222e9fa5ae6d7d1572025c32dc47"
|
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strict-num"
|
name = "strict-num"
|
||||||
|
@ -5722,12 +5720,12 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "style"
|
name = "style"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
source = "git+https://github.com/servo/stylo?branch=2023-09-01#bcdebc41b2a2222e9fa5ae6d7d1572025c32dc47"
|
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"app_units",
|
"app_units",
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"atomic_refcell",
|
"atomic_refcell",
|
||||||
"bitflags 1.3.2",
|
"bitflags 2.5.0",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"cssparser",
|
"cssparser",
|
||||||
"derive_more",
|
"derive_more",
|
||||||
|
@ -5781,7 +5779,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=2023-09-01#bcdebc41b2a2222e9fa5ae6d7d1572025c32dc47"
|
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
]
|
]
|
||||||
|
@ -5789,7 +5787,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "style_derive"
|
name = "style_derive"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
source = "git+https://github.com/servo/stylo?branch=2023-09-01#bcdebc41b2a2222e9fa5ae6d7d1572025c32dc47"
|
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"darling",
|
"darling",
|
||||||
"derive_common",
|
"derive_common",
|
||||||
|
@ -5820,10 +5818,10 @@ 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=2023-09-01#bcdebc41b2a2222e9fa5ae6d7d1572025c32dc47"
|
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"app_units",
|
"app_units",
|
||||||
"bitflags 1.3.2",
|
"bitflags 2.5.0",
|
||||||
"cssparser",
|
"cssparser",
|
||||||
"euclid",
|
"euclid",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
@ -6174,7 +6172,7 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "to_shmem"
|
name = "to_shmem"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
source = "git+https://github.com/servo/stylo?branch=2023-09-01#bcdebc41b2a2222e9fa5ae6d7d1572025c32dc47"
|
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cssparser",
|
"cssparser",
|
||||||
"servo_arc",
|
"servo_arc",
|
||||||
|
@ -6187,7 +6185,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "to_shmem_derive"
|
name = "to_shmem_derive"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
source = "git+https://github.com/servo/stylo?branch=2023-09-01#bcdebc41b2a2222e9fa5ae6d7d1572025c32dc47"
|
source = "git+https://github.com/servo/stylo?branch=2023-10-16#bab07f5fa1d0101d6b3c274e3715d1c1ef77e33c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"darling",
|
"darling",
|
||||||
"derive_common",
|
"derive_common",
|
||||||
|
@ -7007,7 +7005,7 @@ dependencies = [
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"khronos-egl",
|
"khronos-egl",
|
||||||
"libc",
|
"libc",
|
||||||
"libloading 0.7.4",
|
"libloading 0.8.3",
|
||||||
"log",
|
"log",
|
||||||
"metal 0.27.0",
|
"metal 0.27.0",
|
||||||
"naga",
|
"naga",
|
||||||
|
|
20
Cargo.toml
20
Cargo.toml
|
@ -26,7 +26,7 @@ compositing_traits = { path = "components/shared/compositing" }
|
||||||
content-security-policy = { version = "0.5", features = ["serde"] }
|
content-security-policy = { version = "0.5", features = ["serde"] }
|
||||||
cookie = "0.12"
|
cookie = "0.12"
|
||||||
crossbeam-channel = "0.5"
|
crossbeam-channel = "0.5"
|
||||||
cssparser = "0.32"
|
cssparser = { version = "0.33", features = ["serde"] }
|
||||||
darling = { version = "0.20", default-features = false }
|
darling = { version = "0.20", default-features = false }
|
||||||
data-url = "0.1.0"
|
data-url = "0.1.0"
|
||||||
devtools_traits = { path = "components/shared/devtools" }
|
devtools_traits = { path = "components/shared/devtools" }
|
||||||
|
@ -64,7 +64,7 @@ keyboard-types = "0.6"
|
||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
malloc_size_of = { git = "https://github.com/servo/stylo", branch = "2023-09-01", features = ["servo"] }
|
malloc_size_of = { git = "https://github.com/servo/stylo", branch = "2023-10-16", features = ["servo"] }
|
||||||
malloc_size_of_derive = "0.1"
|
malloc_size_of_derive = "0.1"
|
||||||
mime = "0.3.13"
|
mime = "0.3.13"
|
||||||
mime_guess = "2.0.3"
|
mime_guess = "2.0.3"
|
||||||
|
@ -87,31 +87,31 @@ rustls = { version = "0.21.10", 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 = "2023-09-01" }
|
selectors = { git = "https://github.com/servo/stylo", branch = "2023-10-16" }
|
||||||
serde = "1.0.197"
|
serde = "1.0.197"
|
||||||
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 = "2023-09-01" }
|
servo_arc = { git = "https://github.com/servo/stylo", branch = "2023-10-16" }
|
||||||
servo_atoms = { git = "https://github.com/servo/stylo", branch = "2023-09-01" }
|
servo_atoms = { git = "https://github.com/servo/stylo", branch = "2023-10-16" }
|
||||||
size_of_test = { git = "https://github.com/servo/stylo", branch = "2023-09-01" }
|
size_of_test = { git = "https://github.com/servo/stylo", branch = "2023-10-16" }
|
||||||
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 = "2023-09-01", features = ["servo"] }
|
style = { git = "https://github.com/servo/stylo", branch = "2023-10-16", features = ["servo"] }
|
||||||
style_config = { git = "https://github.com/servo/stylo", branch = "2023-09-01" }
|
style_config = { git = "https://github.com/servo/stylo", branch = "2023-10-16" }
|
||||||
style_traits = { git = "https://github.com/servo/stylo", branch = "2023-09-01", features = ["servo"] }
|
style_traits = { git = "https://github.com/servo/stylo", branch = "2023-10-16", features = ["servo"] }
|
||||||
# NOTE: the sm-angle feature only enables ANGLE on Windows, not other platforms!
|
# NOTE: the sm-angle feature only enables ANGLE on Windows, not other platforms!
|
||||||
surfman = { version = "0.9", features = ["chains", "sm-angle", "sm-angle-default"] }
|
surfman = { version = "0.9", features = ["chains", "sm-angle", "sm-angle-default"] }
|
||||||
syn = { version = "2", default-features = false, features = ["clone-impls", "derive", "parsing"] }
|
syn = { version = "2", default-features = false, features = ["clone-impls", "derive", "parsing"] }
|
||||||
synstructure = "0.13"
|
synstructure = "0.13"
|
||||||
thin-vec = "0.2.13"
|
thin-vec = "0.2.13"
|
||||||
time = "0.1.41"
|
time = "0.1.41"
|
||||||
to_shmem = { git = "https://github.com/servo/stylo", branch = "2023-09-01" }
|
to_shmem = { git = "https://github.com/servo/stylo", branch = "2023-10-16" }
|
||||||
tokio = "1"
|
tokio = "1"
|
||||||
tokio-rustls = "0.24"
|
tokio-rustls = "0.24"
|
||||||
tungstenite = "0.20"
|
tungstenite = "0.20"
|
||||||
|
|
|
@ -20,7 +20,6 @@ bitflags = { workspace = true }
|
||||||
byteorder = { workspace = true }
|
byteorder = { workspace = true }
|
||||||
canvas_traits = { workspace = true }
|
canvas_traits = { workspace = true }
|
||||||
crossbeam-channel = { workspace = true }
|
crossbeam-channel = { workspace = true }
|
||||||
cssparser = { workspace = true }
|
|
||||||
euclid = { workspace = true }
|
euclid = { workspace = true }
|
||||||
font-kit = "0.11"
|
font-kit = "0.11"
|
||||||
fnv = { workspace = true }
|
fnv = { workspace = true }
|
||||||
|
|
|
@ -7,7 +7,6 @@ use std::mem;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
use canvas_traits::canvas::*;
|
use canvas_traits::canvas::*;
|
||||||
use cssparser::RgbaLegacy;
|
|
||||||
use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D};
|
use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D};
|
||||||
use euclid::{point2, vec2};
|
use euclid::{point2, vec2};
|
||||||
use font_kit::family_name::FamilyName;
|
use font_kit::family_name::FamilyName;
|
||||||
|
@ -22,6 +21,7 @@ use ipc_channel::ipc::{IpcSender, IpcSharedMemory};
|
||||||
use log::{debug, error, warn};
|
use log::{debug, error, warn};
|
||||||
use num_traits::ToPrimitive;
|
use num_traits::ToPrimitive;
|
||||||
use servo_arc::Arc as ServoArc;
|
use servo_arc::Arc as ServoArc;
|
||||||
|
use style::color::parsing::RgbaLegacy;
|
||||||
use style::properties::style_structs::Font as FontStyleStruct;
|
use style::properties::style_structs::Font as FontStyleStruct;
|
||||||
use style::values::computed::font;
|
use style::values::computed::font;
|
||||||
use style_traits::values::ToCss;
|
use style_traits::values::ToCss;
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use canvas_traits::canvas::*;
|
use canvas_traits::canvas::*;
|
||||||
use cssparser::RgbaLegacy;
|
|
||||||
use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D};
|
use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D};
|
||||||
use euclid::Angle;
|
use euclid::Angle;
|
||||||
use font_kit::font::Font;
|
use font_kit::font::Font;
|
||||||
use log::warn;
|
use log::warn;
|
||||||
use lyon_geom::Arc;
|
use lyon_geom::Arc;
|
||||||
use raqote::PathOp;
|
use raqote::PathOp;
|
||||||
|
use style::color::parsing::RgbaLegacy;
|
||||||
|
|
||||||
use crate::canvas_data;
|
use crate::canvas_data;
|
||||||
use crate::canvas_data::{
|
use crate::canvas_data::{
|
||||||
|
|
|
@ -26,6 +26,7 @@ use style::values::computed::font::{
|
||||||
FontWeight, SingleFontFamily,
|
FontWeight, SingleFontFamily,
|
||||||
};
|
};
|
||||||
use style::values::computed::{FontLanguageOverride, XLang};
|
use style::values::computed::{FontLanguageOverride, XLang};
|
||||||
|
use style::values::generics::font::LineHeight;
|
||||||
use webrender_api::{FontInstanceKey, FontKey, IdNamespace};
|
use webrender_api::{FontInstanceKey, FontKey, IdNamespace};
|
||||||
|
|
||||||
struct TestFontSource {
|
struct TestFontSource {
|
||||||
|
@ -112,6 +113,7 @@ fn style() -> FontStyleStruct {
|
||||||
font_stretch: FontStretch::hundred(),
|
font_stretch: FontStretch::hundred(),
|
||||||
hash: 0,
|
hash: 0,
|
||||||
font_language_override: FontLanguageOverride::normal(),
|
font_language_override: FontLanguageOverride::normal(),
|
||||||
|
line_height: LineHeight::Normal,
|
||||||
_x_lang: XLang::get_initial_value(),
|
_x_lang: XLang::get_initial_value(),
|
||||||
};
|
};
|
||||||
style.compute_font_hash();
|
style.compute_font_hash();
|
||||||
|
|
|
@ -1527,7 +1527,6 @@ where
|
||||||
},
|
},
|
||||||
// XXX: Non-None image types unimplemented.
|
// XXX: Non-None image types unimplemented.
|
||||||
Image::ImageSet(..) |
|
Image::ImageSet(..) |
|
||||||
Image::Rect(..) |
|
|
||||||
Image::Gradient(..) |
|
Image::Gradient(..) |
|
||||||
Image::PaintWorklet(..) |
|
Image::PaintWorklet(..) |
|
||||||
Image::CrossFade(..) |
|
Image::CrossFade(..) |
|
||||||
|
|
|
@ -796,10 +796,6 @@ impl Fragment {
|
||||||
Image::CrossFade(..) | Image::ImageSet(..) => {
|
Image::CrossFade(..) | Image::ImageSet(..) => {
|
||||||
unreachable!("Shouldn't be parsed by Servo for now")
|
unreachable!("Shouldn't be parsed by Servo for now")
|
||||||
},
|
},
|
||||||
Image::Rect(ref rect) => {
|
|
||||||
// This is a (boxed) empty enum on non-Gecko
|
|
||||||
match **rect {}
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -771,7 +771,7 @@ impl CollapsedBorder {
|
||||||
CollapsedBorder {
|
CollapsedBorder {
|
||||||
style: BorderStyle::None,
|
style: BorderStyle::None,
|
||||||
width: Au(0),
|
width: Au(0),
|
||||||
color: Color::TRANSPARENT,
|
color: Color::TRANSPARENT_BLACK,
|
||||||
provenance: CollapsedBorderFrom::Table,
|
provenance: CollapsedBorderFrom::Table,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ use style::computed_values::word_break::T as WordBreak;
|
||||||
use style::logical_geometry::{LogicalSize, WritingMode};
|
use style::logical_geometry::{LogicalSize, WritingMode};
|
||||||
use style::properties::style_structs::Font as FontStyleStruct;
|
use style::properties::style_structs::Font as FontStyleStruct;
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::values::generics::text::LineHeight;
|
use style::values::generics::font::LineHeight;
|
||||||
use style::values::specified::text::{TextTransform, TextTransformCase};
|
use style::values::specified::text::{TextTransform, TextTransformCase};
|
||||||
use unicode_bidi as bidi;
|
use unicode_bidi as bidi;
|
||||||
use unicode_script::Script;
|
use unicode_script::Script;
|
||||||
|
@ -550,8 +550,9 @@ pub fn font_metrics_for_style(
|
||||||
|
|
||||||
/// Returns the line block-size needed by the given computed style and font size.
|
/// Returns the line block-size needed by the given computed style and font size.
|
||||||
pub fn line_height_from_style(style: &ComputedValues, metrics: &FontMetrics) -> Au {
|
pub fn line_height_from_style(style: &ComputedValues, metrics: &FontMetrics) -> Au {
|
||||||
let font_size = style.get_font().font_size.computed_size();
|
let font = style.get_font();
|
||||||
match style.get_inherited_text().line_height {
|
let font_size = font.font_size.computed_size();
|
||||||
|
match font.line_height {
|
||||||
LineHeight::Normal => metrics.line_gap,
|
LineHeight::Normal => metrics.line_gap,
|
||||||
LineHeight::Number(l) => Au::from(font_size * l.0),
|
LineHeight::Number(l) => Au::from(font_size * l.0),
|
||||||
LineHeight::Length(l) => Au::from(l),
|
LineHeight::Length(l) => Au::from(l),
|
||||||
|
|
|
@ -777,8 +777,6 @@ impl<'a> BuilderForBoxFragment<'a> {
|
||||||
Image::PaintWorklet(_) => {
|
Image::PaintWorklet(_) => {
|
||||||
// TODO: Add support for PaintWorklet rendering.
|
// TODO: Add support for PaintWorklet rendering.
|
||||||
},
|
},
|
||||||
// Gecko-only value, represented as a (boxed) empty enum on non-Gecko.
|
|
||||||
Image::Rect(ref rect) => match **rect {},
|
|
||||||
Image::ImageSet(..) | Image::CrossFade(..) => {
|
Image::ImageSet(..) | Image::CrossFade(..) => {
|
||||||
unreachable!("Shouldn't be parsed on Servo for now")
|
unreachable!("Shouldn't be parsed on Servo for now")
|
||||||
},
|
},
|
||||||
|
|
|
@ -84,7 +84,7 @@ use style::logical_geometry::WritingMode;
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::values::computed::Length;
|
use style::values::computed::Length;
|
||||||
use style::values::generics::box_::VerticalAlignKeyword;
|
use style::values::generics::box_::VerticalAlignKeyword;
|
||||||
use style::values::generics::text::LineHeight;
|
use style::values::generics::font::LineHeight;
|
||||||
use style::values::specified::text::{TextAlignKeyword, TextDecorationLine};
|
use style::values::specified::text::{TextAlignKeyword, TextDecorationLine};
|
||||||
use style::values::specified::{TextAlignLast, TextJustify};
|
use style::values::specified::{TextAlignLast, TextJustify};
|
||||||
use style::Zero;
|
use style::Zero;
|
||||||
|
@ -1829,7 +1829,7 @@ impl InlineContainerState {
|
||||||
// when `line-height` is normal.
|
// when `line-height` is normal.
|
||||||
let mut ascent = font_metrics.ascent;
|
let mut ascent = font_metrics.ascent;
|
||||||
let mut descent = font_metrics.descent;
|
let mut descent = font_metrics.descent;
|
||||||
if style.get_inherited_text().line_height == LineHeight::Normal {
|
if style.get_font().line_height == LineHeight::Normal {
|
||||||
let half_leading_from_line_gap =
|
let half_leading_from_line_gap =
|
||||||
(font_metrics.line_gap - descent - ascent).scale_by(0.5);
|
(font_metrics.line_gap - descent - ascent).scale_by(0.5);
|
||||||
ascent += half_leading_from_line_gap;
|
ascent += half_leading_from_line_gap;
|
||||||
|
@ -1856,7 +1856,7 @@ impl InlineContainerState {
|
||||||
// zero in this case, the line may get some height when taking them into
|
// zero in this case, the line may get some height when taking them into
|
||||||
// considering with other zero line height boxes that converge on other block axis
|
// considering with other zero line height boxes that converge on other block axis
|
||||||
// locations when using the above formula.
|
// locations when using the above formula.
|
||||||
if style.get_inherited_text().line_height != LineHeight::Normal {
|
if style.get_font().line_height != LineHeight::Normal {
|
||||||
let half_leading =
|
let half_leading =
|
||||||
(Au::from_f32_px(line_height.px()) - (ascent + descent)).scale_by(0.5);
|
(Au::from_f32_px(line_height.px()) - (ascent + descent)).scale_by(0.5);
|
||||||
ascent += half_leading;
|
ascent += half_leading;
|
||||||
|
@ -2217,8 +2217,9 @@ fn place_pending_floats(ifc: &mut InlineFormattingContextState, line_items: &mut
|
||||||
}
|
}
|
||||||
|
|
||||||
fn line_height(parent_style: &ComputedValues, font_metrics: &FontMetrics) -> Length {
|
fn line_height(parent_style: &ComputedValues, font_metrics: &FontMetrics) -> Length {
|
||||||
let font_size = parent_style.get_font().font_size.computed_size();
|
let font = parent_style.get_font();
|
||||||
match parent_style.get_inherited_text().line_height {
|
let font_size = font.font_size.computed_size();
|
||||||
|
match font.line_height {
|
||||||
LineHeight::Normal => Length::from(font_metrics.line_gap),
|
LineHeight::Normal => Length::from(font_metrics.line_gap),
|
||||||
LineHeight::Number(number) => font_size * number.0,
|
LineHeight::Number(number) => font_size * number.0,
|
||||||
LineHeight::Length(length) => length.0,
|
LineHeight::Length(length) => length.0,
|
||||||
|
|
|
@ -12,7 +12,7 @@ use servo_arc::Arc;
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::values::computed::Length;
|
use style::values::computed::Length;
|
||||||
use style::values::generics::box_::{GenericVerticalAlign, VerticalAlignKeyword};
|
use style::values::generics::box_::{GenericVerticalAlign, VerticalAlignKeyword};
|
||||||
use style::values::generics::text::LineHeight;
|
use style::values::generics::font::LineHeight;
|
||||||
use style::values::specified::box_::DisplayOutside;
|
use style::values::specified::box_::DisplayOutside;
|
||||||
use style::values::specified::text::TextDecorationLine;
|
use style::values::specified::text::TextDecorationLine;
|
||||||
use style::Zero;
|
use style::Zero;
|
||||||
|
@ -581,8 +581,9 @@ impl FloatLineItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn line_height(parent_style: &ComputedValues, font_metrics: &FontMetrics) -> Length {
|
fn line_height(parent_style: &ComputedValues, font_metrics: &FontMetrics) -> Length {
|
||||||
let font_size = parent_style.get_font().font_size.computed_size();
|
let font = parent_style.get_font();
|
||||||
match parent_style.get_inherited_text().line_height {
|
let font_size = font.font_size.computed_size();
|
||||||
|
match font.line_height {
|
||||||
LineHeight::Normal => Length::from(font_metrics.line_gap),
|
LineHeight::Normal => Length::from(font_metrics.line_gap),
|
||||||
LineHeight::Number(number) => font_size * number.0,
|
LineHeight::Number(number) => font_size * number.0,
|
||||||
LineHeight::Length(length) => length.0,
|
LineHeight::Length(length) => length.0,
|
||||||
|
|
|
@ -39,7 +39,6 @@ where
|
||||||
]),
|
]),
|
||||||
// XXX: Non-None image types unimplemented.
|
// XXX: Non-None image types unimplemented.
|
||||||
Image::ImageSet(..) |
|
Image::ImageSet(..) |
|
||||||
Image::Rect(..) |
|
|
||||||
Image::Gradient(..) |
|
Image::Gradient(..) |
|
||||||
Image::CrossFade(..) |
|
Image::CrossFade(..) |
|
||||||
Image::PaintWorklet(..) |
|
Image::PaintWorklet(..) |
|
||||||
|
|
|
@ -29,7 +29,7 @@ use style::shared_lock::SharedRwLock;
|
||||||
use style::stylesheets::{CssRuleType, Origin, UrlExtraData};
|
use style::stylesheets::{CssRuleType, Origin, UrlExtraData};
|
||||||
use style::stylist::RuleInclusion;
|
use style::stylist::RuleInclusion;
|
||||||
use style::traversal::resolve_style;
|
use style::traversal::resolve_style;
|
||||||
use style::values::generics::text::LineHeight;
|
use style::values::generics::font::LineHeight;
|
||||||
use style_traits::{ParsingMode, ToCss};
|
use style_traits::{ParsingMode, ToCss};
|
||||||
use webrender_api::ExternalScrollId;
|
use webrender_api::ExternalScrollId;
|
||||||
|
|
||||||
|
@ -161,8 +161,9 @@ pub fn process_resolved_style_request<'dom>(
|
||||||
// For line height, the resolved value is the computed value if it
|
// For line height, the resolved value is the computed value if it
|
||||||
// is "normal" and the used value otherwise.
|
// is "normal" and the used value otherwise.
|
||||||
if longhand_id == LonghandId::LineHeight {
|
if longhand_id == LonghandId::LineHeight {
|
||||||
let font_size = style.get_font().font_size.computed_size();
|
let font = style.get_font();
|
||||||
return match style.get_inherited_text().line_height {
|
let font_size = font.font_size.computed_size();
|
||||||
|
return match font.line_height {
|
||||||
LineHeight::Normal => computed_style(),
|
LineHeight::Normal => computed_style(),
|
||||||
LineHeight::Number(value) => (font_size * value.0).to_css_string(),
|
LineHeight::Number(value) => (font_size * value.0).to_css_string(),
|
||||||
LineHeight::Length(value) => value.0.to_css_string(),
|
LineHeight::Length(value) => value.0.to_css_string(),
|
||||||
|
|
|
@ -12,7 +12,7 @@ use canvas_traits::canvas::{
|
||||||
FillRule, LineCapStyle, LineJoinStyle, LinearGradientStyle, RadialGradientStyle,
|
FillRule, LineCapStyle, LineJoinStyle, LinearGradientStyle, RadialGradientStyle,
|
||||||
RepetitionStyle, TextAlign, TextBaseline,
|
RepetitionStyle, TextAlign, TextBaseline,
|
||||||
};
|
};
|
||||||
use cssparser::{Parser, ParserInput, RgbaLegacy};
|
use cssparser::{Parser, ParserInput};
|
||||||
use euclid::default::{Point2D, Rect, Size2D, Transform2D};
|
use euclid::default::{Point2D, Rect, Size2D, Transform2D};
|
||||||
use euclid::vec2;
|
use euclid::vec2;
|
||||||
use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory};
|
use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory};
|
||||||
|
@ -22,6 +22,7 @@ use pixels::PixelFormat;
|
||||||
use profile_traits::ipc as profiled_ipc;
|
use profile_traits::ipc as profiled_ipc;
|
||||||
use script_traits::ScriptMsg;
|
use script_traits::ScriptMsg;
|
||||||
use servo_url::{ImmutableOrigin, ServoUrl};
|
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||||
|
use style::color::parsing::RgbaLegacy;
|
||||||
use style::color::{AbsoluteColor, ColorSpace};
|
use style::color::{AbsoluteColor, ColorSpace};
|
||||||
use style::context::QuirksMode;
|
use style::context::QuirksMode;
|
||||||
use style::parser::ParserContext;
|
use style::parser::ParserContext;
|
||||||
|
|
|
@ -543,9 +543,9 @@ pub enum ProtoOrIfaceIndex {
|
||||||
Constructor(PrototypeList::Constructor),
|
Constructor(PrototypeList::Constructor),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<usize> for ProtoOrIfaceIndex {
|
impl From<ProtoOrIfaceIndex> for usize {
|
||||||
fn into(self) -> usize {
|
fn from(index: ProtoOrIfaceIndex) -> usize {
|
||||||
match self {
|
match index {
|
||||||
ProtoOrIfaceIndex::ID(id) => id as usize,
|
ProtoOrIfaceIndex::ID(id) => id as usize,
|
||||||
ProtoOrIfaceIndex::Constructor(constructor) => constructor as usize,
|
ProtoOrIfaceIndex::Constructor(constructor) => constructor as usize,
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,9 +51,9 @@ impl ByteString {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<Vec<u8>> for ByteString {
|
impl From<ByteString> for Vec<u8> {
|
||||||
fn into(self) -> Vec<u8> {
|
fn from(byte_string: ByteString) -> Vec<u8> {
|
||||||
self.0
|
byte_string.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -640,21 +640,21 @@ impl From<DOMString> for String {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<Vec<u8>> for DOMString {
|
impl From<DOMString> for Vec<u8> {
|
||||||
fn into(self) -> Vec<u8> {
|
fn from(contents: DOMString) -> Vec<u8> {
|
||||||
self.0.into()
|
contents.0.into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Into<Cow<'a, str>> for DOMString {
|
impl<'a> From<DOMString> for Cow<'a, str> {
|
||||||
fn into(self) -> Cow<'a, str> {
|
fn from(contents: DOMString) -> Cow<'a, str> {
|
||||||
self.0.into()
|
contents.0.into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Into<CowRcStr<'a>> for DOMString {
|
impl<'a> From<DOMString> for CowRcStr<'a> {
|
||||||
fn into(self) -> CowRcStr<'a> {
|
fn from(contents: DOMString) -> CowRcStr<'a> {
|
||||||
self.0.into()
|
contents.0.into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,15 +110,13 @@ pub fn xml_name_type(name: &str) -> XMLName {
|
||||||
|
|
||||||
fn is_valid_continuation(c: char) -> bool {
|
fn is_valid_continuation(c: char) -> bool {
|
||||||
is_valid_start(c) ||
|
is_valid_start(c) ||
|
||||||
match c {
|
matches!(c,
|
||||||
'-' |
|
'-' |
|
||||||
'.' |
|
'.' |
|
||||||
'0'..='9' |
|
'0'..='9' |
|
||||||
'\u{B7}' |
|
'\u{B7}' |
|
||||||
'\u{300}'..='\u{36F}' |
|
'\u{300}'..='\u{36F}' |
|
||||||
'\u{203F}'..='\u{2040}' => true,
|
'\u{203F}'..='\u{2040}')
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut iter = name.chars();
|
let mut iter = name.chars();
|
||||||
|
|
|
@ -64,14 +64,14 @@ impl CryptoMethods for Crypto {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_integer_buffer(array_type: Type) -> bool {
|
fn is_integer_buffer(array_type: Type) -> bool {
|
||||||
match array_type {
|
matches!(
|
||||||
|
array_type,
|
||||||
Type::Uint8 |
|
Type::Uint8 |
|
||||||
Type::Uint8Clamped |
|
Type::Uint8Clamped |
|
||||||
Type::Int8 |
|
Type::Int8 |
|
||||||
Type::Uint16 |
|
Type::Uint16 |
|
||||||
Type::Int16 |
|
Type::Int16 |
|
||||||
Type::Uint32 |
|
Type::Uint32 |
|
||||||
Type::Int32 => true,
|
Type::Int32
|
||||||
_ => false,
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -345,16 +345,17 @@ impl Element {
|
||||||
self.is.borrow().clone()
|
self.is.borrow().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <https://dom.spec.whatwg.org/#concept-element-custom-element-state>
|
||||||
pub fn set_custom_element_state(&self, state: CustomElementState) {
|
pub fn set_custom_element_state(&self, state: CustomElementState) {
|
||||||
// no need to inflate rare data for uncustomized
|
// no need to inflate rare data for uncustomized
|
||||||
if state != CustomElementState::Uncustomized || self.rare_data().is_some() {
|
if state != CustomElementState::Uncustomized || self.rare_data().is_some() {
|
||||||
self.ensure_rare_data().custom_element_state = state;
|
self.ensure_rare_data().custom_element_state = state;
|
||||||
}
|
}
|
||||||
// https://dom.spec.whatwg.org/#concept-element-defined
|
|
||||||
let in_defined_state = match state {
|
let in_defined_state = matches!(
|
||||||
CustomElementState::Uncustomized | CustomElementState::Custom => true,
|
state,
|
||||||
_ => false,
|
CustomElementState::Uncustomized | CustomElementState::Custom
|
||||||
};
|
);
|
||||||
self.set_state(ElementState::DEFINED, in_defined_state)
|
self.set_state(ElementState::DEFINED, in_defined_state)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -627,7 +628,7 @@ pub trait LayoutElementHelpers<'dom> {
|
||||||
fn get_lang_for_layout(self) -> String;
|
fn get_lang_for_layout(self) -> String;
|
||||||
fn get_state_for_layout(self) -> ElementState;
|
fn get_state_for_layout(self) -> ElementState;
|
||||||
fn insert_selector_flags(self, flags: ElementSelectorFlags);
|
fn insert_selector_flags(self, flags: ElementSelectorFlags);
|
||||||
fn has_selector_flags(self, flags: ElementSelectorFlags) -> bool;
|
fn get_selector_flags(self) -> ElementSelectorFlags;
|
||||||
/// The shadow root this element is a host of.
|
/// The shadow root this element is a host of.
|
||||||
fn get_shadow_root_for_layout(self) -> Option<LayoutDom<'dom, ShadowRoot>>;
|
fn get_shadow_root_for_layout(self) -> Option<LayoutDom<'dom, ShadowRoot>>;
|
||||||
fn get_attr_for_layout(
|
fn get_attr_for_layout(
|
||||||
|
@ -707,7 +708,7 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(color) = bgcolor {
|
if let Some(color) = bgcolor {
|
||||||
use cssparser::FromParsedColor;
|
use style::color::parsing::FromParsedColor;
|
||||||
hints.push(from_declaration(
|
hints.push(from_declaration(
|
||||||
shared_lock,
|
shared_lock,
|
||||||
PropertyDeclaration::BackgroundColor(specified::Color::from_rgba(
|
PropertyDeclaration::BackgroundColor(specified::Color::from_rgba(
|
||||||
|
@ -747,7 +748,7 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(color) = color {
|
if let Some(color) = color {
|
||||||
use cssparser::FromParsedColor;
|
use style::color::parsing::FromParsedColor;
|
||||||
hints.push(from_declaration(
|
hints.push(from_declaration(
|
||||||
shared_lock,
|
shared_lock,
|
||||||
PropertyDeclaration::Color(longhands::color::SpecifiedValue(
|
PropertyDeclaration::Color(longhands::color::SpecifiedValue(
|
||||||
|
@ -1107,8 +1108,8 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
fn has_selector_flags(self, flags: ElementSelectorFlags) -> bool {
|
fn get_selector_flags(self) -> ElementSelectorFlags {
|
||||||
unsafe { (self.unsafe_get()).selector_flags.get().contains(flags) }
|
unsafe { self.unsafe_get().selector_flags.get() }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -1393,21 +1394,18 @@ impl Element {
|
||||||
}
|
}
|
||||||
|
|
||||||
// <a>, <input>, <select>, and <textrea> are inherently focusable.
|
// <a>, <input>, <select>, and <textrea> are inherently focusable.
|
||||||
match node.type_id() {
|
matches!(
|
||||||
|
node.type_id(),
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(
|
NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||||
HTMLElementTypeId::HTMLAnchorElement,
|
HTMLElementTypeId::HTMLAnchorElement,
|
||||||
)) |
|
)) | NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(
|
|
||||||
HTMLElementTypeId::HTMLInputElement,
|
HTMLElementTypeId::HTMLInputElement,
|
||||||
)) |
|
)) | NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(
|
|
||||||
HTMLElementTypeId::HTMLSelectElement,
|
HTMLElementTypeId::HTMLSelectElement,
|
||||||
)) |
|
)) | NodeTypeId::Element(ElementTypeId::HTMLElement(
|
||||||
NodeTypeId::Element(ElementTypeId::HTMLElement(
|
|
||||||
HTMLElementTypeId::HTMLTextAreaElement,
|
HTMLElementTypeId::HTMLTextAreaElement,
|
||||||
)) => true,
|
))
|
||||||
_ => false,
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_actually_disabled(&self) -> bool {
|
pub fn is_actually_disabled(&self) -> bool {
|
||||||
|
@ -1493,7 +1491,7 @@ impl Element {
|
||||||
.map(|js| DomRoot::from_ref(&**js))
|
.map(|js| DomRoot::from_ref(&**js))
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name
|
/// <https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name>
|
||||||
pub fn get_attribute_by_name(&self, name: DOMString) -> Option<DomRoot<Attr>> {
|
pub fn get_attribute_by_name(&self, name: DOMString) -> Option<DomRoot<Attr>> {
|
||||||
let name = &self.parsed_name(name);
|
let name = &self.parsed_name(name);
|
||||||
let maybe_attribute = self
|
let maybe_attribute = self
|
||||||
|
@ -1506,10 +1504,7 @@ impl Element {
|
||||||
if *name == local_name!("id") || *name == local_name!("name") {
|
if *name == local_name!("id") || *name == local_name!("name") {
|
||||||
match maybe_attr {
|
match maybe_attr {
|
||||||
None => true,
|
None => true,
|
||||||
Some(ref attr) => match *attr.value() {
|
Some(ref attr) => matches!(*attr.value(), AttrValue::Atom(_)),
|
||||||
AttrValue::Atom(_) => true,
|
|
||||||
_ => false,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
true
|
true
|
||||||
|
@ -2932,10 +2927,7 @@ impl VirtualMethods for Element {
|
||||||
//
|
//
|
||||||
// Juggle a bit to keep the borrow checker happy
|
// Juggle a bit to keep the borrow checker happy
|
||||||
// while avoiding the extra clone.
|
// while avoiding the extra clone.
|
||||||
let is_declaration = match *attr.value() {
|
let is_declaration = matches!(*attr.value(), AttrValue::Declaration(..));
|
||||||
AttrValue::Declaration(..) => true,
|
|
||||||
_ => false,
|
|
||||||
};
|
|
||||||
|
|
||||||
let block = if is_declaration {
|
let block = if is_declaration {
|
||||||
let mut value = AttrValue::String(String::new());
|
let mut value = AttrValue::String(String::new());
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use cssparser::RgbaLegacy;
|
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use embedder_traits::EmbedderMsg;
|
use embedder_traits::EmbedderMsg;
|
||||||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||||
use js::rust::HandleObject;
|
use js::rust::HandleObject;
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
use style::attr::AttrValue;
|
use style::attr::AttrValue;
|
||||||
|
use style::color::parsing::RgbaLegacy;
|
||||||
|
|
||||||
use crate::dom::attr::Attr;
|
use crate::dom::attr::Attr;
|
||||||
use crate::dom::bindings::codegen::Bindings::HTMLBodyElementBinding::HTMLBodyElementMethods;
|
use crate::dom::bindings::codegen::Bindings::HTMLBodyElementBinding::HTMLBodyElementMethods;
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use cssparser::RgbaLegacy;
|
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||||
use js::rust::HandleObject;
|
use js::rust::HandleObject;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
use style::attr::AttrValue;
|
use style::attr::AttrValue;
|
||||||
|
use style::color::parsing::RgbaLegacy;
|
||||||
use style::str::{read_numbers, HTML_SPACE_CHARACTERS};
|
use style::str::{read_numbers, HTML_SPACE_CHARACTERS};
|
||||||
|
|
||||||
use crate::dom::attr::Attr;
|
use crate::dom::attr::Attr;
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use cssparser::RgbaLegacy;
|
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||||
use js::rust::HandleObject;
|
use js::rust::HandleObject;
|
||||||
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
|
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
|
||||||
|
use style::color::parsing::RgbaLegacy;
|
||||||
|
|
||||||
use crate::dom::bindings::codegen::Bindings::HTMLHRElementBinding::HTMLHRElementMethods;
|
use crate::dom::bindings::codegen::Bindings::HTMLHRElementBinding::HTMLHRElementMethods;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use cssparser::RgbaLegacy;
|
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||||
use js::rust::HandleObject;
|
use js::rust::HandleObject;
|
||||||
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
|
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
|
||||||
|
use style::color::parsing::RgbaLegacy;
|
||||||
use style::context::QuirksMode;
|
use style::context::QuirksMode;
|
||||||
|
|
||||||
use crate::dom::bindings::codegen::Bindings::HTMLTableCellElementBinding::HTMLTableCellElementMethods;
|
use crate::dom::bindings::codegen::Bindings::HTMLTableCellElementBinding::HTMLTableCellElementMethods;
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
|
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
|
||||||
use cssparser::RgbaLegacy;
|
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||||
use js::rust::HandleObject;
|
use js::rust::HandleObject;
|
||||||
use style::attr::{parse_unsigned_integer, AttrValue, LengthOrPercentageOrAuto};
|
use style::attr::{parse_unsigned_integer, AttrValue, LengthOrPercentageOrAuto};
|
||||||
|
use style::color::parsing::RgbaLegacy;
|
||||||
|
|
||||||
use crate::dom::attr::Attr;
|
use crate::dom::attr::Attr;
|
||||||
use crate::dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMethods;
|
use crate::dom::bindings::codegen::Bindings::HTMLCollectionBinding::HTMLCollectionMethods;
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use cssparser::RgbaLegacy;
|
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||||
use js::rust::HandleObject;
|
use js::rust::HandleObject;
|
||||||
use style::attr::AttrValue;
|
use style::attr::AttrValue;
|
||||||
|
use style::color::parsing::RgbaLegacy;
|
||||||
|
|
||||||
use crate::dom::bindings::codegen::Bindings::HTMLTableElementBinding::HTMLTableElementMethods;
|
use crate::dom::bindings::codegen::Bindings::HTMLTableElementBinding::HTMLTableElementMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::HTMLTableRowElementBinding::HTMLTableRowElementMethods;
|
use crate::dom::bindings::codegen::Bindings::HTMLTableRowElementBinding::HTMLTableRowElementMethods;
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use cssparser::RgbaLegacy;
|
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||||
use js::rust::HandleObject;
|
use js::rust::HandleObject;
|
||||||
use style::attr::AttrValue;
|
use style::attr::AttrValue;
|
||||||
|
use style::color::parsing::RgbaLegacy;
|
||||||
|
|
||||||
use crate::dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::HTMLTableSectionElementMethods;
|
use crate::dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::HTMLTableSectionElementMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
||||||
|
|
|
@ -3454,10 +3454,10 @@ impl UniqueId {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<LayoutNodeType> for NodeTypeId {
|
impl From<NodeTypeId> for LayoutNodeType {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn into(self) -> LayoutNodeType {
|
fn from(node_type: NodeTypeId) -> LayoutNodeType {
|
||||||
match self {
|
match node_type {
|
||||||
NodeTypeId::Element(e) => LayoutNodeType::Element(e.into()),
|
NodeTypeId::Element(e) => LayoutNodeType::Element(e.into()),
|
||||||
NodeTypeId::CharacterData(CharacterDataTypeId::Text(_)) => LayoutNodeType::Text,
|
NodeTypeId::CharacterData(CharacterDataTypeId::Text(_)) => LayoutNodeType::Text,
|
||||||
x => unreachable!("Layout should not traverse nodes of type {:?}", x),
|
x => unreachable!("Layout should not traverse nodes of type {:?}", x),
|
||||||
|
@ -3465,10 +3465,10 @@ impl Into<LayoutNodeType> for NodeTypeId {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<LayoutElementType> for ElementTypeId {
|
impl From<ElementTypeId> for LayoutElementType {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn into(self) -> LayoutElementType {
|
fn from(element_type: ElementTypeId) -> LayoutElementType {
|
||||||
match self {
|
match element_type {
|
||||||
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBodyElement) => {
|
ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLBodyElement) => {
|
||||||
LayoutElementType::HTMLBodyElement
|
LayoutElementType::HTMLBodyElement
|
||||||
},
|
},
|
||||||
|
|
|
@ -24,10 +24,7 @@ gl_enums! {
|
||||||
|
|
||||||
impl TexImageTarget {
|
impl TexImageTarget {
|
||||||
pub fn is_cubic(&self) -> bool {
|
pub fn is_cubic(&self) -> bool {
|
||||||
match *self {
|
!matches!(*self, TexImageTarget::Texture2D)
|
||||||
TexImageTarget::Texture2D => false,
|
|
||||||
_ => true,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn dimensions(self) -> u8 {
|
pub fn dimensions(self) -> u8 {
|
||||||
|
|
|
@ -2520,6 +2520,7 @@ impl Window {
|
||||||
|
|
||||||
impl Window {
|
impl Window {
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn new(
|
pub fn new(
|
||||||
runtime: Rc<Runtime>,
|
runtime: Rc<Runtime>,
|
||||||
script_chan: MainThreadScriptChan,
|
script_chan: MainThreadScriptChan,
|
||||||
|
|
|
@ -99,9 +99,9 @@ impl XRSystem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<SessionMode> for XRSessionMode {
|
impl From<XRSessionMode> for SessionMode {
|
||||||
fn into(self) -> SessionMode {
|
fn from(mode: XRSessionMode) -> SessionMode {
|
||||||
match self {
|
match mode {
|
||||||
XRSessionMode::Immersive_vr => SessionMode::ImmersiveVR,
|
XRSessionMode::Immersive_vr => SessionMode::ImmersiveVR,
|
||||||
XRSessionMode::Immersive_ar => SessionMode::ImmersiveAR,
|
XRSessionMode::Immersive_ar => SessionMode::ImmersiveAR,
|
||||||
XRSessionMode::Inline => SessionMode::Inline,
|
XRSessionMode::Inline => SessionMode::Inline,
|
||||||
|
|
|
@ -149,10 +149,7 @@ impl<'dom, LayoutDataType: LayoutDataTrait> ServoLayoutElement<'dom, LayoutDataT
|
||||||
fn is_root(&self) -> bool {
|
fn is_root(&self) -> bool {
|
||||||
match self.as_node().parent_node() {
|
match self.as_node().parent_node() {
|
||||||
None => false,
|
None => false,
|
||||||
Some(node) => match node.script_type_id() {
|
Some(node) => matches!(node.script_type_id(), NodeTypeId::Document(_)),
|
||||||
NodeTypeId::Document(_) => true,
|
|
||||||
_ => false,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -456,6 +453,21 @@ impl<'dom, LayoutDataType: LayoutDataTrait> style::dom::TElement
|
||||||
) -> euclid::default::Size2D<Option<app_units::Au>> {
|
) -> euclid::default::Size2D<Option<app_units::Au>> {
|
||||||
todo!();
|
todo!();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn has_selector_flags(&self, flags: ElementSelectorFlags) -> bool {
|
||||||
|
self.element.get_selector_flags().contains(flags)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn relative_selector_search_direction(&self) -> Option<ElementSelectorFlags> {
|
||||||
|
let flags = self.element.get_selector_flags().intersection(
|
||||||
|
ElementSelectorFlags::RELATIVE_SELECTOR_SEARCH_DIRECTION_ANCESTOR_SIBLING,
|
||||||
|
);
|
||||||
|
if flags.is_empty() {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(flags)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'dom, LayoutDataType: LayoutDataTrait> ::selectors::Element
|
impl<'dom, LayoutDataType: LayoutDataTrait> ::selectors::Element
|
||||||
|
@ -587,15 +599,11 @@ impl<'dom, LayoutDataType: LayoutDataTrait> ::selectors::Element
|
||||||
|
|
||||||
NonTSPseudoClass::Lang(ref lang) => self.match_element_lang(None, lang),
|
NonTSPseudoClass::Lang(ref lang) => self.match_element_lang(None, lang),
|
||||||
|
|
||||||
NonTSPseudoClass::ServoNonZeroBorder => {
|
NonTSPseudoClass::ServoNonZeroBorder => !matches!(
|
||||||
match self
|
self.element
|
||||||
.element
|
.get_attr_for_layout(&ns!(), &local_name!("border")),
|
||||||
.get_attr_for_layout(&ns!(), &local_name!("border"))
|
None | Some(&AttrValue::UInt(_, 0))
|
||||||
{
|
),
|
||||||
None | Some(&AttrValue::UInt(_, 0)) => false,
|
|
||||||
_ => true,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
NonTSPseudoClass::ReadOnly => !self
|
NonTSPseudoClass::ReadOnly => !self
|
||||||
.element
|
.element
|
||||||
.get_state_for_layout()
|
.get_state_for_layout()
|
||||||
|
|
|
@ -97,9 +97,6 @@ impl<'dom, LayoutDataType: LayoutDataTrait> ServoLayoutNode<'dom, LayoutDataType
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// # Safety
|
|
||||||
///
|
|
||||||
/// This function should not be called if there is no TrustedNodeAddress.
|
|
||||||
pub unsafe fn new(address: &TrustedNodeAddress) -> Self {
|
pub unsafe fn new(address: &TrustedNodeAddress) -> Self {
|
||||||
ServoLayoutNode::from_layout_js(LayoutDom::from_trusted_node_address(*address))
|
ServoLayoutNode::from_layout_js(LayoutDom::from_trusted_node_address(*address))
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,9 +71,6 @@ impl<'dom, LayoutDataType: LayoutDataTrait> ServoShadowRoot<'dom, LayoutDataType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # Safety
|
|
||||||
///
|
|
||||||
/// This function should not mutate StyleSharedRwLockReadGuard.
|
|
||||||
pub unsafe fn flush_stylesheets(
|
pub unsafe fn flush_stylesheets(
|
||||||
&self,
|
&self,
|
||||||
stylist: &mut Stylist,
|
stylist: &mut Stylist,
|
||||||
|
|
|
@ -16,7 +16,6 @@ xr-profile = ["webxr-api/profile", "time"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
crossbeam-channel = { workspace = true }
|
crossbeam-channel = { workspace = true }
|
||||||
cssparser = { workspace = true }
|
|
||||||
euclid = { workspace = true }
|
euclid = { workspace = true }
|
||||||
ipc-channel = { workspace = true }
|
ipc-channel = { workspace = true }
|
||||||
lazy_static = { workspace = true }
|
lazy_static = { workspace = true }
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use cssparser::RgbaLegacy;
|
|
||||||
use euclid::default::{Point2D, Rect, Size2D, Transform2D};
|
use euclid::default::{Point2D, Rect, Size2D, Transform2D};
|
||||||
use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender, IpcSender, IpcSharedMemory};
|
use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender, IpcSender, IpcSharedMemory};
|
||||||
use malloc_size_of_derive::MallocSizeOf;
|
use malloc_size_of_derive::MallocSizeOf;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_bytes::ByteBuf;
|
use serde_bytes::ByteBuf;
|
||||||
|
use style::color::parsing::RgbaLegacy;
|
||||||
use style::properties::style_structs::Font as FontStyleStruct;
|
use style::properties::style_structs::Font as FontStyleStruct;
|
||||||
use webrender_api::ImageKey;
|
use webrender_api::ImageKey;
|
||||||
|
|
||||||
|
|
|
@ -441,7 +441,6 @@ pub trait ThreadSafeLayoutElement<'dom>:
|
||||||
&style_pseudo,
|
&style_pseudo,
|
||||||
RuleInclusion::All,
|
RuleInclusion::All,
|
||||||
data.styles.primary(),
|
data.styles.primary(),
|
||||||
data.styles.primary(),
|
|
||||||
/* is_probe = */ false,
|
/* is_probe = */ false,
|
||||||
/* matching_func = */ None,
|
/* matching_func = */ None,
|
||||||
)
|
)
|
||||||
|
|
|
@ -21,9 +21,10 @@ fn srgb_legacy_from_floats(red: f32, green: f32, blue: f32, alpha: f32) -> Absol
|
||||||
// Color
|
// Color
|
||||||
#[test]
|
#[test]
|
||||||
fn test_rgba_color_interepolation_preserves_transparent() {
|
fn test_rgba_color_interepolation_preserves_transparent() {
|
||||||
|
let transparent = AbsoluteColor::TRANSPARENT_BLACK;
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
interpolate_color(AbsoluteColor::TRANSPARENT, AbsoluteColor::TRANSPARENT, 0.5),
|
interpolate_color(transparent, transparent, 0.5),
|
||||||
AbsoluteColor::TRANSPARENT
|
transparent
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,10 @@
|
||||||
|
|
||||||
use cssparser::{Parser, ParserInput};
|
use cssparser::{Parser, ParserInput};
|
||||||
use euclid::{Scale, Size2D};
|
use euclid::{Scale, Size2D};
|
||||||
use servo_arc::Arc;
|
|
||||||
use style::applicable_declarations::CascadePriority;
|
use style::applicable_declarations::CascadePriority;
|
||||||
use style::context::QuirksMode;
|
use style::context::QuirksMode;
|
||||||
use style::custom_properties::{
|
use style::custom_properties::{
|
||||||
CustomPropertiesBuilder, CustomPropertiesMap, Name, SpecifiedValue,
|
ComputedCustomProperties, CustomPropertiesBuilder, Name, SpecifiedValue,
|
||||||
};
|
};
|
||||||
use style::media_queries::{Device, MediaType};
|
use style::media_queries::{Device, MediaType};
|
||||||
use style::properties::{CustomDeclaration, CustomDeclarationValue};
|
use style::properties::{CustomDeclaration, CustomDeclarationValue};
|
||||||
|
@ -19,8 +18,8 @@ use test::{self, Bencher};
|
||||||
|
|
||||||
fn cascade(
|
fn cascade(
|
||||||
name_and_value: &[(&str, &str)],
|
name_and_value: &[(&str, &str)],
|
||||||
inherited: Option<&Arc<CustomPropertiesMap>>,
|
inherited: &ComputedCustomProperties,
|
||||||
) -> Option<Arc<CustomPropertiesMap>> {
|
) -> ComputedCustomProperties {
|
||||||
let declarations = name_and_value
|
let declarations = name_and_value
|
||||||
.iter()
|
.iter()
|
||||||
.map(|&(name, value)| {
|
.map(|&(name, value)| {
|
||||||
|
@ -39,7 +38,7 @@ fn cascade(
|
||||||
Scale::new(1.0),
|
Scale::new(1.0),
|
||||||
);
|
);
|
||||||
let stylist = Stylist::new(device, QuirksMode::NoQuirks);
|
let stylist = Stylist::new(device, QuirksMode::NoQuirks);
|
||||||
let mut builder = CustomPropertiesBuilder::new(inherited, &stylist);
|
let mut builder = CustomPropertiesBuilder::new(inherited, &stylist, false);
|
||||||
|
|
||||||
for declaration in &declarations {
|
for declaration in &declarations {
|
||||||
builder.cascade(
|
builder.cascade(
|
||||||
|
@ -54,11 +53,14 @@ fn cascade(
|
||||||
#[bench]
|
#[bench]
|
||||||
fn cascade_custom_simple(b: &mut Bencher) {
|
fn cascade_custom_simple(b: &mut Bencher) {
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
let parent = cascade(&[("foo", "10px"), ("bar", "100px")], None);
|
let parent = cascade(
|
||||||
|
&[("foo", "10px"), ("bar", "100px")],
|
||||||
|
&ComputedCustomProperties::default(),
|
||||||
|
);
|
||||||
|
|
||||||
test::black_box(cascade(
|
test::black_box(cascade(
|
||||||
&[("baz", "calc(40em + 4px)"), ("bazz", "calc(30em + 4px)")],
|
&[("baz", "calc(40em + 4px)"), ("bazz", "calc(30em + 4px)")],
|
||||||
parent.as_ref(),
|
&parent,
|
||||||
))
|
))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
[opacity-valid.html]
|
|
||||||
[e.style['opacity'\] = "clamp(50%, 0%, 70%)" should set the property value]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[e.style['opacity'\] = "clamp(50%, 80%, 70%)" should set the property value]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[e.style['opacity'\] = "min(50%, 0%)" should set the property value]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[e.style['opacity'\] = "max(0%, 50%)" should set the property value]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[rlh-in-monospace.html]
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[getComputedStyle-calc-mixed-units-002.html]
|
|
||||||
[testing width: calc(8lh + 7px)]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[lh-unit-001.html]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[lh-unit-002.html]
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[lh-unit-005.html]
|
|
||||||
[lh relative to line-height inherited from parent]
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[rlh-invalidation.html]
|
|
||||||
[CSS Values and Units Test: rlh invalidation]
|
|
||||||
expected: FAIL
|
|
|
@ -82,21 +82,3 @@
|
||||||
|
|
||||||
[widows: inherit]
|
[widows: inherit]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[content: attr( |bar )]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[content: attr(foo-bar, "fallback")]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[content: attr(foo_bar, "fallback")]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[content: attr(|bar, "fallback")]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[content: attr(foo, "")]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[content: attr( |foo , "" )]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
[parent-style-relative-units.html]
|
|
||||||
[Font-size based on canvas element line-height]
|
|
||||||
expected: FAIL
|
|
|
@ -1,12 +0,0 @@
|
||||||
[opacity-valid.html]
|
|
||||||
[e.style['opacity'\] = "clamp(50%, 0%, 70%)" should set the property value]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[e.style['opacity'\] = "clamp(50%, 80%, 70%)" should set the property value]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[e.style['opacity'\] = "min(50%, 0%)" should set the property value]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[e.style['opacity'\] = "max(0%, 50%)" should set the property value]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[rlh-in-monospace.html]
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[getComputedStyle-calc-mixed-units-002.html]
|
|
||||||
[testing width: calc(8lh + 7px)]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[lh-unit-001.html]
|
|
||||||
expected: FAIL
|
|
|
@ -1,2 +0,0 @@
|
||||||
[lh-unit-002.html]
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[lh-unit-005.html]
|
|
||||||
[lh relative to line-height inherited from parent]
|
|
||||||
expected: FAIL
|
|
|
@ -1,3 +0,0 @@
|
||||||
[rlh-invalidation.html]
|
|
||||||
[CSS Values and Units Test: rlh invalidation]
|
|
||||||
expected: FAIL
|
|
|
@ -148,21 +148,3 @@
|
||||||
|
|
||||||
[unicode-bidi: inherit]
|
[unicode-bidi: inherit]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[content: attr( |bar )]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[content: attr(foo-bar, "fallback")]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[content: attr(foo_bar, "fallback")]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[content: attr(|bar, "fallback")]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[content: attr(foo, "")]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[content: attr( |foo , "" )]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
[parent-style-relative-units.html]
|
|
||||||
[Font-size based on canvas element line-height]
|
|
||||||
expected: FAIL
|
|
Loading…
Add table
Add a link
Reference in a new issue