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

@ -73,6 +73,7 @@ use style::invalidation::element::restyle_hints::RestyleHint;
use style::media_queries::{Device, MediaList, MediaType};
use style::properties::style_structs::Font;
use style::properties::{ComputedValues, PropertyId};
use style::queries::values::PrefersColorScheme;
use style::selector_parser::{PseudoElement, SnapshotMap};
use style::servo::media_queries::FontMetricsProvider;
use style::shared_lock::{SharedRwLock, SharedRwLockReadGuard, StylesheetGuards};
@ -570,6 +571,8 @@ impl LayoutThread {
Scale::new(window_size.device_pixel_ratio.get()),
Box::new(LayoutFontMetricsProvider(font_context.clone())),
ComputedValues::initial_values_with_font_override(font),
// TODO: obtain preferred color scheme from embedder
PrefersColorScheme::Light,
);
LayoutThread {
@ -1121,6 +1124,8 @@ impl LayoutThread {
Scale::new(window_size_data.device_pixel_ratio.get()),
Box::new(LayoutFontMetricsProvider(self.font_context.clone())),
self.stylist.device().default_computed_values().to_arc(),
// TODO: obtain preferred color scheme from embedder
PrefersColorScheme::Light,
);
// Preserve any previously computed root font size.