Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions components/layout_thread/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ use style::logical_geometry::LogicalPoint;
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::servo::restyle_damage::ServoRestyleDamage;
Expand Down Expand Up @@ -591,6 +592,8 @@ impl LayoutThread {
Scale::new(window_size.device_pixel_ratio.get()),
Box::new(LayoutFontMetricsProvider),
ComputedValues::initial_values_with_font_override(font),
// TODO: obtain preferred color scheme from embedder
PrefersColorScheme::Light,
);

LayoutThread {
Expand Down Expand Up @@ -1414,6 +1417,8 @@ impl LayoutThread {
Scale::new(window_size_data.device_pixel_ratio.get()),
Box::new(LayoutFontMetricsProvider),
self.stylist.device().default_computed_values().to_arc(),
// TODO: obtain preferred color scheme from embedder
PrefersColorScheme::Light,
);

// Preserve any previously computed root font size.
Expand Down
5 changes: 5 additions & 0 deletions components/layout_thread_2020/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/style/custom_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/style/stylist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -256,6 +257,7 @@ fn mock_stylist() -> Stylist {
Scale::new(1.0),
Box::new(DummyMetricsProvider),
initial_style,
PrefersColorScheme::Light,
);
Stylist::new(device, QuirksMode::NoQuirks)
}
Expand Down
12 changes: 0 additions & 12 deletions tests/wpt/meta/css/mediaqueries/prefers-color-scheme.html.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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