зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1307402 - use a more precise bounding box for initial letter texts. r=jfkthame
MozReview-Commit-ID: 5OIXp0uQisn --HG-- extra : rebase_source : 00f6a72742c763bb3ec572a08d3cdaf12402d7f6
This commit is contained in:
Родитель
2b9135929b
Коммит
23d3ede6fc
|
@ -256,7 +256,13 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
|
|||
aMetrics.ISize(lineWM) = ll->EndSpan(this) + bp.IStartEnd(wm);
|
||||
ll->SetInFirstLetter(false);
|
||||
|
||||
nsLayoutUtils::SetBSizeFromFontMetrics(this, aMetrics, bp, lineWM, wm);
|
||||
if (mStyleContext->StyleTextReset()->mInitialLetterSize != 0.0f) {
|
||||
aMetrics.SetBlockStartAscent(kidMetrics.BlockStartAscent() +
|
||||
bp.BStart(wm));
|
||||
aMetrics.BSize(lineWM) = kidMetrics.BSize(lineWM) + bp.BStartEnd(wm);
|
||||
} else {
|
||||
nsLayoutUtils::SetBSizeFromFontMetrics(this, aMetrics, bp, lineWM, wm);
|
||||
}
|
||||
}
|
||||
|
||||
if (!NS_INLINE_IS_BREAK_BEFORE(aReflowStatus)) {
|
||||
|
|
|
@ -8772,6 +8772,14 @@ nsTextFrame::IsFloatingFirstLetterChild() const
|
|||
frame->GetType() == nsGkAtoms::letterFrame;
|
||||
}
|
||||
|
||||
bool
|
||||
nsTextFrame::IsInitialLetterChild() const
|
||||
{
|
||||
nsIFrame* frame = GetParent();
|
||||
return frame && frame->StyleTextReset()->mInitialLetterSize != 0.0f &&
|
||||
frame->GetType() == nsGkAtoms::letterFrame;
|
||||
}
|
||||
|
||||
struct NewlineProperty {
|
||||
int32_t mStartOffset;
|
||||
// The offset of the first \n after mStartOffset, or -1 if there is none
|
||||
|
@ -9050,9 +9058,10 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
|
|||
|
||||
// The metrics for the text go in here
|
||||
gfxTextRun::Metrics textMetrics;
|
||||
gfxFont::BoundingBoxType boundingBoxType = IsFloatingFirstLetterChild() ?
|
||||
gfxFont::TIGHT_HINTED_OUTLINE_EXTENTS :
|
||||
gfxFont::LOOSE_INK_EXTENTS;
|
||||
gfxFont::BoundingBoxType boundingBoxType =
|
||||
IsFloatingFirstLetterChild() || IsInitialLetterChild()
|
||||
? gfxFont::TIGHT_HINTED_OUTLINE_EXTENTS
|
||||
: gfxFont::LOOSE_INK_EXTENTS;
|
||||
NS_ASSERTION(!(NS_REFLOW_CALC_BOUNDING_METRICS & aMetrics.mFlags),
|
||||
"We shouldn't be passed NS_REFLOW_CALC_BOUNDING_METRICS anymore");
|
||||
|
||||
|
|
|
@ -587,6 +587,8 @@ public:
|
|||
|
||||
bool IsFloatingFirstLetterChild() const;
|
||||
|
||||
bool IsInitialLetterChild() const;
|
||||
|
||||
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override;
|
||||
|
||||
void AssignJustificationGaps(const mozilla::JustificationAssignment& aAssign);
|
||||
|
|
Загрузка…
Ссылка в новой задаче