Bug 1693222 - Implement SelectedItem and SelectedItemText system colors. r=mstange

Since Highlight / HighlightText are now equivalent to the text selection
ones, remove those too.

Differential Revision: https://phabricator.services.mozilla.com/D123964
This commit is contained in:
Emilio Cobos Álvarez 2021-09-01 18:21:57 +00:00
Родитель ee0689e5fb
Коммит c3eb845bbf
33 изменённых файлов: 98 добавлений и 122 удалений

Просмотреть файл

@ -67,8 +67,8 @@
} }
.contentSearchSuggestionRow.selected { .contentSearchSuggestionRow.selected {
background-color: Highlight; background-color: SelectedItem;
color: HighlightText; color: SelectedItemText;
} }
.contentSearchHeader, .contentSearchHeader,
@ -132,7 +132,7 @@
} }
.contentSearchOneOffItem.selected { .contentSearchOneOffItem.selected {
background-color: Highlight; background-color: SelectedItem;
background-image: none; background-image: none;
} }

Просмотреть файл

@ -11,7 +11,7 @@
@media (-moz-windows-default-theme: 0) { @media (-moz-windows-default-theme: 0) {
xul|richlistitem[originaltype="autofill-profile"][selected="true"] > .autofill-item-box { xul|richlistitem[originaltype="autofill-profile"][selected="true"] > .autofill-item-box {
background-color: Highlight; background-color: SelectedItem;
} }
.autofill-item-box { .autofill-item-box {

Просмотреть файл

@ -98,8 +98,8 @@ menuitem.bookmark-item {
/* Bookmark drag and drop styles */ /* Bookmark drag and drop styles */
.bookmark-item[dragover-into="true"] { .bookmark-item[dragover-into="true"] {
background: Highlight !important; background: SelectedItem !important;
color: HighlightText !important; color: SelectedItemText !important;
} }
.bookmark-item[cutting] > .toolbarbutton-icon, .bookmark-item[cutting] > .toolbarbutton-icon,
@ -202,8 +202,8 @@ menuitem.bookmark-item {
:root:not(:-moz-lwtheme) { :root:not(:-moz-lwtheme) {
--urlbar-popup-action-color: -moz-nativehyperlinktext; --urlbar-popup-action-color: -moz-nativehyperlinktext;
--autocomplete-popup-highlight-background: Highlight; --autocomplete-popup-highlight-background: SelectedItem;
--autocomplete-popup-highlight-color: HighlightText; --autocomplete-popup-highlight-color: SelectedItemText;
} }
/* Translation infobar */ /* Translation infobar */

Просмотреть файл

@ -16,8 +16,8 @@
} }
#viewGroup > radio[selected="true"] { #viewGroup > radio[selected="true"] {
background-color: Highlight; background-color: SelectedItem;
color: HighlightText; color: SelectedItemText;
} }
#viewGroup > radio > .radio-label-box { #viewGroup > radio > .radio-label-box {

Просмотреть файл

@ -437,8 +437,8 @@ moz-input-box > menupopup .context-menu-add-engine > .menu-iconic-left {
/* Bookmark drag and drop styles */ /* Bookmark drag and drop styles */
.bookmark-item[dragover-into="true"] { .bookmark-item[dragover-into="true"] {
background: Highlight !important; background: SelectedItem !important;
color: HighlightText !important; color: SelectedItemText !important;
} }
/* Translation */ /* Translation */

Просмотреть файл

@ -38,8 +38,8 @@
} }
.autocomplete-richlistitem[selected] { .autocomplete-richlistitem[selected] {
background-color: Highlight; background-color: SelectedItem;
color: HighlightText; color: SelectedItemText;
} }
/* Autocomplete richlistitem support for a two-line label display */ /* Autocomplete richlistitem support for a two-line label display */
@ -100,7 +100,7 @@
#PopupAutoComplete > richlistbox > richlistitem[originaltype="importableLogins"][selected] > .two-line-wrapper > .ac-site-icon, #PopupAutoComplete > richlistbox > richlistitem[originaltype="importableLogins"][selected] > .two-line-wrapper > .ac-site-icon,
#PopupAutoComplete > richlistbox > richlistitem[originaltype="loginWithOrigin"][selected] > .two-line-wrapper > .ac-site-icon, #PopupAutoComplete > richlistbox > richlistitem[originaltype="loginWithOrigin"][selected] > .two-line-wrapper > .ac-site-icon,
#PopupAutoComplete > richlistbox > richlistitem[originaltype="login"] > .ac-site-icon[selected] { #PopupAutoComplete > richlistbox > richlistitem[originaltype="login"] > .ac-site-icon[selected] {
fill: HighlightText; fill: SelectedItemText;
} }
/* Login form autocompletion with origin showing and generated passwords */ /* Login form autocompletion with origin showing and generated passwords */

Просмотреть файл

@ -256,7 +256,7 @@ menupopup::part(drop-indicator) {
list-style-image: none; list-style-image: none;
height: 2px; height: 2px;
margin-inline-end: -4em; margin-inline-end: -4em;
background-color: Highlight; background-color: SelectedItem;
pointer-events: none; pointer-events: none;
} }

Просмотреть файл

@ -78,7 +78,7 @@ treechildren::-moz-tree-cell-text(title, separator) {
} }
treechildren::-moz-tree-cell-text(title, separator, selected, focus) { treechildren::-moz-tree-cell-text(title, separator, selected, focus) {
color: HighlightText; color: SelectedItemText;
} }
/* Remove tiny spacing in separators appearing after the twisty column */ /* Remove tiny spacing in separators appearing after the twisty column */

Просмотреть файл

