]> git.draconx.ca Git - gentoo-fixes.git/blobdiff - www-client/firefox/files/firefox-52.9.0-fix-thebes-templates.patch
Resurrect firefox-52.9.0 ebuild.
[gentoo-fixes.git] / www-client / firefox / files / firefox-52.9.0-fix-thebes-templates.patch
diff --git a/www-client/firefox/files/firefox-52.9.0-fix-thebes-templates.patch b/www-client/firefox/files/firefox-52.9.0-fix-thebes-templates.patch
new file mode 100644 (file)
index 0000000..ac62839
--- /dev/null
@@ -0,0 +1,183 @@
+diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp
+index d0b747fff..9ec629285 100644
+--- a/gfx/thebes/gfxFont.cpp
++++ b/gfx/thebes/gfxFont.cpp
+@@ -2535,85 +2535,6 @@ IsBoundarySpace(char16_t aChar, char16_t aNextChar)
+     return 0;
+ }
+-#ifdef __GNUC__
+-#define GFX_MAYBE_UNUSED __attribute__((unused))
+-#else
+-#define GFX_MAYBE_UNUSED
+-#endif
+-
+-template<typename T>
+-gfxShapedWord*
+-gfxFont::GetShapedWord(DrawTarget *aDrawTarget,
+-                       const T    *aText,
+-                       uint32_t    aLength,
+-                       uint32_t    aHash,
+-                       Script      aRunScript,
+-                       bool        aVertical,
+-                       int32_t     aAppUnitsPerDevUnit,
+-                       uint32_t    aFlags,
+-                       gfxTextPerfMetrics *aTextPerf GFX_MAYBE_UNUSED)
+-{
+-    // if the cache is getting too big, flush it and start over
+-    uint32_t wordCacheMaxEntries =
+-        gfxPlatform::GetPlatform()->WordCacheMaxEntries();
+-    if (mWordCache->Count() > wordCacheMaxEntries) {
+-        NS_WARNING("flushing shaped-word cache");
+-        ClearCachedWords();
+-    }
+-
+-    // if there's a cached entry for this word, just return it
+-    CacheHashKey key(aText, aLength, aHash,
+-                     aRunScript,
+-                     aAppUnitsPerDevUnit,
+-                     aFlags);
+-
+-    CacheHashEntry *entry = mWordCache->PutEntry(key);
+-    if (!entry) {
+-        NS_WARNING("failed to create word cache entry - expect missing text");
+-        return nullptr;
+-    }
+-    gfxShapedWord* sw = entry->mShapedWord.get();
+-
+-    bool isContent = !mStyle.systemFont;
+-
+-    if (sw) {
+-        sw->ResetAge();
+-        Telemetry::Accumulate((isContent ? Telemetry::WORD_CACHE_HITS_CONTENT :
+-                                   Telemetry::WORD_CACHE_HITS_CHROME),
+-                              aLength);
+-#ifndef RELEASE_OR_BETA
+-        if (aTextPerf) {
+-            aTextPerf->current.wordCacheHit++;
+-        }
+-#endif
+-        return sw;
+-    }
+-
+-    Telemetry::Accumulate((isContent ? Telemetry::WORD_CACHE_MISSES_CONTENT :
+-                               Telemetry::WORD_CACHE_MISSES_CHROME),
+-                          aLength);
+-#ifndef RELEASE_OR_BETA
+-    if (aTextPerf) {
+-        aTextPerf->current.wordCacheMiss++;
+-    }
+-#endif
+-
+-    sw = gfxShapedWord::Create(aText, aLength, aRunScript, aAppUnitsPerDevUnit,
+-                               aFlags);
+-    entry->mShapedWord.reset(sw);
+-    if (!sw) {
+-        NS_WARNING("failed to create gfxShapedWord - expect missing text");
+-        return nullptr;
+-    }
+-
+-    DebugOnly<bool> ok =
+-        ShapeText(aDrawTarget, aText, 0, aLength, aRunScript, aVertical, sw);
+-
+-    NS_WARNING_ASSERTION(ok, "failed to shape word - expect garbled text");
+-
+-    return sw;
+-}
+-
+ bool
+ gfxFont::CacheHashEntry::KeyEquals(const KeyTypePointer aKey) const
+ {
+diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h
+index ead0b7666..c38d06675 100644
+--- a/gfx/thebes/gfxFont.h
++++ b/gfx/thebes/gfxFont.h
+@@ -2220,4 +2220,88 @@ struct EmphasisMarkDrawParams {
+     bool isVertical;
+ };
++#include "mozilla/Telemetry.h"
++#include "mozilla/DebugOnly.h"
++
++#ifdef __GNUC__
++#define GFX_MAYBE_UNUSED __attribute__((unused))
++#else
++#define GFX_MAYBE_UNUSED
++#endif
++
++template<typename T>
++gfxShapedWord*
++gfxFont::GetShapedWord(DrawTarget *aDrawTarget,
++                       const T    *aText,
++                       uint32_t    aLength,
++                       uint32_t    aHash,
++                       Script      aRunScript,
++                       bool        aVertical,
++                       int32_t     aAppUnitsPerDevUnit,
++                       uint32_t    aFlags,
++                       gfxTextPerfMetrics *aTextPerf GFX_MAYBE_UNUSED)
++{
++    using namespace mozilla;
++
++    // if the cache is getting too big, flush it and start over
++    uint32_t wordCacheMaxEntries =
++        gfxPlatform::GetPlatform()->WordCacheMaxEntries();
++    if (mWordCache->Count() > wordCacheMaxEntries) {
++        NS_WARNING("flushing shaped-word cache");
++        ClearCachedWords();
++    }
++
++    // if there's a cached entry for this word, just return it
++    CacheHashKey key(aText, aLength, aHash,
++                     aRunScript,
++                     aAppUnitsPerDevUnit,
++                     aFlags);
++
++    CacheHashEntry *entry = mWordCache->PutEntry(key);
++    if (!entry) {
++        NS_WARNING("failed to create word cache entry - expect missing text");
++        return nullptr;
++    }
++    gfxShapedWord* sw = entry->mShapedWord.get();
++
++    bool isContent = !mStyle.systemFont;
++
++    if (sw) {
++        sw->ResetAge();
++        Telemetry::Accumulate((isContent ? Telemetry::WORD_CACHE_HITS_CONTENT :
++                                   Telemetry::WORD_CACHE_HITS_CHROME),
++                              aLength);
++#ifndef RELEASE_OR_BETA
++        if (aTextPerf) {
++            aTextPerf->current.wordCacheHit++;
++        }
++#endif
++        return sw;
++    }
++
++    Telemetry::Accumulate((isContent ? Telemetry::WORD_CACHE_MISSES_CONTENT :
++                               Telemetry::WORD_CACHE_MISSES_CHROME),
++                          aLength);
++#ifndef RELEASE_OR_BETA
++    if (aTextPerf) {
++        aTextPerf->current.wordCacheMiss++;
++    }
++#endif
++
++    sw = gfxShapedWord::Create(aText, aLength, aRunScript, aAppUnitsPerDevUnit,
++                               aFlags);
++    entry->mShapedWord.reset(sw);
++    if (!sw) {
++        NS_WARNING("failed to create gfxShapedWord - expect missing text");
++        return nullptr;
++    }
++
++    DebugOnly<bool> ok =
++        ShapeText(aDrawTarget, aText, 0, aLength, aRunScript, aVertical, sw);
++
++    NS_WARNING_ASSERTION(ok, "failed to shape word - expect garbled text");
++
++    return sw;
++}
++
+ #endif