Bug 1255973 - Remove redundant overrides from gfxPlatform subclasses. r=jfkthame

This commit is contained in:
Masatoshi Kimura 2016-03-18 21:43:38 +09:00
Родитель 8469845e9e
Коммит 66f8a469ef
8 изменённых файлов: 35 добавлений и 240 удалений

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

@ -246,37 +246,12 @@ gfxAndroidPlatform::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
aFontList.AppendElement("Droid Sans Fallback");
}
nsresult
gfxAndroidPlatform::GetFontList(nsIAtom *aLangGroup,
const nsACString& aGenericFamily,
nsTArray<nsString>& aListOfFonts)
{
gfxPlatformFontList::PlatformFontList()->GetFontList(aLangGroup,
aGenericFamily,
aListOfFonts);
return NS_OK;
}
void
gfxAndroidPlatform::GetSystemFontList(InfallibleTArray<FontListEntry>* retValue)
{
gfxFT2FontList::PlatformFontList()->GetSystemFontList(retValue);
}
nsresult
gfxAndroidPlatform::UpdateFontList()
{
gfxPlatformFontList::PlatformFontList()->UpdateFontList();
return NS_OK;
}
nsresult
gfxAndroidPlatform::GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName)
{
gfxPlatformFontList::PlatformFontList()->GetStandardFamilyName(aFontName, aFamilyName);
return NS_OK;
}
gfxPlatformFontList*
gfxAndroidPlatform::CreatePlatformFontList()
{
@ -326,34 +301,6 @@ gfxAndroidPlatform::GetFTLibrary()
return gPlatformFTLibrary;
}
gfxFontEntry*
gfxAndroidPlatform::LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle)
{
return gfxPlatformFontList::PlatformFontList()->LookupLocalFont(aFontName,
aWeight,
aStretch,
aStyle);
}
gfxFontEntry*
gfxAndroidPlatform::MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle,
const uint8_t* aFontData,
uint32_t aLength)
{
return gfxPlatformFontList::PlatformFontList()->MakePlatformFont(aFontName,
aWeight,
aStretch,
aStyle,
aFontData,
aLength);
}
already_AddRefed<ScaledFont>
gfxAndroidPlatform::GetScaledFontForFont(DrawTarget* aTarget, gfxFont *aFont)
{

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

@ -45,30 +45,11 @@ public:
// platform implementations of font functions
virtual bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags);
virtual gfxPlatformFontList* CreatePlatformFontList();
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle);
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle,
const uint8_t* aFontData,
uint32_t aLength);
virtual void GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
int32_t aRunScript,
nsTArray<const char*>& aFontList);
virtual nsresult GetFontList(nsIAtom *aLangGroup,
const nsACString& aGenericFamily,
nsTArray<nsString>& aListOfFonts);
virtual nsresult UpdateFontList();
virtual nsresult GetStandardFamilyName(const nsAString& aFontName,
nsAString& aFamilyName);
gfxFontGroup*
CreateFontGroup(const mozilla::FontFamilyList& aFontFamilyList,
const gfxFontStyle *aStyle,

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

@ -1381,13 +1381,26 @@ gfxPlatform::GetFontList(nsIAtom *aLangGroup,
const nsACString& aGenericFamily,
nsTArray<nsString>& aListOfFonts)
{
return NS_ERROR_NOT_IMPLEMENTED;
gfxPlatformFontList::PlatformFontList()->GetFontList(aLangGroup,
aGenericFamily,
aListOfFonts);
return NS_OK;
}
nsresult
gfxPlatform::UpdateFontList()
{
return NS_ERROR_NOT_IMPLEMENTED;
gfxPlatformFontList::PlatformFontList()->UpdateFontList();
return NS_OK;
}
nsresult
gfxPlatform::GetStandardFamilyName(const nsAString& aFontName,
nsAString& aFamilyName)
{
gfxPlatformFontList::PlatformFontList()->GetStandardFamilyName(aFontName,
aFamilyName);
return NS_OK;
}
bool
@ -1462,6 +1475,18 @@ gfxPlatform::UseGraphiteShaping()
return mGraphiteShapingEnabled;
}
gfxFontEntry*
gfxPlatform::LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle)
{
return gfxPlatformFontList::PlatformFontList()->LookupLocalFont(aFontName,
aWeight,
aStretch,
aStyle);
}
gfxFontEntry*
gfxPlatform::MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight,
@ -1470,15 +1495,12 @@ gfxPlatform::MakePlatformFont(const nsAString& aFontName,
const uint8_t* aFontData,
uint32_t aLength)
{
// Default implementation does not handle activating downloaded fonts;
// just free the data and return.
// Platforms that support @font-face must override this,
// using the data to instantiate the font, and taking responsibility
// for freeing it when no longer required.
if (aFontData) {
free((void*)aFontData);
}
return nullptr;
return gfxPlatformFontList::PlatformFontList()->MakePlatformFont(aFontName,
aWeight,
aStretch,
aStyle,
aFontData,
aLength);
}
mozilla::layers::DiagnosticTypes

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