@ -55,7 +55,7 @@
} }
#engineList treechildren::-moz-tree-drop-feedback { #engineList treechildren::-moz-tree-drop-feedback {
background-color: Highlight; background-color: SelectedItem;
width: 10000px; /* 100% doesn't work; 10k is hopefully larger than any window width: 10000px; /* 100% doesn't work; 10k is hopefully larger than any window
we may have, overflow isn't visible. */ we may have, overflow isn't visible. */
height: 2px; height: 2px;

Просмотреть файл

@ -77,8 +77,8 @@ body {
} }
.item.selected:focus > .item-title-container { .item.selected:focus > .item-title-container {
background-color: Highlight; background-color: SelectedItem;
color: HighlightText; color: SelectedItemText;
} }
.item.client .item-twisty-container { .item.client .item-twisty-container {

Просмотреть файл

@ -70,7 +70,7 @@
} }
#tabbrowser-arrowscrollbox[highlight]::part(scrollbutton-down) { #tabbrowser-arrowscrollbox[highlight]::part(scrollbutton-down) {
background-color: Highlight; background-color: SelectedItem;
} }
toolbar .toolbarbutton-1 { toolbar .toolbarbutton-1 {

Просмотреть файл

@ -109,8 +109,8 @@
#urlbar-input:-moz-lwtheme::selection, #urlbar-input:-moz-lwtheme::selection,
.searchbar-textbox:-moz-lwtheme::selection { .searchbar-textbox:-moz-lwtheme::selection {
background-color: var(--lwt-toolbar-field-highlight, -moz-system-color(text-select-background, light)); background-color: var(--lwt-toolbar-field-highlight, -moz-system-color(Highlight, light));
color: var(--lwt-toolbar-field-highlight-text, -moz-system-color(text-select-foreground, light)); color: var(--lwt-toolbar-field-highlight-text, -moz-system-color(HighlightText, light));
} }
#urlbar-input:not(:focus):-moz-lwtheme::selection, #urlbar-input:not(:focus):-moz-lwtheme::selection,
@ -120,14 +120,14 @@
:root[lwt-toolbar-field-focus-brighttext] #urlbar-input:focus::selection, :root[lwt-toolbar-field-focus-brighttext] #urlbar-input:focus::selection,
:root[lwt-toolbar-field-focus-brighttext] .searchbar-textbox:focus-within::selection { :root[lwt-toolbar-field-focus-brighttext] .searchbar-textbox:focus-within::selection {
background-color: var(--lwt-toolbar-field-highlight, -moz-system-color(text-select-background, dark)); background-color: var(--lwt-toolbar-field-highlight, -moz-system-color(Highlight, dark));
color: var(--lwt-toolbar-field-highlight-text, -moz-system-color(text-select-foreground, dark)); color: var(--lwt-toolbar-field-highlight-text, -moz-system-color(HighlightText, dark));
} }
:root[lwt-toolbar-field-brighttext] #urlbar-input:not(:focus)::selection, :root[lwt-toolbar-field-brighttext] #urlbar-input:not(:focus)::selection,
:root[lwt-toolbar-field-brighttext] .searchbar-textbox:not(:focus-within)::selection { :root[lwt-toolbar-field-brighttext] .searchbar-textbox:not(:focus-within)::selection {
background-color: var(--lwt-toolbar-field-highlight, -moz-system-color(text-select-background-disabled, dark)); background-color: var(--lwt-toolbar-field-highlight, -moz-system-color(text-select-background-disabled, dark));
color: var(--lwt-toolbar-field-highlight-text, -moz-system-color(text-select-foreground, dark)); color: var(--lwt-toolbar-field-highlight-text, -moz-system-color(HighlightText, dark));
} }
#urlbar:not([focused="true"]) { #urlbar:not([focused="true"]) {
@ -310,9 +310,9 @@
/* Use system colors for low/high contrast mode */ /* Use system colors for low/high contrast mode */
@media (prefers-contrast) { @media (prefers-contrast) {
#urlbar-search-mode-indicator { #urlbar-search-mode-indicator {
background-color: Highlight; background-color: SelectedItem;
outline-color: Highlight; outline-color: SelectedItem;
color: HighlightText; color: SelectedItemText;
} }
#urlbar-search-mode-indicator-close { #urlbar-search-mode-indicator-close {

Просмотреть файл

@ -14,8 +14,8 @@
:root { :root {
--autocomplete-popup-background: var(--arrowpanel-background); --autocomplete-popup-background: var(--arrowpanel-background);
--autocomplete-popup-color: var(--arrowpanel-color); --autocomplete-popup-color: var(--arrowpanel-color);
--autocomplete-popup-highlight-background: Highlight; --autocomplete-popup-highlight-background: SelectedItem;
--autocomplete-popup-highlight-color: HighlightText; --autocomplete-popup-highlight-color: SelectedItemText;
--urlbar-popup-action-color: hsl(178, 100%, 28%); --urlbar-popup-action-color: hsl(178, 100%, 28%);

Просмотреть файл

@ -222,8 +222,8 @@
stroke: ButtonText; stroke: ButtonText;
} }
.titlebar-button:hover { .titlebar-button:hover {
background-color: Highlight; background-color: SelectedItem;
stroke: HighlightText; stroke: SelectedItemText;
} }
.titlebar-min { .titlebar-min {

Просмотреть файл

@ -531,8 +531,8 @@ menuitem.bookmark-item {
toolbarbutton.bookmark-item[dragover="true"][open="true"] { toolbarbutton.bookmark-item[dragover="true"][open="true"] {
appearance: none; appearance: none;
background: Highlight !important; background: SelectedItem !important;
color: HighlightText !important; color: SelectedItemText !important;
} }
/* Translation infobar */ /* Translation infobar */

Просмотреть файл

@ -10,11 +10,11 @@
--organizer-pane-background: -moz-Dialog; --organizer-pane-background: -moz-Dialog;
--organizer-content-background: -moz-Dialog; --organizer-content-background: -moz-Dialog;
--organizer-hover-background: Highlight; --organizer-hover-background: SelectedItem;
--organizer-hover-color: HighlightText; --organizer-hover-color: SelectedItemText;
--organizer-selected-background: Highlight; --organizer-selected-background: SelectedItem;
--organizer-selected-color: HighlightText; --organizer-selected-color: SelectedItemText;
--organizer-outline-color: Highlight; --organizer-outline-color: SelectedItem;
--organizer-separator-color: ThreeDDarkShadow; --organizer-separator-color: ThreeDDarkShadow;
--organizer-border-color: ThreeDShadow; --organizer-border-color: ThreeDShadow;

Просмотреть файл

@ -22,8 +22,8 @@
--minimize-button-active-background-color: hsla(0,0%,70%,.6); --minimize-button-active-background-color: hsla(0,0%,70%,.6);
--control-icon-unchecked-hover-background-color: hsla(0,0%,70%,.2); --control-icon-unchecked-hover-background-color: hsla(0,0%,70%,.2);
--control-icon-unchecked-active-background-color: hsla(0,0%,70%,.6); --control-icon-unchecked-active-background-color: hsla(0,0%,70%,.6);
--control-icon-checked-background-color: Highlight; --control-icon-checked-background-color: SelectedItem;
--control-icon-checked-icon-fill: HighlightText; --control-icon-checked-icon-fill: SelectedItemText;
--control-icon-checked-hover-background-color: hsla(0,0%,70%,.2); --control-icon-checked-hover-background-color: hsla(0,0%,70%,.2);
--control-icon-checked-active-background-color: hsla(0,0%,70%,.6); --control-icon-checked-active-background-color: hsla(0,0%,70%,.6);
} }

Просмотреть файл

@ -434,7 +434,7 @@ DeviceColor nsDisplaySelectionOverlay::ComputeColor() const {
return ComputeColorFromSelectionStyle(*style); return ComputeColorFromSelectionStyle(*style);
} }
if (mSelectionValue == nsISelectionController::SELECTION_ON) { if (mSelectionValue == nsISelectionController::SELECTION_ON) {
colorID = LookAndFeel::ColorID::TextSelectBackground; colorID = LookAndFeel::ColorID::Highlight;
} else if (mSelectionValue == nsISelectionController::SELECTION_ATTENTION) { } else if (mSelectionValue == nsISelectionController::SELECTION_ATTENTION) {
colorID = LookAndFeel::ColorID::TextSelectBackgroundAttention; colorID = LookAndFeel::ColorID::TextSelectBackgroundAttention;
} else { } else {

Просмотреть файл

@ -4061,9 +4061,9 @@ void nsTextPaintStyle::InitCommonColors() {
nscolor defaultWindowBackgroundColor = nscolor defaultWindowBackgroundColor =
LookAndFeel::Color(LookAndFeel::ColorID::WindowBackground, mFrame); LookAndFeel::Color(LookAndFeel::ColorID::WindowBackground, mFrame);
nscolor selectionTextColor = nscolor selectionTextColor =
LookAndFeel::Color(LookAndFeel::ColorID::TextSelectForeground, mFrame); LookAndFeel::Color(LookAndFeel::ColorID::Highlighttext, mFrame);
nscolor selectionBGColor = nscolor selectionBGColor =
LookAndFeel::Color(LookAndFeel::ColorID::TextSelectBackground, mFrame); LookAndFeel::Color(LookAndFeel::ColorID::Highlight, mFrame);
mSufficientContrast = std::min( mSufficientContrast = std::min(
std::min(NS_SUFFICIENT_LUMINOSITY_DIFFERENCE, std::min(NS_SUFFICIENT_LUMINOSITY_DIFFERENCE,
@ -4111,7 +4111,7 @@ bool nsTextPaintStyle::InitSelectionColorsAndShadow() {
} }
nscolor selectionBGColor = nscolor selectionBGColor =
LookAndFeel::Color(LookAndFeel::ColorID::TextSelectBackground, mFrame); LookAndFeel::Color(LookAndFeel::ColorID::Highlight, mFrame);
switch (selectionStatus) { switch (selectionStatus) {
case nsISelectionController::SELECTION_ATTENTION: { case nsISelectionController::SELECTION_ATTENTION: {
@ -4135,7 +4135,7 @@ bool nsTextPaintStyle::InitSelectionColorsAndShadow() {
} }
mSelectionTextColor = mSelectionTextColor =
LookAndFeel::Color(LookAndFeel::ColorID::TextSelectForeground, mFrame); LookAndFeel::Color(LookAndFeel::ColorID::Highlighttext, mFrame);
if (mResolveColors) { if (mResolveColors) {
// On MacOS X, only the background color gets set, // On MacOS X, only the background color gets set,

Просмотреть файл

@ -1699,8 +1699,7 @@ void nsDisplayMathMLSelectionRect::Paint(nsDisplayListBuilder* aBuilder,
mFrame->PresContext()->AppUnitsPerDevPixel(), mFrame->PresContext()->AppUnitsPerDevPixel(),
*drawTarget); *drawTarget);
// get color to use for selection from the look&feel object // get color to use for selection from the look&feel object
nscolor bgColor = nscolor bgColor = LookAndFeel::Color(LookAndFeel::ColorID::Highlight, mFrame);
LookAndFeel::Color(LookAndFeel::ColorID::TextSelectBackground, mFrame);
drawTarget->FillRect(rect, ColorPattern(ToDeviceColor(bgColor))); drawTarget->FillRect(rect, ColorPattern(ToDeviceColor(bgColor)));
} }
@ -1857,8 +1856,8 @@ void nsMathMLChar::PaintForeground(nsIFrame* aForFrame,
&nsStyleText::mWebkitTextFillColor); &nsStyleText::mWebkitTextFillColor);
if (aIsSelected) { if (aIsSelected) {
// get color to use for selection from the look&feel object // get color to use for selection from the look&feel object
fgColor = LookAndFeel::Color(LookAndFeel::ColorID::TextSelectForeground, fgColor = LookAndFeel::Color(LookAndFeel::ColorID::Highlighttext, aForFrame,
aForFrame, fgColor); fgColor);
} }
aRenderingContext.SetColor(sRGBColor::FromABGR(fgColor)); aRenderingContext.SetColor(sRGBColor::FromABGR(fgColor));
aRenderingContext.Save(); aRenderingContext.Save();

Просмотреть файл

@ -351,14 +351,13 @@ select > option {
} }
option:checked { option:checked {
background-color: -moz-html-cellhighlight !important; background-color: text-select-background-disabled !important;
color: -moz-html-cellhighlighttext !important; color: SelectedItemText !important;
} }
select:focus > option:checked, select:focus > option:checked,
select:focus > optgroup > option:checked { select:focus > optgroup > option:checked {
background-color: Highlight !important; background-color: SelectedItem !important;
color: HighlightText !important;
} }
optgroup { optgroup {

Просмотреть файл

@ -263,8 +263,7 @@ void nsTableCellFrame::DecorateForSelection(DrawTarget* aDrawTarget,
if (displaySelection == nsISelectionController::SELECTION_DISABLED) { if (displaySelection == nsISelectionController::SELECTION_DISABLED) {
bordercolor = NS_RGB(176, 176, 176); // disabled color bordercolor = NS_RGB(176, 176, 176); // disabled color
} else { } else {
bordercolor = LookAndFeel::Color( bordercolor = LookAndFeel::Color(LookAndFeel::ColorID::Highlight, this);
LookAndFeel::ColorID::TextSelectBackground, this);
} }
nscoord threePx = nsPresContext::CSSPixelsToAppUnits(3); nscoord threePx = nsPresContext::CSSPixelsToAppUnits(3);
if ((mRect.width > threePx) && (mRect.height > threePx)) { if ((mRect.width > threePx) && (mRect.height > threePx)) {

Просмотреть файл

@ -244,10 +244,6 @@ pub enum SystemColor {
#[css(skip)] #[css(skip)]
TextForeground, TextForeground,
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")] #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
TextSelectBackground,
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
TextSelectForeground,
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
TextSelectBackgroundDisabled, TextSelectBackgroundDisabled,
#[parse(condition = "ParserContext::in_ua_or_chrome_sheet")] #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")]
TextSelectBackgroundAttention, TextSelectBackgroundAttention,
@ -339,9 +335,11 @@ pub enum SystemColor {
/// Used for selected but not focused cell text. /// Used for selected but not focused cell text.
MozCellhighlighttext, MozCellhighlighttext,
/// Used for selected but not focused html cell backgrounds. /// Used for selected but not focused html cell backgrounds.
MozHtmlCellhighlight, #[parse(aliases = "-moz-html-cellhighlight")]
Selecteditem,
/// Used for selected but not focused html cell text. /// Used for selected but not focused html cell text.
MozHtmlCellhighlighttext, #[parse(aliases = "-moz-html-cellhighlighttext")]
Selecteditemtext,
/// Used to button text background when hovered. /// Used to button text background when hovered.
MozButtonhoverface, MozButtonhoverface,
/// Used to button text color when hovered. /// Used to button text color when hovered.

Просмотреть файл

@ -23,6 +23,8 @@ test_valid_value("color", "Highlight", "highlight");
test_valid_value("color", "HighlightText", "highlighttext"); test_valid_value("color", "HighlightText", "highlighttext");
test_valid_value("color", "LinkText", "linktext"); test_valid_value("color", "LinkText", "linktext");
test_valid_value("color", "VisitedText", "visitedtext"); test_valid_value("color", "VisitedText", "visitedtext");
test_valid_value("color", "SelectedItem", "selecteditem");
test_valid_value("color", "SelectedItemText", "selecteditemtext");
</script> </script>
</body> </body>
</html> </html>

Просмотреть файл

@ -75,8 +75,8 @@ html|input.findbar-textbox:focus {
} }
html|input.findbar-textbox:-moz-lwtheme::selection { html|input.findbar-textbox:-moz-lwtheme::selection {
background-color: var(--lwt-toolbar-field-highlight, -moz-system-color(text-select-background, light)); background-color: var(--lwt-toolbar-field-highlight, -moz-system-color(Higlight, light));
color: var(--lwt-toolbar-field-highlight-text, -moz-system-color(text-select-foreground, light)); color: var(--lwt-toolbar-field-highlight-text, -moz-system-color(HighlightText, light));
} }
html|input.findbar-textbox:not(:focus):-moz-lwtheme::selection { html|input.findbar-textbox:not(:focus):-moz-lwtheme::selection {
@ -84,13 +84,13 @@ html|input.findbar-textbox:not(:focus):-moz-lwtheme::selection {
} }
:root[lwt-toolbar-field-focus-brighttext] html|input.findbar-textbox:focus::selection { :root[lwt-toolbar-field-focus-brighttext] html|input.findbar-textbox:focus::selection {
background-color: var(--lwt-toolbar-field-highlight, -moz-system-color(text-select-background, dark)); background-color: var(--lwt-toolbar-field-highlight, -moz-system-color(Higlight, dark));
color: var(--lwt-toolbar-field-highlight-text, -moz-system-color(text-select-foreground, dark)); color: var(--lwt-toolbar-field-highlight-text, -moz-system-color(HighlightText, dark));
} }
:root[lwt-toolbar-field-brighttext] html|input.findbar-textbox:not(:focus)::selection { :root[lwt-toolbar-field-brighttext] html|input.findbar-textbox:not(:focus)::selection {
background-color: var(--lwt-toolbar-field-highlight, -moz-system-color(text-select-background-disabled, dark)); background-color: var(--lwt-toolbar-field-highlight, -moz-system-color(text-select-background-disabled, dark));
color: var(--lwt-toolbar-field-highlight-text, -moz-system-color(text-select-foreground, dark)); color: var(--lwt-toolbar-field-highlight-text, -moz-system-color(HighlightText, dark));
} }

Просмотреть файл

@ -103,7 +103,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aColorScheme,
switch (aID) { switch (aID) {
// These colors don't seem to be used for anything anymore in Mozilla // These colors don't seem to be used for anything anymore in Mozilla
// (except here at least TextSelectBackground and TextSelectForeground)
// The CSS2 colors below are used. // The CSS2 colors below are used.
case ColorID::WindowForeground: case ColorID::WindowForeground:
aColor = mSystemColors.textColorPrimary; aColor = mSystemColors.textColorPrimary;
@ -122,7 +121,7 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aColorScheme,
// not used? // not used?
aColor = mSystemColors.textColorPrimary; aColor = mSystemColors.textColorPrimary;
break; break;
case ColorID::TextSelectBackground: { case ColorID::Highlight: {
// Matched to action_accent in java codebase. This works fine with both // Matched to action_accent in java codebase. This works fine with both
// light and dark color scheme. // light and dark color scheme.
nscolor accent = nscolor accent =
@ -131,7 +130,7 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aColorScheme,
NS_RGBA(NS_GET_R(accent), NS_GET_G(accent), NS_GET_B(accent), 153); NS_RGBA(NS_GET_R(accent), NS_GET_G(accent), NS_GET_B(accent), 153);
break; break;
} }
case ColorID::TextSelectForeground: case ColorID::Highlighttext:
// Selection background is transparent enough that any foreground color // Selection background is transparent enough that any foreground color
// does. // does.
aColor = NS_SAME_AS_FOREGROUND_COLOR; aColor = NS_SAME_AS_FOREGROUND_COLOR;
@ -179,15 +178,13 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aColorScheme,
aColor = NS_RGB(0xb1, 0xa5, 0x98); aColor = NS_RGB(0xb1, 0xa5, 0x98);
break; break;
case ColorID::MozCellhighlight: case ColorID::MozCellhighlight:
case ColorID::MozHtmlCellhighlight: case ColorID::Selecteditem:
case ColorID::Highlight:
case ColorID::MozAccentColor: case ColorID::MozAccentColor:
aColor = UseNativeAccent() ? mSystemColors.colorAccent aColor = UseNativeAccent() ? mSystemColors.colorAccent
: widget::sDefaultAccent.ToABGR(); : widget::sDefaultAccent.ToABGR();
break; break;
case ColorID::MozCellhighlighttext: case ColorID::MozCellhighlighttext:
case ColorID::MozHtmlCellhighlighttext: case ColorID::Selecteditemtext:
case ColorID::Highlighttext:
case ColorID::MozAccentColorForeground: case ColorID::MozAccentColorForeground:
aColor = UseNativeAccent() aColor = UseNativeAccent()
? nsNativeBasicTheme::ComputeCustomAccentForeground( ? nsNativeBasicTheme::ComputeCustomAccentForeground(

Просмотреть файл

@ -146,7 +146,7 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme, nscolor
case ColorID::TextForeground: case ColorID::TextForeground:
color = NS_RGB(0x00, 0x00, 0x00); color = NS_RGB(0x00, 0x00, 0x00);
break; break;
case ColorID::TextSelectBackground: case ColorID::Highlight:
color = ProcessSelectionBackground(GetColorFromNSColor(NSColor.selectedTextBackgroundColor), color = ProcessSelectionBackground(GetColorFromNSColor(NSColor.selectedTextBackgroundColor),
aScheme); aScheme);
break; break;
@ -156,11 +156,9 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme, nscolor
color = ProcessSelectionBackground(GetColorFromNSColor(NSColor.secondarySelectedControlColor), color = ProcessSelectionBackground(GetColorFromNSColor(NSColor.secondarySelectedControlColor),
aScheme); aScheme);
break; break;
case ColorID::Highlight: // CSS2 color
case ColorID::MozMenuhover: case ColorID::MozMenuhover:
color = GetColorFromNSColor(NSColor.alternateSelectedControlColor); color = GetColorFromNSColor(NSColor.alternateSelectedControlColor);
break; break;
case ColorID::Highlighttext: // CSS2 color
case ColorID::MozAccentColorForeground: case ColorID::MozAccentColorForeground:
case ColorID::MozMenuhovertext: case ColorID::MozMenuhovertext:
color = GetColorFromNSColor(NSColor.alternateSelectedControlTextColor); color = GetColorFromNSColor(NSColor.alternateSelectedControlTextColor);
@ -175,7 +173,7 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme, nscolor
case ColorID::IMESelectedConvertedTextForeground: case ColorID::IMESelectedConvertedTextForeground:
case ColorID::IMERawInputForeground: case ColorID::IMERawInputForeground:
case ColorID::IMEConvertedTextForeground: case ColorID::IMEConvertedTextForeground:
case ColorID::TextSelectForeground: case ColorID::Highlighttext:
color = NS_SAME_AS_FOREGROUND_COLOR; color = NS_SAME_AS_FOREGROUND_COLOR;
break; break;
case ColorID::IMERawInputUnderline: case ColorID::IMERawInputUnderline:
@ -297,7 +295,7 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme, nscolor
break; break;
case ColorID::MozDialogtext: case ColorID::MozDialogtext:
case ColorID::MozCellhighlighttext: case ColorID::MozCellhighlighttext:
case ColorID::MozHtmlCellhighlighttext: case ColorID::Selecteditemtext:
case ColorID::MozColheadertext: case ColorID::MozColheadertext:
case ColorID::MozColheaderhovertext: case ColorID::MozColheaderhovertext:
color = GetColorFromNSColor(NSColor.controlTextColor); color = GetColorFromNSColor(NSColor.controlTextColor);
@ -337,8 +335,8 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme, nscolor
color = NS_RGB(0xDC, 0xDC, 0xDC); color = NS_RGB(0xDC, 0xDC, 0xDC);
break; break;
case ColorID::MozCellhighlight: case ColorID::MozCellhighlight:
case ColorID::MozHtmlCellhighlight:
case ColorID::MozMacSecondaryhighlight: case ColorID::MozMacSecondaryhighlight:
case ColorID::Selecteditem:
// For inactive list selection // For inactive list selection
color = GetColorFromNSColor(NSColor.secondarySelectedControlColor); color = GetColorFromNSColor(NSColor.secondarySelectedControlColor);
break; break;

Просмотреть файл

@ -261,7 +261,7 @@ class SelectionStyleProvider final {
nsAutoCString style(":selected{"); nsAutoCString style(":selected{");
// FYI: LookAndFeel always returns selection colors of GtkTextView. // FYI: LookAndFeel always returns selection colors of GtkTextView.
if (auto selectionForegroundColor = if (auto selectionForegroundColor =
GetSystemColor(LookAndFeel::ColorID::TextSelectForeground)) { GetSystemColor(LookAndFeel::ColorID::Highlight)) {
double alpha = double alpha =
static_cast<double>(NS_GET_A(*selectionForegroundColor)) / 0xFF; static_cast<double>(NS_GET_A(*selectionForegroundColor)) / 0xFF;
style.AppendPrintf("color:rgba(%u,%u,%u,", style.AppendPrintf("color:rgba(%u,%u,%u,",
@ -274,7 +274,7 @@ class SelectionStyleProvider final {
style.AppendPrintf(");"); style.AppendPrintf(");");
} }
if (auto selectionBackgroundColor = if (auto selectionBackgroundColor =
GetSystemColor(LookAndFeel::ColorID::TextSelectBackground)) { GetSystemColor(LookAndFeel::ColorID::Highlighttext)) {
double alpha = double alpha =
static_cast<double>(NS_GET_A(*selectionBackgroundColor)) / 0xFF; static_cast<double>(NS_GET_A(*selectionBackgroundColor)) / 0xFF;
style.AppendPrintf("background-color:rgba(%u,%u,%u,", style.AppendPrintf("background-color:rgba(%u,%u,%u,",

Просмотреть файл

@ -393,7 +393,6 @@ nsresult nsLookAndFeel::PerThemeData::GetColor(ColorID aID,
switch (aID) { switch (aID) {
// These colors don't seem to be used for anything anymore in Mozilla // These colors don't seem to be used for anything anymore in Mozilla
// (except here at least TextSelectBackground and TextSelectForeground)
// The CSS2 colors below are used. // The CSS2 colors below are used.
case ColorID::WindowBackground: case ColorID::WindowBackground:
case ColorID::WidgetBackground: case ColorID::WidgetBackground:
@ -417,14 +416,13 @@ nsresult nsLookAndFeel::PerThemeData::GetColor(ColorID aID,
aColor = mMozWindowText; aColor = mMozWindowText;
break; break;
case ColorID::WidgetSelectBackground: case ColorID::WidgetSelectBackground:
case ColorID::TextSelectBackground:
case ColorID::IMESelectedRawTextBackground: case ColorID::IMESelectedRawTextBackground:
case ColorID::IMESelectedConvertedTextBackground: case ColorID::IMESelectedConvertedTextBackground:
case ColorID::MozDragtargetzone: case ColorID::MozDragtargetzone:
case ColorID::Highlight: // preference selected item, case ColorID::Highlight: // preference selected item,
aColor = mTextSelectedBackground; aColor = mTextSelectedBackground;
break; break;
case ColorID::TextSelectForeground: case ColorID::Highlighttext:
if (NS_GET_A(mTextSelectedBackground) < 155) { if (NS_GET_A(mTextSelectedBackground) < 155) {
aColor = NS_SAME_AS_FOREGROUND_COLOR; aColor = NS_SAME_AS_FOREGROUND_COLOR;
break; break;
@ -433,14 +431,13 @@ nsresult nsLookAndFeel::PerThemeData::GetColor(ColorID aID,
case ColorID::WidgetSelectForeground: case ColorID::WidgetSelectForeground:
case ColorID::IMESelectedRawTextForeground: case ColorID::IMESelectedRawTextForeground:
case ColorID::IMESelectedConvertedTextForeground: case ColorID::IMESelectedConvertedTextForeground:
case ColorID::Highlighttext:
aColor = mTextSelectedText; aColor = mTextSelectedText;
break; break;
case ColorID::MozHtmlCellhighlight: case ColorID::Selecteditem:
case ColorID::MozAccentColor: case ColorID::MozAccentColor:
aColor = mAccentColor; aColor = mAccentColor;
break; break;
case ColorID::MozHtmlCellhighlighttext: case ColorID::Selecteditemtext:
case ColorID::MozAccentColorForeground: case ColorID::MozAccentColorForeground:
aColor = mAccentColorForeground; aColor = mAccentColorForeground;
break; break;

Просмотреть файл

@ -73,18 +73,12 @@ nsresult HeadlessLookAndFeel::NativeGetColor(ColorID aID, ColorScheme,
case ColorID::TextHighlightForeground: case ColorID::TextHighlightForeground:
aColor = NS_RGB(0xff, 0xff, 0xff); aColor = NS_RGB(0xff, 0xff, 0xff);
break; break;
case ColorID::TextSelectBackground:
aColor = NS_RGB(0xaa, 0xaa, 0xaa);
break;
case ColorID::TextSelectBackgroundAttention: case ColorID::TextSelectBackgroundAttention:
aColor = NS_TRANSPARENT; aColor = NS_TRANSPARENT;
break; break;
case ColorID::TextSelectBackgroundDisabled: case ColorID::TextSelectBackgroundDisabled:
aColor = NS_RGB(0xaa, 0xaa, 0xaa); aColor = NS_RGB(0xaa, 0xaa, 0xaa);
break; break;
case ColorID::TextSelectForeground:
aColor = NS_SAME_AS_FOREGROUND_COLOR;
break;
case ColorID::Widget3DHighlight: case ColorID::Widget3DHighlight:
aColor = NS_RGB(0xa0, 0xa0, 0xa0); aColor = NS_RGB(0xa0, 0xa0, 0xa0);
break; break;
@ -110,10 +104,12 @@ nsresult HeadlessLookAndFeel::NativeGetColor(ColorID aID, ColorScheme,
aColor = NS_RGB(0x00, 0x00, 0x00); aColor = NS_RGB(0x00, 0x00, 0x00);
break; break;
case ColorID::Highlight: case ColorID::Highlight:
case ColorID::Selecteditem:
case ColorID::MozAccentColor: case ColorID::MozAccentColor:
aColor = NS_RGB(53, 132, 228); aColor = NS_RGB(53, 132, 228);
break; break;
case ColorID::Highlighttext: case ColorID::Highlighttext:
case ColorID::Selecteditemtext:
case ColorID::MozAccentColorForeground: case ColorID::MozAccentColorForeground:
aColor = NS_RGB(0xff, 0xff, 0xff); aColor = NS_RGB(0xff, 0xff, 0xff);
break; break;

Просмотреть файл

@ -206,8 +206,6 @@ static const char sColorPrefs[][41] = {
"ui.widget3DShadow", "ui.widget3DShadow",
"ui.textBackground", "ui.textBackground",
"ui.textForeground", "ui.textForeground",
"ui.textSelectBackground",
"ui.textSelectForeground",
"ui.textSelectBackgroundDisabled", "ui.textSelectBackgroundDisabled",
"ui.textSelectBackgroundAttention", "ui.textSelectBackgroundAttention",
"ui.textHighlightBackground", "ui.textHighlightBackground",
@ -269,8 +267,8 @@ static const char sColorPrefs[][41] = {
"ui.-moz-dragtargetzone", "ui.-moz-dragtargetzone",
"ui.-moz-cellhighlight", "ui.-moz-cellhighlight",
"ui.-moz_cellhighlighttext", "ui.-moz_cellhighlighttext",
"ui.-moz-html-cellhighlight", "ui.selecteditem",
"ui.-moz-html-cellhighlighttext", "ui.selecteditemtext",
"ui.-moz-buttonhoverface", "ui.-moz-buttonhoverface",
"ui.-moz_buttonhovertext", "ui.-moz_buttonhovertext",
"ui.-moz_menuhover", "ui.-moz_menuhover",
@ -476,8 +474,11 @@ nsXPLookAndFeel::~nsXPLookAndFeel() {
static bool IsSpecialColor(LookAndFeel::ColorID aID, nscolor aColor) { static bool IsSpecialColor(LookAndFeel::ColorID aID, nscolor aColor) {
using ColorID = LookAndFeel::ColorID; using ColorID = LookAndFeel::ColorID;
if (aColor == NS_SAME_AS_FOREGROUND_COLOR) {
return true;
}
switch (aID) { switch (aID) {
case ColorID::TextSelectForeground:
case ColorID::IMESelectedRawTextBackground: case ColorID::IMESelectedRawTextBackground:
case ColorID::IMESelectedConvertedTextBackground: case ColorID::IMESelectedConvertedTextBackground:
case ColorID::IMERawInputBackground: case ColorID::IMERawInputBackground:
@ -550,8 +551,8 @@ nscolor nsXPLookAndFeel::GetStandinForNativeColor(ColorID aID) {
COLOR(MozDragtargetzone, 0xFF, 0xFF, 0xFF) COLOR(MozDragtargetzone, 0xFF, 0xFF, 0xFF)
COLOR(MozCellhighlight, 0xF0, 0xF0, 0xF0) COLOR(MozCellhighlight, 0xF0, 0xF0, 0xF0)
COLOR(MozCellhighlighttext, 0x00, 0x00, 0x00) COLOR(MozCellhighlighttext, 0x00, 0x00, 0x00)
COLOR(MozHtmlCellhighlight, 0x33, 0x99, 0xFF) COLOR(Selecteditem, 0x33, 0x99, 0xFF)
COLOR(MozHtmlCellhighlighttext, 0xFF, 0xFF, 0xFF) COLOR(Selecteditemtext, 0xFF, 0xFF, 0xFF)
COLOR(MozButtonhoverface, 0xF0, 0xF0, 0xF0) COLOR(MozButtonhoverface, 0xF0, 0xF0, 0xF0)
COLOR(MozGtkButtonactivetext, 0x00, 0x00, 0x00) COLOR(MozGtkButtonactivetext, 0x00, 0x00, 0x00)
COLOR(MozButtonhovertext, 0x00, 0x00, 0x00) COLOR(MozButtonhovertext, 0x00, 0x00, 0x00)
@ -1052,8 +1053,6 @@ static bool ColorIsCSSAccessible(LookAndFeel::ColorID aId) {
case ColorID::Widget3DShadow: case ColorID::Widget3DShadow:
case ColorID::TextBackground: case ColorID::TextBackground:
case ColorID::TextForeground: case ColorID::TextForeground:
case ColorID::TextSelectBackground:
case ColorID::TextSelectForeground:
case ColorID::TextSelectBackgroundDisabled: case ColorID::TextSelectBackgroundDisabled:
case ColorID::TextSelectBackgroundAttention: case ColorID::TextSelectBackgroundAttention:
case ColorID::TextHighlightBackground: case ColorID::TextHighlightBackground:

Просмотреть файл

@ -76,15 +76,13 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID, ColorScheme, nscolor& aResult) {
case ColorID::TextForeground: case ColorID::TextForeground:
aResult = NS_RGB(0x00, 0x00, 0x00); aResult = NS_RGB(0x00, 0x00, 0x00);
break; break;
case ColorID::TextSelectBackground: case ColorID::Highlight:
case ColorID::Highlight: // CSS2 color
aResult = NS_RGB(0xaa, 0xaa, 0xaa); aResult = NS_RGB(0xaa, 0xaa, 0xaa);
break; break;
case ColorID::MozMenuhover: case ColorID::MozMenuhover:
aResult = NS_RGB(0xee, 0xee, 0xee); aResult = NS_RGB(0xee, 0xee, 0xee);
break; break;
case ColorID::TextSelectForeground: case ColorID::Highlighttext:
case ColorID::Highlighttext: // CSS2 color
case ColorID::MozMenuhovertext: case ColorID::MozMenuhovertext:
aResult = mColorTextSelectForeground; aResult = mColorTextSelectForeground;
break; break;
@ -199,7 +197,7 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID, ColorScheme, nscolor& aResult) {
break; break;
case ColorID::MozDialogtext: case ColorID::MozDialogtext:
case ColorID::MozCellhighlighttext: case ColorID::MozCellhighlighttext:
case ColorID::MozHtmlCellhighlighttext: case ColorID::Selecteditemtext:
case ColorID::MozColheadertext: case ColorID::MozColheadertext:
case ColorID::MozColheaderhovertext: case ColorID::MozColheaderhovertext:
aResult = mColorDarkText; aResult = mColorDarkText;
@ -231,7 +229,7 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID, ColorScheme, nscolor& aResult) {
aResult = NS_RGB(0xDC, 0xDC, 0xDC); aResult = NS_RGB(0xDC, 0xDC, 0xDC);
break; break;
case ColorID::MozCellhighlight: case ColorID::MozCellhighlight:
case ColorID::MozHtmlCellhighlight: case ColorID::Selecteditem:
case ColorID::MozMacSecondaryhighlight: case ColorID::MozMacSecondaryhighlight:
// For inactive list selection // For inactive list selection
aResult = NS_RGB(0xaa, 0xaa, 0xaa); aResult = NS_RGB(0xaa, 0xaa, 0xaa);

Просмотреть файл

@ -150,16 +150,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme,
case ColorID::TextForeground: case ColorID::TextForeground:
idx = COLOR_WINDOWTEXT; idx = COLOR_WINDOWTEXT;
break; break;
case ColorID::TextSelectBackground:
case ColorID::IMESelectedRawTextBackground:
case ColorID::IMESelectedConvertedTextBackground:
idx = COLOR_HIGHLIGHT;
break;
case ColorID::TextSelectForeground:
case ColorID::IMESelectedRawTextForeground:
case ColorID::IMESelectedConvertedTextForeground:
idx = COLOR_HIGHLIGHTTEXT;
break;
case ColorID::IMERawInputBackground: case ColorID::IMERawInputBackground:
case ColorID::IMEConvertedTextBackground: case ColorID::IMEConvertedTextBackground:
aColor = NS_TRANSPARENT; aColor = NS_TRANSPARENT;
@ -214,8 +204,10 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme,
idx = COLOR_GRAYTEXT; idx = COLOR_GRAYTEXT;
break; break;
case ColorID::Highlight: case ColorID::Highlight:
case ColorID::MozHtmlCellhighlight: case ColorID::Selecteditem:
case ColorID::MozMenuhover: case ColorID::MozMenuhover:
case ColorID::IMESelectedRawTextBackground:
case ColorID::IMESelectedConvertedTextBackground:
idx = COLOR_HIGHLIGHT; idx = COLOR_HIGHLIGHT;
break; break;
case ColorID::MozMenubarhovertext: case ColorID::MozMenubarhovertext:
@ -232,7 +224,9 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme,
} }
// Fall through // Fall through
case ColorID::Highlighttext: case ColorID::Highlighttext:
case ColorID::MozHtmlCellhighlighttext: case ColorID::Selecteditemtext:
case ColorID::IMESelectedRawTextForeground:
case ColorID::IMESelectedConvertedTextForeground:
idx = COLOR_HIGHLIGHTTEXT; idx = COLOR_HIGHLIGHTTEXT;
break; break;
case ColorID::Inactiveborder: case ColorID::Inactiveborder: