From ed806afe525ea2fec86a90b107f2cb45c2a81533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 22 May 2023 00:51:12 +0200 Subject: [PATCH] style: Expose text selection foreground / background colors to chrome code Differential Revision: https://phabricator.services.mozilla.com/D117417 --- components/style/values/specified/color.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/components/style/values/specified/color.rs b/components/style/values/specified/color.rs index 85d8d613290..4016cd1d81e 100644 --- a/components/style/values/specified/color.rs +++ b/components/style/values/specified/color.rs @@ -196,13 +196,13 @@ pub enum SystemColor { TextBackground, #[css(skip)] TextForeground, - #[css(skip)] + #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")] TextSelectBackground, - #[css(skip)] + #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")] TextSelectForeground, - #[css(skip)] + #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")] TextSelectBackgroundDisabled, - #[css(skip)] + #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")] TextSelectBackgroundAttention, #[css(skip)] TextHighlightBackground, @@ -417,9 +417,15 @@ impl SystemColor { SystemColor::Activetext => prefs.mActiveLinkColor, SystemColor::Visitedtext => prefs.mVisitedLinkColor, - _ => unsafe { - bindings::Gecko_GetLookAndFeelSystemColor(*self as i32, cx.device().document(), scheme) - }, + _ => { + let color = unsafe { + bindings::Gecko_GetLookAndFeelSystemColor(*self as i32, cx.device().document(), scheme) + }; + if color == bindings::NS_SAME_AS_FOREGROUND_COLOR { + return ComputedColor::currentcolor(); + } + color + } }) } }