@ -329,7 +329,7 @@ public:
* Resolving a font name to family name. The result MUST be in the result of GetFontList().
* If the name doesn't in the system, aFamilyName will be empty string, but not failed.
*/
virtual nsresult GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName) = 0;
virtual nsresult GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName);
/**
* Create the appropriate platform font group
@ -350,8 +350,7 @@ public:
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle)
{ return nullptr; }
uint8_t aStyle);
/**
* Activate a platform font. (Needed to support @font-face src url().)

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

@ -131,13 +131,6 @@ gfxPlatformMac::GetScaledFontForFont(DrawTarget* aTarget, gfxFont *aFont)
return font->GetScaledFont(aTarget);
}
nsresult
gfxPlatformMac::GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName)
{
gfxPlatformFontList::PlatformFontList()->GetStandardFamilyName(aFontName, aFamilyName);
return NS_OK;
}
gfxFontGroup *
gfxPlatformMac::CreateFontGroup(const FontFamilyList& aFontFamilyList,
const gfxFontStyle *aStyle,
@ -149,38 +142,6 @@ gfxPlatformMac::CreateFontGroup(const FontFamilyList& aFontFamilyList,
aUserFontSet, aDevToCssSize);
}
// these will move to gfxPlatform once all platforms support the fontlist
gfxFontEntry*
gfxPlatformMac::LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle)
{
return gfxPlatformFontList::PlatformFontList()->LookupLocalFont(aFontName,
aWeight,
aStretch,
aStyle);
}
gfxFontEntry*
gfxPlatformMac::MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle,
const uint8_t* aFontData,
uint32_t aLength)
{
// Ownership of aFontData is received here, and passed on to
// gfxPlatformFontList::MakePlatformFont(), which must ensure the data
// is released with free when no longer needed
return gfxPlatformFontList::PlatformFontList()->MakePlatformFont(aFontName,
aWeight,
aStretch,
aStyle,
aFontData,
aLength);
}
bool
gfxPlatformMac::IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags)
{
@ -203,23 +164,6 @@ gfxPlatformMac::IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags)
return true;
}
// these will also move to gfxPlatform once all platforms support the fontlist
nsresult
gfxPlatformMac::GetFontList(nsIAtom *aLangGroup,
const nsACString& aGenericFamily,
nsTArray<nsString>& aListOfFonts)
{
gfxPlatformFontList::PlatformFontList()->GetFontList(aLangGroup, aGenericFamily, aListOfFonts);
return NS_OK;
}
nsresult
gfxPlatformMac::UpdateFontList()
{
gfxPlatformFontList::PlatformFontList()->UpdateFontList();
return NS_OK;
}
static const char kFontArialUnicodeMS[] = "Arial Unicode MS";
static const char kFontAppleBraille[] = "Apple Braille";
static const char kFontAppleColorEmoji[] = "Apple Color Emoji";

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

@ -33,8 +33,6 @@ public:
already_AddRefed<mozilla::gfx::ScaledFont>
GetScaledFontForFont(mozilla::gfx::DrawTarget* aTarget, gfxFont *aFont) override;
nsresult GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName) override;
gfxFontGroup*
CreateFontGroup(const mozilla::FontFamilyList& aFontFamilyList,
const gfxFontStyle *aStyle,
@ -42,27 +40,10 @@ public:
gfxUserFontSet *aUserFontSet,
gfxFloat aDevToCssSize) override;
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle) override;
virtual gfxPlatformFontList* CreatePlatformFontList() override;
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle,
const uint8_t* aFontData,
uint32_t aLength) override;
bool IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags) override;
nsresult GetFontList(nsIAtom *aLangGroup,
const nsACString& aGenericFamily,
nsTArray<nsString>& aListOfFonts) override;
nsresult UpdateFontList() override;
virtual void GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
int32_t aRunScript,
nsTArray<const char*>& aFontList) override;

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

@ -650,24 +650,6 @@ gfxWindowsPlatform::GetScaledFontForFont(DrawTarget* aTarget, gfxFont *aFont)
return Factory::CreateScaledFontForNativeFont(nativeFont, aFont->GetAdjustedSize());
}
nsresult
gfxWindowsPlatform::GetFontList(nsIAtom *aLangGroup,
const nsACString& aGenericFamily,
nsTArray<nsString>& aListOfFonts)
{
gfxPlatformFontList::PlatformFontList()->GetFontList(aLangGroup, aGenericFamily, aListOfFonts);
return NS_OK;
}
nsresult
gfxWindowsPlatform::UpdateFontList()
{
gfxPlatformFontList::PlatformFontList()->UpdateFontList();
return NS_OK;
}
static const char kFontAparajita[] = "Aparajita";
static const char kFontArabicTypesetting[] = "Arabic Typesetting";
static const char kFontArial[] = "Arial";
@ -900,13 +882,6 @@ gfxWindowsPlatform::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
aFontList.AppendElement(kFontArialUnicodeMS);
}
nsresult
gfxWindowsPlatform::GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName)
{
gfxPlatformFontList::PlatformFontList()->GetStandardFamilyName(aFontName, aFamilyName);
return NS_OK;
}
gfxFontGroup *
gfxWindowsPlatform::CreateFontGroup(const FontFamilyList& aFontFamilyList,
const gfxFontStyle *aStyle,
@ -918,34 +893,6 @@ gfxWindowsPlatform::CreateFontGroup(const FontFamilyList& aFontFamilyList,
aUserFontSet, aDevToCssSize);
}
gfxFontEntry*
gfxWindowsPlatform::LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle)
{
return gfxPlatformFontList::PlatformFontList()->LookupLocalFont(aFontName,
aWeight,
aStretch,
aStyle);
}
gfxFontEntry*
gfxWindowsPlatform::MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle,
const uint8_t* aFontData,
uint32_t aLength)
{
return gfxPlatformFontList::PlatformFontList()->MakePlatformFont(aFontName,
aWeight,
aStretch,
aStyle,
aFontData,
aLength);
}
bool
gfxWindowsPlatform::IsFontFormatSupported(nsIURI *aFontURI, uint32_t aFormatFlags)
{

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

@ -159,18 +159,10 @@ public:
*/
void VerifyD2DDevice(bool aAttemptForce);
nsresult GetFontList(nsIAtom *aLangGroup,
const nsACString& aGenericFamily,
nsTArray<nsString>& aListOfFonts) override;
nsresult UpdateFontList();
virtual void GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
int32_t aRunScript,
nsTArray<const char*>& aFontList) override;
nsresult GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName) override;
gfxFontGroup*
CreateFontGroup(const mozilla::FontFamilyList& aFontFamilyList,
const gfxFontStyle *aStyle,
@ -178,24 +170,6 @@ public:
gfxUserFontSet *aUserFontSet,
gfxFloat aDevToCssSize) override;
/**
* Look up a local platform font using the full font face name (needed to support @font-face src local() )
*/
virtual gfxFontEntry* LookupLocalFont(const nsAString& aFontName,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle) override;
/**
* Activate a platform font (needed to support @font-face src url() )
*/
virtual gfxFontEntry* MakePlatformFont(const nsAString& aFontName,
uint16_t aWeight,
int16_t aStretch,
uint8_t aStyle,
const uint8_t* aFontData,
uint32_t aLength) override;
virtual bool CanUseHardwareVideoDecoding() override;
/**