From 21a2c4c2b389ba30c138e21e85a74648b3189eba Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Tue, 8 Dec 2015 12:55:01 -0500 Subject: [PATCH] Bug 1225018 part 4 - Ensure leading for emphasis marks of text directly inside block. r=jfkthame --HG-- extra : source : 778a1de3e41583e1c8f0a885ca34efc12375396a --- layout/generic/nsLineLayout.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/layout/generic/nsLineLayout.cpp b/layout/generic/nsLineLayout.cpp index db52510ec9f7..18bcf0b26043 100644 --- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -2329,6 +2329,32 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd) lineWM.IsLineInverted()); nscoord blockEnd = blockStart + minimumLineBSize; + if (mStyleText->HasTextEmphasis()) { + nscoord fontMaxHeight = fm->MaxHeight(); + nscoord emphasisHeight = + GetBSizeOfEmphasisMarks(spanFrame, inflation); + nscoord delta = fontMaxHeight + emphasisHeight - minimumLineBSize; + if (delta > 0) { + if (minimumLineBSize < fontMaxHeight) { + // If the leadings are negative, fill them first. + nscoord ascent = fm->MaxAscent(); + nscoord descent = fm->MaxDescent(); + if (lineWM.IsLineInverted()) { + Swap(ascent, descent); + } + blockStart = -ascent; + blockEnd = descent; + delta = emphasisHeight; + } + LogicalSide side = mStyleText->TextEmphasisSide(lineWM); + if (side == eLogicalSideBStart) { + blockStart -= delta; + } else { + blockEnd += delta; + } + } + } + if (blockStart < minBCoord) minBCoord = blockStart; if (blockEnd > maxBCoord) maxBCoord = blockEnd;