mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 14:25:52 +00:00
Bug 780436 Union actual text-decoration rect to the overflow rect of floating first letter's child r=roc
This commit is contained in:
parent
9058490531
commit
82480ecdcd
@ -4676,11 +4676,37 @@ nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext,
|
||||
if (IsFloatingFirstLetterChild()) {
|
||||
// The underline/overline drawable area must be contained in the overflow
|
||||
// rect when this is in floating first letter frame at *both* modes.
|
||||
nsFontMetrics* fm = aProvider.GetFontMetrics();
|
||||
nscoord fontAscent = fm->MaxAscent();
|
||||
nscoord fontHeight = fm->MaxHeight();
|
||||
nsRect fontRect(0, mAscent - fontAscent, GetSize().width, fontHeight);
|
||||
aVisualOverflowRect->UnionRect(*aVisualOverflowRect, fontRect);
|
||||
nsIFrame* firstLetterFrame = aBlockReflowState.frame;
|
||||
PRUint8 decorationStyle = firstLetterFrame->GetStyleContext()->
|
||||
GetStyleTextReset()->GetDecorationStyle();
|
||||
if (decorationStyle != NS_STYLE_TEXT_DECORATION_STYLE_NONE) {
|
||||
nsFontMetrics* fontMetrics = aProvider.GetFontMetrics();
|
||||
nscoord underlineOffset, underlineSize;
|
||||
fontMetrics->GetUnderline(underlineOffset, underlineSize);
|
||||
nscoord maxAscent = fontMetrics->MaxAscent();
|
||||
|
||||
gfxFloat appUnitsPerDevUnit = aPresContext->AppUnitsPerDevPixel();
|
||||
gfxFloat gfxWidth = aVisualOverflowRect->width / appUnitsPerDevUnit;
|
||||
gfxFloat gfxAscent = gfxFloat(mAscent) / appUnitsPerDevUnit;
|
||||
gfxFloat gfxMaxAscent = maxAscent / appUnitsPerDevUnit;
|
||||
gfxFloat gfxUnderlineSize = underlineSize / appUnitsPerDevUnit;
|
||||
gfxFloat gfxUnderlineOffset = underlineOffset / appUnitsPerDevUnit;
|
||||
nsRect underlineRect =
|
||||
nsCSSRendering::GetTextDecorationRect(aPresContext,
|
||||
gfxSize(gfxWidth, gfxUnderlineSize), gfxAscent, gfxUnderlineOffset,
|
||||
NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE, decorationStyle);
|
||||
nsRect overlineRect =
|
||||
nsCSSRendering::GetTextDecorationRect(aPresContext,
|
||||
gfxSize(gfxWidth, gfxUnderlineSize), gfxAscent, gfxMaxAscent,
|
||||
NS_STYLE_TEXT_DECORATION_LINE_OVERLINE, decorationStyle);
|
||||
|
||||
aVisualOverflowRect->UnionRect(*aVisualOverflowRect, underlineRect);
|
||||
aVisualOverflowRect->UnionRect(*aVisualOverflowRect, overlineRect);
|
||||
|
||||
// XXX If strikeoutSize is much thicker than the underlineSize, it may
|
||||
// cause overflowing from the overflow rect. However, such case
|
||||
// isn't realistic, we don't need to compute it now.
|
||||
}
|
||||
}
|
||||
if (aIncludeTextDecorations) {
|
||||
// Since CSS 2.1 requires that text-decoration defined on ancestors maintain
|
||||
|
Loading…
Reference in New Issue
Block a user