Use the appropriate color based on visitedness for the 'color' property. (Bug 147777) r=roc
authorL. David Baron <dbaron@dbaron.org>
Fri, 02 Apr 2010 18:58:25 -0700
changeset 40176 4c89e5f153310037f11eded58fec5de494ed994c
parent 40175 bb3c411b50d502c065e839fcf69101067d8f15d2
child 40177 e127bc371a0c5c7d2e83e1795af07814f76335b1
push id12591
push userdbaron@mozilla.com
push dateSat, 03 Apr 2010 02:02:09 +0000
treeherdermozilla-central@85754ddc898e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs147777
milestone1.9.3a4pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
Use the appropriate color based on visitedness for the 'color' property. (Bug 147777) r=roc
layout/generic/nsBulletFrame.cpp
layout/generic/nsHTMLContainerFrame.cpp
layout/generic/nsTextFrameThebes.cpp
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -242,20 +242,18 @@ nsBulletFrame::PaintBullet(nsIRenderingC
         nsLayoutUtils::DrawSingleImage(&aRenderingContext,
              imageCon, nsLayoutUtils::GetGraphicsFilterForFrame(this),
              dest + aPt, aDirtyRect, imgIContainer::FLAG_NONE);
         return;
       }
     }
   }
 
-  const nsStyleColor* myColor = GetStyleColor();
-
   nsCOMPtr<nsIFontMetrics> fm;
-  aRenderingContext.SetColor(myColor->mColor);
+  aRenderingContext.SetColor(GetVisitedDependentColor(eCSSProperty_color));
 
   mTextIsRTL = PR_FALSE;
 
   nsAutoString text;
   switch (listStyleType) {
   case NS_STYLE_LIST_STYLE_NONE:
     break;
 
--- a/layout/generic/nsHTMLContainerFrame.cpp
+++ b/layout/generic/nsHTMLContainerFrame.cpp
@@ -445,17 +445,17 @@ nsHTMLContainerFrame::GetTextDecorations
     // decorations.
     return; 
   }
 
   if (!aIsBlock) {
     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;
     }
   }
   else {
     // We want to ignore a text-decoration from an ancestor frame that
     // is redundant with one from a descendant frame.  This isn't just
@@ -465,17 +465,17 @@ nsHTMLContainerFrame::GetTextDecorations
     // it starts set to all possible decorations.
     PRUint8 decorMask = NS_STYLE_TEXT_DECORATION_LINES_MASK;
 
     // walk tree
     for (nsIFrame* frame = this; frame; frame = frame->GetParent()) {
       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;
           decorMask &= ~NS_STYLE_TEXT_DECORATION_UNDERLINE;
           aDecorations |= NS_STYLE_TEXT_DECORATION_UNDERLINE;
         }
         if (NS_STYLE_TEXT_DECORATION_OVERLINE & decors) {
           aOverColor = color;
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -103,17 +103,16 @@
 #include "nsILineIterator.h"
 
 #include "nsIServiceManager.h"
 #ifdef ACCESSIBILITY
 #include "nsIAccessible.h"
 #include "nsIAccessibilityService.h"
 #endif
 #include "nsAutoPtr.h"
-#include "nsStyleSet.h"
 
 #include "nsBidiFrames.h"
 #include "nsBidiPresUtils.h"
 #include "nsBidiUtils.h"
 
 #include "nsIThebesFontMetrics.h"
 #include "gfxFont.h"
 #include "gfxContext.h"
@@ -3001,17 +3000,17 @@ nsTextPaintStyle::EnsureSufficientContra
     return PR_TRUE;
   }
   return PR_FALSE;
 }
 
 nscolor
 nsTextPaintStyle::GetTextColor()
 {
-  nscolor color = mFrame->GetStyleColor()->mColor;
+  nscolor color = mFrame->GetVisitedDependentColor(eCSSProperty_color);
   if (ShouldDarkenColors(mPresContext)) {
     color = DarkenColor(color);
   }
   return color;
 }
 
 PRBool
 nsTextPaintStyle::GetSelectionColors(nscolor* aForeColor,
@@ -3164,17 +3163,17 @@ nsTextPaintStyle::InitSelectionColors()
     sc = mPresContext->StyleSet()->
       ProbePseudoElementStyle(selectionContent,
                               nsCSSPseudoElements::ePseudo_mozSelection,
                               mFrame->GetStyleContext());
     // Use -moz-selection pseudo class.
     if (sc) {
       const nsStyleBackground* bg = sc->GetStyleBackground();
       mSelectionBGColor = bg->mBackgroundColor;
-      mSelectionTextColor = sc->GetStyleColor()->mColor;
+      mSelectionTextColor = sc->GetVisitedDependentColor(eCSSProperty_color);
       return PR_TRUE;
     }
   }
 
   nsILookAndFeel* look = mPresContext->LookAndFeel();
 
   nscolor selectionBGColor;
   look->GetColor(nsILookAndFeel::eColor_TextSelectBackground,
@@ -3194,18 +3193,18 @@ nsTextPaintStyle::InitSelectionColors()
     mSelectionBGColor = selectionBGColor;
   }
 
   look->GetColor(nsILookAndFeel::eColor_TextSelectForeground,
                  mSelectionTextColor);
 
   // 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);
   }
   return PR_TRUE;
 }
 
 nsTextPaintStyle::nsSelectionStyle*
 nsTextPaintStyle::GetSelectionStyle(PRInt32 aIndex)
@@ -3999,23 +3998,23 @@ nsTextFrame::GetTextDecorations(nsPresCo
        decorMask && context && context->HasTextDecorations();
        context = context->GetParent()) {
     const nsStyleTextReset* styleText = context->GetStyleTextReset();
     if (!useOverride && 
         (NS_STYLE_TEXT_DECORATION_OVERRIDE_ALL & styleText->mTextDecoration)) {
       // 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;
         decorations.mDecorations |= NS_STYLE_TEXT_DECORATION_UNDERLINE;
       }
       if (NS_STYLE_TEXT_DECORATION_OVERLINE & useDecorations) {
         decorations.mOverColor = useOverride ? overrideColor : color;
         decorMask &= ~NS_STYLE_TEXT_DECORATION_OVERLINE;