mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Update Stylo to 2023-10-16 (#31932)
* Update Stylo to 2023-10-16 * Fixup for https://phabricator.services.mozilla.com/D185154 * Fixup for https://phabricator.services.mozilla.com/D188216 * Fixup for https://phabricator.services.mozilla.com/D185677 * Fixup for https://phabricator.services.mozilla.com/D188566 * Fixup for https://phabricator.services.mozilla.com/D188727 * Fixup for https://phabricator.services.mozilla.com/D189475 * Fixup for https://phabricator.services.mozilla.com/D189521 * Fixup for https://phabricator.services.mozilla.com/D188812 * Fixup for https://phabricator.services.mozilla.com/D189484 * Update test expectations
This commit is contained in:
parent
a7ad92d9a3
commit
fff9ef87e6
48 changed files with 97 additions and 181 deletions
46
Cargo.lock
generated
46
Cargo.lock
generated
|
@ -329,7 +329,7 @@ dependencies = [
|
|||
"bitflags 2.5.0",
|
||||
"cexpr",
|
||||
"clang-sys",
|
||||
"itertools 0.10.5",
|
||||
"itertools 0.12.1",
|
||||
"lazy_static",
|
||||
"lazycell",
|
||||
"log",
|
||||
|
@ -572,7 +572,6 @@ dependencies = [
|
|||
"byteorder",
|
||||
"canvas_traits",
|
||||
"crossbeam-channel",
|
||||
"cssparser",
|
||||
"euclid",
|
||||
"fnv",
|
||||
"font-kit",
|
||||
|
@ -603,7 +602,6 @@ name = "canvas_traits"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"crossbeam-channel",
|
||||
"cssparser",
|
||||
"euclid",
|
||||
"ipc-channel",
|
||||
"lazy_static",
|
||||
|
@ -1081,9 +1079,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cssparser"
|
||||
version = "0.32.0"
|
||||
version = "0.33.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2d54fe63cb80af11947c98a880393db44448d0b512f9b6c318398ae355794cb9"
|
||||
checksum = "9be934d936a0fbed5bcdc01042b770de1398bf79d0e192f49fa7faea0e99281e"
|
||||
dependencies = [
|
||||
"cssparser-macros",
|
||||
"dtoa-short",
|
||||
|
@ -1110,7 +1108,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "e16e44ab292b1dddfdaf7be62cfd8877df52f2f3fde5858d95bab606be259f20"
|
||||
dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"libloading 0.7.4",
|
||||
"libloading 0.8.3",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
|
@ -1200,7 +1198,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "derive_common"
|
||||
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 = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
|
@ -1306,7 +1304,7 @@ version = "0.5.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
|
||||
dependencies = [
|
||||
"libloading 0.7.4",
|
||||
"libloading 0.8.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3450,7 +3448,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "malloc_size_of"
|
||||
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 = [
|
||||
"accountable-refcell",
|
||||
"app_units",
|
||||
|
@ -5063,9 +5061,9 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "selectors"
|
||||
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 = [
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.5.0",
|
||||
"cssparser",
|
||||
"derive_more",
|
||||
"fxhash",
|
||||
|
@ -5351,7 +5349,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "servo_arc"
|
||||
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 = [
|
||||
"nodrop",
|
||||
"serde",
|
||||
|
@ -5361,7 +5359,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "servo_atoms"
|
||||
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 = [
|
||||
"string_cache",
|
||||
"string_cache_codegen",
|
||||
|
@ -5559,7 +5557,7 @@ checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d"
|
|||
[[package]]
|
||||
name = "size_of_test"
|
||||
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 = [
|
||||
"static_assertions",
|
||||
]
|
||||
|
@ -5685,7 +5683,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
|||
[[package]]
|
||||
name = "static_prefs"
|
||||
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]]
|
||||
name = "strict-num"
|
||||
|
@ -5722,12 +5720,12 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "style"
|
||||
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 = [
|
||||
"app_units",
|
||||
"arrayvec",
|
||||
"atomic_refcell",
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.5.0",
|
||||
"byteorder",
|
||||
"cssparser",
|
||||
"derive_more",
|
||||
|
@ -5781,7 +5779,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "style_config"
|
||||
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 = [
|
||||
"lazy_static",
|
||||
]
|
||||
|
@ -5789,7 +5787,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "style_derive"
|
||||
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 = [
|
||||
"darling",
|
||||
"derive_common",
|
||||
|
@ -5820,10 +5818,10 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "style_traits"
|
||||
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 = [
|
||||
"app_units",
|
||||
"bitflags 1.3.2",
|
||||
"bitflags 2.5.0",
|
||||
"cssparser",
|
||||
"euclid",
|
||||
"lazy_static",
|
||||
|
@ -6174,7 +6172,7 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|||
[[package]]
|
||||
name = "to_shmem"
|
||||
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 = [
|
||||
"cssparser",
|
||||
"servo_arc",
|
||||
|
@ -6187,7 +6185,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "to_shmem_derive"
|
||||
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 = [
|
||||
"darling",
|
||||
"derive_common",
|
||||
|
@ -7007,7 +7005,7 @@ dependencies = [
|
|||
"js-sys",
|
||||
"khronos-egl",
|
||||
"libc",
|
||||
"libloading 0.7.4",
|
||||
"libloading 0.8.3",
|
||||
"log",
|
||||
"metal 0.27.0",
|
||||
"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"] }
|
||||
cookie = "0.12"
|
||||
crossbeam-channel = "0.5"
|
||||
cssparser = "0.32"
|
||||
cssparser = { version = "0.33", features = ["serde"] }
|
||||
darling = { version = "0.20", default-features = false }
|
||||
data-url = "0.1.0"
|
||||
devtools_traits = { path = "components/shared/devtools" }
|
||||
|
@ -64,7 +64,7 @@ keyboard-types = "0.6"
|
|||
lazy_static = "1.4"
|
||||
libc = "0.2"
|
||||
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"
|
||||
mime = "0.3.13"
|
||||
mime_guess = "2.0.3"
|
||||
|
@ -87,31 +87,31 @@ rustls = { version = "0.21.10", features = ["dangerous_configuration"] }
|
|||
rustls-pemfile = "1.0.4"
|
||||
script_layout_interface = { path = "components/shared/script_layout" }
|
||||
script_traits = { path = "components/shared/script" }
|
||||
selectors = { git = "https://github.com/servo/stylo", branch = "2023-09-01" }
|
||||
selectors = { git = "https://github.com/servo/stylo", branch = "2023-10-16" }
|
||||
serde = "1.0.197"
|
||||
serde_bytes = "0.11"
|
||||
serde_json = "1.0"
|
||||
servo-media = { git = "https://github.com/servo/media" }
|
||||
servo-media-dummy = { git = "https://github.com/servo/media" }
|
||||
servo-media-gstreamer = { git = "https://github.com/servo/media" }
|
||||
servo_arc = { git = "https://github.com/servo/stylo", branch = "2023-09-01" }
|
||||
servo_atoms = { git = "https://github.com/servo/stylo", branch = "2023-09-01" }
|
||||
size_of_test = { 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-10-16" }
|
||||
size_of_test = { git = "https://github.com/servo/stylo", branch = "2023-10-16" }
|
||||
smallbitvec = "2.5.3"
|
||||
smallvec = "1.13"
|
||||
sparkle = "0.1.26"
|
||||
string_cache = "0.8"
|
||||
string_cache_codegen = "0.5"
|
||||
style = { git = "https://github.com/servo/stylo", branch = "2023-09-01", features = ["servo"] }
|
||||
style_config = { git = "https://github.com/servo/stylo", branch = "2023-09-01" }
|
||||
style_traits = { 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-10-16" }
|
||||
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!
|
||||
surfman = { version = "0.9", features = ["chains", "sm-angle", "sm-angle-default"] }
|
||||
syn = { version = "2", default-features = false, features = ["clone-impls", "derive", "parsing"] }
|
||||
synstructure = "0.13"
|
||||
thin-vec = "0.2.13"
|
||||
time = "0.1.41"
|
||||
to_shmem = { git = "https://github.com/servo/stylo", branch = "2023-09-01" }
|
||||
to_shmem = { git = "https://github.com/servo/stylo", branch = "2023-10-16" }
|
||||
tokio = "1"
|
||||
tokio-rustls = "0.24"
|
||||
tungstenite = "0.20"
|
||||
|
|
|
@ -20,7 +20,6 @@ bitflags = { workspace = true }
|
|||
byteorder = { workspace = true }
|
||||
canvas_traits = { workspace = true }
|
||||
crossbeam-channel = { workspace = true }
|
||||
cssparser = { workspace = true }
|
||||
euclid = { workspace = true }
|
||||
font-kit = "0.11"
|
||||
fnv = { workspace = true }
|
||||
|
|
|
@ -7,7 +7,6 @@ use std::mem;
|
|||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use canvas_traits::canvas::*;
|
||||
use cssparser::RgbaLegacy;
|
||||
use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D};
|
||||
use euclid::{point2, vec2};
|
||||
use font_kit::family_name::FamilyName;
|
||||
|
@ -22,6 +21,7 @@ use ipc_channel::ipc::{IpcSender, IpcSharedMemory};
|
|||
use log::{debug, error, warn};
|
||||
use num_traits::ToPrimitive;
|
||||
use servo_arc::Arc as ServoArc;
|
||||
use style::color::parsing::RgbaLegacy;
|
||||
use style::properties::style_structs::Font as FontStyleStruct;
|
||||
use style::values::computed::font;
|
||||
use style_traits::values::ToCss;
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use canvas_traits::canvas::*;
|
||||
use cssparser::RgbaLegacy;
|
||||
use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D};
|
||||
use euclid::Angle;
|
||||
use font_kit::font::Font;
|
||||
use log::warn;
|
||||
use lyon_geom::Arc;
|
||||
use raqote::PathOp;
|
||||
use style::color::parsing::RgbaLegacy;
|
||||
|
||||
use crate::canvas_data;
|
||||
use crate::canvas_data::{
|
||||
|
|
|
@ -26,6 +26,7 @@ use style::values::computed::font::{
|
|||
FontWeight, SingleFontFamily,
|
||||
};
|
||||
use style::values::computed::{FontLanguageOverride, XLang};
|
||||
use style::values::generics::font::LineHeight;
|
||||
use webrender_api::{FontInstanceKey, FontKey, IdNamespace};
|
||||
|
||||
struct TestFontSource {
|
||||
|
@ -112,6 +113,7 @@ fn style() -> FontStyleStruct {
|
|||
font_stretch: FontStretch::hundred(),
|
||||
hash: 0,
|
||||
font_language_override: FontLanguageOverride::normal(),
|
||||
line_height: LineHeight::Normal,
|
||||
_x_lang: XLang::get_initial_value(),
|
||||
};
|
||||
style.compute_font_hash();
|
||||
|
|
|
@ -1527,7 +1527,6 @@ where
|
|||
},
|
||||
// XXX: Non-None image types unimplemented.
|
||||
Image::ImageSet(..) |
|
||||
Image::Rect(..) |
|
||||
Image::Gradient(..) |
|
||||
Image::PaintWorklet(..) |
|
||||
Image::CrossFade(..) |
|
||||
|
|
|
@ -796,10 +796,6 @@ impl Fragment {
|
|||
Image::CrossFade(..) | Image::ImageSet(..) => {
|
||||
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 {
|
||||
style: BorderStyle::None,
|
||||
width: Au(0),
|
||||
color: Color::TRANSPARENT,
|
||||
color: Color::TRANSPARENT_BLACK,
|
||||
provenance: CollapsedBorderFrom::Table,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ use style::computed_values::word_break::T as WordBreak;
|
|||
use style::logical_geometry::{LogicalSize, WritingMode};
|
||||
use style::properties::style_structs::Font as FontStyleStruct;
|
||||
use style::properties::ComputedValues;
|
||||
use style::values::generics::text::LineHeight;
|
||||
use style::values::generics::font::LineHeight;
|
||||
use style::values::specified::text::{TextTransform, TextTransformCase};
|
||||
use unicode_bidi as bidi;
|
||||
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.
|
||||
pub fn line_height_from_style(style: &ComputedValues, metrics: &FontMetrics) -> Au {
|
||||
let font_size = style.get_font().font_size.computed_size();
|
||||
match style.get_inherited_text().line_height {
|
||||
let font = style.get_font();
|
||||
let font_size = font.font_size.computed_size();
|
||||
match font.line_height {
|
||||
LineHeight::Normal => metrics.line_gap,
|
||||
LineHeight::Number(l) => Au::from(font_size * l.0),
|
||||
LineHeight::Length(l) => Au::from(l),
|
||||
|
|
|
@ -777,8 +777,6 @@ impl<'a> BuilderForBoxFragment<'a> {
|
|||
Image::PaintWorklet(_) => {
|
||||
// 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(..) => {
|
||||
unreachable!("Shouldn't be parsed on Servo for now")
|
||||
},
|
||||
|
|
|
@ -84,7 +84,7 @@ use style::logical_geometry::WritingMode;
|
|||
use style::properties::ComputedValues;
|
||||
use style::values::computed::Length;
|
||||
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::{TextAlignLast, TextJustify};
|
||||
use style::Zero;
|
||||
|
@ -1829,7 +1829,7 @@ impl InlineContainerState {
|
|||
// when `line-height` is normal.
|
||||
let mut ascent = font_metrics.ascent;
|
||||
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 =
|
||||
(font_metrics.line_gap - descent - ascent).scale_by(0.5);
|
||||
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
|
||||
// considering with other zero line height boxes that converge on other block axis
|
||||
// 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 =
|
||||
(Au::from_f32_px(line_height.px()) - (ascent + descent)).scale_by(0.5);
|
||||
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 {
|
||||
let font_size = parent_style.get_font().font_size.computed_size();
|
||||
match parent_style.get_inherited_text().line_height {
|
||||
let font = parent_style.get_font();
|
||||
let font_size = font.font_size.computed_size();
|
||||
match font.line_height {
|
||||
LineHeight::Normal => Length::from(font_metrics.line_gap),
|
||||
LineHeight::Number(number) => font_size * number.0,
|
||||
LineHeight::Length(length) => length.0,
|
||||
|
|
|
@ -12,7 +12,7 @@ use servo_arc::Arc;
|
|||
use style::properties::ComputedValues;
|
||||
use style::values::computed::Length;
|
||||
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::text::TextDecorationLine;
|
||||
use style::Zero;
|
||||
|
@ -581,8 +581,9 @@ impl FloatLineItem {
|
|||
}
|
||||
|
||||
fn line_height(parent_style: &ComputedValues, font_metrics: &FontMetrics) -> Length {
|
||||
let font_size = parent_style.get_font().font_size.computed_size();
|
||||
match parent_style.get_inherited_text().line_height {
|
||||
let font = parent_style.get_font();
|
||||
let font_size = font.font_size.computed_size();
|
||||
match font.line_height {
|
||||
LineHeight::Normal => Length::from(font_metrics.line_gap),
|
||||
LineHeight::Number(number) => font_size * number.0,
|
||||
LineHeight::Length(length) => length.0,
|
||||
|
|
|
@ -39,7 +39,6 @@ where
|
|||
]),
|
||||
// XXX: Non-None image types unimplemented.
|
||||
Image::ImageSet(..) |
|
||||
Image::Rect(..) |
|
||||
Image::Gradient(..) |
|
||||
Image::CrossFade(..) |
|
||||
Image::PaintWorklet(..) |
|
||||
|
|
|
@ -29,7 +29,7 @@ use style::shared_lock::SharedRwLock;
|
|||
use style::stylesheets::{CssRuleType, Origin, UrlExtraData};
|
||||
use style::stylist::RuleInclusion;
|
||||
use style::traversal::resolve_style;
|
||||
use style::values::generics::text::LineHeight;
|
||||
use style::values::generics::font::LineHeight;
|
||||
use style_traits::{ParsingMode, ToCss};
|
||||
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
|
||||
// is "normal" and the used value otherwise.
|
||||
if longhand_id == LonghandId::LineHeight {
|
||||
let font_size = style.get_font().font_size.computed_size();
|
||||
return match style.get_inherited_text().line_height {
|
||||
let font = style.get_font();
|
||||
let font_size = font.font_size.computed_size();
|
||||
return match font.line_height {
|
||||
LineHeight::Normal => computed_style(),
|
||||
LineHeight::Number(value) => (font_size * 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,
|
||||
RepetitionStyle, TextAlign, TextBaseline,
|
||||
};
|
||||
use cssparser::{Parser, ParserInput, RgbaLegacy};
|
||||
use cssparser::{Parser, ParserInput};
|
||||
use euclid::default::{Point2D, Rect, Size2D, Transform2D};
|
||||
use euclid::vec2;
|
||||
use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory};
|
||||
|
@ -22,6 +22,7 @@ use pixels::PixelFormat;
|
|||
use profile_traits::ipc as profiled_ipc;
|
||||
use script_traits::ScriptMsg;
|
||||
use servo_url::{ImmutableOrigin, ServoUrl};
|
||||
use style::color::parsing::RgbaLegacy;
|
||||
use style::color::{AbsoluteColor, ColorSpace};
|
||||
use style::context::QuirksMode;
|
||||
use style::parser::ParserContext;
|
||||
|
|
|
@ -628,7 +628,7 @@ pub trait LayoutElementHelpers<'dom> {
|
|||
fn get_lang_for_layout(self) -> String;
|
||||
fn get_state_for_layout(self) -> ElementState;
|
||||
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.
|
||||
fn get_shadow_root_for_layout(self) -> Option<LayoutDom<'dom, ShadowRoot>>;
|
||||
fn get_attr_for_layout(
|
||||
|
@ -708,7 +708,7 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
|
|||
};
|
||||
|
||||
if let Some(color) = bgcolor {
|
||||
use cssparser::FromParsedColor;
|
||||
use style::color::parsing::FromParsedColor;
|
||||
hints.push(from_declaration(
|
||||
shared_lock,
|
||||
PropertyDeclaration::BackgroundColor(specified::Color::from_rgba(
|
||||
|
@ -748,7 +748,7 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
|
|||
};
|
||||
|
||||
if let Some(color) = color {
|
||||
use cssparser::FromParsedColor;
|
||||
use style::color::parsing::FromParsedColor;
|
||||
hints.push(from_declaration(
|
||||
shared_lock,
|
||||
PropertyDeclaration::Color(longhands::color::SpecifiedValue(
|
||||
|
@ -1108,8 +1108,8 @@ impl<'dom> LayoutElementHelpers<'dom> for LayoutDom<'dom, Element> {
|
|||
|
||||
#[inline]
|
||||
#[allow(unsafe_code)]
|
||||
fn has_selector_flags(self, flags: ElementSelectorFlags) -> bool {
|
||||
unsafe { (self.unsafe_get()).selector_flags.get().contains(flags) }
|
||||
fn get_selector_flags(self) -> ElementSelectorFlags {
|
||||
unsafe { self.unsafe_get().selector_flags.get() }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
* 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/. */
|
||||
|
||||
use cssparser::RgbaLegacy;
|
||||
use dom_struct::dom_struct;
|
||||
use embedder_traits::EmbedderMsg;
|
||||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||
use js::rust::HandleObject;
|
||||
use servo_url::ServoUrl;
|
||||
use style::attr::AttrValue;
|
||||
use style::color::parsing::RgbaLegacy;
|
||||
|
||||
use crate::dom::attr::Attr;
|
||||
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
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use cssparser::RgbaLegacy;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||
use js::rust::HandleObject;
|
||||
use servo_atoms::Atom;
|
||||
use style::attr::AttrValue;
|
||||
use style::color::parsing::RgbaLegacy;
|
||||
use style::str::{read_numbers, HTML_SPACE_CHARACTERS};
|
||||
|
||||
use crate::dom::attr::Attr;
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
* 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/. */
|
||||
|
||||
use cssparser::RgbaLegacy;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||
use js::rust::HandleObject;
|
||||
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
|
||||
use style::color::parsing::RgbaLegacy;
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::HTMLHRElementBinding::HTMLHRElementMethods;
|
||||
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
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use cssparser::RgbaLegacy;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||
use js::rust::HandleObject;
|
||||
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
|
||||
use style::color::parsing::RgbaLegacy;
|
||||
use style::context::QuirksMode;
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::HTMLTableCellElementBinding::HTMLTableCellElementMethods;
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
use std::cell::Cell;
|
||||
|
||||
use cssparser::RgbaLegacy;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||
use js::rust::HandleObject;
|
||||
use style::attr::{parse_unsigned_integer, AttrValue, LengthOrPercentageOrAuto};
|
||||
use style::color::parsing::RgbaLegacy;
|
||||
|
||||
use crate::dom::attr::Attr;
|
||||
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
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use cssparser::RgbaLegacy;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||
use js::rust::HandleObject;
|
||||
use style::attr::AttrValue;
|
||||
use style::color::parsing::RgbaLegacy;
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::HTMLTableElementBinding::HTMLTableElementMethods;
|
||||
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
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use cssparser::RgbaLegacy;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever::{local_name, namespace_url, ns, LocalName, Prefix};
|
||||
use js::rust::HandleObject;
|
||||
use style::attr::AttrValue;
|
||||
use style::color::parsing::RgbaLegacy;
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::HTMLTableSectionElementBinding::HTMLTableSectionElementMethods;
|
||||
use crate::dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
|
||||
|
|
|
@ -453,6 +453,21 @@ impl<'dom, LayoutDataType: LayoutDataTrait> style::dom::TElement
|
|||
) -> euclid::default::Size2D<Option<app_units::Au>> {
|
||||
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
|
||||
|
|
|
@ -16,7 +16,6 @@ xr-profile = ["webxr-api/profile", "time"]
|
|||
|
||||
[dependencies]
|
||||
crossbeam-channel = { workspace = true }
|
||||
cssparser = { workspace = true }
|
||||
euclid = { workspace = true }
|
||||
ipc-channel = { workspace = true }
|
||||
lazy_static = { workspace = true }
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
use std::default::Default;
|
||||
use std::str::FromStr;
|
||||
|
||||
use cssparser::RgbaLegacy;
|
||||
use euclid::default::{Point2D, Rect, Size2D, Transform2D};
|
||||
use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender, IpcSender, IpcSharedMemory};
|
||||
use malloc_size_of_derive::MallocSizeOf;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_bytes::ByteBuf;
|
||||
use style::color::parsing::RgbaLegacy;
|
||||
use style::properties::style_structs::Font as FontStyleStruct;
|
||||
use webrender_api::ImageKey;
|
||||
|
||||
|
|
|
@ -441,7 +441,6 @@ pub trait ThreadSafeLayoutElement<'dom>:
|
|||
&style_pseudo,
|
||||
RuleInclusion::All,
|
||||
data.styles.primary(),
|
||||
data.styles.primary(),
|
||||
/* is_probe = */ false,
|
||||
/* matching_func = */ None,
|
||||
)
|
||||
|
|
|
@ -21,9 +21,10 @@ fn srgb_legacy_from_floats(red: f32, green: f32, blue: f32, alpha: f32) -> Absol
|
|||
// Color
|
||||
#[test]
|
||||
fn test_rgba_color_interepolation_preserves_transparent() {
|
||||
let transparent = AbsoluteColor::TRANSPARENT_BLACK;
|
||||
assert_eq!(
|
||||
interpolate_color(AbsoluteColor::TRANSPARENT, AbsoluteColor::TRANSPARENT, 0.5),
|
||||
AbsoluteColor::TRANSPARENT
|
||||
interpolate_color(transparent, transparent, 0.5),
|
||||
transparent
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,11 +4,10 @@
|
|||
|
||||
use cssparser::{Parser, ParserInput};
|
||||
use euclid::{Scale, Size2D};
|
||||
use servo_arc::Arc;
|
||||
use style::applicable_declarations::CascadePriority;
|
||||
use style::context::QuirksMode;
|
||||
use style::custom_properties::{
|
||||
CustomPropertiesBuilder, CustomPropertiesMap, Name, SpecifiedValue,
|
||||
ComputedCustomProperties, CustomPropertiesBuilder, Name, SpecifiedValue,
|
||||
};
|
||||
use style::media_queries::{Device, MediaType};
|
||||
use style::properties::{CustomDeclaration, CustomDeclarationValue};
|
||||
|
@ -19,8 +18,8 @@ use test::{self, Bencher};
|
|||
|
||||
fn cascade(
|
||||
name_and_value: &[(&str, &str)],
|
||||
inherited: Option<&Arc<CustomPropertiesMap>>,
|
||||
) -> Option<Arc<CustomPropertiesMap>> {
|
||||
inherited: &ComputedCustomProperties,
|
||||
) -> ComputedCustomProperties {
|
||||
let declarations = name_and_value
|
||||
.iter()
|
||||
.map(|&(name, value)| {
|
||||
|
@ -39,7 +38,7 @@ fn cascade(
|
|||
Scale::new(1.0),
|
||||
);
|
||||
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 {
|
||||
builder.cascade(
|
||||
|
@ -54,11 +53,14 @@ fn cascade(
|
|||
#[bench]
|
||||
fn cascade_custom_simple(b: &mut Bencher) {
|
||||
b.iter(|| {
|
||||
let parent = cascade(&[("foo", "10px"), ("bar", "100px")], None);
|
||||
let parent = cascade(
|
||||
&[("foo", "10px"), ("bar", "100px")],
|
||||
&ComputedCustomProperties::default(),
|
||||
);
|
||||
|
||||
test::black_box(cascade(
|
||||
&[("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]
|
||||
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]
|
||||
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