Bug 798853, gfx. r=roc

This commit is contained in:
Mats Palmgren 2012-10-22 15:53:31 +02:00
parent 4058b7e19b
commit 8b20f6f589
2 changed files with 14 additions and 3 deletions

View File

@ -30,6 +30,7 @@
#include "nsBidiUtils.h"
#include "nsUnicodeRange.h"
#include "nsStyleConsts.h"
#include "mozilla/FloatingPoint.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "mozilla/Telemetry.h"
@ -1281,6 +1282,9 @@ gfxFontCache::AddNew(gfxFont *aFont)
return;
gfxFont *oldFont = entry->mFont;
entry->mFont = aFont;
// Assert that we can find the entry we just put in (this fails if the key
// has a NaN float value in it, e.g. 'sizeAdjust').
MOZ_ASSERT(entry == mFonts.GetEntry(key));
// If someone's asked us to replace an existing font entry, then that's a
// bit weird, but let it happen, and expire the old font if it's not used.
if (oldFont && oldFont->GetExpirationState()->IsTracked()) {
@ -1319,8 +1323,9 @@ gfxFontCache::DestroyFont(gfxFont *aFont)
{
Key key(aFont->GetFontEntry(), aFont->GetStyle());
HashEntry *entry = mFonts.GetEntry(key);
if (entry && entry->mFont == aFont)
if (entry && entry->mFont == aFont) {
mFonts.RemoveEntry(key);
}
NS_ASSERTION(aFont->GetRefCount() == 0,
"Destroying with non-zero ref count!");
delete aFont;
@ -4218,6 +4223,9 @@ gfxFontStyle::gfxFontStyle(uint8_t aStyle, uint16_t aWeight, int16_t aStretch,
systemFont(aSystemFont), printerFont(aPrinterFont),
style(aStyle)
{
MOZ_ASSERT(!MOZ_DOUBLE_IS_NaN(size));
MOZ_ASSERT(!MOZ_DOUBLE_IS_NaN(sizeAdjust));
if (weight > 900)
weight = 900;
if (weight < 100)

View File

@ -128,14 +128,17 @@ struct THEBES_API gfxFontStyle {
int8_t ComputeWeight() const;
bool Equals(const gfxFontStyle& other) const {
return (size == other.size) &&
return
(*reinterpret_cast<const uint64_t*>(&size) ==
*reinterpret_cast<const uint64_t*>(&other.size)) &&
(style == other.style) &&
(systemFont == other.systemFont) &&
(printerFont == other.printerFont) &&
(weight == other.weight) &&
(stretch == other.stretch) &&
(language == other.language) &&
(sizeAdjust == other.sizeAdjust) &&
(*reinterpret_cast<const uint32_t*>(&sizeAdjust) ==
*reinterpret_cast<const uint32_t*>(&other.sizeAdjust)) &&
(featureSettings == other.featureSettings) &&
(languageOverride == other.languageOverride);
}