mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 04:09:50 +00:00
Backed out changeset 932c269da17b (bug 1008019)
This commit is contained in:
parent
d85473072e
commit
dd9d82e540
@ -838,7 +838,6 @@ gfxTextRun::BreakAndMeasureText(uint32_t aStart, uint32_t aMaxLength,
|
||||
PropertyProvider *aProvider,
|
||||
SuppressBreak aSuppressBreak,
|
||||
gfxFloat *aTrimWhitespace,
|
||||
bool aWhitespaceCanHang,
|
||||
Metrics *aMetrics,
|
||||
gfxFont::BoundingBoxType aBoundingBoxType,
|
||||
DrawTarget* aRefDrawTarget,
|
||||
@ -869,7 +868,7 @@ gfxTextRun::BreakAndMeasureText(uint32_t aStart, uint32_t aMaxLength,
|
||||
|
||||
gfxFloat width = 0;
|
||||
gfxFloat advance = 0;
|
||||
// The number of space characters that can be trimmed or hang at a soft-wrap
|
||||
// The number of space characters that can be trimmed
|
||||
uint32_t trimmableChars = 0;
|
||||
// The amount of space removed by ignoring trimmableChars
|
||||
gfxFloat trimmableAdvance = 0;
|
||||
@ -952,7 +951,7 @@ gfxTextRun::BreakAndMeasureText(uint32_t aStart, uint32_t aMaxLength,
|
||||
}
|
||||
|
||||
advance += charAdvance;
|
||||
if (aTrimWhitespace || aWhitespaceCanHang) {
|
||||
if (aTrimWhitespace) {
|
||||
if (mCharacterGlyphs[i].CharIsSpace()) {
|
||||
++trimmableChars;
|
||||
trimmableAdvance += charAdvance;
|
||||
@ -986,26 +985,13 @@ gfxTextRun::BreakAndMeasureText(uint32_t aStart, uint32_t aMaxLength,
|
||||
|
||||
if (aMetrics) {
|
||||
auto fitEnd = aStart + charsFit;
|
||||
if (aTrimWhitespace || trimmableChars == 0) {
|
||||
// measure everything except trimmed space
|
||||
*aMetrics = MeasureText(Range(aStart, fitEnd - trimmableChars),
|
||||
aBoundingBoxType, aRefDrawTarget,
|
||||
aProvider);
|
||||
} else {
|
||||
// measure everything
|
||||
*aMetrics = MeasureText(Range(aStart, fitEnd),
|
||||
aBoundingBoxType, aRefDrawTarget,
|
||||
aProvider);
|
||||
// restrict width of hanging whitespace so it doesn't overflow
|
||||
if (aWhitespaceCanHang && aMetrics->mAdvanceWidth > aWidth) {
|
||||
// measure just hanging whitespace
|
||||
Metrics hangMetrics =
|
||||
MeasureText(Range(fitEnd - trimmableChars, fitEnd),
|
||||
aBoundingBoxType, aRefDrawTarget,
|
||||
aProvider);
|
||||
aMetrics->mAdvanceWidth = std::max(aWidth,
|
||||
aMetrics->mAdvanceWidth - hangMetrics.mAdvanceWidth);
|
||||
}
|
||||
*aMetrics = MeasureText(Range(aStart, fitEnd), aBoundingBoxType,
|
||||
aRefDrawTarget, aProvider);
|
||||
if (trimmableChars) {
|
||||
Metrics trimMetrics =
|
||||
MeasureText(Range(fitEnd - trimmableChars, fitEnd),
|
||||
aBoundingBoxType, aRefDrawTarget, aProvider);
|
||||
aMetrics->mAdvanceWidth -= trimMetrics.mAdvanceWidth;
|
||||
}
|
||||
}
|
||||
if (aTrimWhitespace) {
|
||||
|
@ -395,7 +395,6 @@ public:
|
||||
PropertyProvider *aProvider,
|
||||
SuppressBreak aSuppressBreak,
|
||||
gfxFloat *aTrimWhitespace,
|
||||
bool aHangWhitespace,
|
||||
Metrics *aMetrics,
|
||||
gfxFont::BoundingBoxType aBoundingBoxType,
|
||||
DrawTarget* aDrawTargetForTightBoundingBox,
|
||||
|
@ -9089,9 +9089,6 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
|
||||
}
|
||||
bool canTrimTrailingWhitespace = !textStyle->WhiteSpaceIsSignificant() ||
|
||||
(GetStateBits() & TEXT_IS_IN_TOKEN_MATHML);
|
||||
// allow whitespace to overflow the container
|
||||
bool whitespaceCanHang = textStyle->WhiteSpaceCanWrapStyle() &&
|
||||
textStyle->WhiteSpaceIsSignificant();
|
||||
gfxBreakPriority breakPriority = aLineLayout.LastOptionalBreakPriority();
|
||||
gfxTextRun::SuppressBreak suppressBreak = gfxTextRun::eNoSuppressBreak;
|
||||
bool shouldSuppressLineBreak = ShouldSuppressLineBreak();
|
||||
@ -9106,7 +9103,6 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
|
||||
availWidth,
|
||||
&provider, suppressBreak,
|
||||
canTrimTrailingWhitespace ? &trimmedWidth : nullptr,
|
||||
whitespaceCanHang,
|
||||
&textMetrics, boundingBoxType,
|
||||
aDrawTarget,
|
||||
&usedHyphenation, &transformedLastBreak,
|
||||
|
Loading…
x
Reference in New Issue
Block a user