Use the appropriate color based on visitedness for the 'color' property. (Bug 147777) r=roc

This commit is contained in:
L. David Baron 2010-04-02 18:58:25 -07:00
parent 7a857e9b5a
commit a35f4b2aac
3 changed files with 10 additions and 13 deletions

View file

@ -247,10 +247,8 @@ nsBulletFrame::PaintBullet(nsIRenderingContext& aRenderingContext, nsPoint aPt,
} }
} }
const nsStyleColor* myColor = GetStyleColor();
nsCOMPtr<nsIFontMetrics> fm; nsCOMPtr<nsIFontMetrics> fm;
aRenderingContext.SetColor(myColor->mColor); aRenderingContext.SetColor(GetVisitedDependentColor(eCSSProperty_color));
mTextIsRTL = PR_FALSE; mTextIsRTL = PR_FALSE;

View file

@ -450,7 +450,7 @@ nsHTMLContainerFrame::GetTextDecorations(nsPresContext* aPresContext,
aDecorations = this->GetStyleTextReset()->mTextDecoration & aDecorations = this->GetStyleTextReset()->mTextDecoration &
NS_STYLE_TEXT_DECORATION_LINES_MASK; NS_STYLE_TEXT_DECORATION_LINES_MASK;
if (aDecorations) { if (aDecorations) {
nscolor color = this->GetStyleColor()->mColor; nscolor color = this->GetVisitedDependentColor(eCSSProperty_color);
aUnderColor = color; aUnderColor = color;
aOverColor = color; aOverColor = color;
aStrikeColor = color; aStrikeColor = color;
@ -470,7 +470,7 @@ nsHTMLContainerFrame::GetTextDecorations(nsPresContext* aPresContext,
PRUint8 decors = frame->GetStyleTextReset()->mTextDecoration & decorMask; PRUint8 decors = frame->GetStyleTextReset()->mTextDecoration & decorMask;
if (decors) { if (decors) {
// A *new* text-decoration is found. // A *new* text-decoration is found.
nscolor color = frame->GetStyleColor()->mColor; nscolor color = frame->GetVisitedDependentColor(eCSSProperty_color);
if (NS_STYLE_TEXT_DECORATION_UNDERLINE & decors) { if (NS_STYLE_TEXT_DECORATION_UNDERLINE & decors) {
aUnderColor = color; aUnderColor = color;

View file

@ -108,7 +108,6 @@
#include "nsIAccessibilityService.h" #include "nsIAccessibilityService.h"
#endif #endif
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
#include "nsStyleSet.h"
#include "nsBidiFrames.h" #include "nsBidiFrames.h"
#include "nsBidiPresUtils.h" #include "nsBidiPresUtils.h"
@ -3006,7 +3005,7 @@ nsTextPaintStyle::EnsureSufficientContrast(nscolor *aForeColor, nscolor *aBackCo
nscolor nscolor
nsTextPaintStyle::GetTextColor() nsTextPaintStyle::GetTextColor()
{ {
nscolor color = mFrame->GetStyleColor()->mColor; nscolor color = mFrame->GetVisitedDependentColor(eCSSProperty_color);
if (ShouldDarkenColors(mPresContext)) { if (ShouldDarkenColors(mPresContext)) {
color = DarkenColor(color); color = DarkenColor(color);
} }
@ -3169,7 +3168,7 @@ nsTextPaintStyle::InitSelectionColors()
if (sc) { if (sc) {
const nsStyleBackground* bg = sc->GetStyleBackground(); const nsStyleBackground* bg = sc->GetStyleBackground();
mSelectionBGColor = bg->mBackgroundColor; mSelectionBGColor = bg->mBackgroundColor;
mSelectionTextColor = sc->GetStyleColor()->mColor; mSelectionTextColor = sc->GetVisitedDependentColor(eCSSProperty_color);
return PR_TRUE; return PR_TRUE;
} }
} }
@ -3199,8 +3198,8 @@ nsTextPaintStyle::InitSelectionColors()
// On MacOS X, we don't exchange text color and BG color. // On MacOS X, we don't exchange text color and BG color.
if (mSelectionTextColor == NS_DONT_CHANGE_COLOR) { if (mSelectionTextColor == NS_DONT_CHANGE_COLOR) {
mSelectionTextColor = EnsureDifferentColors(mFrame->GetStyleColor()->mColor, nscoord frameColor = mFrame->GetVisitedDependentColor(eCSSProperty_color);
mSelectionBGColor); mSelectionTextColor = EnsureDifferentColors(frameColor, mSelectionBGColor);
} else { } else {
EnsureSufficientContrast(&mSelectionTextColor, &mSelectionBGColor); EnsureSufficientContrast(&mSelectionTextColor, &mSelectionBGColor);
} }
@ -4004,13 +4003,13 @@ nsTextFrame::GetTextDecorations(nsPresContext* aPresContext)
// This handles the <a href="blah.html"><font color="green">La // This handles the <a href="blah.html"><font color="green">La
// la la</font></a> case. The link underline should be green. // la la</font></a> case. The link underline should be green.
useOverride = PR_TRUE; useOverride = PR_TRUE;
overrideColor = context->GetStyleColor()->mColor; overrideColor = context->GetVisitedDependentColor(eCSSProperty_color);
} }
PRUint8 useDecorations = decorMask & styleText->mTextDecoration; PRUint8 useDecorations = decorMask & styleText->mTextDecoration;
if (useDecorations) {// a decoration defined here if (useDecorations) {// a decoration defined here
nscolor color = context->GetStyleColor()->mColor; nscolor color = context->GetVisitedDependentColor(eCSSProperty_color);
if (NS_STYLE_TEXT_DECORATION_UNDERLINE & useDecorations) { if (NS_STYLE_TEXT_DECORATION_UNDERLINE & useDecorations) {
decorations.mUnderColor = useOverride ? overrideColor : color; decorations.mUnderColor = useOverride ? overrideColor : color;
decorMask &= ~NS_STYLE_TEXT_DECORATION_UNDERLINE; decorMask &= ~NS_STYLE_TEXT_DECORATION_UNDERLINE;