Bug 1423509 - cleanup for BuildTextRunsScanner::SetupLineBreakerContext. r=jfkthame
The textBreakPoints variable and its related logic are copied from
BuildTextRunForFrames, however, they are not used in
SetupLineBreakerContext at all. Remove the variable allocation and the
unnecessary while loop.
MozReview-Commit-ID: 1AsA6V7aGMh
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -2462,17 +2462,16 @@ BuildTextRunsScanner::SetupLineBreakerCo
}
void *textPtr = buffer.AppendElements(bufferSize, fallible);
if (!textPtr) {
return false;
}
gfxSkipChars skipChars;
- AutoTArray<int32_t,50> textBreakPoints;
TextRunUserData dummyData;
TextRunMappedFlow dummyMappedFlow;
TextRunMappedFlow* userMappedFlows;
TextRunUserData* userData;
TextRunUserData* userDataToDestroy;
// If the situation is particularly simple (and common) we don't need to
// allocate userData.
if (mMappedFlows.Length() == 1 && !mMappedFlows[0].mEndFrame &&
@@ -2483,19 +2482,16 @@ BuildTextRunsScanner::SetupLineBreakerCo
dummyData.mMappedFlowCount = mMappedFlows.Length();
dummyData.mLastFlowIndex = 0;
} else {
userData = CreateUserData(mMappedFlows.Length());
userMappedFlows = reinterpret_cast<TextRunMappedFlow*>(userData + 1);
userDataToDestroy = userData;
}
- uint32_t nextBreakIndex = 0;
- nsTextFrame* nextBreakBeforeFrame = GetNextBreakBeforeFrame(&nextBreakIndex);
-
const nsStyleText* textStyle = nullptr;
for (uint32_t i = 0; i < mMappedFlows.Length(); ++i) {
MappedFlow* mappedFlow = &mMappedFlows[i];
nsTextFrame* f = mappedFlow->mStartFrame;
textStyle = f->StyleText();
nsTextFrameUtils::CompressionMode compression =
GetCSSWhitespaceToCompressionMode(f, textStyle);
@@ -2508,22 +2504,16 @@ BuildTextRunsScanner::SetupLineBreakerCo
int32_t contentLength = contentEnd - contentStart;
TextRunMappedFlow* newFlow = &userMappedFlows[i];
newFlow->mStartFrame = mappedFlow->mStartFrame;
newFlow->mDOMOffsetToBeforeTransformOffset = skipChars.GetOriginalCharCount() -
mappedFlow->mStartFrame->GetContentOffset();
newFlow->mContentLength = contentLength;
- while (nextBreakBeforeFrame && nextBreakBeforeFrame->GetContent() == content) {
- textBreakPoints.AppendElement(
- nextBreakBeforeFrame->GetContentOffset() + newFlow->mDOMOffsetToBeforeTransformOffset);
- nextBreakBeforeFrame = GetNextBreakBeforeFrame(&nextBreakIndex);
- }
-
nsTextFrameUtils::Flags analysisFlags;
if (frag->Is2b()) {
NS_ASSERTION(mDoubleByteText, "Wrong buffer char size!");
char16_t* bufStart = static_cast<char16_t*>(textPtr);
char16_t* bufEnd = nsTextFrameUtils::TransformText(
frag->Get2b() + contentStart, contentLength, bufStart,
compression, &mNextRunContextInfo, &skipChars, &analysisFlags);
textPtr = bufEnd;