Bug 1227001 part 1 - Remove SetupBreakSinksFlags from BuildTextRunsScanner. r=jfkthame

--HG--
extra : source : 2ef65b73284b28557846d737f704552a2a474389
This commit is contained in:
Xidorn Quan 2015-11-24 10:23:05 +11:00
Родитель 62f9ceed14
Коммит 03bc38abaf
1 изменённых файлов: 7 добавлений и 30 удалений

Просмотреть файл

@ -925,14 +925,7 @@ public:
bool SetupLineBreakerContext(gfxTextRun *aTextRun); bool SetupLineBreakerContext(gfxTextRun *aTextRun);
void AssignTextRun(gfxTextRun* aTextRun, float aInflation); void AssignTextRun(gfxTextRun* aTextRun, float aInflation);
nsTextFrame* GetNextBreakBeforeFrame(uint32_t* aIndex); nsTextFrame* GetNextBreakBeforeFrame(uint32_t* aIndex);
enum SetupBreakSinksFlags { void SetupBreakSinksForTextRun(gfxTextRun* aTextRun, const void* aTextPtr);
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);
struct FindBoundaryState { struct FindBoundaryState {
nsIFrame* mStopAtFrame; nsIFrame* mStopAtFrame;
nsTextFrame* mFirstTextFrame; nsTextFrame* mFirstTextFrame;
@ -2267,14 +2260,7 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
// the breaks may be stored in the textrun during this very call. // 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 // 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. // making up the textrun, but I don't see a way to avoid this.
uint32_t flags = 0; SetupBreakSinksForTextRun(textRun, textPtr);
if (mDoubleByteText) {
flags |= SBS_DOUBLE_BYTE;
}
if (mSkipIncompleteTextRuns) {
flags |= SBS_SUPPRESS_SINK;
}
SetupBreakSinksForTextRun(textRun, textPtr, flags);
if (mSkipIncompleteTextRuns) { if (mSkipIncompleteTextRuns) {
mSkipIncompleteTextRuns = !TextContainsLineBreakerWhiteSpace(textPtr, mSkipIncompleteTextRuns = !TextContainsLineBreakerWhiteSpace(textPtr,
@ -2407,14 +2393,7 @@ BuildTextRunsScanner::SetupLineBreakerContext(gfxTextRun *aTextRun)
// the breaks may be stored in the textrun during this very call. // 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 // 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. // making up the textrun, but I don't see a way to avoid this.
uint32_t flags = 0; SetupBreakSinksForTextRun(aTextRun, buffer.Elements());
if (mDoubleByteText) {
flags |= SBS_DOUBLE_BYTE;
}
if (mSkipIncompleteTextRuns) {
flags |= SBS_SUPPRESS_SINK;
}
SetupBreakSinksForTextRun(aTextRun, buffer.Elements(), flags);
DestroyUserData(userDataToDestroy); DestroyUserData(userDataToDestroy);
@ -2443,8 +2422,7 @@ HasCompressedLeadingWhitespace(nsTextFrame* aFrame, const nsStyleText* aStyleTex
void void
BuildTextRunsScanner::SetupBreakSinksForTextRun(gfxTextRun* aTextRun, BuildTextRunsScanner::SetupBreakSinksForTextRun(gfxTextRun* aTextRun,
const void* aTextPtr, const void* aTextPtr)
uint32_t aFlags)
{ {
// textruns have uniform language // textruns have uniform language
const nsStyleFont *styleFont = mMappedFlows[0].mStartFrame->StyleFont(); const nsStyleFont *styleFont = mMappedFlows[0].mStartFrame->StyleFont();
@ -2465,8 +2443,7 @@ BuildTextRunsScanner::SetupBreakSinksForTextRun(gfxTextRun* aTextRun,
mappedFlow->mStartFrame->GetContentOffset()); mappedFlow->mStartFrame->GetContentOffset());
nsAutoPtr<BreakSink>* breakSink = mBreakSinks.AppendElement( nsAutoPtr<BreakSink>* breakSink = mBreakSinks.AppendElement(
new BreakSink(aTextRun, mContext, offset, new BreakSink(aTextRun, mContext, offset, false));
(aFlags & SBS_EXISTING_TEXTRUN) != 0));
if (!breakSink || !*breakSink) if (!breakSink || !*breakSink)
return; return;
@ -2502,8 +2479,8 @@ BuildTextRunsScanner::SetupBreakSinksForTextRun(gfxTextRun* aTextRun,
if (length > 0) { if (length > 0) {
BreakSink* sink = BreakSink* sink =
(aFlags & SBS_SUPPRESS_SINK) ? nullptr : (*breakSink).get(); mSkipIncompleteTextRuns ? nullptr : (*breakSink).get();
if (aFlags & SBS_DOUBLE_BYTE) { if (mDoubleByteText) {
const char16_t* text = reinterpret_cast<const char16_t*>(aTextPtr); const char16_t* text = reinterpret_cast<const char16_t*>(aTextPtr);
mLineBreaker.AppendText(hyphenationLanguage, text + offset, mLineBreaker.AppendText(hyphenationLanguage, text + offset,
length, flags, sink); length, flags, sink);