зеркало из https://github.com/mozilla/gecko-dev.git
Back out bug 384836 to diagnose Tp/Tp2 regression bug 385957.
This commit is contained in:
Родитель
325916e150
Коммит
ebcc8539e8
|
@ -589,8 +589,7 @@ public:
|
|||
* breaks are the same as the old
|
||||
*/
|
||||
virtual PRBool SetPotentialLineBreaks(PRUint32 aStart, PRUint32 aLength,
|
||||
PRPackedBool *aBreakBefore,
|
||||
gfxContext *aRefContext);
|
||||
PRPackedBool *aBreakBefore);
|
||||
|
||||
/**
|
||||
* Layout provides PropertyProvider objects. These allow detection of
|
||||
|
@ -720,8 +719,7 @@ public:
|
|||
*/
|
||||
virtual PRBool SetLineBreaks(PRUint32 aStart, PRUint32 aLength,
|
||||
PRBool aLineBreakBefore, PRBool aLineBreakAfter,
|
||||
gfxFloat *aAdvanceWidthDelta,
|
||||
gfxContext *aRefContext);
|
||||
gfxFloat *aAdvanceWidthDelta);
|
||||
|
||||
/**
|
||||
* Finds the longest substring that will fit into the given width.
|
||||
|
|
|
@ -686,8 +686,7 @@ gfxTextRun::Clone(const gfxTextRunFactory::Parameters *aParams, const void *aTex
|
|||
|
||||
PRBool
|
||||
gfxTextRun::SetPotentialLineBreaks(PRUint32 aStart, PRUint32 aLength,
|
||||
PRPackedBool *aBreakBefore,
|
||||
gfxContext *aRefContext)
|
||||
PRPackedBool *aBreakBefore)
|
||||
{
|
||||
NS_ASSERTION(aStart + aLength <= mCharacterCount, "Overflow");
|
||||
|
||||
|
@ -1417,8 +1416,7 @@ gfxTextRun::GetAdvanceWidth(PRUint32 aStart, PRUint32 aLength,
|
|||
PRBool
|
||||
gfxTextRun::SetLineBreaks(PRUint32 aStart, PRUint32 aLength,
|
||||
PRBool aLineBreakBefore, PRBool aLineBreakAfter,
|
||||
gfxFloat *aAdvanceWidthDelta,
|
||||
gfxContext *aRefContext)
|
||||
gfxFloat *aAdvanceWidthDelta)
|
||||
{
|
||||
// Do nothing because our shaping does not currently take linebreaks into
|
||||
// account. There is no change in advance width.
|
||||
|
|
|
@ -910,22 +910,20 @@ public:
|
|||
|
||||
class BreakSink : public nsILineBreakSink {
|
||||
public:
|
||||
BreakSink(gfxTextRun* aTextRun, gfxContext* aContext, PRUint32 aOffsetIntoTextRun,
|
||||
BreakSink(gfxTextRun* aTextRun, PRUint32 aOffsetIntoTextRun,
|
||||
PRBool aExistingTextRun) :
|
||||
mTextRun(aTextRun), mContext(aContext),
|
||||
mOffsetIntoTextRun(aOffsetIntoTextRun),
|
||||
mChangedBreaks(PR_FALSE), mExistingTextRun(aExistingTextRun) {}
|
||||
mTextRun(aTextRun), mOffsetIntoTextRun(aOffsetIntoTextRun),
|
||||
mChangedBreaks(PR_FALSE), mExistingTextRun(aExistingTextRun) {}
|
||||
|
||||
virtual void SetBreaks(PRUint32 aOffset, PRUint32 aLength,
|
||||
PRPackedBool* aBreakBefore) {
|
||||
if (mTextRun->SetPotentialLineBreaks(aOffset + mOffsetIntoTextRun, aLength,
|
||||
aBreakBefore, mContext)) {
|
||||
aBreakBefore)) {
|
||||
mChangedBreaks = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
gfxTextRun* mTextRun;
|
||||
gfxContext* mContext;
|
||||
PRUint32 mOffsetIntoTextRun;
|
||||
PRPackedBool mChangedBreaks;
|
||||
PRPackedBool mExistingTextRun;
|
||||
|
@ -1808,7 +1806,7 @@ HasCompressedLeadingWhitespace(nsTextFrame* aFrame, PRInt32 aContentEndOffset,
|
|||
}
|
||||
|
||||
void
|
||||
BuildTextRunsScanner::SetupBreakSinksForTextRun(gfxTextRun* aTextRun,
|
||||
BuildTextRunsScanner::SetupBreakSinksForTextRun(gfxTextRun* aTextRun,
|
||||
PRBool aIsExistingTextRun,
|
||||
PRBool aSuppressSink)
|
||||
{
|
||||
|
@ -1823,8 +1821,7 @@ BuildTextRunsScanner::SetupBreakSinksForTextRun(gfxTextRun* aTextRun,
|
|||
for (i = 0; i < mMappedFlows.Length(); ++i) {
|
||||
MappedFlow* mappedFlow = &mMappedFlows[i];
|
||||
nsAutoPtr<BreakSink>* breakSink = mBreakSinks.AppendElement(
|
||||
new BreakSink(aTextRun, mContext,
|
||||
mappedFlow->mTransformedTextOffset, aIsExistingTextRun));
|
||||
new BreakSink(aTextRun, mappedFlow->mTransformedTextOffset, aIsExistingTextRun));
|
||||
if (!breakSink || !*breakSink)
|
||||
return;
|
||||
PRUint32 offset = mappedFlow->mTransformedTextOffset;
|
||||
|
@ -5569,12 +5566,10 @@ nsTextFrame::TrimTrailingWhiteSpace(nsPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
gfxContext* ctx = NS_STATIC_CAST(gfxContext*,
|
||||
aRC.GetNativeGraphicData(nsIRenderingContext::NATIVE_THEBES_CONTEXT));
|
||||
gfxFloat advanceDelta;
|
||||
mTextRun->SetLineBreaks(trimmedStart, trimmedEnd - trimmedStart,
|
||||
(GetStateBits() & TEXT_START_OF_LINE) != 0, PR_TRUE,
|
||||
&advanceDelta, ctx);
|
||||
&advanceDelta);
|
||||
|
||||
// aDeltaWidth is *subtracted* from our width.
|
||||
// If advanceDelta is positive then setting the line break made us longer,
|
||||
|
|
|
@ -61,7 +61,8 @@ public:
|
|||
const PRUint32 aFlags, nsStyleContext** aStyles,
|
||||
PRBool aOwnsFactory)
|
||||
: gfxTextRun(aParams, aString, aLength, aFontGroup, aFlags),
|
||||
mFactory(aFactory), mOwnsFactory(aOwnsFactory)
|
||||
mFactory(aFactory), mRefContext(aParams->mContext),
|
||||
mOwnsFactory(aOwnsFactory)
|
||||
{
|
||||
PRUint32 i;
|
||||
for (i = 0; i < aLength; ++i) {
|
||||
|
@ -79,20 +80,18 @@ public:
|
|||
}
|
||||
|
||||
virtual PRBool SetPotentialLineBreaks(PRUint32 aStart, PRUint32 aLength,
|
||||
PRPackedBool* aBreakBefore,
|
||||
gfxContext* aRefContext)
|
||||
PRPackedBool* aBreakBefore)
|
||||
{
|
||||
PRBool changed = gfxTextRun::SetPotentialLineBreaks(aStart, aLength,
|
||||
aBreakBefore, aRefContext);
|
||||
mFactory->RebuildTextRun(this, aRefContext);
|
||||
PRBool changed = gfxTextRun::SetPotentialLineBreaks(aStart, aLength, aBreakBefore);
|
||||
mFactory->RebuildTextRun(this);
|
||||
return changed;
|
||||
}
|
||||
virtual PRBool SetLineBreaks(PRUint32 aStart, PRUint32 aLength,
|
||||
PRBool aLineBreakBefore, PRBool aLineBreakAfter,
|
||||
gfxFloat* aAdvanceWidthDelta,
|
||||
gfxContext* aRefContext);
|
||||
gfxFloat* aAdvanceWidthDelta);
|
||||
|
||||
nsTransformingTextRunFactory *mFactory;
|
||||
nsRefPtr<gfxContext> mRefContext;
|
||||
nsTArray<PRUint32> mLineBreaks;
|
||||
nsTArray<nsRefPtr<nsStyleContext> > mStyles;
|
||||
PRPackedBool mOwnsFactory;
|
||||
|
@ -101,8 +100,7 @@ public:
|
|||
PRBool
|
||||
nsTransformedTextRun::SetLineBreaks(PRUint32 aStart, PRUint32 aLength,
|
||||
PRBool aLineBreakBefore, PRBool aLineBreakAfter,
|
||||
gfxFloat* aAdvanceWidthDelta,
|
||||
gfxContext* aRefContext)
|
||||
gfxFloat* aAdvanceWidthDelta)
|
||||
{
|
||||
nsTArray<PRUint32> newBreaks;
|
||||
PRUint32 i;
|
||||
|
@ -143,7 +141,7 @@ nsTransformedTextRun::SetLineBreaks(PRUint32 aStart, PRUint32 aLength,
|
|||
mLineBreaks.SwapElements(newBreaks);
|
||||
|
||||
gfxFloat currentAdvance = GetAdvanceWidth(aStart, aLength, nsnull);
|
||||
mFactory->RebuildTextRun(this, aRefContext);
|
||||
mFactory->RebuildTextRun(this);
|
||||
if (aAdvanceWidthDelta) {
|
||||
*aAdvanceWidthDelta = GetAdvanceWidth(aStart, aLength, nsnull) - currentAdvance;
|
||||
}
|
||||
|
@ -162,7 +160,7 @@ nsTransformingTextRunFactory::MakeTextRun(const PRUnichar* aString, PRUint32 aLe
|
|||
if (!textRun)
|
||||
return nsnull;
|
||||
|
||||
RebuildTextRun(textRun, aParams->mContext);
|
||||
RebuildTextRun(textRun);
|
||||
return textRun;
|
||||
}
|
||||
|
||||
|
@ -312,11 +310,10 @@ MergeCharactersInTextRun(gfxTextRun* aDest, gfxTextRun* aSrc,
|
|||
}
|
||||
|
||||
static gfxTextRunFactory::Parameters
|
||||
GetParametersForInner(nsTransformedTextRun* aTextRun, PRUint32* aFlags,
|
||||
gfxContext* aRefContext)
|
||||
GetParametersForInner(nsTransformedTextRun* aTextRun, PRUint32* aFlags)
|
||||
{
|
||||
gfxTextRunFactory::Parameters params =
|
||||
{ aRefContext, nsnull, nsnull,
|
||||
{ aTextRun->mRefContext, nsnull, nsnull,
|
||||
nsnull, nsnull, PRUint32(aTextRun->GetAppUnitsPerDevUnit())
|
||||
};
|
||||
*aFlags = aTextRun->GetFlags() & ~gfxFontGroup::TEXT_IS_PERSISTENT;
|
||||
|
@ -324,8 +321,7 @@ GetParametersForInner(nsTransformedTextRun* aTextRun, PRUint32* aFlags,
|
|||
}
|
||||
|
||||
void
|
||||
nsFontVariantTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun,
|
||||
gfxContext* aRefContext)
|
||||
nsFontVariantTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun)
|
||||
{
|
||||
nsICaseConversion* converter = nsTextTransformer::GetCaseConv();
|
||||
if (!converter)
|
||||
|
@ -339,8 +335,7 @@ nsFontVariantTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun,
|
|||
return;
|
||||
|
||||
PRUint32 flags;
|
||||
gfxTextRunFactory::Parameters innerParams =
|
||||
GetParametersForInner(aTextRun, &flags, aRefContext);
|
||||
gfxTextRunFactory::Parameters innerParams = GetParametersForInner(aTextRun, &flags);
|
||||
// The text outlives the child and inner textruns
|
||||
flags |= gfxFontGroup::TEXT_IS_PERSISTENT;
|
||||
|
||||
|
@ -409,8 +404,7 @@ nsFontVariantTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun,
|
|||
// (and also child will be shaped appropriately)
|
||||
NS_ASSERTION(canBreakBeforeArray.Length() == i - runStart,
|
||||
"lost some break-before values?");
|
||||
child->SetPotentialLineBreaks(0, canBreakBeforeArray.Length(),
|
||||
canBreakBeforeArray.Elements(), aRefContext);
|
||||
child->SetPotentialLineBreaks(0, canBreakBeforeArray.Length(), canBreakBeforeArray.Elements());
|
||||
AppendTextRun(aTextRun, child, runStart);
|
||||
|
||||
runStart = i;
|
||||
|
@ -433,8 +427,7 @@ nsFontVariantTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun,
|
|||
}
|
||||
|
||||
void
|
||||
nsCaseTransformTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun,
|
||||
gfxContext* aRefContext)
|
||||
nsCaseTransformTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun)
|
||||
{
|
||||
nsICaseConversion* converter = nsTextTransformer::GetCaseConv();
|
||||
if (!converter)
|
||||
|
@ -514,8 +507,7 @@ nsCaseTransformTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun,
|
|||
"lost track of line breaks somehow");
|
||||
|
||||
PRUint32 flags;
|
||||
gfxTextRunFactory::Parameters innerParams =
|
||||
GetParametersForInner(aTextRun, &flags, aRefContext);
|
||||
gfxTextRunFactory::Parameters innerParams = GetParametersForInner(aTextRun, &flags);
|
||||
gfxFontGroup* fontGroup = aTextRun->GetFontGroup();
|
||||
|
||||
nsAutoPtr<gfxTextRun> child;
|
||||
|
@ -539,8 +531,7 @@ nsCaseTransformTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun,
|
|||
// (and also child will be shaped appropriately)
|
||||
NS_ASSERTION(convertedString.Length() == canBreakBeforeArray.Length(),
|
||||
"Dropped characters or break-before values somewhere!");
|
||||
child->SetPotentialLineBreaks(0, canBreakBeforeArray.Length(),
|
||||
canBreakBeforeArray.Elements(), aRefContext);
|
||||
child->SetPotentialLineBreaks(0, canBreakBeforeArray.Length(), canBreakBeforeArray.Elements());
|
||||
// Now merge multiple characters into one multi-glyph character as required
|
||||
MergeCharactersInTextRun(aTextRun, child, charsToMergeArray.Elements());
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
gfxFontGroup* aFontGroup, PRUint32 aFlags,
|
||||
nsStyleContext** aStyles, PRBool aOwnsFactory = PR_TRUE);
|
||||
|
||||
virtual void RebuildTextRun(nsTransformedTextRun* aTextRun, gfxContext* aRefContext) = 0;
|
||||
virtual void RebuildTextRun(nsTransformedTextRun* aTextRun) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -66,7 +66,7 @@ public:
|
|||
*/
|
||||
class nsFontVariantTextRunFactory : public nsTransformingTextRunFactory {
|
||||
public:
|
||||
virtual void RebuildTextRun(nsTransformedTextRun* aTextRun, gfxContext* aRefContext);
|
||||
virtual void RebuildTextRun(nsTransformedTextRun* aTextRun);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -87,7 +87,7 @@ public:
|
|||
: mInnerTransformingTextRunFactory(aInnerTransformingTextRunFactory),
|
||||
mAllUppercase(aAllUppercase) {}
|
||||
|
||||
virtual void RebuildTextRun(nsTransformedTextRun* aTextRun, gfxContext* aRefContext);
|
||||
virtual void RebuildTextRun(nsTransformedTextRun* aTextRun);
|
||||
|
||||
protected:
|
||||
nsAutoPtr<nsTransformingTextRunFactory> mInnerTransformingTextRunFactory;
|
||||
|
|
Загрузка…
Ссылка в новой задаче