forked from mirrors/gecko-dev
Bug 1867940 - Text Fragments: Implement sensible default colors. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D212378
This commit is contained in:
parent
516e3e428a
commit
db5d7e6f67
8 changed files with 25 additions and 5 deletions
|
|
@ -226,11 +226,12 @@ void nsTextPaintStyle::GetTargetTextColors(nscolor* aForeColor,
|
|||
&nsStyleBackground::mBackgroundColor);
|
||||
return;
|
||||
}
|
||||
// XXX(:jjaschke): Before shipping this feature, a sensible set of colors must
|
||||
// be set (Bug 1867940).
|
||||
// in the meantime, use the colors of find selection.
|
||||
GetHighlightColors(aForeColor, aBackColor);
|
||||
*aBackColor =
|
||||
LookAndFeel::Color(LookAndFeel::ColorID::TargetTextBackground, mFrame);
|
||||
*aForeColor =
|
||||
LookAndFeel::Color(LookAndFeel::ColorID::TargetTextForeground, mFrame);
|
||||
}
|
||||
|
||||
bool nsTextPaintStyle::GetCustomHighlightTextColor(nsAtom* aHighlightName,
|
||||
nscolor* aForeColor) {
|
||||
NS_ASSERTION(aForeColor, "aForeColor is null");
|
||||
|
|
|
|||
|
|
@ -365,6 +365,10 @@ pub enum SystemColor {
|
|||
#[css(skip)]
|
||||
TextHighlightForeground,
|
||||
#[css(skip)]
|
||||
TargetTextBackground,
|
||||
#[css(skip)]
|
||||
TargetTextForeground,
|
||||
#[css(skip)]
|
||||
IMERawInputBackground,
|
||||
#[css(skip)]
|
||||
IMERawInputForeground,
|
||||
|
|
|
|||
|
|
@ -255,6 +255,8 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aColorScheme,
|
|||
case ColorID::Mark:
|
||||
case ColorID::MozAutofillBackground:
|
||||
case ColorID::SpellCheckerUnderline:
|
||||
case ColorID::TargetTextBackground:
|
||||
case ColorID::TargetTextForeground:
|
||||
aColor = GetStandinForNativeColor(aID, aColorScheme);
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -358,6 +358,8 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
|
|||
case ColorID::Activeborder:
|
||||
case ColorID::Inactiveborder:
|
||||
case ColorID::MozAutofillBackground:
|
||||
case ColorID::TargetTextBackground:
|
||||
case ColorID::TargetTextForeground:
|
||||
aColor = GetStandinForNativeColor(aID, aScheme);
|
||||
return NS_OK;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -801,6 +801,8 @@ nsresult nsLookAndFeel::PerThemeData::GetColor(ColorID aID,
|
|||
case ColorID::Mark:
|
||||
case ColorID::Marktext:
|
||||
case ColorID::MozAutofillBackground:
|
||||
case ColorID::TargetTextBackground:
|
||||
case ColorID::TargetTextForeground:
|
||||
aColor = GetStandinForNativeColor(
|
||||
aID, mIsDark ? ColorScheme::Dark : ColorScheme::Light);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -297,6 +297,8 @@ static const char sColorPrefs[][41] = {
|
|||
"ui.textSelectAttentionForeground",
|
||||
"ui.textHighlightBackground",
|
||||
"ui.textHighlightForeground",
|
||||
"ui.targetTextBackground",
|
||||
"ui.targetTextForeground",
|
||||
"ui.IMERawInputBackground",
|
||||
"ui.IMERawInputForeground",
|
||||
"ui.IMERawInputUnderline",
|
||||
|
|
@ -709,6 +711,8 @@ nscolor nsXPLookAndFeel::GetStandinForNativeColor(ColorID aID,
|
|||
COLOR(MozNativehyperlinktext, 0x00, 0x66, 0xCC)
|
||||
COLOR(MozNativevisitedhyperlinktext, 0x55, 0x1A, 0x8B)
|
||||
COLOR(MozAutofillBackground, 0xff, 0xfc, 0xc8)
|
||||
COLOR(TargetTextBackground, 0xff, 0xeb, 0xcd)
|
||||
COLOR(TargetTextForeground, 0x00, 0x00, 0x00)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ void nsLookAndFeel::RefreshImpl() {
|
|||
mInitialized = false;
|
||||
}
|
||||
|
||||
nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme,
|
||||
nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aColorScheme,
|
||||
nscolor& aResult) {
|
||||
EnsureInit();
|
||||
|
||||
|
|
@ -204,6 +204,9 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme,
|
|||
// which in turn uses systemPurpleColor, so we do the same here.
|
||||
aResult = GetColorFromUIColor([UIColor systemPurpleColor]);
|
||||
break;
|
||||
case ColorID::TargetTextBackground:
|
||||
case ColorID::TargetTextForeground:
|
||||
aResult = GetStandinForNativeColor(aID, aColorScheme);
|
||||
default:
|
||||
NS_WARNING("Someone asked nsILookAndFeel for a color I don't know about");
|
||||
aResult = NS_RGB(0xff, 0xff, 0xff);
|
||||
|
|
|
|||
|
|
@ -371,6 +371,8 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
|
|||
case ColorID::Mark:
|
||||
case ColorID::SpellCheckerUnderline:
|
||||
case ColorID::MozAutofillBackground:
|
||||
case ColorID::TargetTextBackground:
|
||||
case ColorID::TargetTextForeground:
|
||||
aColor = GetStandinForNativeColor(aID, aScheme);
|
||||
return NS_OK;
|
||||
default:
|
||||
|
|
|
|||
Loading…
Reference in a new issue