зеркало из https://github.com/mozilla/gecko-dev.git
Bug 647421 -moz-text-decoration-color and -moz-text-decoration-style should be reset by text-decoration r=dbaron, sr=bzbarsky
This commit is contained in:
Родитель
f919596523
Коммит
1adf21f3e7
|
@ -241,13 +241,13 @@ MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
}
|
||||
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(TextReset)) {
|
||||
// Make <a><font color="red">text</font></a> give the text a red underline
|
||||
// in quirks mode. The NS_STYLE_TEXT_DECORATION_OVERRIDE_ALL flag only
|
||||
// in quirks mode. The NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL flag only
|
||||
// affects quirks mode rendering.
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::color);
|
||||
nscolor color;
|
||||
if (value && value->GetColorValue(color)) {
|
||||
nsCSSValue* decoration = aData->ValueForTextDecoration();
|
||||
PRInt32 newValue = NS_STYLE_TEXT_DECORATION_OVERRIDE_ALL;
|
||||
nsCSSValue* decoration = aData->ValueForTextDecorationLine();
|
||||
PRInt32 newValue = NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL;
|
||||
if (decoration->GetUnit() == eCSSUnit_Enumerated) {
|
||||
newValue |= decoration->GetIntValue();
|
||||
}
|
||||
|
|
|
@ -273,7 +273,9 @@ nsSMILCSSProperty::IsPropertyAnimatable(nsCSSProperty aPropID)
|
|||
case eCSSProperty_stroke_opacity:
|
||||
case eCSSProperty_stroke_width:
|
||||
case eCSSProperty_text_anchor:
|
||||
case eCSSProperty_text_blink:
|
||||
case eCSSProperty_text_decoration:
|
||||
case eCSSProperty_text_decoration_line:
|
||||
case eCSSProperty_text_rendering:
|
||||
case eCSSProperty_visibility:
|
||||
case eCSSProperty_word_spacing:
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
* http://www.w3.org/TR/DOM-Level-2-Style
|
||||
*/
|
||||
|
||||
[scriptable, uuid(f28df617-ac8b-48e0-8094-c4642ab43940)]
|
||||
[scriptable, uuid(35c15ba1-932d-4a95-8f08-ddcdd50c041a)]
|
||||
interface nsIDOMCSS2Properties : nsISupports
|
||||
{
|
||||
attribute DOMString background;
|
||||
|
@ -677,9 +677,15 @@ interface nsIDOMCSS2Properties : nsISupports
|
|||
attribute DOMString backgroundSize;
|
||||
// raises(DOMException) on setting
|
||||
|
||||
attribute DOMString MozTextBlink;
|
||||
// raises(DOMException) on setting
|
||||
|
||||
attribute DOMString MozTextDecorationColor;
|
||||
// raises(DOMException) on setting
|
||||
|
||||
attribute DOMString MozTextDecorationLine;
|
||||
// raises(DOMException) on setting
|
||||
|
||||
attribute DOMString MozTextDecorationStyle;
|
||||
// raises(DOMException) on setting
|
||||
|
||||
|
|
|
@ -3414,10 +3414,9 @@ nsCSSRendering::PaintDecorationLine(gfxContext* aGfxContext,
|
|||
if (rect.IsEmpty())
|
||||
return;
|
||||
|
||||
if (aDecoration != NS_STYLE_TEXT_DECORATION_UNDERLINE &&
|
||||
aDecoration != NS_STYLE_TEXT_DECORATION_OVERLINE &&
|
||||
aDecoration != NS_STYLE_TEXT_DECORATION_LINE_THROUGH)
|
||||
{
|
||||
if (aDecoration != NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE &&
|
||||
aDecoration != NS_STYLE_TEXT_DECORATION_LINE_OVERLINE &&
|
||||
aDecoration != NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH) {
|
||||
NS_ERROR("Invalid decoration value!");
|
||||
return;
|
||||
}
|
||||
|
@ -3703,7 +3702,7 @@ nsCSSRendering::GetTextDecorationRectInternal(const gfxPoint& aPt,
|
|||
gfxFloat baseline = NS_floor(aPt.y + aAscent + 0.5);
|
||||
gfxFloat offset = 0.0;
|
||||
switch (aDecoration) {
|
||||
case NS_STYLE_TEXT_DECORATION_UNDERLINE:
|
||||
case NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE:
|
||||
offset = aOffset;
|
||||
if (canLiftUnderline) {
|
||||
if (descentLimit < -offset + r.Height()) {
|
||||
|
@ -3717,10 +3716,10 @@ nsCSSRendering::GetTextDecorationRectInternal(const gfxPoint& aPt,
|
|||
}
|
||||
}
|
||||
break;
|
||||
case NS_STYLE_TEXT_DECORATION_OVERLINE:
|
||||
case NS_STYLE_TEXT_DECORATION_LINE_OVERLINE:
|
||||
offset = aOffset - lineHeight + r.Height();
|
||||
break;
|
||||
case NS_STYLE_TEXT_DECORATION_LINE_THROUGH: {
|
||||
case NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH: {
|
||||
gfxFloat extra = NS_floor(r.Height() / 2.0 + 0.5);
|
||||
extra = NS_MAX(extra, lineHeight);
|
||||
offset = aOffset - lineHeight + extra;
|
||||
|
|
|
@ -301,9 +301,9 @@ struct nsCSSRendering {
|
|||
* the baseline of the text (if the value is
|
||||
* positive, the line is lifted up)
|
||||
* @param aDecoration which line will be painted. The value can be
|
||||
* NS_STYLE_TEXT_DECORATION_UNDERLINE or
|
||||
* NS_STYLE_TEXT_DECORATION_OVERLINE or
|
||||
* NS_STYLE_TEXT_DECORATION_LINE_THROUGH.
|
||||
* NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE or
|
||||
* NS_STYLE_TEXT_DECORATION_LINE_OVERLINE or
|
||||
* NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH.
|
||||
* @param aStyle the style of the decoration line such as
|
||||
* NS_STYLE_TEXT_DECORATION_STYLE_*.
|
||||
* @param aDescentLimit If aDescentLimit is zero or larger and the
|
||||
|
@ -341,9 +341,9 @@ struct nsCSSRendering {
|
|||
* the baseline of the text (if the value is
|
||||
* positive, the line is lifted up)
|
||||
* @param aDecoration which line will be painted. The value can be
|
||||
* NS_STYLE_TEXT_DECORATION_UNDERLINE or
|
||||
* NS_STYLE_TEXT_DECORATION_OVERLINE or
|
||||
* NS_STYLE_TEXT_DECORATION_LINE_THROUGH.
|
||||
* NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE or
|
||||
* NS_STYLE_TEXT_DECORATION_LINE_OVERLINE or
|
||||
* NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH.
|
||||
* @param aStyle the style of the decoration line such as
|
||||
* NS_STYLE_TEXT_DECORATION_STYLE_*.
|
||||
* @param aDescentLimit If aDescentLimit is zero or larger and the
|
||||
|
|
|
@ -633,17 +633,20 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
|
|||
// Note: make sure that the largest NS_STYLE_TEXT_ALIGN_* value is smaller than
|
||||
// the smallest NS_STYLE_VERTICAL_ALIGN_* value below!
|
||||
|
||||
// See nsStyleText
|
||||
#define NS_STYLE_TEXT_BLINK_NONE 0
|
||||
#define NS_STYLE_TEXT_BLINK_BLINK 1
|
||||
|
||||
// See nsStyleText, nsStyleFont
|
||||
#define NS_STYLE_TEXT_DECORATION_NONE 0
|
||||
#define NS_STYLE_TEXT_DECORATION_UNDERLINE NS_FONT_DECORATION_UNDERLINE
|
||||
#define NS_STYLE_TEXT_DECORATION_OVERLINE NS_FONT_DECORATION_OVERLINE
|
||||
#define NS_STYLE_TEXT_DECORATION_LINE_THROUGH NS_FONT_DECORATION_LINE_THROUGH
|
||||
#define NS_STYLE_TEXT_DECORATION_BLINK 0x08
|
||||
#define NS_STYLE_TEXT_DECORATION_PREF_ANCHORS 0x10
|
||||
#define NS_STYLE_TEXT_DECORATION_LINE_NONE 0
|
||||
#define NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE NS_FONT_DECORATION_UNDERLINE
|
||||
#define NS_STYLE_TEXT_DECORATION_LINE_OVERLINE NS_FONT_DECORATION_OVERLINE
|
||||
#define NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH NS_FONT_DECORATION_LINE_THROUGH
|
||||
#define NS_STYLE_TEXT_DECORATION_LINE_PREF_ANCHORS 0x10
|
||||
// OVERRIDE_ALL does not occur in stylesheets; it only comes from HTML
|
||||
// attribute mapping (and thus appears in computed data)
|
||||
#define NS_STYLE_TEXT_DECORATION_OVERRIDE_ALL 0x20
|
||||
#define NS_STYLE_TEXT_DECORATION_LINES_MASK (NS_STYLE_TEXT_DECORATION_UNDERLINE | NS_STYLE_TEXT_DECORATION_OVERLINE | NS_STYLE_TEXT_DECORATION_LINE_THROUGH)
|
||||
#define NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL 0x20
|
||||
#define NS_STYLE_TEXT_DECORATION_LINE_LINES_MASK (NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE | NS_STYLE_TEXT_DECORATION_LINE_OVERLINE | NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH)
|
||||
|
||||
// See nsStyleText
|
||||
#define NS_STYLE_TEXT_DECORATION_STYLE_NONE 0 // not in CSS spec, mapped to -moz-none
|
||||
|
|
|
@ -859,8 +859,9 @@ nsRect
|
|||
nsBlockFrame::ComputeTightBounds(gfxContext* aContext) const
|
||||
{
|
||||
// be conservative
|
||||
if (GetStyleContext()->HasTextDecorations())
|
||||
if (GetStyleContext()->HasTextDecorationLines()) {
|
||||
return GetVisualOverflowRect();
|
||||
}
|
||||
return ComputeSimpleTightBounds(aContext);
|
||||
}
|
||||
|
||||
|
|
|
@ -130,12 +130,12 @@ nsDisplayTextDecoration::Paint(nsDisplayListBuilder* aBuilder,
|
|||
|
||||
nsPoint pt = ToReferenceFrame();
|
||||
nsHTMLContainerFrame* f = static_cast<nsHTMLContainerFrame*>(mFrame);
|
||||
if (mDecoration == NS_STYLE_TEXT_DECORATION_UNDERLINE) {
|
||||
if (mDecoration == NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE) {
|
||||
gfxFloat underlineOffset = fontGroup->GetUnderlineOffset();
|
||||
f->PaintTextDecorationLine(aCtx->ThebesContext(), pt, mLine, mColor,
|
||||
mStyle, underlineOffset, ascent,
|
||||
metrics.underlineSize, mDecoration);
|
||||
} else if (mDecoration == NS_STYLE_TEXT_DECORATION_OVERLINE) {
|
||||
} else if (mDecoration == NS_STYLE_TEXT_DECORATION_LINE_OVERLINE) {
|
||||
f->PaintTextDecorationLine(aCtx->ThebesContext(), pt, mLine, mColor,
|
||||
mStyle, metrics.maxAscent, ascent,
|
||||
metrics.underlineSize, mDecoration);
|
||||
|
@ -240,23 +240,24 @@ nsDisplayTextShadow::Paint(nsDisplayListBuilder* aBuilder,
|
|||
nsRect underlineRect;
|
||||
nsRect overlineRect;
|
||||
nsRect lineThroughRect;
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_UNDERLINE) {
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE) {
|
||||
gfxSize size(lineWidth, metrics.underlineSize);
|
||||
underlineRect = nsCSSRendering::GetTextDecorationRect(presContext, size,
|
||||
ascent, underlineOffset,
|
||||
NS_STYLE_TEXT_DECORATION_UNDERLINE, mUnderlineStyle);
|
||||
NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE,
|
||||
mUnderlineStyle);
|
||||
}
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_OVERLINE) {
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_LINE_OVERLINE) {
|
||||
gfxSize size(lineWidth, metrics.underlineSize);
|
||||
overlineRect = nsCSSRendering::GetTextDecorationRect(presContext, size,
|
||||
ascent, metrics.maxAscent,
|
||||
NS_STYLE_TEXT_DECORATION_OVERLINE, mOverlineStyle);
|
||||
NS_STYLE_TEXT_DECORATION_LINE_OVERLINE, mOverlineStyle);
|
||||
}
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_LINE_THROUGH) {
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_LINE_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_LINE_LINE_THROUGH,
|
||||
mStrikeThroughStyle);
|
||||
}
|
||||
|
||||
|
@ -276,13 +277,13 @@ nsDisplayTextShadow::Paint(nsDisplayListBuilder* aBuilder,
|
|||
}
|
||||
|
||||
nsRect shadowRect(0, 0, 0, 0);
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_UNDERLINE) {
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE) {
|
||||
shadowRect.UnionRect(shadowRect, underlineRect + linePt);
|
||||
}
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_OVERLINE) {
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_LINE_OVERLINE) {
|
||||
shadowRect.UnionRect(shadowRect, overlineRect + linePt);
|
||||
}
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_LINE_THROUGH) {
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH) {
|
||||
shadowRect.UnionRect(shadowRect, lineThroughRect + linePt);
|
||||
}
|
||||
|
||||
|
@ -299,21 +300,23 @@ nsDisplayTextShadow::Paint(nsDisplayListBuilder* aBuilder,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_UNDERLINE) {
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE) {
|
||||
f->PaintTextDecorationLine(shadowCtx, pt, mLine, shadowColor,
|
||||
mUnderlineStyle, underlineOffset, ascent,
|
||||
metrics.underlineSize, NS_STYLE_TEXT_DECORATION_UNDERLINE);
|
||||
metrics.underlineSize,
|
||||
NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE);
|
||||
}
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_OVERLINE) {
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_LINE_OVERLINE) {
|
||||
f->PaintTextDecorationLine(shadowCtx, pt, mLine, shadowColor,
|
||||
mOverlineStyle, metrics.maxAscent, ascent,
|
||||
metrics.underlineSize, NS_STYLE_TEXT_DECORATION_OVERLINE);
|
||||
metrics.underlineSize,
|
||||
NS_STYLE_TEXT_DECORATION_LINE_OVERLINE);
|
||||
}
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_LINE_THROUGH) {
|
||||
if (mDecorationFlags & NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH) {
|
||||
f->PaintTextDecorationLine(shadowCtx, pt, mLine, shadowColor,
|
||||
mStrikeThroughStyle, metrics.strikeoutOffset,
|
||||
ascent, metrics.strikeoutSize,
|
||||
NS_STYLE_TEXT_DECORATION_LINE_THROUGH);
|
||||
NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH);
|
||||
}
|
||||
|
||||
contextBoxBlur.DoPaint();
|
||||
|
@ -350,12 +353,12 @@ nsHTMLContainerFrame::DisplayTextDecorations(nsDisplayListBuilder* aBuilder,
|
|||
// nsTextFrame::PaintTextDecorations. (See bug 1777.)
|
||||
nscolor underColor, overColor, strikeColor;
|
||||
PRUint8 underStyle, overStyle, strikeStyle;
|
||||
PRUint8 decorations = NS_STYLE_TEXT_DECORATION_NONE;
|
||||
PRUint8 decorations = NS_STYLE_TEXT_DECORATION_LINE_NONE;
|
||||
GetTextDecorations(PresContext(), aLine != nsnull, decorations, underColor,
|
||||
overColor, strikeColor, underStyle, overStyle,
|
||||
strikeStyle);
|
||||
|
||||
if (decorations == NS_STYLE_TEXT_DECORATION_NONE) {
|
||||
if (decorations == NS_STYLE_TEXT_DECORATION_LINE_NONE) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -369,24 +372,27 @@ nsHTMLContainerFrame::DisplayTextDecorations(nsDisplayListBuilder* aBuilder,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
if ((decorations & NS_STYLE_TEXT_DECORATION_UNDERLINE) &&
|
||||
if ((decorations & NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE) &&
|
||||
underStyle != NS_STYLE_TEXT_DECORATION_STYLE_NONE) {
|
||||
rv = aBelowTextDecorations->AppendNewToTop(new (aBuilder)
|
||||
nsDisplayTextDecoration(aBuilder, this, NS_STYLE_TEXT_DECORATION_UNDERLINE,
|
||||
nsDisplayTextDecoration(aBuilder, this,
|
||||
NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE,
|
||||
underColor, underStyle, aLine));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
if ((decorations & NS_STYLE_TEXT_DECORATION_OVERLINE) &&
|
||||
if ((decorations & NS_STYLE_TEXT_DECORATION_LINE_OVERLINE) &&
|
||||
overStyle != NS_STYLE_TEXT_DECORATION_STYLE_NONE) {
|
||||
rv = aBelowTextDecorations->AppendNewToTop(new (aBuilder)
|
||||
nsDisplayTextDecoration(aBuilder, this, NS_STYLE_TEXT_DECORATION_OVERLINE,
|
||||
nsDisplayTextDecoration(aBuilder, this,
|
||||
NS_STYLE_TEXT_DECORATION_LINE_OVERLINE,
|
||||
overColor, overStyle, aLine));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
if ((decorations & NS_STYLE_TEXT_DECORATION_LINE_THROUGH) &&
|
||||
if ((decorations & NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH) &&
|
||||
strikeStyle != NS_STYLE_TEXT_DECORATION_STYLE_NONE) {
|
||||
rv = aAboveTextDecorations->AppendNewToTop(new (aBuilder)
|
||||
nsDisplayTextDecoration(aBuilder, this, NS_STYLE_TEXT_DECORATION_LINE_THROUGH,
|
||||
nsDisplayTextDecoration(aBuilder, this,
|
||||
NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH,
|
||||
strikeColor, strikeStyle, aLine));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
@ -473,8 +479,8 @@ nsHTMLContainerFrame::GetTextDecorations(nsPresContext* aPresContext,
|
|||
PRUint8& aOverStyle,
|
||||
PRUint8& aStrikeStyle)
|
||||
{
|
||||
aDecorations = NS_STYLE_TEXT_DECORATION_NONE;
|
||||
if (!mStyleContext->HasTextDecorations()) {
|
||||
aDecorations = NS_STYLE_TEXT_DECORATION_LINE_NONE;
|
||||
if (!mStyleContext->HasTextDecorationLines()) {
|
||||
// This is a necessary, but not sufficient, condition for text
|
||||
// decorations.
|
||||
return;
|
||||
|
@ -482,8 +488,8 @@ nsHTMLContainerFrame::GetTextDecorations(nsPresContext* aPresContext,
|
|||
|
||||
if (!aIsBlock) {
|
||||
const nsStyleTextReset* styleTextReset = this->GetStyleTextReset();
|
||||
aDecorations = styleTextReset->mTextDecoration &
|
||||
NS_STYLE_TEXT_DECORATION_LINES_MASK;
|
||||
aDecorations = styleTextReset->mTextDecorationLine &
|
||||
NS_STYLE_TEXT_DECORATION_LINE_LINES_MASK;
|
||||
if (aDecorations) {
|
||||
nscolor color =
|
||||
this->GetVisitedDependentColor(eCSSProperty_text_decoration_color);
|
||||
|
@ -499,35 +505,35 @@ nsHTMLContainerFrame::GetTextDecorations(nsPresContext* aPresContext,
|
|||
// must win. At any point in the loop below, this variable
|
||||
// indicates which decorations we are still paying attention to;
|
||||
// it starts set to all possible decorations.
|
||||
PRUint8 decorMask = NS_STYLE_TEXT_DECORATION_LINES_MASK;
|
||||
PRUint8 decorMask = NS_STYLE_TEXT_DECORATION_LINE_LINES_MASK;
|
||||
|
||||
// walk tree
|
||||
for (nsIFrame* frame = this; frame; frame = frame->GetParent()) {
|
||||
const nsStyleTextReset* styleTextReset = frame->GetStyleTextReset();
|
||||
PRUint8 decors = styleTextReset->mTextDecoration & decorMask;
|
||||
PRUint8 decors = styleTextReset->mTextDecorationLine & decorMask;
|
||||
if (decors) {
|
||||
// A *new* text-decoration is found.
|
||||
nscolor color = frame->GetVisitedDependentColor(
|
||||
eCSSProperty_text_decoration_color);
|
||||
PRUint8 style = styleTextReset->GetDecorationStyle();
|
||||
|
||||
if (NS_STYLE_TEXT_DECORATION_UNDERLINE & decors) {
|
||||
if (NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE & decors) {
|
||||
aUnderColor = color;
|
||||
aUnderStyle = style;
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_UNDERLINE;
|
||||
aDecorations |= NS_STYLE_TEXT_DECORATION_UNDERLINE;
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE;
|
||||
aDecorations |= NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE;
|
||||
}
|
||||
if (NS_STYLE_TEXT_DECORATION_OVERLINE & decors) {
|
||||
if (NS_STYLE_TEXT_DECORATION_LINE_OVERLINE & decors) {
|
||||
aOverColor = color;
|
||||
aOverStyle = style;
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_OVERLINE;
|
||||
aDecorations |= NS_STYLE_TEXT_DECORATION_OVERLINE;
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_LINE_OVERLINE;
|
||||
aDecorations |= NS_STYLE_TEXT_DECORATION_LINE_OVERLINE;
|
||||
}
|
||||
if (NS_STYLE_TEXT_DECORATION_LINE_THROUGH & decors) {
|
||||
if (NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH & decors) {
|
||||
aStrikeColor = color;
|
||||
aStrikeStyle = style;
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_LINE_THROUGH;
|
||||
aDecorations |= NS_STYLE_TEXT_DECORATION_LINE_THROUGH;
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH;
|
||||
aDecorations |= NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH;
|
||||
}
|
||||
}
|
||||
// If all possible decorations have now been specified, no
|
||||
|
@ -565,7 +571,7 @@ nsHTMLContainerFrame::GetTextDecorations(nsPresContext* aPresContext,
|
|||
if (aDecorations) {
|
||||
// If this frame contains no text, we're required to ignore this property
|
||||
if (!HasTextFrameDescendantOrInFlow(this)) {
|
||||
aDecorations = NS_STYLE_TEXT_DECORATION_NONE;
|
||||
aDecorations = NS_STYLE_TEXT_DECORATION_LINE_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ protected:
|
|||
* 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
|
||||
* NOTE: This function assigns NS_STYLE_TEXT_DECORATION_LINE_NONE to
|
||||
* aDecorations for text-less frames. See bug 20163 for
|
||||
* details.
|
||||
* NOTE: The results of color and style for each lines were not initialized
|
||||
|
@ -172,10 +172,10 @@ protected:
|
|||
* i.e. negative offsets draws *below*
|
||||
* the baseline.
|
||||
* @param aSize the thickness of the line
|
||||
* @param aDecoration which line will be painted
|
||||
* i.e., NS_STYLE_TEXT_DECORATION_UNDERLINE or
|
||||
* NS_STYLE_TEXT_DECORATION_OVERLINE or
|
||||
* NS_STYLE_TEXT_DECORATION_LINE_THROUGH.
|
||||
* @param aDecoration which line will be painted i.e.,
|
||||
* NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE or
|
||||
* NS_STYLE_TEXT_DECORATION_LINE_OVERLINE or
|
||||
* NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH.
|
||||
*/
|
||||
virtual void PaintTextDecorationLine(gfxContext* aCtx,
|
||||
const nsPoint& aPt,
|
||||
|
|
|
@ -1878,8 +1878,7 @@ nsHTMLReflowState::InitConstraints(nsPresContext* aPresContext,
|
|||
mFlags.mBlinks = (parentReflowState && parentReflowState->mFlags.mBlinks);
|
||||
if (!mFlags.mBlinks && BlinkIsAllowed()) {
|
||||
const nsStyleTextReset* st = frame->GetStyleTextReset();
|
||||
mFlags.mBlinks =
|
||||
((st->mTextDecoration & NS_STYLE_TEXT_DECORATION_BLINK) != 0);
|
||||
mFlags.mBlinks = (st->mTextBlink != NS_STYLE_TEXT_BLINK_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -230,8 +230,9 @@ nsRect
|
|||
nsInlineFrame::ComputeTightBounds(gfxContext* aContext) const
|
||||
{
|
||||
// be conservative
|
||||
if (GetStyleContext()->HasTextDecorations())
|
||||
if (GetStyleContext()->HasTextDecorationLines()) {
|
||||
return GetVisualOverflowRect();
|
||||
}
|
||||
return ComputeSimpleTightBounds(aContext);
|
||||
}
|
||||
|
||||
|
|
|
@ -451,15 +451,15 @@ protected:
|
|||
return HasUnderline() || HasOverline() || HasStrikeout();
|
||||
}
|
||||
PRBool HasUnderline() {
|
||||
return (mDecorations & NS_STYLE_TEXT_DECORATION_UNDERLINE) &&
|
||||
return (mDecorations & NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE) &&
|
||||
mUnderStyle != NS_STYLE_TEXT_DECORATION_STYLE_NONE;
|
||||
}
|
||||
PRBool HasOverline() {
|
||||
return (mDecorations & NS_STYLE_TEXT_DECORATION_OVERLINE) &&
|
||||
return (mDecorations & NS_STYLE_TEXT_DECORATION_LINE_OVERLINE) &&
|
||||
mOverStyle != NS_STYLE_TEXT_DECORATION_STYLE_NONE;
|
||||
}
|
||||
PRBool HasStrikeout() {
|
||||
return (mDecorations & NS_STYLE_TEXT_DECORATION_LINE_THROUGH) &&
|
||||
return (mDecorations & NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH) &&
|
||||
mStrikeStyle != NS_STYLE_TEXT_DECORATION_STYLE_NONE;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -4242,21 +4242,20 @@ nsTextFrame::GetTextDecorations(nsPresContext* aPresContext)
|
|||
// A mask of all possible decorations.
|
||||
// FIXME: Per spec, we still need to draw all relevant decorations
|
||||
// from ancestors, not just the nearest one from each.
|
||||
PRUint8 decorMask = NS_STYLE_TEXT_DECORATION_UNDERLINE |
|
||||
NS_STYLE_TEXT_DECORATION_OVERLINE |
|
||||
NS_STYLE_TEXT_DECORATION_LINE_THROUGH;
|
||||
PRUint8 decorMask = NS_STYLE_TEXT_DECORATION_LINE_LINES_MASK;
|
||||
|
||||
PRBool isChild; // ignored
|
||||
for (nsIFrame* f = this; decorMask && f;
|
||||
NS_SUCCEEDED(f->GetParentStyleContextFrame(aPresContext, &f, &isChild))
|
||||
|| (f = nsnull)) {
|
||||
nsStyleContext* context = f->GetStyleContext();
|
||||
if (!context->HasTextDecorations()) {
|
||||
if (!context->HasTextDecorationLines()) {
|
||||
break;
|
||||
}
|
||||
const nsStyleTextReset* styleText = context->GetStyleTextReset();
|
||||
if (!useOverride &&
|
||||
(NS_STYLE_TEXT_DECORATION_OVERRIDE_ALL & styleText->mTextDecoration)) {
|
||||
(NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL &
|
||||
styleText->mTextDecorationLine)) {
|
||||
// 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;
|
||||
|
@ -4265,7 +4264,7 @@ nsTextFrame::GetTextDecorations(nsPresContext* aPresContext)
|
|||
}
|
||||
|
||||
// FIXME: see above (remove this check)
|
||||
PRUint8 useDecorations = decorMask & styleText->mTextDecoration;
|
||||
PRUint8 useDecorations = decorMask & styleText->mTextDecorationLine;
|
||||
if (useDecorations) {// a decoration defined here
|
||||
nscolor color = context->GetVisitedDependentColor(
|
||||
eCSSProperty_text_decoration_color);
|
||||
|
@ -4279,23 +4278,23 @@ nsTextFrame::GetTextDecorations(nsPresContext* aPresContext)
|
|||
// containing line; otherwise use the element's font); when
|
||||
// drawing it should always be relative to the line baseline.
|
||||
// This way we move the decorations for relative positioning.
|
||||
if (NS_STYLE_TEXT_DECORATION_UNDERLINE & useDecorations) {
|
||||
if (NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE & useDecorations) {
|
||||
decorations.mUnderColor = useOverride ? overrideColor : color;
|
||||
decorations.mUnderStyle = styleText->GetDecorationStyle();
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_UNDERLINE;
|
||||
decorations.mDecorations |= NS_STYLE_TEXT_DECORATION_UNDERLINE;
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE;
|
||||
decorations.mDecorations |= NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE;
|
||||
}
|
||||
if (NS_STYLE_TEXT_DECORATION_OVERLINE & useDecorations) {
|
||||
if (NS_STYLE_TEXT_DECORATION_LINE_OVERLINE & useDecorations) {
|
||||
decorations.mOverColor = useOverride ? overrideColor : color;
|
||||
decorations.mOverStyle = styleText->GetDecorationStyle();
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_OVERLINE;
|
||||
decorations.mDecorations |= NS_STYLE_TEXT_DECORATION_OVERLINE;
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_LINE_OVERLINE;
|
||||
decorations.mDecorations |= NS_STYLE_TEXT_DECORATION_LINE_OVERLINE;
|
||||
}
|
||||
if (NS_STYLE_TEXT_DECORATION_LINE_THROUGH & useDecorations) {
|
||||
if (NS_STYLE_TEXT_DECORATION_LINE_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;
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH;
|
||||
decorations.mDecorations |= NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4387,7 +4386,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, decorations.mOverStyle);
|
||||
NS_STYLE_TEXT_DECORATION_LINE_OVERLINE, decorations.mOverStyle);
|
||||
}
|
||||
if (decorations.HasUnderline()) {
|
||||
lineColor = aOverrideColor ? *aOverrideColor : decorations.mUnderColor;
|
||||
|
@ -4395,7 +4394,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, decorations.mUnderStyle);
|
||||
NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE, decorations.mUnderStyle);
|
||||
}
|
||||
if (decorations.HasStrikeout()) {
|
||||
lineColor = aOverrideColor ? *aOverrideColor : decorations.mStrikeColor;
|
||||
|
@ -4403,7 +4402,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, decorations.mStrikeStyle);
|
||||
NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH, decorations.mStrikeStyle);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4549,7 +4548,7 @@ static void DrawSelectionDecorations(gfxContext* aContext, SelectionType aType,
|
|||
size.height *= relativeSize;
|
||||
nsCSSRendering::PaintDecorationLine(
|
||||
aContext, color, pt, size, aAscent, aFontMetrics.underlineOffset,
|
||||
NS_STYLE_TEXT_DECORATION_UNDERLINE, style, descentLimit);
|
||||
NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE, style, descentLimit);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5340,9 +5339,8 @@ nsTextFrame::CombineSelectionUnderlineRect(nsPresContext* aPresContext,
|
|||
size.height *= relativeSize;
|
||||
decorationArea =
|
||||
nsCSSRendering::GetTextDecorationRect(aPresContext, size,
|
||||
ascent, underlineOffset,
|
||||
NS_STYLE_TEXT_DECORATION_UNDERLINE,
|
||||
style, descentLimit);
|
||||
ascent, underlineOffset, NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE,
|
||||
style, descentLimit);
|
||||
aRect.UnionRect(aRect, decorationArea);
|
||||
}
|
||||
DestroySelectionDetails(details);
|
||||
|
@ -6315,7 +6313,7 @@ RoundOut(const gfxRect& aRect)
|
|||
nsRect
|
||||
nsTextFrame::ComputeTightBounds(gfxContext* aContext) const
|
||||
{
|
||||
if ((GetStyleContext()->HasTextDecorations() &&
|
||||
if ((GetStyleContext()->HasTextDecorationLines() &&
|
||||
eCompatibility_NavQuirks == PresContext()->CompatibilityMode()) ||
|
||||
(GetStateBits() & TEXT_HYPHEN_BREAK)) {
|
||||
// This is conservative, but OK.
|
||||
|
|
|
@ -63,3 +63,8 @@
|
|||
here is red text with green decoration lines</span>,
|
||||
and here is blue text without decoration lines.
|
||||
</p>
|
||||
<p style="color: blue;
|
||||
text-decoration: underline line-through overline;">
|
||||
Here has blue decoration lines even though its color is specified as red
|
||||
before text-decoration.
|
||||
</p>
|
||||
|
|
|
@ -71,3 +71,9 @@
|
|||
here is red text with green decoration lines</span>,
|
||||
and here is blue text without decoration lines.
|
||||
</p>
|
||||
<p style="color: blue;
|
||||
-moz-text-decoration-color: red;
|
||||
text-decoration: underline line-through overline;">
|
||||
Here has blue decoration lines even though its color is specified as red
|
||||
before text-decoration.
|
||||
</p>
|
||||
|
|
|
@ -65,3 +65,8 @@
|
|||
here is red text with green decoration lines</span>,
|
||||
and here is blue text without decoration lines.
|
||||
</p>
|
||||
<p style="color: blue;
|
||||
text-decoration: underline line-through overline;">
|
||||
Here has blue decoration lines even though its color is specified as red
|
||||
before text-decoration.
|
||||
</p>
|
||||
|
|
|
@ -70,3 +70,9 @@
|
|||
here is red text with green decoration lines</span>,
|
||||
and here is blue text without decoration lines.
|
||||
</p>
|
||||
<p style="color: blue;
|
||||
-moz-text-decoration-color: red;
|
||||
text-decoration: underline line-through overline;">
|
||||
Here has blue decoration lines even though its color is specified as red
|
||||
before text-decoration.
|
||||
</p>
|
||||
|
|
|
@ -43,3 +43,7 @@
|
|||
<p>
|
||||
Here is specified the decoration style as -moz-none.
|
||||
</p>
|
||||
<p style="text-decoration: underline line-through overline;">
|
||||
Here has solid decoration lines even if its style is specified as dotted
|
||||
before text-decoration.
|
||||
</p>
|
||||
|
|
|
@ -35,3 +35,8 @@
|
|||
-moz-text-decoration-style: -moz-none;">
|
||||
Here is specified the decoration style as -moz-none.
|
||||
</p>
|
||||
<p style="-moz-text-decoration-style: dotted;
|
||||
text-decoration: underline line-through overline;">
|
||||
Here has solid decoration lines even if its style is specified as dotted
|
||||
before text-decoration.
|
||||
</p>
|
||||
|
|
|
@ -28,3 +28,7 @@
|
|||
<p>
|
||||
Here is specified the decoration style as -moz-none.
|
||||
</p>
|
||||
<p style="text-decoration: underline line-through overline;">
|
||||
Here has solid decoration lines even if its style is specified as dotted
|
||||
before text-decoration.
|
||||
</p>
|
||||
|
|
|
@ -27,3 +27,8 @@
|
|||
-moz-text-decoration-style: -moz-none;">
|
||||
Here is specified the decoration style as -moz-none.
|
||||
</p>
|
||||
<p style="-moz-text-decoration-style: dotted;
|
||||
text-decoration: underline line-through overline;">
|
||||
Here has solid decoration lines even if its style is specified as dotted
|
||||
before text-decoration.
|
||||
</p>
|
||||
|
|
|
@ -580,6 +580,56 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue) const
|
|||
xValue.AppendToString(eCSSProperty_overflow_x, aValue);
|
||||
break;
|
||||
}
|
||||
case eCSSProperty_text_decoration: {
|
||||
// If text-decoration-color or text-decoration-style isn't initial value,
|
||||
// we cannot serialize the text-decoration shorthand value.
|
||||
const nsCSSValue &decorationColor =
|
||||
*data->ValueFor(eCSSProperty_text_decoration_color);
|
||||
const nsCSSValue &decorationStyle =
|
||||
*data->ValueFor(eCSSProperty_text_decoration_style);
|
||||
|
||||
NS_ABORT_IF_FALSE(decorationStyle.GetUnit() == eCSSUnit_Enumerated,
|
||||
nsPrintfCString(32, "bad text-decoration-style unit %d",
|
||||
decorationStyle.GetUnit()).get());
|
||||
|
||||
if (decorationColor.GetUnit() != eCSSUnit_Enumerated ||
|
||||
decorationColor.GetIntValue() != NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR ||
|
||||
decorationStyle.GetIntValue() !=
|
||||
NS_STYLE_TEXT_DECORATION_STYLE_SOLID) {
|
||||
return;
|
||||
}
|
||||
|
||||
const nsCSSValue &textBlink =
|
||||
*data->ValueFor(eCSSProperty_text_blink);
|
||||
const nsCSSValue &decorationLine =
|
||||
*data->ValueFor(eCSSProperty_text_decoration_line);
|
||||
|
||||
NS_ABORT_IF_FALSE(textBlink.GetUnit() == eCSSUnit_Enumerated,
|
||||
nsPrintfCString(32, "bad text-blink unit %d",
|
||||
textBlink.GetUnit()).get());
|
||||
NS_ABORT_IF_FALSE(decorationLine.GetUnit() == eCSSUnit_Enumerated,
|
||||
nsPrintfCString(32, "bad text-decoration-line unit %d",
|
||||
decorationLine.GetUnit()).get());
|
||||
|
||||
PRBool blinkNone = (textBlink.GetIntValue() == NS_STYLE_TEXT_BLINK_NONE);
|
||||
PRBool lineNone =
|
||||
(decorationLine.GetIntValue() == NS_STYLE_TEXT_DECORATION_LINE_NONE);
|
||||
|
||||
if (blinkNone && lineNone) {
|
||||
AppendValueToString(eCSSProperty_text_decoration_line, aValue);
|
||||
} else {
|
||||
if (!blinkNone) {
|
||||
AppendValueToString(eCSSProperty_text_blink, aValue);
|
||||
}
|
||||
if (!lineNone) {
|
||||
if (!aValue.IsEmpty()) {
|
||||
aValue.Append(PRUnichar(' '));
|
||||
}
|
||||
AppendValueToString(eCSSProperty_text_decoration_line, aValue);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case eCSSProperty_transition: {
|
||||
const nsCSSValue &transProp =
|
||||
*data->ValueFor(eCSSProperty_transition_property);
|
||||
|
|
|
@ -522,7 +522,8 @@ protected:
|
|||
PRBool ParsePadding();
|
||||
PRBool ParseQuotes();
|
||||
PRBool ParseSize();
|
||||
PRBool ParseTextDecoration(nsCSSValue& aValue);
|
||||
PRBool ParseTextDecoration();
|
||||
PRBool ParseTextDecorationLine(nsCSSValue& aValue);
|
||||
|
||||
PRBool ParseShadowItem(nsCSSValue& aValue, PRBool aIsBoxShadow);
|
||||
PRBool ParseShadowList(nsCSSProperty aProperty);
|
||||
|
@ -5566,6 +5567,8 @@ CSSParserImpl::ParsePropertyByFunction(nsCSSProperty aPropID)
|
|||
return ParseQuotes();
|
||||
case eCSSProperty_size:
|
||||
return ParseSize();
|
||||
case eCSSProperty_text_decoration:
|
||||
return ParseTextDecoration();
|
||||
case eCSSProperty__moz_transform:
|
||||
return ParseMozTransform();
|
||||
case eCSSProperty__moz_transform_origin:
|
||||
|
@ -5625,8 +5628,8 @@ CSSParserImpl::ParseSingleValueProperty(nsCSSValue& aValue,
|
|||
return ParseFontWeight(aValue);
|
||||
case eCSSProperty_marks:
|
||||
return ParseMarks(aValue);
|
||||
case eCSSProperty_text_decoration:
|
||||
return ParseTextDecoration(aValue);
|
||||
case eCSSProperty_text_decoration_line:
|
||||
return ParseTextDecorationLine(aValue);
|
||||
default:
|
||||
NS_ABORT_IF_FALSE(PR_FALSE, "should not reach here");
|
||||
return PR_FALSE;
|
||||
|
@ -7944,19 +7947,108 @@ CSSParserImpl::ParseSize()
|
|||
}
|
||||
|
||||
PRBool
|
||||
CSSParserImpl::ParseTextDecoration(nsCSSValue& aValue)
|
||||
CSSParserImpl::ParseTextDecoration()
|
||||
{
|
||||
if (ParseVariant(aValue, VARIANT_HK, nsCSSProps::kTextDecorationKTable)) {
|
||||
enum {
|
||||
eDecorationNone = 0x00,
|
||||
eDecorationUnderline = 0x01,
|
||||
eDecorationOverline = 0x02,
|
||||
eDecorationLineThrough = 0x04,
|
||||
eDecorationBlink = 0x08,
|
||||
eDecorationPrefAnchors = 0x10
|
||||
};
|
||||
|
||||
PR_STATIC_ASSERT(eDecorationUnderline ==
|
||||
NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE);
|
||||
PR_STATIC_ASSERT(eDecorationOverline ==
|
||||
NS_STYLE_TEXT_DECORATION_LINE_OVERLINE);
|
||||
PR_STATIC_ASSERT(eDecorationLineThrough ==
|
||||
NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH);
|
||||
PR_STATIC_ASSERT(eDecorationPrefAnchors ==
|
||||
NS_STYLE_TEXT_DECORATION_LINE_PREF_ANCHORS);
|
||||
|
||||
static const PRInt32 kTextDecorationKTable[] = {
|
||||
eCSSKeyword_none, eDecorationNone,
|
||||
eCSSKeyword_underline, eDecorationUnderline,
|
||||
eCSSKeyword_overline, eDecorationOverline,
|
||||
eCSSKeyword_line_through, eDecorationLineThrough,
|
||||
eCSSKeyword_blink, eDecorationBlink,
|
||||
eCSSKeyword__moz_anchor_decoration, eDecorationPrefAnchors,
|
||||
eCSSKeyword_UNKNOWN,-1
|
||||
};
|
||||
|
||||
nsCSSValue value;
|
||||
if (!ParseVariant(value, VARIANT_HK, kTextDecorationKTable)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsCSSValue blink, line, style, color;
|
||||
switch (value.GetUnit()) {
|
||||
case eCSSUnit_Enumerated: {
|
||||
// We shouldn't accept decoration line style and color via
|
||||
// text-decoration.
|
||||
color.SetIntValue(NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR,
|
||||
eCSSUnit_Enumerated);
|
||||
style.SetIntValue(NS_STYLE_TEXT_DECORATION_STYLE_SOLID,
|
||||
eCSSUnit_Enumerated);
|
||||
|
||||
PRInt32 intValue = value.GetIntValue();
|
||||
if (intValue == eDecorationNone) {
|
||||
blink.SetIntValue(NS_STYLE_TEXT_BLINK_NONE, eCSSUnit_Enumerated);
|
||||
line.SetIntValue(NS_STYLE_TEXT_DECORATION_LINE_NONE,
|
||||
eCSSUnit_Enumerated);
|
||||
break;
|
||||
}
|
||||
|
||||
// look for more keywords
|
||||
nsCSSValue keyword;
|
||||
PRInt32 index;
|
||||
for (index = 0; index < 3; index++) {
|
||||
if (!ParseEnum(keyword, kTextDecorationKTable)) {
|
||||
break;
|
||||
}
|
||||
PRInt32 newValue = keyword.GetIntValue();
|
||||
if (newValue == eDecorationNone || newValue & intValue) {
|
||||
// 'none' keyword in conjuction with others is not allowed, and
|
||||
// duplicate keyword is not allowed.
|
||||
return PR_FALSE;
|
||||
}
|
||||
intValue |= newValue;
|
||||
}
|
||||
|
||||
blink.SetIntValue((intValue & eDecorationBlink) != 0 ?
|
||||
NS_STYLE_TEXT_BLINK_BLINK : NS_STYLE_TEXT_BLINK_NONE,
|
||||
eCSSUnit_Enumerated);
|
||||
line.SetIntValue((intValue & ~eDecorationBlink), eCSSUnit_Enumerated);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
blink = line = color = style = value;
|
||||
break;
|
||||
}
|
||||
|
||||
AppendValue(eCSSProperty_text_blink, blink);
|
||||
AppendValue(eCSSProperty_text_decoration_line, line);
|
||||
AppendValue(eCSSProperty_text_decoration_color, color);
|
||||
AppendValue(eCSSProperty_text_decoration_style, style);
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
CSSParserImpl::ParseTextDecorationLine(nsCSSValue& aValue)
|
||||
{
|
||||
if (ParseVariant(aValue, VARIANT_HK, nsCSSProps::kTextDecorationLineKTable)) {
|
||||
if (eCSSUnit_Enumerated == aValue.GetUnit()) {
|
||||
PRInt32 intValue = aValue.GetIntValue();
|
||||
if (intValue != NS_STYLE_TEXT_DECORATION_NONE) {
|
||||
if (intValue != NS_STYLE_TEXT_DECORATION_LINE_NONE) {
|
||||
// look for more keywords
|
||||
nsCSSValue keyword;
|
||||
PRInt32 index;
|
||||
for (index = 0; index < 3; index++) {
|
||||
if (ParseEnum(keyword, nsCSSProps::kTextDecorationKTable)) {
|
||||
for (index = 0; index < 2; index++) {
|
||||
if (ParseEnum(keyword, nsCSSProps::kTextDecorationLineKTable)) {
|
||||
PRInt32 newValue = keyword.GetIntValue();
|
||||
if (newValue == NS_STYLE_TEXT_DECORATION_NONE ||
|
||||
if (newValue == NS_STYLE_TEXT_DECORATION_LINE_NONE ||
|
||||
newValue & intValue) {
|
||||
// 'none' keyword in conjuction with others is not allowed, and
|
||||
// duplicate keyword is not allowed.
|
||||
|
|
|
@ -2130,16 +2130,20 @@ CSS_PROP_TEXT(
|
|||
kTextAlignKTable,
|
||||
CSS_PROP_NO_OFFSET,
|
||||
eStyleAnimType_None)
|
||||
CSS_PROP_TEXTRESET(
|
||||
CSS_PROP_SHORTHAND(
|
||||
text-decoration,
|
||||
text_decoration,
|
||||
TextDecoration,
|
||||
CSS_PROPERTY_PARSE_FUNCTION)
|
||||
CSS_PROP_TEXTRESET(
|
||||
-moz-text-blink,
|
||||
text_blink,
|
||||
CSS_PROP_DOMPROP_PREFIXED(TextBlink),
|
||||
CSS_PROPERTY_PARSE_VALUE |
|
||||
CSS_PROPERTY_VALUE_PARSER_FUNCTION |
|
||||
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE,
|
||||
0,
|
||||
kTextDecorationKTable,
|
||||
offsetof(nsStyleTextReset, mTextDecoration),
|
||||
VARIANT_HK,
|
||||
kTextBlinkKTable,
|
||||
offsetof(nsStyleTextReset, mTextBlink),
|
||||
eStyleAnimType_EnumU8)
|
||||
CSS_PROP_TEXTRESET(
|
||||
-moz-text-decoration-color,
|
||||
|
@ -2152,6 +2156,17 @@ CSS_PROP_TEXTRESET(
|
|||
kBorderColorKTable,
|
||||
CSS_PROP_NO_OFFSET,
|
||||
eStyleAnimType_Custom)
|
||||
CSS_PROP_TEXTRESET(
|
||||
-moz-text-decoration-line,
|
||||
text_decoration_line,
|
||||
CSS_PROP_DOMPROP_PREFIXED(TextDecorationLine),
|
||||
CSS_PROPERTY_PARSE_VALUE |
|
||||
CSS_PROPERTY_VALUE_PARSER_FUNCTION |
|
||||
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE,
|
||||
0,
|
||||
kTextDecorationLineKTable,
|
||||
offsetof(nsStyleTextReset, mTextDecorationLine),
|
||||
eStyleAnimType_EnumU8)
|
||||
CSS_PROP_TEXTRESET(
|
||||
-moz-text-decoration-style,
|
||||
text_decoration_style,
|
||||
|
|
|
@ -1184,13 +1184,18 @@ const PRInt32 nsCSSProps::kTextAlignKTable[] = {
|
|||
eCSSKeyword_UNKNOWN,-1
|
||||
};
|
||||
|
||||
const PRInt32 nsCSSProps::kTextDecorationKTable[] = {
|
||||
eCSSKeyword_none, NS_STYLE_TEXT_DECORATION_NONE,
|
||||
eCSSKeyword_underline, NS_STYLE_TEXT_DECORATION_UNDERLINE,
|
||||
eCSSKeyword_overline, NS_STYLE_TEXT_DECORATION_OVERLINE,
|
||||
eCSSKeyword_line_through, NS_STYLE_TEXT_DECORATION_LINE_THROUGH,
|
||||
eCSSKeyword_blink, NS_STYLE_TEXT_DECORATION_BLINK,
|
||||
eCSSKeyword__moz_anchor_decoration, NS_STYLE_TEXT_DECORATION_PREF_ANCHORS,
|
||||
const PRInt32 nsCSSProps::kTextBlinkKTable[] = {
|
||||
eCSSKeyword_none, NS_STYLE_TEXT_BLINK_NONE,
|
||||
eCSSKeyword_blink, NS_STYLE_TEXT_BLINK_BLINK,
|
||||
eCSSKeyword_UNKNOWN,-1
|
||||
};
|
||||
|
||||
const PRInt32 nsCSSProps::kTextDecorationLineKTable[] = {
|
||||
eCSSKeyword_none, NS_STYLE_TEXT_DECORATION_LINE_NONE,
|
||||
eCSSKeyword_underline, NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE,
|
||||
eCSSKeyword_overline, NS_STYLE_TEXT_DECORATION_LINE_OVERLINE,
|
||||
eCSSKeyword_line_through, NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH,
|
||||
eCSSKeyword__moz_anchor_decoration, NS_STYLE_TEXT_DECORATION_LINE_PREF_ANCHORS,
|
||||
eCSSKeyword_UNKNOWN,-1
|
||||
};
|
||||
|
||||
|
@ -2004,6 +2009,14 @@ static const nsCSSProperty gPaddingEndSubpropTable[] = {
|
|||
eCSSProperty_UNKNOWN
|
||||
};
|
||||
|
||||
static const nsCSSProperty gTextDecorationSubpropTable[] = {
|
||||
eCSSProperty_text_blink,
|
||||
eCSSProperty_text_decoration_color,
|
||||
eCSSProperty_text_decoration_line,
|
||||
eCSSProperty_text_decoration_style,
|
||||
eCSSProperty_UNKNOWN
|
||||
};
|
||||
|
||||
static const nsCSSProperty gTransitionSubpropTable[] = {
|
||||
eCSSProperty_transition_property,
|
||||
eCSSProperty_transition_duration,
|
||||
|
|
|
@ -408,7 +408,8 @@ public:
|
|||
static const PRInt32 kStackSizingKTable[];
|
||||
static const PRInt32 kTableLayoutKTable[];
|
||||
static const PRInt32 kTextAlignKTable[];
|
||||
static const PRInt32 kTextDecorationKTable[];
|
||||
static const PRInt32 kTextBlinkKTable[];
|
||||
static const PRInt32 kTextDecorationLineKTable[];
|
||||
static const PRInt32 kTextDecorationStyleKTable[];
|
||||
static const PRInt32 kTextTransformKTable[];
|
||||
static const PRInt32 kTransitionTimingFunctionKTable[];
|
||||
|
|
|
@ -790,19 +790,19 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult) const
|
|||
aResult.AppendInt(GetIntValue(), 10);
|
||||
}
|
||||
else if (eCSSUnit_Enumerated == unit) {
|
||||
if (eCSSProperty_text_decoration == aProperty) {
|
||||
if (eCSSProperty_text_decoration_line == aProperty) {
|
||||
PRInt32 intValue = GetIntValue();
|
||||
if (NS_STYLE_TEXT_DECORATION_NONE == intValue) {
|
||||
if (NS_STYLE_TEXT_DECORATION_LINE_NONE == intValue) {
|
||||
AppendASCIItoUTF16(nsCSSProps::LookupPropertyValue(aProperty, intValue),
|
||||
aResult);
|
||||
} else {
|
||||
// Ignore the "override all" internal value.
|
||||
// (It doesn't have a string representation.)
|
||||
intValue &= ~NS_STYLE_TEXT_DECORATION_OVERRIDE_ALL;
|
||||
intValue &= ~NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL;
|
||||
nsStyleUtil::AppendBitmaskCSSValue(
|
||||
aProperty, intValue,
|
||||
NS_STYLE_TEXT_DECORATION_UNDERLINE,
|
||||
NS_STYLE_TEXT_DECORATION_PREF_ANCHORS,
|
||||
NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE,
|
||||
NS_STYLE_TEXT_DECORATION_LINE_PREF_ANCHORS,
|
||||
aResult);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2261,26 +2261,48 @@ nsComputedDOMStyle::DoGetTextAlign()
|
|||
return val;
|
||||
}
|
||||
|
||||
nsIDOMCSSValue*
|
||||
nsComputedDOMStyle::DoGetMozTextBlink()
|
||||
{
|
||||
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
||||
|
||||
val->SetIdent(
|
||||
nsCSSProps::ValueToKeywordEnum(GetStyleTextReset()->mTextBlink,
|
||||
nsCSSProps::kTextBlinkKTable));
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
nsIDOMCSSValue*
|
||||
nsComputedDOMStyle::DoGetTextDecoration()
|
||||
{
|
||||
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
||||
|
||||
PRInt32 intValue = GetStyleTextReset()->mTextDecoration;
|
||||
PRUint8 line = GetStyleTextReset()->mTextDecorationLine;
|
||||
// Clear the -moz-anchor-decoration bit and the OVERRIDE_ALL bits -- we
|
||||
// don't want these to appear in the computed style.
|
||||
line &= ~(NS_STYLE_TEXT_DECORATION_LINE_PREF_ANCHORS |
|
||||
NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL);
|
||||
PRUint8 blink = GetStyleTextReset()->mTextBlink;
|
||||
|
||||
if (NS_STYLE_TEXT_DECORATION_NONE == intValue) {
|
||||
if (blink == NS_STYLE_TEXT_BLINK_NONE &&
|
||||
line == NS_STYLE_TEXT_DECORATION_LINE_NONE) {
|
||||
val->SetIdent(eCSSKeyword_none);
|
||||
} else {
|
||||
nsAutoString decorationString;
|
||||
// Clear the -moz-anchor-decoration bit and the OVERRIDE_ALL bits -- we
|
||||
// don't want these to appear in the computed style.
|
||||
intValue &= ~(NS_STYLE_TEXT_DECORATION_PREF_ANCHORS |
|
||||
NS_STYLE_TEXT_DECORATION_OVERRIDE_ALL);
|
||||
nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_text_decoration, intValue,
|
||||
NS_STYLE_TEXT_DECORATION_UNDERLINE,
|
||||
NS_STYLE_TEXT_DECORATION_BLINK,
|
||||
decorationString);
|
||||
val->SetString(decorationString);
|
||||
nsAutoString str;
|
||||
if (line != NS_STYLE_TEXT_DECORATION_LINE_NONE) {
|
||||
nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_text_decoration_line,
|
||||
line, NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE,
|
||||
NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH, str);
|
||||
}
|
||||
if (blink != NS_STYLE_TEXT_BLINK_NONE) {
|
||||
if (!str.IsEmpty()) {
|
||||
str.Append(PRUnichar(' '));
|
||||
}
|
||||
nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_text_blink, blink,
|
||||
NS_STYLE_TEXT_BLINK_BLINK, NS_STYLE_TEXT_BLINK_BLINK, str);
|
||||
}
|
||||
val->SetString(str);
|
||||
}
|
||||
|
||||
return val;
|
||||
|
@ -2303,6 +2325,30 @@ nsComputedDOMStyle::DoGetMozTextDecorationColor()
|
|||
return val;
|
||||
}
|
||||
|
||||
nsIDOMCSSValue*
|
||||
nsComputedDOMStyle::DoGetMozTextDecorationLine()
|
||||
{
|
||||
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
||||
|
||||
PRInt32 intValue = GetStyleTextReset()->mTextDecorationLine;
|
||||
|
||||
if (NS_STYLE_TEXT_DECORATION_LINE_NONE == intValue) {
|
||||
val->SetIdent(eCSSKeyword_none);
|
||||
} else {
|
||||
nsAutoString decorationLineString;
|
||||
// Clear the -moz-anchor-decoration bit and the OVERRIDE_ALL bits -- we
|
||||
// don't want these to appear in the computed style.
|
||||
intValue &= ~(NS_STYLE_TEXT_DECORATION_LINE_PREF_ANCHORS |
|
||||
NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL);
|
||||
nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_text_decoration_line,
|
||||
intValue, NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE,
|
||||
NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH, decorationLineString);
|
||||
val->SetString(decorationLineString);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
nsIDOMCSSValue*
|
||||
nsComputedDOMStyle::DoGetMozTextDecorationStyle()
|
||||
{
|
||||
|
@ -4347,7 +4393,9 @@ nsComputedDOMStyle::GetQueryablePropertyMap(PRUint32* aLength)
|
|||
COMPUTED_STYLE_MAP_ENTRY(stroke_width, StrokeWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY(text_anchor, TextAnchor),
|
||||
COMPUTED_STYLE_MAP_ENTRY(text_rendering, TextRendering),
|
||||
COMPUTED_STYLE_MAP_ENTRY(text_blink, MozTextBlink),
|
||||
COMPUTED_STYLE_MAP_ENTRY(text_decoration_color, MozTextDecorationColor),
|
||||
COMPUTED_STYLE_MAP_ENTRY(text_decoration_line, MozTextDecorationLine),
|
||||
COMPUTED_STYLE_MAP_ENTRY(text_decoration_style, MozTextDecorationStyle)
|
||||
|
||||
};
|
||||
|
|
|
@ -308,8 +308,10 @@ private:
|
|||
/* Text Properties */
|
||||
nsIDOMCSSValue* DoGetLineHeight();
|
||||
nsIDOMCSSValue* DoGetTextAlign();
|
||||
nsIDOMCSSValue* DoGetMozTextBlink();
|
||||
nsIDOMCSSValue* DoGetTextDecoration();
|
||||
nsIDOMCSSValue* DoGetMozTextDecorationColor();
|
||||
nsIDOMCSSValue* DoGetMozTextDecorationLine();
|
||||
nsIDOMCSSValue* DoGetMozTextDecorationStyle();
|
||||
nsIDOMCSSValue* DoGetTextIndent();
|
||||
nsIDOMCSSValue* DoGetTextTransform();
|
||||
|
|
|
@ -3371,26 +3371,32 @@ nsRuleNode::ComputeTextResetData(void* aStartStruct,
|
|||
}
|
||||
}
|
||||
|
||||
// text-decoration: enum (bit field), inherit, initial
|
||||
const nsCSSValue* decorationValue = aRuleData->ValueForTextDecoration();
|
||||
if (eCSSUnit_Enumerated == decorationValue->GetUnit()) {
|
||||
PRInt32 td = decorationValue->GetIntValue();
|
||||
text->mTextDecoration = td;
|
||||
if (td & NS_STYLE_TEXT_DECORATION_PREF_ANCHORS) {
|
||||
// text-blink: enum, inherit, initial
|
||||
SetDiscrete(*aRuleData->ValueForTextBlink(), text->mTextBlink,
|
||||
canStoreInRuleTree, SETDSC_ENUMERATED, parentText->mTextBlink,
|
||||
NS_STYLE_TEXT_BLINK_NONE, 0, 0, 0, 0);
|
||||
|
||||
// text-decoration-line: enum (bit field), inherit, initial
|
||||
const nsCSSValue* decorationLineValue =
|
||||
aRuleData->ValueForTextDecorationLine();
|
||||
if (eCSSUnit_Enumerated == decorationLineValue->GetUnit()) {
|
||||
PRInt32 td = decorationLineValue->GetIntValue();
|
||||
text->mTextDecorationLine = td;
|
||||
if (td & NS_STYLE_TEXT_DECORATION_LINE_PREF_ANCHORS) {
|
||||
PRBool underlineLinks =
|
||||
mPresContext->GetCachedBoolPref(kPresContext_UnderlineLinks);
|
||||
if (underlineLinks) {
|
||||
text->mTextDecoration |= NS_STYLE_TEXT_DECORATION_UNDERLINE;
|
||||
text->mTextDecorationLine |= NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE;
|
||||
}
|
||||
else {
|
||||
text->mTextDecoration &= ~NS_STYLE_TEXT_DECORATION_UNDERLINE;
|
||||
text->mTextDecorationLine &= ~NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE;
|
||||
}
|
||||
}
|
||||
} else if (eCSSUnit_Inherit == decorationValue->GetUnit()) {
|
||||
} else if (eCSSUnit_Inherit == decorationLineValue->GetUnit()) {
|
||||
canStoreInRuleTree = PR_FALSE;
|
||||
text->mTextDecoration = parentText->mTextDecoration;
|
||||
} else if (eCSSUnit_Initial == decorationValue->GetUnit()) {
|
||||
text->mTextDecoration = NS_STYLE_TEXT_DECORATION_NONE;
|
||||
text->mTextDecorationLine = parentText->mTextDecorationLine;
|
||||
} else if (eCSSUnit_Initial == decorationLineValue->GetUnit()) {
|
||||
text->mTextDecorationLine = NS_STYLE_TEXT_DECORATION_LINE_NONE;
|
||||
}
|
||||
|
||||
// text-decoration-color: color, string, enum, inherit, initial
|
||||
|
|
|
@ -329,14 +329,16 @@ nsStyleContext::ApplyStyleFixups(nsPresContext* aPresContext)
|
|||
{
|
||||
// See if we have any text decorations.
|
||||
// First see if our parent has text decorations. If our parent does, then we inherit the bit.
|
||||
if (mParent && mParent->HasTextDecorations())
|
||||
mBits |= NS_STYLE_HAS_TEXT_DECORATIONS;
|
||||
else {
|
||||
if (mParent && mParent->HasTextDecorationLines()) {
|
||||
mBits |= NS_STYLE_HAS_TEXT_DECORATION_LINES;
|
||||
} else {
|
||||
// We might have defined a decoration.
|
||||
const nsStyleTextReset* text = GetStyleTextReset();
|
||||
if (text->mTextDecoration != NS_STYLE_TEXT_DECORATION_NONE &&
|
||||
text->mTextDecoration != NS_STYLE_TEXT_DECORATION_OVERRIDE_ALL)
|
||||
mBits |= NS_STYLE_HAS_TEXT_DECORATIONS;
|
||||
PRUint8 decorationLine = text->mTextDecorationLine;
|
||||
if (decorationLine != NS_STYLE_TEXT_DECORATION_LINE_NONE &&
|
||||
decorationLine != NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL) {
|
||||
mBits |= NS_STYLE_HAS_TEXT_DECORATION_LINES;
|
||||
}
|
||||
}
|
||||
|
||||
if ((mParent && mParent->HasPseudoElementData()) || mPseudoTag) {
|
||||
|
|
|
@ -128,9 +128,9 @@ public:
|
|||
PRBool aRelevantLinkVisited);
|
||||
|
||||
// Does this style context or any of its ancestors have text
|
||||
// decorations?
|
||||
PRBool HasTextDecorations() const
|
||||
{ return !!(mBits & NS_STYLE_HAS_TEXT_DECORATIONS); }
|
||||
// decoration lines?
|
||||
PRBool HasTextDecorationLines() const
|
||||
{ return !!(mBits & NS_STYLE_HAS_TEXT_DECORATION_LINES); }
|
||||
|
||||
// Does this style context represent the style for a pseudo-element or
|
||||
// inherit data from such a style context? Whether this returns true
|
||||
|
|
|
@ -2601,7 +2601,8 @@ nsStyleTextReset::nsStyleTextReset(void)
|
|||
{
|
||||
MOZ_COUNT_CTOR(nsStyleTextReset);
|
||||
mVerticalAlign.SetIntValue(NS_STYLE_VERTICAL_ALIGN_BASELINE, eStyleUnit_Enumerated);
|
||||
mTextDecoration = NS_STYLE_TEXT_DECORATION_NONE;
|
||||
mTextBlink = NS_STYLE_TEXT_BLINK_NONE;
|
||||
mTextDecorationLine = NS_STYLE_TEXT_DECORATION_LINE_NONE;
|
||||
mTextDecorationColor = NS_RGB(0,0,0);
|
||||
mTextDecorationStyle =
|
||||
NS_STYLE_TEXT_DECORATION_STYLE_SOLID | BORDER_COLOR_FOREGROUND;
|
||||
|
@ -2623,15 +2624,15 @@ nsChangeHint nsStyleTextReset::CalcDifference(const nsStyleTextReset& aOther) co
|
|||
{
|
||||
if (mVerticalAlign == aOther.mVerticalAlign
|
||||
&& mUnicodeBidi == aOther.mUnicodeBidi) {
|
||||
// Reflow for blink changes
|
||||
if (mTextBlink != aOther.mTextBlink) {
|
||||
return NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
|
||||
PRUint8 lineStyle = GetDecorationStyle();
|
||||
PRUint8 otherLineStyle = aOther.GetDecorationStyle();
|
||||
if (mTextDecoration != aOther.mTextDecoration ||
|
||||
if (mTextDecorationLine != aOther.mTextDecorationLine ||
|
||||
lineStyle != otherLineStyle) {
|
||||
// Reflow for blink changes
|
||||
if ((mTextDecoration & NS_STYLE_TEXT_DECORATION_BLINK) !=
|
||||
(aOther.mTextDecoration & NS_STYLE_TEXT_DECORATION_BLINK)) {
|
||||
return NS_STYLE_HINT_REFLOW;
|
||||
}
|
||||
// Reflow for decoration line style changes only to or from double or
|
||||
// wave because that may cause overflow area changes
|
||||
if (lineStyle == NS_STYLE_TEXT_DECORATION_STYLE_DOUBLE ||
|
||||
|
|
|
@ -81,8 +81,8 @@ struct nsCSSValueList;
|
|||
#define NS_STYLE_INHERIT_MASK 0x00ffffff
|
||||
|
||||
// Additional bits for nsStyleContext's mBits:
|
||||
// See nsStyleContext::HasTextDecorations
|
||||
#define NS_STYLE_HAS_TEXT_DECORATIONS 0x01000000
|
||||
// See nsStyleContext::HasTextDecorationLines
|
||||
#define NS_STYLE_HAS_TEXT_DECORATION_LINES 0x01000000
|
||||
// See nsStyleContext::HasPseudoElementData.
|
||||
#define NS_STYLE_HAS_PSEUDO_ELEMENT_DATA 0x02000000
|
||||
// See nsStyleContext::RelevantLinkIsVisited
|
||||
|
@ -1210,7 +1210,8 @@ struct nsStyleTextReset {
|
|||
|
||||
nsStyleCoord mVerticalAlign; // [reset] coord, percent, calc, enum (see nsStyleConsts.h)
|
||||
|
||||
PRUint8 mTextDecoration; // [reset] see nsStyleConsts.h
|
||||
PRUint8 mTextBlink; // [reset] see nsStyleConsts.h
|
||||
PRUint8 mTextDecorationLine; // [reset] see nsStyleConsts.h
|
||||
PRUint8 mUnicodeBidi; // [reset] see nsStyleConsts.h
|
||||
protected:
|
||||
PRUint8 mTextDecorationStyle; // [reset] see nsStyleConsts.h
|
||||
|
|
|
@ -2432,13 +2432,23 @@ var gCSSProperties = {
|
|||
other_values: [ "center", "justify", "end" ],
|
||||
invalid_values: []
|
||||
},
|
||||
"text-decoration": {
|
||||
domProp: "textDecoration",
|
||||
"-moz-text-blink": {
|
||||
domProp: "MozTextBlink",
|
||||
inherited: false,
|
||||
type: CSS_TYPE_LONGHAND,
|
||||
initial_values: [ "none" ],
|
||||
other_values: [ "underline", "overline", "line-through", "blink line-through underline", "underline overline line-through blink", "-moz-anchor-decoration", "blink -moz-anchor-decoration" ],
|
||||
invalid_values: [ "underline none", "none underline", "line-through blink line-through" ]
|
||||
other_values: [ "blink" ],
|
||||
invalid_values: [ "underline", "overline", "line-through", "none underline", "underline blink", "blink underline" ]
|
||||
},
|
||||
"text-decoration": {
|
||||
domProp: "textDecoration",
|
||||
inherited: false,
|
||||
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
|
||||
subproperties: [ "-moz-text-blink", "-moz-text-decoration-color", "-moz-text-decoration-line", "-moz-text-decoration-style" ],
|
||||
initial_values: [ "none" ],
|
||||
other_values: [ "underline", "overline", "line-through", "blink", "blink line-through underline", "underline overline line-through blink", "-moz-anchor-decoration", "blink -moz-anchor-decoration" ],
|
||||
invalid_values: [ "none none", "underline none", "none underline", "blink none", "none blink", "line-through blink line-through", "underline overline line-through blink none", "underline overline line-throuh blink blink",
|
||||
"underline red solid", "underline #ff0000", "solid underline", "red underline", "#ff0000 underline" ]
|
||||
},
|
||||
"-moz-text-decoration-color": {
|
||||
domProp: "MozTextDecorationColor",
|
||||
|
@ -2449,6 +2459,14 @@ var gCSSProperties = {
|
|||
other_values: [ "green", "rgba(255,128,0,0.5)", "transparent" ],
|
||||
invalid_values: [ "#0", "#00", "#0000", "#00000", "#0000000", "#00000000", "#000000000" ]
|
||||
},
|
||||
"-moz-text-decoration-line": {
|
||||
domProp: "MozTextDecorationLine",
|
||||
inherited: false,
|
||||
type: CSS_TYPE_LONGHAND,
|
||||
initial_values: [ "none" ],
|
||||
other_values: [ "underline", "overline", "line-through", "line-through underline", "underline overline line-through", "-moz-anchor-decoration", "-moz-anchor-decoration" ],
|
||||
invalid_values: [ "none none", "underline none", "none underline", "line-through blink line-through", "underline overline line-through blink none", "underline overline line-throuh blink blink" ]
|
||||
},
|
||||
"-moz-text-decoration-style": {
|
||||
domProp: "MozTextDecorationStyle",
|
||||
inherited: false,
|
||||
|
|
|
@ -426,16 +426,17 @@ nsTextBoxFrame::DrawText(nsRenderingContext& aRenderingContext,
|
|||
PRUint8 underStyle;
|
||||
PRUint8 strikeStyle;
|
||||
nsStyleContext* context = mStyleContext;
|
||||
|
||||
PRUint8 decorations = NS_STYLE_TEXT_DECORATION_NONE; // Begin with no decorations
|
||||
PRUint8 decorMask = NS_STYLE_TEXT_DECORATION_UNDERLINE | NS_STYLE_TEXT_DECORATION_OVERLINE |
|
||||
NS_STYLE_TEXT_DECORATION_LINE_THROUGH; // A mask of all possible decorations.
|
||||
PRBool hasDecorations = context->HasTextDecorations();
|
||||
|
||||
// Begin with no decorations
|
||||
PRUint8 decorations = NS_STYLE_TEXT_DECORATION_LINE_NONE;
|
||||
// A mask of all possible decorations.
|
||||
PRUint8 decorMask = NS_STYLE_TEXT_DECORATION_LINE_LINES_MASK;
|
||||
PRBool hasDecorationLines = context->HasTextDecorationLines();
|
||||
|
||||
do { // find decoration colors
|
||||
const nsStyleTextReset* styleText = context->GetStyleTextReset();
|
||||
|
||||
if (decorMask & styleText->mTextDecoration) { // a decoration defined here
|
||||
if (decorMask & styleText->mTextDecorationLine) { // a decoration defined here
|
||||
nscolor color;
|
||||
if (aOverrideColor) {
|
||||
color = *aOverrideColor;
|
||||
|
@ -448,32 +449,35 @@ nsTextBoxFrame::DrawText(nsRenderingContext& aRenderingContext,
|
|||
}
|
||||
PRUint8 style = styleText->GetDecorationStyle();
|
||||
|
||||
if (NS_STYLE_TEXT_DECORATION_UNDERLINE & decorMask & styleText->mTextDecoration) {
|
||||
if (NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE & decorMask &
|
||||
styleText->mTextDecorationLine) {
|
||||
underColor = color;
|
||||
underStyle = style;
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_UNDERLINE;
|
||||
decorations |= NS_STYLE_TEXT_DECORATION_UNDERLINE;
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE;
|
||||
decorations |= NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE;
|
||||
}
|
||||
if (NS_STYLE_TEXT_DECORATION_OVERLINE & decorMask & styleText->mTextDecoration) {
|
||||
if (NS_STYLE_TEXT_DECORATION_LINE_OVERLINE & decorMask &
|
||||
styleText->mTextDecorationLine) {
|
||||
overColor = color;
|
||||
overStyle = style;
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_OVERLINE;
|
||||
decorations |= NS_STYLE_TEXT_DECORATION_OVERLINE;
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_LINE_OVERLINE;
|
||||
decorations |= NS_STYLE_TEXT_DECORATION_LINE_OVERLINE;
|
||||
}
|
||||
if (NS_STYLE_TEXT_DECORATION_LINE_THROUGH & decorMask & styleText->mTextDecoration) {
|
||||
if (NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH & decorMask &
|
||||
styleText->mTextDecorationLine) {
|
||||
strikeColor = color;
|
||||
strikeStyle = style;
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_LINE_THROUGH;
|
||||
decorations |= NS_STYLE_TEXT_DECORATION_LINE_THROUGH;
|
||||
decorMask &= ~NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH;
|
||||
decorations |= NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH;
|
||||
}
|
||||
}
|
||||
if (0 != decorMask) {
|
||||
context = context->GetParent();
|
||||
if (context) {
|
||||
hasDecorations = context->HasTextDecorations();
|
||||
hasDecorationLines = context->HasTextDecorationLines();
|
||||
}
|
||||
}
|
||||
} while (context && hasDecorations && (0 != decorMask));
|
||||
} while (context && hasDecorationLines && (0 != decorMask));
|
||||
|
||||
nsRefPtr<nsFontMetrics> fontMet;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet));
|
||||
|
@ -505,14 +509,14 @@ nsTextBoxFrame::DrawText(nsRenderingContext& aRenderingContext,
|
|||
nsCSSRendering::PaintDecorationLine(ctx, underColor,
|
||||
pt, gfxSize(width, sizePixel),
|
||||
ascentPixel, offsetPixel,
|
||||
NS_STYLE_TEXT_DECORATION_UNDERLINE, underStyle);
|
||||
NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE, underStyle);
|
||||
}
|
||||
if ((decorations & NS_FONT_DECORATION_OVERLINE) &&
|
||||
overStyle != NS_STYLE_TEXT_DECORATION_STYLE_NONE) {
|
||||
nsCSSRendering::PaintDecorationLine(ctx, overColor,
|
||||
pt, gfxSize(width, sizePixel),
|
||||
ascentPixel, ascentPixel,
|
||||
NS_STYLE_TEXT_DECORATION_OVERLINE, overStyle);
|
||||
NS_STYLE_TEXT_DECORATION_LINE_OVERLINE, overStyle);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -593,7 +597,8 @@ nsTextBoxFrame::DrawText(nsRenderingContext& aRenderingContext,
|
|||
gfxFloat sizePixel = presContext->AppUnitsToGfxUnits(size);
|
||||
nsCSSRendering::PaintDecorationLine(ctx, strikeColor,
|
||||
pt, gfxSize(width, sizePixel), ascentPixel, offsetPixel,
|
||||
NS_STYLE_TEXT_DECORATION_LINE_THROUGH, strikeStyle);
|
||||
NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH,
|
||||
strikeStyle);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3602,7 +3602,7 @@ nsTreeBodyFrame::PaintText(PRInt32 aRowIndex,
|
|||
aRenderingContext.SetColor(textContext->GetStyleColor()->mColor);
|
||||
|
||||
// Draw decorations.
|
||||
PRUint8 decorations = textContext->GetStyleTextReset()->mTextDecoration;
|
||||
PRUint8 decorations = textContext->GetStyleTextReset()->mTextDecorationLine;
|
||||
|
||||
nscoord offset;
|
||||
nscoord size;
|
||||
|
|
Загрузка…
Ссылка в новой задаче