diff --git a/browser/themes/shared/urlbar-searchbar.inc.css b/browser/themes/shared/urlbar-searchbar.inc.css index a70ce006fcc5..a69a0fe0c58d 100644 --- a/browser/themes/shared/urlbar-searchbar.inc.css +++ b/browser/themes/shared/urlbar-searchbar.inc.css @@ -136,7 +136,7 @@ #urlbar-input:not(:focus):-moz-lwtheme::selection, .searchbar-textbox:not(:focus-within):-moz-lwtheme::selection { - background-color: var(--lwt-toolbar-field-highlight, text-select-background-disabled); + background-color: var(--lwt-toolbar-field-highlight, text-select-disabled-background); } #urlbar:not([focused="true"]) { diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index 396b4aadb9ce..1ef135d225ff 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -439,9 +439,9 @@ DeviceColor nsDisplaySelectionOverlay::ComputeColor() const { if (mSelectionValue == nsISelectionController::SELECTION_ON) { colorID = LookAndFeel::ColorID::Highlight; } else if (mSelectionValue == nsISelectionController::SELECTION_ATTENTION) { - colorID = LookAndFeel::ColorID::TextSelectBackgroundAttention; + colorID = LookAndFeel::ColorID::TextSelectAttentionBackground; } else { - colorID = LookAndFeel::ColorID::TextSelectBackgroundDisabled; + colorID = LookAndFeel::ColorID::TextSelectDisabledBackground; } return ApplyTransparencyIfNecessary( diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index f83ea5e2d3c1..30dd90140922 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -4129,13 +4129,18 @@ bool nsTextPaintStyle::InitSelectionColorsAndShadow() { return true; } + mSelectionTextColor = + LookAndFeel::Color(LookAndFeel::ColorID::Highlighttext, mFrame); + nscolor selectionBGColor = LookAndFeel::Color(LookAndFeel::ColorID::Highlight, mFrame); switch (selectionStatus) { case nsISelectionController::SELECTION_ATTENTION: { + mSelectionTextColor = LookAndFeel::Color( + LookAndFeel::ColorID::TextSelectAttentionForeground, mFrame); mSelectionBGColor = LookAndFeel::Color( - LookAndFeel::ColorID::TextSelectBackgroundAttention, mFrame); + LookAndFeel::ColorID::TextSelectAttentionBackground, mFrame); mSelectionBGColor = EnsureDifferentColors(mSelectionBGColor, selectionBGColor); break; @@ -4146,16 +4151,13 @@ bool nsTextPaintStyle::InitSelectionColorsAndShadow() { } default: { mSelectionBGColor = LookAndFeel::Color( - LookAndFeel::ColorID::TextSelectBackgroundDisabled, mFrame); + LookAndFeel::ColorID::TextSelectDisabledBackground, mFrame); mSelectionBGColor = EnsureDifferentColors(mSelectionBGColor, selectionBGColor); break; } } - mSelectionTextColor = - LookAndFeel::Color(LookAndFeel::ColorID::Highlighttext, mFrame); - if (mResolveColors) { EnsureSufficientContrast(&mSelectionTextColor, &mSelectionBGColor); } diff --git a/layout/style/test/test_non_content_accessible_values.html b/layout/style/test/test_non_content_accessible_values.html index 0f794307ddba..5409c7e2874e 100644 --- a/layout/style/test/test_non_content_accessible_values.html +++ b/layout/style/test/test_non_content_accessible_values.html @@ -13,10 +13,9 @@ const NON_CONTENT_ACCESSIBLE_VALUES = { "-moz-colheaderhovertext", "-moz-colheadertext", "-moz-nativevisitedhyperlinktext", - "text-select-foreground", - "text-select-background", - "text-select-background-disabled", - "text-select-background-attention", + "text-select-disabled-background", + "text-select-attention-background", + "text-select-attention-foreground", "-moz-autofill-background", ], "display": [ diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 217b13dcd375..b7bddb6d50f5 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -702,11 +702,14 @@ pref("accessibility.browsewithcaret_shortcut.enabled", true); // These are some selection-related colors which have no per platform // implementation. #if !defined(XP_MACOSX) -pref("ui.textSelectBackgroundDisabled", "#b0b0b0"); +pref("ui.textSelectDisabledBackground", "#b0b0b0"); #endif + // This makes the selection stand out when typeaheadfind is on. // Used with nsISelectionController::SELECTION_ATTENTION -pref("ui.textSelectBackgroundAttention", "#38d878"); +pref("ui.textSelectAttentionBackground", "#38d878"); +pref("ui.textSelectAttentionForeground", "#ffffff"); + // This makes the matched text stand out when findbar highlighting is on. // Used with nsISelectionController::SELECTION_FIND pref("ui.textHighlightBackground", "#ef0fff"); diff --git a/servo/components/style/values/specified/color.rs b/servo/components/style/values/specified/color.rs index e649b54bc068..1010970458aa 100644 --- a/servo/components/style/values/specified/color.rs +++ b/servo/components/style/values/specified/color.rs @@ -216,9 +216,11 @@ pub enum Color { #[repr(u8)] pub enum SystemColor { #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")] - TextSelectBackgroundDisabled, - #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")] - TextSelectBackgroundAttention, + TextSelectDisabledBackground, + #[css(skip)] + TextSelectAttentionBackground, + #[css(skip)] + TextSelectAttentionForeground, #[css(skip)] TextHighlightBackground, #[css(skip)] diff --git a/widget/WidgetMessageUtils.h b/widget/WidgetMessageUtils.h index 091e6dabcd16..b4f917d91bab 100644 --- a/widget/WidgetMessageUtils.h +++ b/widget/WidgetMessageUtils.h @@ -34,12 +34,12 @@ template <> struct ParamTraits : ContiguousEnumSerializer< mozilla::LookAndFeel::ColorID, - mozilla::LookAndFeel::ColorID::TextSelectBackgroundDisabled, + mozilla::LookAndFeel::ColorID::TextSelectDisabledBackground, mozilla::LookAndFeel::ColorID::End> { using IdType = std::underlying_type_t; static_assert( static_cast( - mozilla::LookAndFeel::ColorID::TextSelectBackgroundDisabled) == + mozilla::LookAndFeel::ColorID::TextSelectDisabledBackground) == IdType(0)); }; diff --git a/widget/cocoa/nsLookAndFeel.mm b/widget/cocoa/nsLookAndFeel.mm index cd870e511ce0..41aa8ac6a806 100644 --- a/widget/cocoa/nsLookAndFeel.mm +++ b/widget/cocoa/nsLookAndFeel.mm @@ -124,7 +124,7 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme, nscolor break; // This is used to gray out the selection when it's not focused. Used with // nsISelectionController::SELECTION_DISABLED. - case ColorID::TextSelectBackgroundDisabled: + case ColorID::TextSelectDisabledBackground: color = ProcessSelectionBackground(GetColorFromNSColor(NSColor.secondarySelectedControlColor), aScheme); break; diff --git a/widget/headless/HeadlessLookAndFeelGTK.cpp b/widget/headless/HeadlessLookAndFeelGTK.cpp index ea7d669b1d75..0246850794bc 100644 --- a/widget/headless/HeadlessLookAndFeelGTK.cpp +++ b/widget/headless/HeadlessLookAndFeelGTK.cpp @@ -70,10 +70,7 @@ nsresult HeadlessLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme, case ColorID::TextHighlightForeground: aColor = NS_RGB(0xff, 0xff, 0xff); break; - case ColorID::TextSelectBackgroundAttention: - aColor = NS_TRANSPARENT; - break; - case ColorID::TextSelectBackgroundDisabled: + case ColorID::TextSelectDisabledBackground: aColor = NS_RGB(0xaa, 0xaa, 0xaa); break; case ColorID::Highlight: diff --git a/widget/nsXPLookAndFeel.cpp b/widget/nsXPLookAndFeel.cpp index 0d5d7a5f60ba..cf0967fc5e34 100644 --- a/widget/nsXPLookAndFeel.cpp +++ b/widget/nsXPLookAndFeel.cpp @@ -199,8 +199,9 @@ static_assert(ArrayLength(sFloatPrefs) == size_t(LookAndFeel::FloatID::End), // This array MUST be kept in the same order as the color list in // specified/color.rs static const char sColorPrefs[][41] = { - "ui.textSelectBackgroundDisabled", - "ui.textSelectBackgroundAttention", + "ui.textSelectDisabledBackground", + "ui.textSelectAttentionBackground", + "ui.textSelectAttentionForeground", "ui.textHighlightBackground", "ui.textHighlightForeground", "ui.IMERawInputBackground", @@ -1180,8 +1181,9 @@ static bool ColorIsCSSAccessible(LookAndFeel::ColorID aId) { using ColorID = LookAndFeel::ColorID; switch (aId) { - case ColorID::TextSelectBackgroundDisabled: - case ColorID::TextSelectBackgroundAttention: + case ColorID::TextSelectDisabledBackground: + case ColorID::TextSelectAttentionBackground: + case ColorID::TextSelectAttentionForeground: case ColorID::TextHighlightBackground: case ColorID::TextHighlightForeground: case ColorID::ThemedScrollbar: