Bug 1423509 - cleanup for BuildTextRunsScanner::SetupLineBreakerContext. r=jfkthame
authorJeremy Chen <jeremychen@mozilla.com>
Wed, 06 Dec 2017 17:18:07 +0800
changeset 708680 3e891763f31727c1cc84dbda8061bd1dc14d4d94
parent 708679 0a040f4441d0a284b1b51daa8567a8ed7feb1b6f
child 708681 a74542182b9743acd6bb3370203c5f38fc2a1b71
push id92403
push userVYV03354@nifty.ne.jp
push dateWed, 06 Dec 2017 22:18:41 +0000
reviewersjfkthame
bugs1423509
milestone59.0a1
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
layout/generic/nsTextFrame.cpp
--- 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;