зеркало из https://github.com/mozilla/gecko-dev.git
Bug 59109 Part 3: Implement text-decoration-color and text-decoration-style rendering r=dbaron
This commit is contained in:
Родитель
8de7beda92
Коммит
fcb9c01bf9
|
@ -239,6 +239,8 @@ input > .anonymous-div {
|
|||
/* XXXldb I'm not sure if we really want the 'text-decoration: inherit',
|
||||
but it's needed to make 'text-decoration' "work" on text inputs. */
|
||||
text-decoration: inherit;
|
||||
-moz-text-decoration-color: inherit;
|
||||
-moz-text-decoration-style: inherit;
|
||||
}
|
||||
|
||||
input:disabled,
|
||||
|
|
|
@ -6076,6 +6076,7 @@ nsBlockFrame::PaintTextDecorationLine(gfxContext* aCtx,
|
|||
const nsPoint& aPt,
|
||||
nsLineBox* aLine,
|
||||
nscolor aColor,
|
||||
PRUint8 aStyle,
|
||||
gfxFloat aOffset,
|
||||
gfxFloat aAscent,
|
||||
gfxFloat aSize,
|
||||
|
@ -6096,7 +6097,7 @@ nsBlockFrame::PaintTextDecorationLine(gfxContext* aCtx,
|
|||
nsCSSRendering::PaintDecorationLine(
|
||||
aCtx, aColor, pt, size,
|
||||
PresContext()->AppUnitsToGfxUnits(aLine->GetAscent()),
|
||||
aOffset, aDecoration, NS_STYLE_TEXT_DECORATION_STYLE_SOLID);
|
||||
aOffset, aDecoration, aStyle);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -369,6 +369,7 @@ protected:
|
|||
const nsPoint& aPt,
|
||||
nsLineBox* aLine,
|
||||
nscolor aColor,
|
||||
PRUint8 aStyle,
|
||||
gfxFloat aOffset,
|
||||
gfxFloat aAscent,
|
||||
gfxFloat aSize,
|
||||
|
|
|
@ -75,9 +75,9 @@ class nsDisplayTextDecoration : public nsDisplayItem {
|
|||
public:
|
||||
nsDisplayTextDecoration(nsDisplayListBuilder* aBuilder,
|
||||
nsHTMLContainerFrame* aFrame, PRUint8 aDecoration,
|
||||
nscolor aColor, nsLineBox* aLine)
|
||||
nscolor aColor, PRUint8 aStyle, nsLineBox* aLine)
|
||||
: nsDisplayItem(aBuilder, aFrame), mLine(aLine), mColor(aColor),
|
||||
mDecoration(aDecoration) {
|
||||
mDecoration(aDecoration), mStyle(aStyle) {
|
||||
MOZ_COUNT_CTOR(nsDisplayTextDecoration);
|
||||
}
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
|
@ -100,6 +100,7 @@ private:
|
|||
nsLineBox* mLine;
|
||||
nscolor mColor;
|
||||
PRUint8 mDecoration;
|
||||
PRUint8 mStyle;
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -136,16 +137,16 @@ nsDisplayTextDecoration::Paint(nsDisplayListBuilder* aBuilder,
|
|||
if (mDecoration == NS_STYLE_TEXT_DECORATION_UNDERLINE) {
|
||||
gfxFloat underlineOffset = fontGroup->GetUnderlineOffset();
|
||||
f->PaintTextDecorationLine(aCtx->ThebesContext(), pt, mLine, mColor,
|
||||
underlineOffset, ascent,
|
||||
mStyle, underlineOffset, ascent,
|
||||
metrics.underlineSize, mDecoration);
|
||||
} else if (mDecoration == NS_STYLE_TEXT_DECORATION_OVERLINE) {
|
||||
f->PaintTextDecorationLine(aCtx->ThebesContext(), pt, mLine, mColor,
|
||||
metrics.maxAscent, ascent,
|
||||
mStyle, metrics.maxAscent, ascent,
|
||||
metrics.underlineSize, mDecoration);
|
||||
} else {
|
||||
f->PaintTextDecorationLine(aCtx->ThebesContext(), pt, mLine, mColor,
|
||||
metrics.strikeoutOffset, ascent,
|
||||
metrics.strikeoutSize, mDecoration);
|
||||
mStyle, metrics.strikeoutOffset,
|
||||
ascent, metrics.strikeoutSize, mDecoration);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,10 +160,12 @@ class nsDisplayTextShadow : public nsDisplayItem {
|
|||
public:
|
||||
nsDisplayTextShadow(nsDisplayListBuilder* aBuilder,
|
||||
nsHTMLContainerFrame* aFrame,
|
||||
const PRUint8 aDecoration,
|
||||
const PRUint8 aDecoration, PRUint8 aUnderlineStyle,
|
||||
PRUint8 aOverlineStyle, PRUint8 aStrikeThroughStyle,
|
||||
nsLineBox* aLine)
|
||||
: nsDisplayItem(aBuilder, aFrame), mLine(aLine),
|
||||
mDecorationFlags(aDecoration) {
|
||||
mDecorationFlags(aDecoration), mUnderlineStyle(aUnderlineStyle),
|
||||
mOverlineStyle(aOverlineStyle), mStrikeThroughStyle(aStrikeThroughStyle) {
|
||||
MOZ_COUNT_CTOR(nsDisplayTextShadow);
|
||||
}
|
||||
virtual ~nsDisplayTextShadow() {
|
||||
|
@ -176,6 +179,9 @@ public:
|
|||
private:
|
||||
nsLineBox* mLine;
|
||||
PRUint8 mDecorationFlags;
|
||||
PRUint8 mUnderlineStyle;
|
||||
PRUint8 mOverlineStyle;
|
||||
PRUint8 mStrikeThroughStyle;
|
||||
};
|
||||
|
||||
void
|
||||
|
@ -243,22 +249,20 @@ nsDisplayTextShadow::Paint(nsDisplayListBuilder* aBuilder,
|
|||
gfxSize size(lineWidth, metrics.underlineSize);
|
||||
underlineRect = nsCSSRendering::GetTextDecorationRect(presContext, size,
|
||||
ascent, underlineOffset,
|
||||
NS_STYLE_TEXT_DECORATION_UNDERLINE,
|
||||
NS_STYLE_TEXT_DECORATION_STYLE_SOLID);
|
||||
NS_STYLE_TEXT_DECORATION_UNDERLINE, mUnderlineStyle);
|
||||
}
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_OVERLINE) {
|
||||
gfxSize size(lineWidth, metrics.underlineSize);
|
||||
overlineRect = nsCSSRendering::GetTextDecorationRect(presContext, size,
|
||||
ascent, metrics.maxAscent,
|
||||
NS_STYLE_TEXT_DECORATION_OVERLINE,
|
||||
NS_STYLE_TEXT_DECORATION_STYLE_SOLID);
|
||||
NS_STYLE_TEXT_DECORATION_OVERLINE, mOverlineStyle);
|
||||
}
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_LINE_THROUGH) {
|
||||
gfxSize size(lineWidth, metrics.strikeoutSize);
|
||||
lineThroughRect = nsCSSRendering::GetTextDecorationRect(presContext, size,
|
||||
ascent, metrics.strikeoutOffset,
|
||||
NS_STYLE_TEXT_DECORATION_LINE_THROUGH,
|
||||
NS_STYLE_TEXT_DECORATION_STYLE_SOLID);
|
||||
mStrikeThroughStyle);
|
||||
}
|
||||
|
||||
for (PRUint32 i = shadowList->Length(); i > 0; --i) {
|
||||
|
@ -302,18 +306,19 @@ nsDisplayTextShadow::Paint(nsDisplayListBuilder* aBuilder,
|
|||
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_UNDERLINE) {
|
||||
f->PaintTextDecorationLine(shadowCtx, pt, mLine, shadowColor,
|
||||
underlineOffset, ascent,
|
||||
mUnderlineStyle, underlineOffset, ascent,
|
||||
metrics.underlineSize, NS_STYLE_TEXT_DECORATION_UNDERLINE);
|
||||
}
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_OVERLINE) {
|
||||
f->PaintTextDecorationLine(shadowCtx, pt, mLine, shadowColor,
|
||||
metrics.maxAscent, ascent,
|
||||
mOverlineStyle, metrics.maxAscent, ascent,
|
||||
metrics.underlineSize, NS_STYLE_TEXT_DECORATION_OVERLINE);
|
||||
}
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_LINE_THROUGH) {
|
||||
f->PaintTextDecorationLine(shadowCtx, pt, mLine, shadowColor,
|
||||
metrics.strikeoutOffset, ascent,
|
||||
metrics.strikeoutSize, NS_STYLE_TEXT_DECORATION_LINE_THROUGH);
|
||||
mStrikeThroughStyle, metrics.strikeoutOffset,
|
||||
ascent, metrics.strikeoutSize,
|
||||
NS_STYLE_TEXT_DECORATION_LINE_THROUGH);
|
||||
}
|
||||
|
||||
contextBoxBlur.DoPaint();
|
||||
|
@ -350,9 +355,11 @@ nsHTMLContainerFrame::DisplayTextDecorations(nsDisplayListBuilder* aBuilder,
|
|||
// behind children, line-through in front. For Quirks mode, see
|
||||
// nsTextFrame::PaintTextDecorations. (See bug 1777.)
|
||||
nscolor underColor, overColor, strikeColor;
|
||||
PRUint8 underStyle, overStyle, strikeStyle;
|
||||
PRUint8 decorations = NS_STYLE_TEXT_DECORATION_NONE;
|
||||
GetTextDecorations(PresContext(), aLine != nsnull, decorations, underColor,
|
||||
overColor, strikeColor);
|
||||
overColor, strikeColor, underStyle, overStyle,
|
||||
strikeStyle);
|
||||
|
||||
if (decorations == NS_STYLE_TEXT_DECORATION_NONE)
|
||||
return NS_OK;
|
||||
|
@ -362,26 +369,27 @@ nsHTMLContainerFrame::DisplayTextDecorations(nsDisplayListBuilder* aBuilder,
|
|||
// list, underneath the text and all decorations.
|
||||
if (GetStyleText()->mTextShadow) {
|
||||
rv = aBelowTextDecorations->AppendNewToTop(new (aBuilder)
|
||||
nsDisplayTextShadow(aBuilder, this, decorations, aLine));
|
||||
nsDisplayTextShadow(aBuilder, this, decorations, underStyle, overStyle,
|
||||
strikeStyle, aLine));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
if (decorations & NS_STYLE_TEXT_DECORATION_UNDERLINE) {
|
||||
rv = aBelowTextDecorations->AppendNewToTop(new (aBuilder)
|
||||
nsDisplayTextDecoration(aBuilder, this, NS_STYLE_TEXT_DECORATION_UNDERLINE,
|
||||
underColor, aLine));
|
||||
underColor, underStyle, aLine));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
if (decorations & NS_STYLE_TEXT_DECORATION_OVERLINE) {
|
||||
rv = aBelowTextDecorations->AppendNewToTop(new (aBuilder)
|
||||
nsDisplayTextDecoration(aBuilder, this, NS_STYLE_TEXT_DECORATION_OVERLINE,
|
||||
overColor, aLine));
|
||||
overColor, overStyle, aLine));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
if (decorations & NS_STYLE_TEXT_DECORATION_LINE_THROUGH) {
|
||||
rv = aAboveTextDecorations->AppendNewToTop(new (aBuilder)
|
||||
nsDisplayTextDecoration(aBuilder, this, NS_STYLE_TEXT_DECORATION_LINE_THROUGH,
|
||||
strikeColor, aLine));
|
||||
strikeColor, strikeStyle, aLine));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -424,6 +432,7 @@ nsHTMLContainerFrame::PaintTextDecorationLine(
|
|||
const nsPoint& aPt,
|
||||
nsLineBox* aLine,
|
||||
nscolor aColor,
|
||||
PRUint8 aStyle,
|
||||
gfxFloat aOffset,
|
||||
gfxFloat aAscent,
|
||||
gfxFloat aSize,
|
||||
|
@ -442,7 +451,7 @@ nsHTMLContainerFrame::PaintTextDecorationLine(
|
|||
PresContext()->AppUnitsToGfxUnits(bp.top + aPt.y));
|
||||
gfxSize size(PresContext()->AppUnitsToGfxUnits(innerWidth), aSize);
|
||||
nsCSSRendering::PaintDecorationLine(aCtx, aColor, pt, size, aAscent, aOffset,
|
||||
aDecoration, NS_STYLE_TEXT_DECORATION_STYLE_SOLID);
|
||||
aDecoration, aStyle);
|
||||
}
|
||||
|
||||
/*virtual*/ void
|
||||
|
@ -461,7 +470,10 @@ nsHTMLContainerFrame::GetTextDecorations(nsPresContext* aPresContext,
|
|||
PRUint8& aDecorations,
|
||||
nscolor& aUnderColor,
|
||||
nscolor& aOverColor,
|
||||
nscolor& aStrikeColor)
|
||||
nscolor& aStrikeColor,
|
||||
PRUint8& aUnderStyle,
|
||||
PRUint8& aOverStyle,
|
||||
PRUint8& aStrikeStyle)
|
||||
{
|
||||
aDecorations = NS_STYLE_TEXT_DECORATION_NONE;
|
||||
if (!mStyleContext->HasTextDecorations()) {
|
||||
|
@ -471,13 +483,15 @@ nsHTMLContainerFrame::GetTextDecorations(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
if (!aIsBlock) {
|
||||
aDecorations = this->GetStyleTextReset()->mTextDecoration &
|
||||
const nsStyleTextReset* styleTextReset = this->GetStyleTextReset();
|
||||
aDecorations = styleTextReset->mTextDecoration &
|
||||
NS_STYLE_TEXT_DECORATION_LINES_MASK;
|
||||
if (aDecorations) {
|
||||
nscolor color = this->GetVisitedDependentColor(eCSSProperty_color);
|
||||
aUnderColor = color;
|
||||
aOverColor = color;
|
||||
aStrikeColor = color;
|
||||
nscolor color =
|
||||
this->GetVisitedDependentColor(eCSSProperty_text_decoration_color);
|
||||
aUnderColor = aOverColor = aStrikeColor = color;
|
||||
aUnderStyle = aOverStyle = aStrikeStyle =
|
||||
styleTextReset->GetDecorationStyle();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -491,23 +505,29 @@ nsHTMLContainerFrame::GetTextDecorations(nsPresContext* aPresContext,
|
|||
|
||||
// walk tree
|
||||
for (nsIFrame* frame = this; frame; frame = frame->GetParent()) {
|
||||
PRUint8 decors = frame->GetStyleTextReset()->mTextDecoration & decorMask;
|
||||
const nsStyleTextReset* styleTextReset = frame->GetStyleTextReset();
|
||||
PRUint8 decors = styleTextReset->mTextDecoration & decorMask;
|
||||
if (decors) {
|
||||
// A *new* text-decoration is found.
|
||||
nscolor color = frame->GetVisitedDependentColor(eCSSProperty_color);
|
||||
nscolor color = frame->GetVisitedDependentColor(
|
||||
eCSSProperty_text_decoration_color);
|
||||
PRUint8 style = styleTextReset->GetDecorationStyle();
|
||||
|
||||
if (NS_STYLE_TEXT_DECORATION_UNDERLINE & decors) {
|
||||
aUnderColor = color;
|
||||
aUnderStyle = style;
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_UNDERLINE;
|
||||
aDecorations |= NS_STYLE_TEXT_DECORATION_UNDERLINE;
|
||||
}
|
||||
if (NS_STYLE_TEXT_DECORATION_OVERLINE & decors) {
|
||||
aOverColor = color;
|
||||
aOverStyle = style;
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_OVERLINE;
|
||||
aDecorations |= NS_STYLE_TEXT_DECORATION_OVERLINE;
|
||||
}
|
||||
if (NS_STYLE_TEXT_DECORATION_LINE_THROUGH & decors) {
|
||||
aStrikeColor = color;
|
||||
aStrikeStyle = style;
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_LINE_THROUGH;
|
||||
aDecorations |= NS_STYLE_TEXT_DECORATION_LINE_THROUGH;
|
||||
}
|
||||
|
|
|
@ -144,6 +144,18 @@ protected:
|
|||
* in aDecoration is set. It is undefined otherwise.
|
||||
* @param aStrikeColor The color of strike-through if the appropriate bit
|
||||
* in aDecoration is set. It is undefined otherwise.
|
||||
* @param aUnderStyle The style of underline if the appropriate bit
|
||||
* in aDecoration is set. It is undefined otherwise.
|
||||
* The style is one of
|
||||
* NS_STYLE_TEXT_DECORATION_STYLE_* consts.
|
||||
* @param aOverStyle The style of overline if the appropriate bit
|
||||
* in aDecoration is set. It is undefined otherwise.
|
||||
* The style is one of
|
||||
* NS_STYLE_TEXT_DECORATION_STYLE_* consts.
|
||||
* @param aStrikeStyle The style of strike-through if the appropriate bit
|
||||
* in aDecoration is set. It is undefined otherwise.
|
||||
* The style is one of
|
||||
* NS_STYLE_TEXT_DECORATION_STYLE_* consts.
|
||||
* NOTE: This function assigns NS_STYLE_TEXT_DECORATION_NONE to
|
||||
* aDecorations for text-less frames. See bug 20163 for
|
||||
* details.
|
||||
|
@ -153,7 +165,10 @@ protected:
|
|||
PRUint8& aDecorations,
|
||||
nscolor& aUnderColor,
|
||||
nscolor& aOverColor,
|
||||
nscolor& aStrikeColor);
|
||||
nscolor& aStrikeColor,
|
||||
PRUint8& aUnderStyle,
|
||||
PRUint8& aOverStyle,
|
||||
PRUint8& aStrikeStyle);
|
||||
|
||||
/**
|
||||
* Function that does the actual drawing of the textdecoration.
|
||||
|
@ -161,6 +176,8 @@ protected:
|
|||
* @param aCtx the Thebes graphics context to draw on
|
||||
* @param aLine the line, or nsnull if this is an inline frame
|
||||
* @param aColor the color of the text-decoration
|
||||
* @param aStyle the style of the text-decoration, i.e., one of
|
||||
* NS_STYLE_TEXT_DECORATION_STYLE_* consts.
|
||||
* @param aAscent ascent of the font from which the
|
||||
* text-decoration was derived.
|
||||
* @param aOffset distance *above* baseline where the
|
||||
|
@ -177,6 +194,7 @@ protected:
|
|||
const nsPoint& aPt,
|
||||
nsLineBox* aLine,
|
||||
nscolor aColor,
|
||||
PRUint8 aStyle,
|
||||
gfxFloat aOffset,
|
||||
gfxFloat aAscent,
|
||||
gfxFloat aSize,
|
||||
|
|
|
@ -432,13 +432,19 @@ protected:
|
|||
|
||||
struct TextDecorations {
|
||||
PRUint8 mDecorations;
|
||||
PRUint8 mOverStyle;
|
||||
PRUint8 mUnderStyle;
|
||||
PRUint8 mStrikeStyle;
|
||||
nscolor mOverColor;
|
||||
nscolor mUnderColor;
|
||||
nscolor mStrikeColor;
|
||||
|
||||
TextDecorations() :
|
||||
mDecorations(0), mOverColor(NS_RGB(0, 0, 0)),
|
||||
mUnderColor(NS_RGB(0, 0, 0)), mStrikeColor(NS_RGB(0, 0, 0))
|
||||
mDecorations(0), mOverStyle(NS_STYLE_TEXT_DECORATION_STYLE_SOLID),
|
||||
mUnderStyle(NS_STYLE_TEXT_DECORATION_STYLE_SOLID),
|
||||
mStrikeStyle(NS_STYLE_TEXT_DECORATION_STYLE_SOLID),
|
||||
mOverColor(NS_RGB(0, 0, 0)), mUnderColor(NS_RGB(0, 0, 0)),
|
||||
mStrikeColor(NS_RGB(0, 0, 0))
|
||||
{ }
|
||||
|
||||
PRBool HasDecorationlines() {
|
||||
|
|
|
@ -4261,13 +4261,15 @@ 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->GetVisitedDependentColor(eCSSProperty_color);
|
||||
overrideColor = context->GetVisitedDependentColor(
|
||||
eCSSProperty_text_decoration_color);
|
||||
}
|
||||
|
||||
// FIXME: see above (remove this check)
|
||||
PRUint8 useDecorations = decorMask & styleText->mTextDecoration;
|
||||
if (useDecorations) {// a decoration defined here
|
||||
nscolor color = context->GetVisitedDependentColor(eCSSProperty_color);
|
||||
nscolor color = context->GetVisitedDependentColor(
|
||||
eCSSProperty_text_decoration_color);
|
||||
|
||||
// FIXME: We also need to record the thickness and position
|
||||
// metrics appropriate to this element (at least in standards
|
||||
|
@ -4280,16 +4282,19 @@ nsTextFrame::GetTextDecorations(nsPresContext* aPresContext)
|
|||
// This way we move the decorations for relative positioning.
|
||||
if (NS_STYLE_TEXT_DECORATION_UNDERLINE & useDecorations) {
|
||||
decorations.mUnderColor = useOverride ? overrideColor : color;
|
||||
decorations.mUnderStyle = styleText->GetDecorationStyle();
|
||||
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;
|
||||
decorations.mOverStyle = styleText->GetDecorationStyle();
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_OVERLINE;
|
||||
decorations.mDecorations |= NS_STYLE_TEXT_DECORATION_OVERLINE;
|
||||
}
|
||||
if (NS_STYLE_TEXT_DECORATION_LINE_THROUGH & useDecorations) {
|
||||
decorations.mStrikeColor = useOverride ? overrideColor : color;
|
||||
decorations.mStrikeStyle = styleText->GetDecorationStyle();
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_LINE_THROUGH;
|
||||
decorations.mDecorations |= NS_STYLE_TEXT_DECORATION_LINE_THROUGH;
|
||||
}
|
||||
|
@ -4384,8 +4389,7 @@ nsTextFrame::PaintTextDecorations(gfxContext* aCtx, const gfxRect& aDirtyRect,
|
|||
size.height = fontMetrics.underlineSize;
|
||||
nsCSSRendering::PaintDecorationLine(
|
||||
aCtx, lineColor, pt, size, ascent, fontMetrics.maxAscent,
|
||||
NS_STYLE_TEXT_DECORATION_OVERLINE,
|
||||
NS_STYLE_TEXT_DECORATION_STYLE_SOLID);
|
||||
NS_STYLE_TEXT_DECORATION_OVERLINE, decorations.mOverStyle);
|
||||
}
|
||||
if (decorations.HasUnderline()) {
|
||||
lineColor = aOverrideColor ? *aOverrideColor : decorations.mUnderColor;
|
||||
|
@ -4393,8 +4397,7 @@ nsTextFrame::PaintTextDecorations(gfxContext* aCtx, const gfxRect& aDirtyRect,
|
|||
gfxFloat offset = aProvider.GetFontGroup()->GetUnderlineOffset();
|
||||
nsCSSRendering::PaintDecorationLine(
|
||||
aCtx, lineColor, pt, size, ascent, offset,
|
||||
NS_STYLE_TEXT_DECORATION_UNDERLINE,
|
||||
NS_STYLE_TEXT_DECORATION_STYLE_SOLID);
|
||||
NS_STYLE_TEXT_DECORATION_UNDERLINE, decorations.mUnderStyle);
|
||||
}
|
||||
if (decorations.HasStrikeout()) {
|
||||
lineColor = aOverrideColor ? *aOverrideColor : decorations.mStrikeColor;
|
||||
|
@ -4402,8 +4405,7 @@ nsTextFrame::PaintTextDecorations(gfxContext* aCtx, const gfxRect& aDirtyRect,
|
|||
gfxFloat offset = fontMetrics.strikeoutOffset;
|
||||
nsCSSRendering::PaintDecorationLine(
|
||||
aCtx, lineColor, pt, size, ascent, offset,
|
||||
NS_STYLE_TEXT_DECORATION_LINE_THROUGH,
|
||||
NS_STYLE_TEXT_DECORATION_STYLE_SOLID);
|
||||
NS_STYLE_TEXT_DECORATION_LINE_THROUGH, decorations.mStrikeStyle);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -165,6 +165,8 @@ input > .anonymous-div {
|
|||
/* XXXldb I'm not sure if we really want the 'text-decoration: inherit',
|
||||
but it's needed to make 'text-decoration' "work" on text inputs. */
|
||||
text-decoration: inherit;
|
||||
-moz-text-decoration-color: inherit;
|
||||
-moz-text-decoration-style: inherit;
|
||||
ime-mode: inherit;
|
||||
resize: inherit;
|
||||
}
|
||||
|
|
|
@ -425,6 +425,9 @@ nsTextBoxFrame::DrawText(nsIRenderingContext& aRenderingContext,
|
|||
nscolor overColor;
|
||||
nscolor underColor;
|
||||
nscolor strikeColor;
|
||||
PRUint8 overStyle;
|
||||
PRUint8 underStyle;
|
||||
PRUint8 strikeStyle;
|
||||
nsStyleContext* context = mStyleContext;
|
||||
|
||||
PRUint8 decorations = NS_STYLE_TEXT_DECORATION_NONE; // Begin with no decorations
|
||||
|
@ -436,20 +439,33 @@ nsTextBoxFrame::DrawText(nsIRenderingContext& aRenderingContext,
|
|||
const nsStyleTextReset* styleText = context->GetStyleTextReset();
|
||||
|
||||
if (decorMask & styleText->mTextDecoration) { // a decoration defined here
|
||||
nscolor color = aOverrideColor ? *aOverrideColor : context->GetStyleColor()->mColor;
|
||||
nscolor color;
|
||||
if (aOverrideColor) {
|
||||
color = *aOverrideColor;
|
||||
} else {
|
||||
PRBool isForeground;
|
||||
styleText->GetDecorationColor(color, isForeground);
|
||||
if (isForeground) {
|
||||
color = context->GetVisitedDependentColor(eCSSProperty_color);
|
||||
}
|
||||
}
|
||||
PRUint8 style = styleText->GetDecorationStyle();
|
||||
|
||||
if (NS_STYLE_TEXT_DECORATION_UNDERLINE & decorMask & styleText->mTextDecoration) {
|
||||
underColor = color;
|
||||
underStyle = style;
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_UNDERLINE;
|
||||
decorations |= NS_STYLE_TEXT_DECORATION_UNDERLINE;
|
||||
}
|
||||
if (NS_STYLE_TEXT_DECORATION_OVERLINE & decorMask & styleText->mTextDecoration) {
|
||||
overColor = color;
|
||||
overStyle = style;
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_OVERLINE;
|
||||
decorations |= NS_STYLE_TEXT_DECORATION_OVERLINE;
|
||||
}
|
||||
if (NS_STYLE_TEXT_DECORATION_LINE_THROUGH & decorMask & styleText->mTextDecoration) {
|
||||
strikeColor = color;
|
||||
strikeStyle = style;
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_LINE_THROUGH;
|
||||
decorations |= NS_STYLE_TEXT_DECORATION_LINE_THROUGH;
|
||||
}
|
||||
|
@ -492,15 +508,13 @@ nsTextBoxFrame::DrawText(nsIRenderingContext& aRenderingContext,
|
|||
nsCSSRendering::PaintDecorationLine(ctx, underColor,
|
||||
pt, gfxSize(width, sizePixel),
|
||||
ascentPixel, offsetPixel,
|
||||
NS_STYLE_TEXT_DECORATION_UNDERLINE,
|
||||
NS_STYLE_TEXT_DECORATION_STYLE_SOLID);
|
||||
NS_STYLE_TEXT_DECORATION_UNDERLINE, underStyle);
|
||||
}
|
||||
if (decorations & NS_FONT_DECORATION_OVERLINE) {
|
||||
nsCSSRendering::PaintDecorationLine(ctx, overColor,
|
||||
pt, gfxSize(width, sizePixel),
|
||||
ascentPixel, ascentPixel,
|
||||
NS_STYLE_TEXT_DECORATION_OVERLINE,
|
||||
NS_STYLE_TEXT_DECORATION_STYLE_SOLID);
|
||||
NS_STYLE_TEXT_DECORATION_OVERLINE, overStyle);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -583,8 +597,7 @@ nsTextBoxFrame::DrawText(nsIRenderingContext& aRenderingContext,
|
|||
gfxFloat sizePixel = presContext->AppUnitsToGfxUnits(size);
|
||||
nsCSSRendering::PaintDecorationLine(ctx, strikeColor,
|
||||
pt, gfxSize(width, sizePixel), ascentPixel, offsetPixel,
|
||||
NS_STYLE_TEXT_DECORATION_LINE_THROUGH,
|
||||
NS_STYLE_TEXT_DECORATION_STYLE_SOLID);
|
||||
NS_STYLE_TEXT_DECORATION_LINE_THROUGH, strikeStyle);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче