mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 455217 - Selection colors for plain text files is wrong (white background, blue text instead of blue background, white text); "code" part; r+sr=dbaron
This commit is contained in:
parent
4aa13cc558
commit
20636c2fb4
@ -38,6 +38,7 @@
|
||||
/* functions that manipulate colors */
|
||||
|
||||
#include "nsCSSColorUtils.h"
|
||||
#include "nsDebug.h"
|
||||
#include <math.h>
|
||||
|
||||
// Weird color computing code stolen from winfe which was stolen
|
||||
@ -189,6 +190,12 @@ int NS_GetBrightness(PRUint8 aRed, PRUint8 aGreen, PRUint8 aBlue)
|
||||
|
||||
PRInt32 NS_GetLuminosity(nscolor aColor)
|
||||
{
|
||||
// When aColor is not opaque, the perceived luminosity will depend
|
||||
// on what color(s) aColor is ultimately drawn on top of, which we
|
||||
// do not know.
|
||||
NS_ASSERTION(NS_GET_A(aColor) == 255,
|
||||
"impossible to compute luminosity of a non-opaque color");
|
||||
|
||||
return (NS_GET_R(aColor) * RED_LUMINOSITY +
|
||||
NS_GET_G(aColor) * GREEN_LUMINOSITY +
|
||||
NS_GET_B(aColor) * BLUE_LUMINOSITY);
|
||||
|
@ -1301,17 +1301,14 @@ nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
|
||||
// If the window is intended to be opaque, ensure that we always
|
||||
// paint an opaque color for its root element, in case there's no
|
||||
// background at all or a partly transparent image.
|
||||
//
|
||||
// The default background color from the prescontext is under user
|
||||
// control, so it might not be opaque either.
|
||||
nsIView* rView;
|
||||
vm->GetRootView(rView);
|
||||
if (!rView->GetParent() &&
|
||||
(!rView->HasWidget() ||
|
||||
rView->GetWidget()->GetTransparencyMode() == eTransparencyOpaque)) {
|
||||
nscolor backColor =
|
||||
NS_ComposeColors(NS_RGB(255,255,255),
|
||||
aPresContext->DefaultBackgroundColor());
|
||||
nscolor backColor = aPresContext->DefaultBackgroundColor();
|
||||
NS_ASSERTION(NS_GET_A(backColor) == 255,
|
||||
"default background color is not opaque");
|
||||
|
||||
canvasColor.mBackgroundColor =
|
||||
NS_ComposeColors(backColor, canvasColor.mBackgroundColor);
|
||||
|
@ -569,6 +569,11 @@ nsPresContext::GetDocumentColorPreferences()
|
||||
mBackgroundColor);
|
||||
}
|
||||
|
||||
// Wherever we got the default background color from, ensure it is
|
||||
// opaque.
|
||||
mBackgroundColor = NS_ComposeColors(NS_RGB(0xFF, 0xFF, 0xFF),
|
||||
mBackgroundColor);
|
||||
|
||||
mUseDocumentColors = !useAccessibilityTheme &&
|
||||
nsContentUtils::GetBoolPref("browser.display.use_document_colors",
|
||||
mUseDocumentColors);
|
||||
|
@ -2968,7 +2968,13 @@ nsTextPaintStyle::InitCommonColors()
|
||||
const nsStyleBackground* bg =
|
||||
nsCSSRendering::FindNonTransparentBackground(sc);
|
||||
NS_ASSERTION(bg, "Cannot find NonTransparentBackground.");
|
||||
mFrameBackgroundColor = bg->mBackgroundColor;
|
||||
|
||||
nscolor defaultBgColor = mPresContext->DefaultBackgroundColor();
|
||||
NS_ASSERTION(NS_GET_A(defaultBgColor) == 255,
|
||||
"default background color is not opaque");
|
||||
|
||||
mFrameBackgroundColor = NS_ComposeColors(defaultBgColor,
|
||||
bg->mBackgroundColor);
|
||||
|
||||
nsILookAndFeel* look = mPresContext->LookAndFeel();
|
||||
nscolor defaultWindowBackgroundColor, selectionTextColor, selectionBGColor;
|
||||
|
Loading…
Reference in New Issue
Block a user