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;
aRenderingContext.SetColor(myColor->mColor);
aRenderingContext.SetColor(GetVisitedDependentColor(eCSSProperty_color));
mTextIsRTL = PR_FALSE;

View file

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

View file

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