Bug 1283106 - Put empty skip chars in gfxPlatform singleton rather than static local variable. r=jfkthame

MozReview-Commit-ID: 5SU6ewm5wbd

--HG--
extra : rebase_source : f522172d3ca191ba33c222c497e91bb718fda23e
This commit is contained in:
Xidorn Quan 2016-07-05 11:02:24 +10:00
parent 2a6206aecc
commit f01d901ec8
2 changed files with 10 additions and 4 deletions

View File

@ -16,6 +16,7 @@
#include "gfxTypes.h"
#include "gfxFontFamilyList.h"
#include "gfxBlur.h"
#include "gfxSkipChars.h"
#include "nsRect.h"
#include "qcms.h"
@ -661,6 +662,8 @@ public:
static bool IsGfxInfoStatusOkay(int32_t aFeature, nsCString* aOutMessage,
nsCString& aFailureId);
const gfxSkipChars& EmptySkipChars() const { return kEmptySkipChars; }
protected:
gfxPlatform();
virtual ~gfxPlatform();
@ -812,6 +815,10 @@ private:
// Generation number for devices that ClientLayerManagers might depend on.
uint64_t mDeviceCounter;
// An instance of gfxSkipChars which is empty. It is used as the
// basis for error-case iterators.
const gfxSkipChars kEmptySkipChars;
};
#endif /* GFX_PLATFORM_H */

View File

@ -2654,8 +2654,8 @@ nsTextFrame::EnsureTextRun(TextRunType aWhichTextRun,
if (!textRun) {
// A text run was not constructed for this frame. This is bad. The caller
// will check mTextRun.
static const gfxSkipChars emptySkipChars;
return gfxSkipCharsIterator(emptySkipChars, 0);
return gfxSkipCharsIterator(gfxPlatform::
GetPlatform()->EmptySkipChars(), 0);
}
TabWidthStore* tabWidths = Properties().Get(TabWidthProperty());
if (tabWidths && tabWidths->mValidForContentOffset != GetContentOffset()) {
@ -2692,8 +2692,7 @@ nsTextFrame::EnsureTextRun(TextRunType aWhichTextRun,
}
NS_ERROR("Can't find flow containing this frame???");
static const gfxSkipChars emptySkipChars;
return gfxSkipCharsIterator(emptySkipChars, 0);
return gfxSkipCharsIterator(gfxPlatform::GetPlatform()->EmptySkipChars(), 0);
}
static uint32_t