diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /servo/components/style/gecko/media_features.rs | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'servo/components/style/gecko/media_features.rs')
-rw-r--r-- | servo/components/style/gecko/media_features.rs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/servo/components/style/gecko/media_features.rs b/servo/components/style/gecko/media_features.rs index 8de45d95c2..df1c5e464b 100644 --- a/servo/components/style/gecko/media_features.rs +++ b/servo/components/style/gecko/media_features.rs @@ -8,13 +8,14 @@ use crate::gecko_bindings::bindings; use crate::gecko_bindings::structs; use crate::gecko_bindings::structs::ScreenColorGamut; use crate::media_queries::{Device, MediaType}; -use crate::queries::condition::KleeneValue; +use crate::parser::ParserContext; use crate::queries::feature::{AllowsRanges, Evaluator, FeatureFlags, QueryFeatureDescription}; use crate::queries::values::Orientation; use crate::values::computed::{CSSPixelLength, Context, Ratio, Resolution}; use crate::values::AtomString; use app_units::Au; use euclid::default::Size2D; +use selectors::kleene_value::KleeneValue; fn device_size(device: &Device) -> Size2D<Au> { let mut width = 0; @@ -286,16 +287,26 @@ fn eval_prefers_contrast(context: &Context, query_value: Option<PrefersContrast> pub enum ForcedColors { /// Page colors are not being forced. None, + /// Page colors would be forced in content. + #[parse(condition = "ParserContext::chrome_rules_enabled")] + Requested, /// Page colors are being forced. Active, } +impl ForcedColors { + /// Returns whether forced-colors is active for this page. + pub fn is_active(self) -> bool { + matches!(self, Self::Active) + } +} + /// https://drafts.csswg.org/mediaqueries-5/#forced-colors fn eval_forced_colors(context: &Context, query_value: Option<ForcedColors>) -> bool { - let forced = !context.device().use_document_colors(); + let forced = context.device().forced_colors(); match query_value { - Some(query_value) => forced == (query_value == ForcedColors::Active), - None => forced, + Some(query_value) => query_value == forced, + None => forced != ForcedColors::None, } } |