From 03bc38abafec00d268f39d2140cc950ed8157c3e Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Tue, 24 Nov 2015 10:23:05 +1100 Subject: [PATCH] Bug 1227001 part 1 - Remove SetupBreakSinksFlags from BuildTextRunsScanner. r=jfkthame --HG-- extra : source : 2ef65b73284b28557846d737f704552a2a474389 --- layout/generic/nsTextFrame.cpp | 37 +++++++--------------------------- 1 file changed, 7 insertions(+), 30 deletions(-) diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index d60115904e72..d8703b749b86 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -925,14 +925,7 @@ public: bool SetupLineBreakerContext(gfxTextRun *aTextRun); void AssignTextRun(gfxTextRun* aTextRun, float aInflation); nsTextFrame* GetNextBreakBeforeFrame(uint32_t* aIndex); - enum SetupBreakSinksFlags { - SBS_DOUBLE_BYTE = (1 << 0), - SBS_EXISTING_TEXTRUN = (1 << 1), - SBS_SUPPRESS_SINK = (1 << 2) - }; - void SetupBreakSinksForTextRun(gfxTextRun* aTextRun, - const void* aTextPtr, - uint32_t aFlags); + void SetupBreakSinksForTextRun(gfxTextRun* aTextRun, const void* aTextPtr); struct FindBoundaryState { nsIFrame* mStopAtFrame; nsTextFrame* mFirstTextFrame; @@ -2267,14 +2260,7 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer) // the breaks may be stored in the textrun during this very call. // This is a bit annoying because it requires another loop over the frames // making up the textrun, but I don't see a way to avoid this. - uint32_t flags = 0; - if (mDoubleByteText) { - flags |= SBS_DOUBLE_BYTE; - } - if (mSkipIncompleteTextRuns) { - flags |= SBS_SUPPRESS_SINK; - } - SetupBreakSinksForTextRun(textRun, textPtr, flags); + SetupBreakSinksForTextRun(textRun, textPtr); if (mSkipIncompleteTextRuns) { mSkipIncompleteTextRuns = !TextContainsLineBreakerWhiteSpace(textPtr, @@ -2407,14 +2393,7 @@ BuildTextRunsScanner::SetupLineBreakerContext(gfxTextRun *aTextRun) // the breaks may be stored in the textrun during this very call. // This is a bit annoying because it requires another loop over the frames // making up the textrun, but I don't see a way to avoid this. - uint32_t flags = 0; - if (mDoubleByteText) { - flags |= SBS_DOUBLE_BYTE; - } - if (mSkipIncompleteTextRuns) { - flags |= SBS_SUPPRESS_SINK; - } - SetupBreakSinksForTextRun(aTextRun, buffer.Elements(), flags); + SetupBreakSinksForTextRun(aTextRun, buffer.Elements()); DestroyUserData(userDataToDestroy); @@ -2443,8 +2422,7 @@ HasCompressedLeadingWhitespace(nsTextFrame* aFrame, const nsStyleText* aStyleTex void BuildTextRunsScanner::SetupBreakSinksForTextRun(gfxTextRun* aTextRun, - const void* aTextPtr, - uint32_t aFlags) + const void* aTextPtr) { // textruns have uniform language const nsStyleFont *styleFont = mMappedFlows[0].mStartFrame->StyleFont(); @@ -2465,8 +2443,7 @@ BuildTextRunsScanner::SetupBreakSinksForTextRun(gfxTextRun* aTextRun, mappedFlow->mStartFrame->GetContentOffset()); nsAutoPtr* breakSink = mBreakSinks.AppendElement( - new BreakSink(aTextRun, mContext, offset, - (aFlags & SBS_EXISTING_TEXTRUN) != 0)); + new BreakSink(aTextRun, mContext, offset, false)); if (!breakSink || !*breakSink) return; @@ -2502,8 +2479,8 @@ BuildTextRunsScanner::SetupBreakSinksForTextRun(gfxTextRun* aTextRun, if (length > 0) { BreakSink* sink = - (aFlags & SBS_SUPPRESS_SINK) ? nullptr : (*breakSink).get(); - if (aFlags & SBS_DOUBLE_BYTE) { + mSkipIncompleteTextRuns ? nullptr : (*breakSink).get(); + if (mDoubleByteText) { const char16_t* text = reinterpret_cast(aTextPtr); mLineBreaker.AppendText(hyphenationLanguage, text + offset, length, flags, sink);