diff options
48 files changed, 97 insertions, 181 deletions
diff --git a/Cargo.lock b/Cargo.lock index e0ec55644df..f8f760cf785 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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", diff --git a/Cargo.toml b/Cargo.toml index 2237d87d746..295633a7a5d 100644 --- a/Cargo.toml +++ b/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" diff --git a/components/canvas/Cargo.toml b/components/canvas/Cargo.toml index ce420ae0c01..e9c6e0800d5 100644 --- a/components/canvas/Cargo.toml +++ b/components/canvas/Cargo.toml @@ -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 } diff --git a/components/canvas/canvas_data.rs b/components/canvas/canvas_data.rs index 451f0455e9a..4dc684bc324 100644 --- a/components/canvas/canvas_data.rs +++ b/components/canvas/canvas_data.rs @@ -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; diff --git a/components/canvas/raqote_backend.rs b/components/canvas/raqote_backend.rs index ae7266475af..16a1c5fa974 100644 --- a/components/canvas/raqote_backend.rs +++ b/components/canvas/raqote_backend.rs @@ -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::{ diff --git a/components/gfx/tests/font_context.rs b/components/gfx/tests/font_context.rs index bf4bcf2c58a..3447493399d 100644 --- a/components/gfx/tests/font_context.rs +++ b/components/gfx/tests/font_context.rs @@ -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(); diff --git a/components/layout/construct.rs b/components/layout/construct.rs index 2a615c944b3..35d414283f1 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -1527,7 +1527,6 @@ where }, // XXX: Non-None image types unimplemented. Image::ImageSet(..) | - Image::Rect(..) | Image::Gradient(..) | Image::PaintWorklet(..) | Image::CrossFade(..) | diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs index d3f19ea1537..fd248d4d4d3 100644 --- a/components/layout/display_list/builder.rs +++ b/components/layout/display_list/builder.rs @@ -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 {} - }, } } } diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs index d8ecda844eb..8e13c55be4e 100644 --- a/components/layout/table_row.rs +++ b/components/layout/table_row.rs @@ -771,7 +771,7 @@ impl CollapsedBorder { CollapsedBorder { style: BorderStyle::None, width: Au(0), - color: Color::TRANSPARENT, + color: Color::TRANSPARENT_BLACK, provenance: CollapsedBorderFrom::Table, } } diff --git a/components/layout/text.rs b/components/layout/text.rs index 4b62deeb7a3..6375f71f8e4 100644 --- a/components/layout/text.rs +++ b/components/layout/text.rs @@ -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), diff --git a/components/layout_2020/display_list/mod.rs b/components/layout_2020/display_list/mod.rs index c180fa06f44..d192eb8242a 100644 --- a/components/layout_2020/display_list/mod.rs +++ b/components/layout_2020/display_list/mod.rs @@ -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") }, diff --git a/components/layout_2020/flow/inline.rs b/components/layout_2020/flow/inline.rs index 1b27f394d14..8ea53e6017c 100644 --- a/components/layout_2020/flow/inline.rs +++ b/components/layout_2020/flow/inline.rs @@ -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, diff --git a/components/layout_2020/flow/line.rs b/components/layout_2020/flow/line.rs index f5f73aeb7ee..651de599856 100644 --- a/components/layout_2020/flow/line.rs +++ b/components/layout_2020/flow/line.rs @@ -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, diff --git a/components/layout_2020/lists.rs b/components/layout_2020/lists.rs index 1b337ac3555..6c71b5f34d0 100644 --- a/components/layout_2020/lists.rs +++ b/components/layout_2020/lists.rs @@ -39,7 +39,6 @@ where ]), // XXX: Non-None image types unimplemented. Image::ImageSet(..) | - Image::Rect(..) | Image::Gradient(..) | Image::CrossFade(..) | Image::PaintWorklet(..) | diff --git a/components/layout_2020/query.rs b/components/layout_2020/query.rs index 2702fe52117..48e052996ff 100644 --- a/components/layout_2020/query.rs +++ b/components/layout_2020/query.rs @@ -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(), diff --git a/components/script/canvas_state.rs b/components/script/canvas_state.rs index 2e2bff84c50..fd5acadf699 100644 --- a/components/script/canvas_state.rs +++ b/components/script/canvas_state.rs @@ -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; diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index f4e9b16d2f1..b0f3896d50b 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -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] diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs index 4dcbfe0b80f..c5ffbb701ba 100644 --- a/components/script/dom/htmlbodyelement.rs +++ b/components/script/dom/htmlbodyelement.rs @@ -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; diff --git a/components/script/dom/htmlfontelement.rs b/components/script/dom/htmlfontelement.rs index 1f8014f04dd..3a796d71c80 100644 --- a/components/script/dom/htmlfontelement.rs +++ b/components/script/dom/htmlfontelement.rs @@ -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; diff --git a/components/script/dom/htmlhrelement.rs b/components/script/dom/htmlhrelement.rs index 96ba4733735..2ce4def0d6a 100644 --- a/components/script/dom/htmlhrelement.rs +++ b/components/script/dom/htmlhrelement.rs @@ -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; diff --git a/components/script/dom/htmltablecellelement.rs b/components/script/dom/htmltablecellelement.rs index 2b4406feb95..3ce4c150e88 100644 --- a/components/script/dom/htmltablecellelement.rs +++ b/components/script/dom/htmltablecellelement.rs @@ -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; diff --git a/components/script/dom/htmltableelement.rs b/components/script/dom/htmltableelement.rs index 6063d582643..888c5bdb72f 100644 --- a/components/script/dom/htmltableelement.rs +++ b/components/script/dom/htmltableelement.rs @@ -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; diff --git a/components/script/dom/htmltablerowelement.rs b/components/script/dom/htmltablerowelement.rs index c400ac8011a..6f794a9b4e6 100644 --- a/components/script/dom/htmltablerowelement.rs +++ b/components/script/dom/htmltablerowelement.rs @@ -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; diff --git a/components/script/dom/htmltablesectionelement.rs b/components/script/dom/htmltablesectionelement.rs index 6dd042a0187..e0e8e9c643f 100644 --- a/components/script/dom/htmltablesectionelement.rs +++ b/components/script/dom/htmltablesectionelement.rs @@ -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; diff --git a/components/script/layout_dom/element.rs b/components/script/layout_dom/element.rs index 3404cf7ffc8..433369bbb89 100644 --- a/components/script/layout_dom/element.rs +++ b/components/script/layout_dom/element.rs @@ -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 diff --git a/components/shared/canvas/Cargo.toml b/components/shared/canvas/Cargo.toml index 6fd52f4e3a4..519b19d1a17 100644 --- a/components/shared/canvas/Cargo.toml +++ b/components/shared/canvas/Cargo.toml @@ -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 } diff --git a/components/shared/canvas/canvas.rs b/components/shared/canvas/canvas.rs index aaea3969bb8..a7224896e1a 100644 --- a/components/shared/canvas/canvas.rs +++ b/components/shared/canvas/canvas.rs @@ -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; diff --git a/components/shared/script_layout/wrapper_traits.rs b/components/shared/script_layout/wrapper_traits.rs index 2450159c6a4..57471e6cbd2 100644 --- a/components/shared/script_layout/wrapper_traits.rs +++ b/components/shared/script_layout/wrapper_traits.rs @@ -441,7 +441,6 @@ pub trait ThreadSafeLayoutElement<'dom>: &style_pseudo, RuleInclusion::All, data.styles.primary(), - data.styles.primary(), /* is_probe = */ false, /* matching_func = */ None, ) diff --git a/tests/unit/style/animated_properties.rs b/tests/unit/style/animated_properties.rs index d8e0abd68ed..174ba914c28 100644 --- a/tests/unit/style/animated_properties.rs +++ b/tests/unit/style/animated_properties.rs @@ -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 ); } diff --git a/tests/unit/style/custom_properties.rs b/tests/unit/style/custom_properties.rs index d41a1bb35aa..f1c62210218 100644 --- a/tests/unit/style/custom_properties.rs +++ b/tests/unit/style/custom_properties.rs @@ -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, )) }) } diff --git a/tests/wpt/meta-legacy-layout/css/css-color/parsing/opacity-valid.html.ini b/tests/wpt/meta-legacy-layout/css/css-color/parsing/opacity-valid.html.ini deleted file mode 100644 index 354f1c2bab3..00000000000 --- a/tests/wpt/meta-legacy-layout/css/css-color/parsing/opacity-valid.html.ini +++ /dev/null @@ -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 diff --git a/tests/wpt/meta-legacy-layout/css/css-fonts/rlh-in-monospace.html.ini b/tests/wpt/meta-legacy-layout/css/css-fonts/rlh-in-monospace.html.ini deleted file mode 100644 index d2d10d94d8a..00000000000 --- a/tests/wpt/meta-legacy-layout/css/css-fonts/rlh-in-monospace.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[rlh-in-monospace.html] - expected: FAIL diff --git a/tests/wpt/meta-legacy-layout/css/css-values/getComputedStyle-calc-mixed-units-002.html.ini b/tests/wpt/meta-legacy-layout/css/css-values/getComputedStyle-calc-mixed-units-002.html.ini deleted file mode 100644 index 5be031b9d28..00000000000 --- a/tests/wpt/meta-legacy-layout/css/css-values/getComputedStyle-calc-mixed-units-002.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[getComputedStyle-calc-mixed-units-002.html] - [testing width: calc(8lh + 7px)] - expected: FAIL diff --git a/tests/wpt/meta-legacy-layout/css/css-values/lh-unit-001.html.ini b/tests/wpt/meta-legacy-layout/css/css-values/lh-unit-001.html.ini deleted file mode 100644 index b53f95bdbb4..00000000000 --- a/tests/wpt/meta-legacy-layout/css/css-values/lh-unit-001.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[lh-unit-001.html] - expected: FAIL diff --git a/tests/wpt/meta-legacy-layout/css/css-values/lh-unit-002.html.ini b/tests/wpt/meta-legacy-layout/css/css-values/lh-unit-002.html.ini deleted file mode 100644 index bad542144c5..00000000000 --- a/tests/wpt/meta-legacy-layout/css/css-values/lh-unit-002.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[lh-unit-002.html] - expected: FAIL diff --git a/tests/wpt/meta-legacy-layout/css/css-values/lh-unit-005.html.ini b/tests/wpt/meta-legacy-layout/css/css-values/lh-unit-005.html.ini deleted file mode 100644 index e2cc94a5f11..00000000000 --- a/tests/wpt/meta-legacy-layout/css/css-values/lh-unit-005.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[lh-unit-005.html] - [lh relative to line-height inherited from parent] - expected: FAIL diff --git a/tests/wpt/meta-legacy-layout/css/css-values/rlh-invalidation.html.ini b/tests/wpt/meta-legacy-layout/css/css-values/rlh-invalidation.html.ini deleted file mode 100644 index c789d36e7f1..00000000000 --- a/tests/wpt/meta-legacy-layout/css/css-values/rlh-invalidation.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[rlh-invalidation.html] - [CSS Values and Units Test: rlh invalidation] - expected: FAIL diff --git a/tests/wpt/meta-legacy-layout/css/cssom/serialize-values.html.ini b/tests/wpt/meta-legacy-layout/css/cssom/serialize-values.html.ini index dedb5905d11..ad00a11fc8d 100644 --- a/tests/wpt/meta-legacy-layout/css/cssom/serialize-values.html.ini +++ b/tests/wpt/meta-legacy-layout/css/cssom/serialize-values.html.ini @@ -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 diff --git a/tests/wpt/meta-legacy-layout/html/canvas/element/text/parent-style-relative-units.html.ini b/tests/wpt/meta-legacy-layout/html/canvas/element/text/parent-style-relative-units.html.ini deleted file mode 100644 index 93b6a7e3452..00000000000 --- a/tests/wpt/meta-legacy-layout/html/canvas/element/text/parent-style-relative-units.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[parent-style-relative-units.html] - [Font-size based on canvas element line-height] - expected: FAIL diff --git a/tests/wpt/meta/css/css-color/parsing/opacity-valid.html.ini b/tests/wpt/meta/css/css-color/parsing/opacity-valid.html.ini deleted file mode 100644 index 354f1c2bab3..00000000000 --- a/tests/wpt/meta/css/css-color/parsing/opacity-valid.html.ini +++ /dev/null @@ -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 diff --git a/tests/wpt/meta/css/css-fonts/rlh-in-monospace.html.ini b/tests/wpt/meta/css/css-fonts/rlh-in-monospace.html.ini deleted file mode 100644 index d2d10d94d8a..00000000000 --- a/tests/wpt/meta/css/css-fonts/rlh-in-monospace.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[rlh-in-monospace.html] - expected: FAIL diff --git a/tests/wpt/meta/css/css-values/getComputedStyle-calc-mixed-units-002.html.ini b/tests/wpt/meta/css/css-values/getComputedStyle-calc-mixed-units-002.html.ini deleted file mode 100644 index 5be031b9d28..00000000000 --- a/tests/wpt/meta/css/css-values/getComputedStyle-calc-mixed-units-002.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[getComputedStyle-calc-mixed-units-002.html] - [testing width: calc(8lh + 7px)] - expected: FAIL diff --git a/tests/wpt/meta/css/css-values/lh-unit-001.html.ini b/tests/wpt/meta/css/css-values/lh-unit-001.html.ini deleted file mode 100644 index b53f95bdbb4..00000000000 --- a/tests/wpt/meta/css/css-values/lh-unit-001.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[lh-unit-001.html] - expected: FAIL diff --git a/tests/wpt/meta/css/css-values/lh-unit-002.html.ini b/tests/wpt/meta/css/css-values/lh-unit-002.html.ini deleted file mode 100644 index bad542144c5..00000000000 --- a/tests/wpt/meta/css/css-values/lh-unit-002.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[lh-unit-002.html] - expected: FAIL diff --git a/tests/wpt/meta/css/css-values/lh-unit-005.html.ini b/tests/wpt/meta/css/css-values/lh-unit-005.html.ini deleted file mode 100644 index e2cc94a5f11..00000000000 --- a/tests/wpt/meta/css/css-values/lh-unit-005.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[lh-unit-005.html] - [lh relative to line-height inherited from parent] - expected: FAIL diff --git a/tests/wpt/meta/css/css-values/rlh-invalidation.html.ini b/tests/wpt/meta/css/css-values/rlh-invalidation.html.ini deleted file mode 100644 index c789d36e7f1..00000000000 --- a/tests/wpt/meta/css/css-values/rlh-invalidation.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[rlh-invalidation.html] - [CSS Values and Units Test: rlh invalidation] - expected: FAIL diff --git a/tests/wpt/meta/css/cssom/serialize-values.html.ini b/tests/wpt/meta/css/cssom/serialize-values.html.ini index 72e9764f5f6..090ecf15c3b 100644 --- a/tests/wpt/meta/css/cssom/serialize-values.html.ini +++ b/tests/wpt/meta/css/cssom/serialize-values.html.ini @@ -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 diff --git a/tests/wpt/meta/html/canvas/element/text/parent-style-relative-units.html.ini b/tests/wpt/meta/html/canvas/element/text/parent-style-relative-units.html.ini deleted file mode 100644 index 93b6a7e3452..00000000000 --- a/tests/wpt/meta/html/canvas/element/text/parent-style-relative-units.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[parent-style-relative-units.html] - [Font-size based on canvas element line-height] - expected: FAIL |