Bug 1739925 - Add a foreground color to attention selection. r=jfkthame
In some platforms (like macOS, windows dark mode, android, and some gtk themes) the foreground selection color might be `currentcolor`, and that doesn't generally guarantee enough contrast with the attention background. Remove HeadlessLookAndFeelGTK's handling of this color since it's useless (always overridden by prefs in all.js) Differential Revision: https://phabricator.services.mozilla.com/D130617
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user