diff options
Diffstat (limited to 'gfx')
-rw-r--r-- | gfx/gl/GfxTexturesReporter.cpp | 8 | ||||
-rw-r--r-- | gfx/ipc/GPUChild.cpp | 9 | ||||
-rw-r--r-- | gfx/ipc/GPUParent.cpp | 8 | ||||
-rw-r--r-- | gfx/src/DriverCrashGuard.cpp | 19 | ||||
-rw-r--r-- | gfx/src/gfxCrashReporterUtils.cpp | 4 | ||||
-rw-r--r-- | gfx/tests/gtest/TestGfxPrefs.cpp | 24 | ||||
-rw-r--r-- | gfx/thebes/gfxFT2Utils.cpp | 30 | ||||
-rw-r--r-- | gfx/thebes/gfxFcPlatformFontList.cpp | 29 | ||||
-rw-r--r-- | gfx/thebes/gfxFcPlatformFontList.h | 4 | ||||
-rw-r--r-- | gfx/thebes/gfxPlatform.cpp | 8 | ||||
-rw-r--r-- | gfx/thebes/gfxPlatformGtk.cpp | 6 | ||||
-rwxr-xr-x | gfx/thebes/gfxWindowsPlatform.cpp | 8 |
12 files changed, 56 insertions, 101 deletions
diff --git a/gfx/gl/GfxTexturesReporter.cpp b/gfx/gl/GfxTexturesReporter.cpp index 8007fe6b1..d2ca70d27 100644 --- a/gfx/gl/GfxTexturesReporter.cpp +++ b/gfx/gl/GfxTexturesReporter.cpp @@ -9,10 +9,6 @@ #include "GfxTexturesReporter.h" #include "gfxPrefs.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif - using namespace mozilla; using namespace mozilla::gl; @@ -75,8 +71,4 @@ GfxTexturesReporter::UpdateAmount(MemoryUse action, size_t amount) } } } - -#ifdef MOZ_CRASHREPORTER - CrashReporter::AnnotateTexturesSize(sAmount); -#endif } diff --git a/gfx/ipc/GPUChild.cpp b/gfx/ipc/GPUChild.cpp index 72328ac0b..3c2797683 100644 --- a/gfx/ipc/GPUChild.cpp +++ b/gfx/ipc/GPUChild.cpp @@ -121,9 +121,6 @@ GPUChild::RecvGraphicsError(const nsCString& aError) bool GPUChild::RecvInitCrashReporter(Shmem&& aShmem) { -#ifdef MOZ_CRASHREPORTER - mCrashReporter = MakeUnique<ipc::CrashReporterHost>(GeckoProcessType_GPU, aShmem); -#endif return true; } @@ -163,12 +160,6 @@ void GPUChild::ActorDestroy(ActorDestroyReason aWhy) { if (aWhy == AbnormalShutdown) { -#ifdef MOZ_CRASHREPORTER - if (mCrashReporter) { - mCrashReporter->GenerateCrashReport(OtherPid()); - mCrashReporter = nullptr; - } -#endif Telemetry::Accumulate(Telemetry::SUBPROCESS_ABNORMAL_ABORT, nsDependentCString(XRE_ChildProcessTypeToString(GeckoProcessType_GPU), 1)); } diff --git a/gfx/ipc/GPUParent.cpp b/gfx/ipc/GPUParent.cpp index d63e17e2f..896c7b36b 100644 --- a/gfx/ipc/GPUParent.cpp +++ b/gfx/ipc/GPUParent.cpp @@ -82,11 +82,6 @@ GPUParent::Init(base::ProcessId aParentPid, nsDebugImpl::SetMultiprocessMode("GPU"); -#ifdef MOZ_CRASHREPORTER - // Init crash reporter support. - CrashReporterClient::InitSingleton(this); -#endif - // Ensure gfxPrefs are initialized. gfxPrefs::GetSingleton(); gfxConfig::Init(); @@ -380,9 +375,6 @@ GPUParent::ActorDestroy(ActorDestroyReason aWhy) gfxVars::Shutdown(); gfxConfig::Shutdown(); gfxPrefs::DestroySingleton(); -#ifdef MOZ_CRASHREPORTER - CrashReporterClient::DestroySingleton(); -#endif XRE_ShutdownChildProcess(); } diff --git a/gfx/src/DriverCrashGuard.cpp b/gfx/src/DriverCrashGuard.cpp index 36d08dcf3..4754c26ad 100644 --- a/gfx/src/DriverCrashGuard.cpp +++ b/gfx/src/DriverCrashGuard.cpp @@ -7,9 +7,6 @@ #include "gfxPrefs.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
#include "nsServiceManagerUtils.h"
#include "nsString.h"
#include "nsXULAppAPI.h"
@@ -164,12 +161,6 @@ DriverCrashGuard::~DriverCrashGuard() } else {
dom::ContentChild::GetSingleton()->SendEndDriverCrashGuard(uint32_t(mType));
}
-
-#ifdef MOZ_CRASHREPORTER
- // Remove the crash report annotation.
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("GraphicsStartupTest"),
- NS_LITERAL_CSTRING(""));
-#endif
}
bool
@@ -208,16 +199,6 @@ DriverCrashGuard::ActivateGuard() {
mGuardActivated = true;
-#ifdef MOZ_CRASHREPORTER
- // Anotate crash reports only if we're a real guard. Otherwise, we could
- // attribute a random parent process crash to a graphics problem in a child
- // process.
- if (mMode != Mode::Proxy) {
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("GraphicsStartupTest"),
- NS_LITERAL_CSTRING("1"));
- }
-#endif
-
// If we're in the content process, the rest of the guarding is handled
// in the parent.
if (XRE_IsContentProcess()) {
diff --git a/gfx/src/gfxCrashReporterUtils.cpp b/gfx/src/gfxCrashReporterUtils.cpp index 42647ccc6..757c15527 100644 --- a/gfx/src/gfxCrashReporterUtils.cpp +++ b/gfx/src/gfxCrashReporterUtils.cpp @@ -5,10 +5,6 @@ #include "gfxCrashReporterUtils.h" -#if defined(MOZ_CRASHREPORTER) -#define MOZ_GFXFEATUREREPORTER 1 -#endif - #ifdef MOZ_GFXFEATUREREPORTER #include "gfxCrashReporterUtils.h" #include <string.h> // for strcmp diff --git a/gfx/tests/gtest/TestGfxPrefs.cpp b/gfx/tests/gtest/TestGfxPrefs.cpp index 72b698ed6..4e3b6037e 100644 --- a/gfx/tests/gtest/TestGfxPrefs.cpp +++ b/gfx/tests/gtest/TestGfxPrefs.cpp @@ -80,27 +80,3 @@ TEST(GfxPrefs, Set) { ASSERT_TRUE(gfxPrefs::APZMaxVelocity() == -1.0f); } -#ifdef MOZ_CRASHREPORTER -// Randomly test the function we use in nsExceptionHandler.cpp here: -extern bool SimpleNoCLibDtoA(double aValue, char* aBuffer, int aBufferLength); -TEST(GfxPrefs, StringUtility) -{ - char testBuffer[64]; - double testVal[] = {13.4, - 3324243.42, - 0.332424342, - 864.0, - 86400 * 100000000.0 * 10000000000.0 * 10000000000.0 * 100.0, - 86400.0 * 366.0 * 100.0 + 14243.44332}; - for (size_t i=0; i<mozilla::ArrayLength(testVal); i++) { - ASSERT_TRUE(SimpleNoCLibDtoA(testVal[i], testBuffer, sizeof(testBuffer))); - ASSERT_TRUE(fabs(1.0 - atof(testBuffer)/testVal[i]) < 0.0001); - } - - // We do not like negative numbers (random limitation) - ASSERT_FALSE(SimpleNoCLibDtoA(-864.0, testBuffer, sizeof(testBuffer))); - - // It won't fit into 32: - ASSERT_FALSE(SimpleNoCLibDtoA(testVal[4], testBuffer, sizeof(testBuffer)/2)); -} -#endif diff --git a/gfx/thebes/gfxFT2Utils.cpp b/gfx/thebes/gfxFT2Utils.cpp index a544a8cb4..77e1c9632 100644 --- a/gfx/thebes/gfxFT2Utils.cpp +++ b/gfx/thebes/gfxFT2Utils.cpp @@ -10,6 +10,10 @@ #include FT_TRUETYPE_TABLES_H #include <algorithm> +#ifndef FT_FACE_FLAG_COLOR +#define FT_FACE_FLAG_COLOR ( 1L << 14 ) +#endif + #ifdef HAVE_FONTCONFIG_FCFREETYPE_H #include <fontconfig/fcfreetype.h> #endif @@ -53,7 +57,7 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics, if (MOZ_UNLIKELY(!mFace)) { // No face. This unfortunate situation might happen if the font // file is (re)moved at the wrong time. - const gfxFloat emHeight = mGfxFont->GetStyle()->size; + const gfxFloat emHeight = mGfxFont->GetAdjustedSize(); aMetrics->emHeight = emHeight; aMetrics->maxAscent = aMetrics->emAscent = 0.8 * emHeight; aMetrics->maxDescent = aMetrics->emDescent = 0.2 * emHeight; @@ -80,6 +84,11 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics, const FT_Size_Metrics& ftMetrics = mFace->size->metrics; + aMetrics->maxAscent = FLOAT_FROM_26_6(ftMetrics.ascender); + aMetrics->maxDescent = -FLOAT_FROM_26_6(ftMetrics.descender); + aMetrics->maxAdvance = FLOAT_FROM_26_6(ftMetrics.max_advance); + gfxFloat lineHeight = FLOAT_FROM_26_6(ftMetrics.height); + gfxFloat emHeight; // Scale for vertical design metric conversion: pixels per design unit. // If this remains at 0.0, we can't use metrics from OS/2 etc. @@ -103,6 +112,19 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics, const TT_Header* head = static_cast<TT_Header*>(FT_Get_Sfnt_Table(mFace, ft_sfnt_head)); if (head) { + // Even if the font is not explicitly scalable, if the face has + // color bitmaps, it should be treated as scalable and scaled to + // the desired size. Metrics based on y_ppem need to be rescaled + // for the adjusted size. This makes metrics agree with the + // scales we pass to Cairo for Fontconfig fonts. + if (mFace->face_flags & FT_FACE_FLAG_COLOR) { + emHeight = mGfxFont->GetAdjustedSize(); + gfxFloat adjustScale = emHeight / ftMetrics.y_ppem; + aMetrics->maxAscent *= adjustScale; + aMetrics->maxDescent *= adjustScale; + aMetrics->maxAdvance *= adjustScale; + lineHeight *= adjustScale; + } gfxFloat emUnit = head->Units_Per_EM; yScale = emHeight / emUnit; } @@ -111,11 +133,6 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics, TT_OS2 *os2 = static_cast<TT_OS2*>(FT_Get_Sfnt_Table(mFace, ft_sfnt_os2)); - aMetrics->maxAscent = FLOAT_FROM_26_6(ftMetrics.ascender); - aMetrics->maxDescent = -FLOAT_FROM_26_6(ftMetrics.descender); - aMetrics->maxAdvance = FLOAT_FROM_26_6(ftMetrics.max_advance); - - gfxFloat lineHeight; if (os2 && os2->sTypoAscender && yScale > 0.0) { aMetrics->emAscent = os2->sTypoAscender * yScale; aMetrics->emDescent = -os2->sTypoDescender * yScale; @@ -142,7 +159,6 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics, } else { aMetrics->emAscent = aMetrics->maxAscent; aMetrics->emDescent = aMetrics->maxDescent; - lineHeight = FLOAT_FROM_26_6(ftMetrics.height); } cairo_text_extents_t extents; diff --git a/gfx/thebes/gfxFcPlatformFontList.cpp b/gfx/thebes/gfxFcPlatformFontList.cpp index 601e7a90c..75e8fb76a 100644 --- a/gfx/thebes/gfxFcPlatformFontList.cpp +++ b/gfx/thebes/gfxFcPlatformFontList.cpp @@ -811,6 +811,15 @@ ChooseFontSize(gfxFontconfigFontEntry* aEntry, bestSize = size; } } + // If the font has bitmaps but wants to be scaled, then let it scale. + if (bestSize >= 0.0) { + FcBool scalable; + if (FcPatternGetBool(aEntry->GetPattern(), + FC_SCALABLE, 0, &scalable) == FcResultMatch && + scalable) { + return requestedSize; + } + } return bestSize; } @@ -946,10 +955,16 @@ gfxFontconfigFontFamily::AddFontPattern(FcPattern* aFontPattern) NS_ASSERTION(!mHasStyles, "font patterns must not be added to already enumerated families"); - FcBool scalable; - if (FcPatternGetBool(aFontPattern, FC_SCALABLE, 0, &scalable) != FcResultMatch || - !scalable) { + FcBool outline; + if (FcPatternGetBool(aFontPattern, FC_OUTLINE, 0, &outline) != FcResultMatch || + !outline) { mHasNonScalableFaces = true; + + FcBool scalable; + if (FcPatternGetBool(aFontPattern, FC_SCALABLE, 0, &scalable) == FcResultMatch && + scalable) { + mForceScalable = true; + } } nsCountedRef<FcPattern> pattern(aFontPattern); @@ -961,7 +976,9 @@ static const double kRejectDistance = 10000.0; // Calculate a distance score representing the size disparity between the // requested style's size and the font entry's size. static double -SizeDistance(gfxFontconfigFontEntry* aEntry, const gfxFontStyle& aStyle) +SizeDistance(gfxFontconfigFontEntry* aEntry, + const gfxFontStyle& aStyle, + bool aForceScalable) { double requestedSize = SizeForStyle(aEntry, aStyle); double bestDist = -1.0; @@ -978,7 +995,7 @@ SizeDistance(gfxFontconfigFontEntry* aEntry, const gfxFontStyle& aStyle) if (bestDist < 0.0) { // No size means scalable return -1.0; - } else if (5.0 * bestDist < requestedSize) { + } else if (aForceScalable || 5.0 * bestDist < requestedSize) { // fontconfig prefers a matching family or lang to pixelsize of bitmap // fonts. CSS suggests a tolerance of 20% on pixelsize. return bestDist; @@ -1012,7 +1029,7 @@ gfxFontconfigFontFamily::FindAllFontsForStyle(const gfxFontStyle& aFontStyle, for (size_t i = 0; i < aFontEntryList.Length(); i++) { gfxFontconfigFontEntry* entry = static_cast<gfxFontconfigFontEntry*>(aFontEntryList[i]); - double dist = SizeDistance(entry, aFontStyle); + double dist = SizeDistance(entry, aFontStyle, mForceScalable); // If the entry is scalable or has a style that does not match // the group of unscalable fonts, then start a new group. if (dist < 0.0 || diff --git a/gfx/thebes/gfxFcPlatformFontList.h b/gfx/thebes/gfxFcPlatformFontList.h index 1bc35021e..aa8f614a9 100644 --- a/gfx/thebes/gfxFcPlatformFontList.h +++ b/gfx/thebes/gfxFcPlatformFontList.h @@ -175,7 +175,8 @@ public: explicit gfxFontconfigFontFamily(const nsAString& aName) : gfxFontFamily(aName), mContainsAppFonts(false), - mHasNonScalableFaces(false) + mHasNonScalableFaces(false), + mForceScalable(false) { } void FindStyleVariations(FontInfoData *aFontInfoData = nullptr) override; @@ -201,6 +202,7 @@ protected: bool mContainsAppFonts; bool mHasNonScalableFaces; + bool mForceScalable; }; class gfxFontconfigFont : public gfxFontconfigFontBase { diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 2e4ec990f..a468592fe 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -71,9 +71,6 @@ #include "nsIScreenManager.h" #include "FrameMetrics.h" #include "MainThreadUtils.h" -#ifdef MOZ_CRASHREPORTER -#include "nsExceptionHandler.h" -#endif #include "nsWeakReference.h" @@ -293,12 +290,7 @@ void CrashStatsLogForwarder::UpdateCrashReport() message << logAnnotation << Get<0>(*it) << "]" << Get<1>(*it) << " (t=" << Get<2>(*it) << ") "; } -#ifdef MOZ_CRASHREPORTER - nsCString reportString(message.str().c_str()); - nsresult annotated = CrashReporter::AnnotateCrashReport(mCrashCriticalKey, reportString); -#else nsresult annotated = NS_ERROR_NOT_IMPLEMENTED; -#endif if (annotated != NS_OK) { printf("Crash Annotation %s: %s", mCrashCriticalKey.get(), message.str().c_str()); diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp index 9d7f512f2..1fb3bc4fd 100644 --- a/gfx/thebes/gfxPlatformGtk.cpp +++ b/gfx/thebes/gfxPlatformGtk.cpp @@ -227,10 +227,10 @@ gfxPlatformGtk::UpdateFontList() // out a more general list static const char kFontDejaVuSans[] = "DejaVu Sans"; static const char kFontDejaVuSerif[] = "DejaVu Serif"; -static const char kFontEmojiOneMozilla[] = "EmojiOne Mozilla"; static const char kFontFreeSans[] = "FreeSans"; static const char kFontFreeSerif[] = "FreeSerif"; static const char kFontTakaoPGothic[] = "TakaoPGothic"; +static const char kFontTwemojiMozilla[] = "Twemoji Mozilla"; static const char kFontDroidSansFallback[] = "Droid Sans Fallback"; static const char kFontWenQuanYiMicroHei[] = "WenQuanYi Micro Hei"; static const char kFontNanumGothic[] = "NanumGothic"; @@ -242,7 +242,7 @@ gfxPlatformGtk::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh, { if (aNextCh == 0xfe0fu) { // if char is followed by VS16, try for a color emoji glyph - aFontList.AppendElement(kFontEmojiOneMozilla); + aFontList.AppendElement(kFontTwemojiMozilla); } aFontList.AppendElement(kFontDejaVuSerif); @@ -254,7 +254,7 @@ gfxPlatformGtk::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh, uint32_t p = aCh >> 16; if (p == 1) { // try color emoji font, unless VS15 (text style) present if (aNextCh != 0xfe0fu && aNextCh != 0xfe0eu) { - aFontList.AppendElement(kFontEmojiOneMozilla); + aFontList.AppendElement(kFontTwemojiMozilla); } } } diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp index 84199170b..af4d932a9 100755 --- a/gfx/thebes/gfxWindowsPlatform.cpp +++ b/gfx/thebes/gfxWindowsPlatform.cpp @@ -634,7 +634,6 @@ static const char kFontCambriaMath[] = "Cambria Math"; static const char kFontEbrima[] = "Ebrima"; static const char kFontEstrangeloEdessa[] = "Estrangelo Edessa"; static const char kFontEuphemia[] = "Euphemia"; -static const char kFontEmojiOneMozilla[] = "EmojiOne Mozilla"; static const char kFontGabriola[] = "Gabriola"; static const char kFontJavaneseText[] = "Javanese Text"; static const char kFontKhmerUI[] = "Khmer UI"; @@ -661,6 +660,7 @@ static const char kFontSegoeUIEmoji[] = "Segoe UI Emoji"; static const char kFontSegoeUISymbol[] = "Segoe UI Symbol"; static const char kFontSylfaen[] = "Sylfaen"; static const char kFontTraditionalArabic[] = "Traditional Arabic"; +static const char kFontTwemojiMozilla[] = "Twemoji Mozilla"; static const char kFontUtsaah[] = "Utsaah"; static const char kFontYuGothic[] = "Yu Gothic"; @@ -671,7 +671,7 @@ gfxWindowsPlatform::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh, { if (aNextCh == 0xfe0fu) { aFontList.AppendElement(kFontSegoeUIEmoji); - aFontList.AppendElement(kFontEmojiOneMozilla); + aFontList.AppendElement(kFontTwemojiMozilla); } // Arial is used as the default fallback for system fallback @@ -683,11 +683,11 @@ gfxWindowsPlatform::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh, if (aNextCh == 0xfe0eu) { aFontList.AppendElement(kFontSegoeUISymbol); aFontList.AppendElement(kFontSegoeUIEmoji); - aFontList.AppendElement(kFontEmojiOneMozilla); + aFontList.AppendElement(kFontTwemojiMozilla); } else { if (aNextCh != 0xfe0fu) { aFontList.AppendElement(kFontSegoeUIEmoji); - aFontList.AppendElement(kFontEmojiOneMozilla); + aFontList.AppendElement(kFontTwemojiMozilla); } aFontList.AppendElement(kFontSegoeUISymbol); } |