diff --git a/layout/generic/nsTextFrameThebes.cpp b/layout/generic/nsTextFrameThebes.cpp
index 1c752ea09b66..01a7658c8973 100644
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -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;
diff --git a/layout/reftests/bugs/263683-1.html b/layout/reftests/bugs/263683-1.html
index 18f2f3c2f78c..2f6ee7b57236 100644
--- a/layout/reftests/bugs/263683-1.html
+++ b/layout/reftests/bugs/263683-1.html
@@ -4,9 +4,12 @@
Bug 263683 Layout Reftest
diff --git a/widget/public/nsILookAndFeel.h b/widget/public/nsILookAndFeel.h
index e37734fc30c7..8500b96f5363 100644
--- a/widget/public/nsILookAndFeel.h
+++ b/widget/public/nsILookAndFeel.h
@@ -76,6 +76,7 @@ public:
eColor_TextSelectBackgroundDisabled,
eColor_TextSelectBackgroundAttention,
eColor_TextHighlightBackground,
+ eColor_TextHighlightForeground,
eColor_IMERawInputBackground,
eColor_IMERawInputForeground,
diff --git a/widget/src/xpwidgets/nsXPLookAndFeel.cpp b/widget/src/xpwidgets/nsXPLookAndFeel.cpp
index c6cc30bf4120..a75417458080 100644
--- a/widget/src/xpwidgets/nsXPLookAndFeel.cpp
+++ b/widget/src/xpwidgets/nsXPLookAndFeel.cpp
@@ -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();