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

This commit is contained in:
Xidorn Quan 2015-11-24 10:23:05 +11:00
parent b750b89be6
commit fecd22dd91

View File

@ -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>* 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<const char16_t*>(aTextPtr);
mLineBreaker.AppendText(hyphenationLanguage, text + offset,
length, flags, sink);