Make Servo compatible with Stylo with prefers-color-scheme support (#34423)

* Make Servo compatible with Stylo with prefer-color-scheme support

Signed-off-by: Nico Burns <nico@nicoburns.com>

Update imports to work with deduped version of stylo PR

Signed-off-by: Nico Burns <nico@nicoburns.com>

Switch back to stylo main branch

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Fix unit tests

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Update text expectations

Signed-off-by: Nico Burns <nico@nicoburns.com>

---------

Signed-off-by: Nico Burns <nico@nicoburns.com>
This commit is contained in:
Nico Burns 2024-11-30 02:48:28 +13:00 committed by GitHub
parent 19a7e95a6a
commit 2dbda69534
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 26 additions and 24 deletions

View file

@ -15,6 +15,7 @@ use style::font_metrics::FontMetrics;
use style::media_queries::{Device, MediaType};
use style::properties::style_structs::Font;
use style::properties::{ComputedValues, CustomDeclaration, CustomDeclarationValue, StyleBuilder};
use style::queries::values::PrefersColorScheme;
use style::rule_cache::RuleCacheConditions;
use style::rule_tree::CascadeLevel;
use style::servo::media_queries::FontMetricsProvider;
@ -72,6 +73,7 @@ fn cascade(
Scale::new(1.0),
Box::new(DummyMetricsProvider),
initial_style,
PrefersColorScheme::Light,
);
let stylist = Stylist::new(device, QuirksMode::NoQuirks);
let mut builder = StyleBuilder::new(stylist.device(), Some(&stylist), None, None, None, false);

View file

@ -14,6 +14,7 @@ use style::properties::style_structs::Font;
use style::properties::{
longhands, ComputedValues, Importance, PropertyDeclaration, PropertyDeclarationBlock,
};
use style::queries::values::PrefersColorScheme;
use style::rule_tree::StyleSource;
use style::selector_map::SelectorMap;
use style::selector_parser::{SelectorImpl, SelectorParser};
@ -256,6 +257,7 @@ fn mock_stylist() -> Stylist {
Scale::new(1.0),
Box::new(DummyMetricsProvider),
initial_style,
PrefersColorScheme::Light,
);
Stylist::new(device, QuirksMode::NoQuirks)
}

View file

@ -8,9 +8,6 @@
[Should be parseable in a CSS stylesheet: '(prefers-color-scheme)']
expected: FAIL
[Check that prefer-color-scheme evaluates to true in the boolean context]
expected: FAIL
[Should be parseable in a CSS stylesheet: '(prefers-color-scheme: dark)']
expected: FAIL
@ -19,12 +16,3 @@
[Should be parseable in JS: '(prefers-color-scheme: light)']
expected: FAIL
[Should be known: '(prefers-color-scheme)']
expected: FAIL
[Should be known: '(prefers-color-scheme: light)']
expected: FAIL
[Should be known: '(prefers-color-scheme: dark)']
expected: FAIL