stylo: `accent-color` is Gecko-only, so the servo engine drops it
Generated from repros/stylo-accent-color-gecko-only/README.md when the site was built at 7aa23e2.
What niso does
Section titled “What niso does”No workaround yet. DECISIONS.md:46 requires accent-color as one of the CSS properties every native control
maps (and DECISIONS.md:31 maps the iOS tint/Material You palette through accent colors), but with servo-engine
stylo, which blitz uses, accent-color declarations are dropped at parse time, so niso cannot read a computed value.
Expected vs actual
Section titled “Expected vs actual”style/properties/longhands.toml:129-136 declares [accent-color] with engine = "gecko". The type
(ColorOrAuto) and struct (inherited_ui, which servo has: caret-color lives there too) are engine-neutral.
Parsing a style attribute under the servo engine:
expected: accent-color: red; caret-color: red;actual: caret-color: red;CARGO_TARGET_DIR=~/.capy/work/repro-target cargo runExit status 1 while the bug reproduces.
Upstream main
Section titled “Upstream main”Reproduces on servo/stylo main at 7f0189de128e6dbd2b504acd3aebee3befa78358 (same output; the
[accent-color] entry is unchanged, still engine = "gecko").
Existing issue or PR
Section titled “Existing issue or PR”None found for enabling it. Searched servo/stylo issues and PRs (all 513) and servo/servo (accent-color); the
only servo hit is https://github.com/servo/servo/issues/28690 (closed, an intermittent WPT failure in
accent-color-invalidation-currentcolor.html). Precedent for this kind of change:
https://github.com/servo/stylo/pull/413 (merged, “Enable scrollbar-color/scrollbar-width for the servo engine”).
Issue text
Section titled “Issue text”Title: Enable accent-color for the servo engine
Body:
accent-color is engine = "gecko" in style/properties/longhands.toml, so servo-engine stylo (Servo, Blitz)
drops accent-color declarations as unknown and has no computed value for it. Its type (ColorOrAuto) and
struct (inherited_ui) already exist under the servo engine, like caret-color.
// Cargo.toml: style = { package = "stylo", git = "https://github.com/servo/stylo", rev = "..." }, url = "2.5"use style::context::QuirksMode;use style::properties::parse_style_attribute;use style::stylesheets::{CssRuleType, UrlExtraData};
fn main() { let url = UrlExtraData::from(url::Url::parse("about:blank").unwrap()); let block = parse_style_attribute("accent-color: red; caret-color: red", &url, None, QuirksMode::NoQuirks, CssRuleType::Style); let mut css = String::new(); block.to_css(&mut css).unwrap(); assert_eq!(css, "accent-color: red; caret-color: red;"); // actual: "caret-color: red;"}Tested at 2dca34592ced37c6aa01733e94206a767194cf9d and main 7f0189de128e6dbd2b504acd3aebee3befa78358.
Suggested fix: drop engine = "gecko" from [accent-color] (as #413 did for scrollbar-color), plus whatever
servo-side glue the build needs (e.g. servo_restyle_damage = "repaint").