Bug 1416607 - error when Moz2DImageRenderer fails to create a NativeFontResource or UnscaledFont. r=jrmuizel

MozReview-Commit-ID: Jool723LUFX
This commit is contained in:
Lee Salzman 2017-11-14 23:15:31 -05:00
Родитель 3349ecafbd
Коммит 29099d481c
1 изменённых файлов: 7 добавлений и 1 удалений

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

@ -8,6 +8,7 @@
#include "mozilla/Range.h" #include "mozilla/Range.h"
#include "mozilla/gfx/2D.h" #include "mozilla/gfx/2D.h"
#include "mozilla/gfx/InlineTranslator.h" #include "mozilla/gfx/InlineTranslator.h"
#include "mozilla/gfx/Logging.h"
#include "mozilla/gfx/RecordedEvent.h" #include "mozilla/gfx/RecordedEvent.h"
#include "WebRenderTypes.h" #include "WebRenderTypes.h"
#include "webrender_ffi.h" #include "webrender_ffi.h"
@ -124,10 +125,15 @@ GetUnscaledFont(Translator *aTranslator, wr::FontKey key) {
type, type,
aTranslator->GetFontContext()); aTranslator->GetFontContext());
RefPtr<UnscaledFont> unscaledFont; RefPtr<UnscaledFont> unscaledFont;
if (fontResource) { if (!fontResource) {
gfxDevCrash(LogReason::NativeFontResourceNotFound) << "Failed to creative NativeFontResource for FontKey " << key.mHandle;
} else {
// Instance data is only needed for GDI fonts which webrender does not // Instance data is only needed for GDI fonts which webrender does not
// support. // support.
unscaledFont = fontResource->CreateUnscaledFont(data.mIndex, nullptr, 0); unscaledFont = fontResource->CreateUnscaledFont(data.mIndex, nullptr, 0);
if (!unscaledFont) {
gfxDevCrash(LogReason::UnscaledFontNotFound) << "Failed to create UnscaledFont for FontKey " << key.mHandle;
}
} }
data.mUnscaledFont = unscaledFont; data.mUnscaledFont = unscaledFont;
return unscaledFont; return unscaledFont;