Bug 403524: Draw correct colors for text-decorations on default-color shadows in quirks mode. r=dbaron
authorVitor Menezes <vmenezes@mozilla.com>
Wed, 03 Aug 2011 11:30:58 -0700
changeset 73780 db9466903986bcf2c3aa42a8b9112661a4e8be95
parent 73779 d3d43eea28c85233baa65ec75a914b573181343d
child 73781 83b2648ee44243cf158a9a98c5aad384e613dd7d
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersdbaron
bugs403524
milestone8.0a1
Bug 403524: Draw correct colors for text-decorations on default-color shadows in quirks mode. r=dbaron Make the quirks mode text-decoration + text-shadow code draw the decorations for shadows that do not have a specified color using the same color used for the un-shadowed decorations, which matches standards mode behavior. (The color of unspecified-color shadows is explicitly undefined in the specification.) This code will (in a later patch on this bug) be used for both quirks and standards modes.
layout/generic/nsTextFrameThebes.cpp
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -4827,33 +4827,37 @@ nsTextFrame::PaintOneShadow(PRUint32 aOf
   nsContextBoxBlur contextBoxBlur;
   gfxContext* shadowContext = contextBoxBlur.Init(shadowRect, 0, blurRadius,
                                                   PresContext()->AppUnitsPerDevPixel(),
                                                   aCtx, aDirtyRect, nsnull);
   if (!shadowContext)
     return;
 
   nscolor shadowColor;
-  if (aShadowDetails->mHasColor)
+  const nscolor* decorationOverrideColor;
+  if (aShadowDetails->mHasColor) {
     shadowColor = aShadowDetails->mColor;
-  else
+    decorationOverrideColor = &shadowColor;
+  } else {
     shadowColor = aForegroundColor;
+    decorationOverrideColor = nsnull;
+  }
 
   aCtx->Save();
   aCtx->NewPath();
   aCtx->SetColor(gfxRGBA(shadowColor));
 
   // Draw the text onto our alpha-only surface to capture the alpha values.
   // Remember that the box blur context has a device offset on it, so we don't need to
   // translate any coordinates to fit on the surface.
   gfxFloat advanceWidth;
   DrawText(shadowContext, aFramePt + shadowOffset,
            aTextBaselinePt + shadowOffset, aOffset, aLength, *aProvider,
            nsTextPaintStyle(this), aClipEdges, advanceWidth,
-           (GetStateBits() & TEXT_HYPHEN_BREAK) != 0, &shadowColor);
+           (GetStateBits() & TEXT_HYPHEN_BREAK) != 0, decorationOverrideColor);
 
   contextBoxBlur.DoPaint();
   aCtx->Restore();
 }
 
 // Paints selection backgrounds and text in the correct colors. Also computes
 // aAllTypes, the union of all selection types that are applying to this text.
 bool