mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-05 13:45:46 +00:00
Bug 365414 overflowed decoration lines are not erased/painted r+sr=roc
This commit is contained in:
parent
051a23c4b6
commit
e2f6a778c9
@ -347,7 +347,9 @@ gfxFont::Measure(gfxTextRun *aTextRun,
|
||||
metrics.mAdvanceWidth = floatAdvance;
|
||||
const PRUint32 appUnitsPerDevUnit = aTextRun->GetAppUnitsPerDevUnit();
|
||||
metrics.mAscent = fontMetrics.maxAscent*appUnitsPerDevUnit;
|
||||
metrics.mDescent = fontMetrics.maxDescent*appUnitsPerDevUnit;
|
||||
gfxFloat descentForUnderline =
|
||||
NS_round(fontMetrics.underlineSize) + NS_round(metrics.mAscent - fontMetrics.underlineOffset) - metrics.mAscent;
|
||||
metrics.mDescent = PR_MAX(fontMetrics.maxDescent, descentForUnderline)*appUnitsPerDevUnit;
|
||||
metrics.mBoundingBox =
|
||||
gfxRect(0, -metrics.mAscent, floatAdvance, metrics.mAscent + metrics.mDescent);
|
||||
return metrics;
|
||||
|
@ -518,6 +518,9 @@ public:
|
||||
float AppUnitsToPoints(nscoord aAppUnits) const
|
||||
{ return (float)aAppUnits / mDeviceContext->AppUnitsPerInch() * 72.0f; }
|
||||
|
||||
nscoord RoundAppUnitsToNearestDevPixels(nscoord aAppUnits) const
|
||||
{ return DevPixelsToAppUnits(AppUnitsToDevPixels(aAppUnits)); }
|
||||
|
||||
/**
|
||||
* Get the language-specific transform type for the current document.
|
||||
* This tells us whether we need to perform special language-dependent
|
||||
|
@ -559,6 +559,15 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
|
||||
// affect our height.
|
||||
fm->GetMaxAscent(aMetrics.ascent);
|
||||
fm->GetHeight(aMetrics.height);
|
||||
// Include the text-decoration lines to the height.
|
||||
// Currently, only undeline is overflowable.
|
||||
nscoord offset, size;
|
||||
fm->GetUnderline(offset, size);
|
||||
nscoord ascentAndUnderline =
|
||||
aPresContext->RoundAppUnitsToNearestDevPixels(aMetrics.ascent - offset) +
|
||||
aPresContext->RoundAppUnitsToNearestDevPixels(size);
|
||||
if (ascentAndUnderline > aMetrics.height)
|
||||
aMetrics.height = ascentAndUnderline;
|
||||
} else {
|
||||
NS_WARNING("Cannot get font metrics - defaulting sizes to 0");
|
||||
aMetrics.ascent = aMetrics.height = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user