Bug 451204 - Highlighted text is white on white text on a yellow background, difficult to read. r+sr=roc

This commit is contained in:
Graeme McCutcheon 2008-09-02 08:28:44 +02:00
parent 133c5f8b4f
commit 3eaf4ad543
4 changed files with 32 additions and 13 deletions

View File

@ -2914,7 +2914,7 @@ nsTextPaintStyle::GetHighlightColors(nscolor* aForeColor,
nscolor foreColor, backColor;
look->GetColor(nsILookAndFeel::eColor_TextHighlightBackground,
backColor);
look->GetColor(nsILookAndFeel::eColor_TextSelectForeground,
look->GetColor(nsILookAndFeel::eColor_TextHighlightForeground,
foreColor);
EnsureSufficientContrast(&foreColor, &backColor);
*aForeColor = foreColor;

View File

@ -4,9 +4,12 @@
<title>Bug 263683 Layout Reftest</title>
<script type="text/javascript">
var userSet = false;
var userValue = null;
var prefName = "ui.textHighlightBackground";
var userSetBG = false;
var userValueBG = null;
var prefNameBG = "ui.textHighlightBackground";
var userSetFG = false;
var userValueFG = null;
var prefNameFG = "ui.textHighlightForeground";
function onLoad() {
// Request security privileges
@ -17,13 +20,17 @@
.getService(Components.interfaces.nsIPrefBranch);
// Check to see if this pref has a user-set value. If so, store it
userSet = prefs.prefHasUserValue(prefName);
userSetFG = prefs.prefHasUserValue(prefNameFG);
userSetBG = prefs.prefHasUserValue(prefNameBG);
if (userSet)
userValue = prefs.getCharPref(prefName);
if (userSetFG)
userValueFG = prefs.getCharPref(prefNameFG);
if (userSetBG)
userValueBG = prefs.getCharPref(prefNameBG);
// Set pref to test colour used in reference file
prefs.setCharPref(prefName, "#f0e020");
prefs.setCharPref(prefNameBG, "#f0e020");
prefs.setCharPref(prefNameFG, "#000000");
var textToSelect = document.getElementById("selecttext");
@ -54,12 +61,15 @@
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
prefs.clearUserPref(prefName);
prefs.clearUserPref(prefNameFG);
prefs.clearUserPref(prefNameBG);
if (!userSet)
return;
prefs.setCharPref(prefName, userValue);
if (userSetFG)
prefs.setCharPref(prefNameFG, userValueFG);
if (userSetBG)
prefs.setCharPref(prefNameBG, userValueBG);
}
</script>

View File

@ -76,6 +76,7 @@ public:
eColor_TextSelectBackgroundDisabled,
eColor_TextSelectBackgroundAttention,
eColor_TextHighlightBackground,
eColor_TextHighlightForeground,
eColor_IMERawInputBackground,
eColor_IMERawInputForeground,

View File

@ -171,6 +171,7 @@ const char nsXPLookAndFeel::sColorPrefs[][38] =
"ui.textSelectBackgroundDisabled",
"ui.textSelectBackgroundAttention",
"ui.textHighlightBackground",
"ui.textHighlightForeground",
"ui.IMERawInputBackground",
"ui.IMERawInputForeground",
"ui.IMERawInputUnderline",
@ -593,6 +594,13 @@ nsXPLookAndFeel::GetColor(const nsColorID aID, nscolor &aColor)
return NS_OK;
}
if (aID == eColor_TextHighlightForeground) {
// The foreground color for the matched text in findbar highlighting
// Used with nsISelectionController::SELECTION_FIND
aColor = NS_RGB(0x00, 0x00, 0x00);
return NS_OK;
}
if (NS_SUCCEEDED(NativeGetColor(aID, aColor))) {
if ((gfxPlatform::GetCMSMode() == eCMSMode_All) && !IsSpecialColor(aID, aColor)) {
cmsHTRANSFORM transform = gfxPlatform::GetCMSInverseRGBTransform();