Bug 1321022 pt 1.5 - Delete the redundant copy constructor in gfxFontStyle (default copy constructor is fine), and rationalize field ordering a bit. r=dholbert

This commit is contained in:
Jonathan Kew 2016-12-03 12:18:28 +00:00
Родитель 9d079aaf03
Коммит 72436283c9
2 изменённых файлов: 21 добавлений и 43 удалений

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

@ -3888,13 +3888,13 @@ gfxFontStyle::gfxFontStyle() :
size(DEFAULT_PIXEL_FONT_SIZE), sizeAdjust(-1.0f), baselineOffset(0.0f),
languageOverride(NO_FONT_LANGUAGE_OVERRIDE),
weight(NS_FONT_WEIGHT_NORMAL), stretch(NS_FONT_STRETCH_NORMAL),
systemFont(true), printerFont(false), useGrayscaleAntialiasing(false),
style(NS_FONT_STYLE_NORMAL),
variantCaps(NS_FONT_VARIANT_CAPS_NORMAL),
variantSubSuper(NS_FONT_VARIANT_POSITION_NORMAL),
systemFont(true), printerFont(false), useGrayscaleAntialiasing(false),
allowSyntheticWeight(true), allowSyntheticStyle(true),
noFallbackVariantFeatures(true),
explicitLanguage(false),
variantCaps(NS_FONT_VARIANT_CAPS_NORMAL),
variantSubSuper(NS_FONT_VARIANT_POSITION_NORMAL)
explicitLanguage(false)
{
}
@ -3910,15 +3910,15 @@ gfxFontStyle::gfxFontStyle(uint8_t aStyle, uint16_t aWeight, int16_t aStretch,
size(aSize), sizeAdjust(aSizeAdjust), baselineOffset(0.0f),
languageOverride(ParseFontLanguageOverride(aLanguageOverride)),
weight(aWeight), stretch(aStretch),
style(aStyle),
variantCaps(NS_FONT_VARIANT_CAPS_NORMAL),
variantSubSuper(NS_FONT_VARIANT_POSITION_NORMAL),
systemFont(aSystemFont), printerFont(aPrinterFont),
useGrayscaleAntialiasing(false),
style(aStyle),
allowSyntheticWeight(aAllowWeightSynthesis),
allowSyntheticStyle(aAllowStyleSynthesis),
noFallbackVariantFeatures(true),
explicitLanguage(aExplicitLanguage),
variantCaps(NS_FONT_VARIANT_CAPS_NORMAL),
variantSubSuper(NS_FONT_VARIANT_POSITION_NORMAL)
explicitLanguage(aExplicitLanguage)
{
MOZ_ASSERT(!mozilla::IsNaN(size));
MOZ_ASSERT(!mozilla::IsNaN(sizeAdjust));
@ -3942,27 +3942,6 @@ gfxFontStyle::gfxFontStyle(uint8_t aStyle, uint16_t aWeight, int16_t aStretch,
}
}
gfxFontStyle::gfxFontStyle(const gfxFontStyle& aStyle) :
language(aStyle.language),
featureValueLookup(aStyle.featureValueLookup),
size(aStyle.size), sizeAdjust(aStyle.sizeAdjust),
baselineOffset(aStyle.baselineOffset),
languageOverride(aStyle.languageOverride),
weight(aStyle.weight), stretch(aStyle.stretch),
systemFont(aStyle.systemFont), printerFont(aStyle.printerFont),
useGrayscaleAntialiasing(aStyle.useGrayscaleAntialiasing),
style(aStyle.style),
allowSyntheticWeight(aStyle.allowSyntheticWeight),
allowSyntheticStyle(aStyle.allowSyntheticStyle),
noFallbackVariantFeatures(aStyle.noFallbackVariantFeatures),
explicitLanguage(aStyle.explicitLanguage),
variantCaps(aStyle.variantCaps),
variantSubSuper(aStyle.variantSubSuper)
{
featureSettings.AppendElements(aStyle.featureSettings);
alternateValues.AppendElements(aStyle.alternateValues);
}
int8_t
gfxFontStyle::ComputeWeight() const
{

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

@ -81,7 +81,6 @@ struct gfxFontStyle {
bool aPrinterFont,
bool aWeightSynthesis, bool aStyleSynthesis,
const nsString& aLanguageOverride);
gfxFontStyle(const gfxFontStyle& aStyle);
// the language (may be an internal langGroup code rather than an actual
// language code) specified in the document or element's lang property,
@ -136,6 +135,15 @@ struct gfxFontStyle {
// constants; see gfxFontConstants.h).
int8_t stretch;
// The style of font (normal, italic, oblique)
uint8_t style;
// caps variant (small-caps, petite-caps, etc.)
uint8_t variantCaps;
// sub/superscript variant
uint8_t variantSubSuper;
// Say that this font is a system font and therefore does not
// require certain fixup that we do for fonts from untrusted
// sources.
@ -147,9 +155,6 @@ struct gfxFontStyle {
// Used to imitate -webkit-font-smoothing: antialiased
bool useGrayscaleAntialiasing : 1;
// The style of font (normal, italic, oblique)
uint8_t style : 2;
// Whether synthetic styles are allowed
bool allowSyntheticWeight : 1;
bool allowSyntheticStyle : 1;
@ -162,12 +167,6 @@ struct gfxFontStyle {
// document, or was inferred from charset/system locale
bool explicitLanguage : 1;
// caps variant (small-caps, petite-caps, etc.)
uint8_t variantCaps;
// sub/superscript variant
uint8_t variantSubSuper;
// Return the final adjusted font size for the given aspect ratio.
// Not meant to be called when sizeAdjust = -1.0.
gfxFloat GetAdjustedSize(gfxFloat aspect) const {
@ -193,6 +192,8 @@ struct gfxFontStyle {
(*reinterpret_cast<const uint64_t*>(&size) ==
*reinterpret_cast<const uint64_t*>(&other.size)) &&
(style == other.style) &&
(weight == other.weight) &&
(stretch == other.stretch) &&
(variantCaps == other.variantCaps) &&
(variantSubSuper == other.variantSubSuper) &&
(allowSyntheticWeight == other.allowSyntheticWeight) &&
@ -201,16 +202,14 @@ struct gfxFontStyle {
(printerFont == other.printerFont) &&
(useGrayscaleAntialiasing == other.useGrayscaleAntialiasing) &&
(explicitLanguage == other.explicitLanguage) &&
(weight == other.weight) &&
(stretch == other.stretch) &&
(language == other.language) &&
(baselineOffset == other.baselineOffset) &&
(*reinterpret_cast<const uint32_t*>(&sizeAdjust) ==
*reinterpret_cast<const uint32_t*>(&other.sizeAdjust)) &&
(featureSettings == other.featureSettings) &&
(languageOverride == other.languageOverride) &&
(alternateValues == other.alternateValues) &&
(featureValueLookup == other.featureValueLookup);
(featureValueLookup == other.featureValueLookup) &&
(languageOverride == other.languageOverride);
}
static void ParseFontFeatureSettings(const nsString& aFeatureString,