Bug 1228501 patch 2 - Remove nsFont::decorations member variable. r=jdaggett
☠☠ backed out by 849931b41e22 ☠ ☠
authorL. David Baron <dbaron@dbaron.org>
Sun, 29 Nov 2015 23:15:01 -0800
changeset 274555 3a3cd254f508e87d384d7598b67751489370812a
parent 274554 e1fd92eeb5ba40ef5ecf50793b911397fd9816d0
child 274556 6c478d7a9467d8336d431cb383402af93da39c0d
push id68626
push userdbaron@mozilla.com
push dateMon, 30 Nov 2015 07:16:42 +0000
treeherdermozilla-inbound@4a3c509bcb25 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdaggett
bugs1228501
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1228501 patch 2 - Remove nsFont::decorations member variable. r=jdaggett The member variable was always set to 0 or to NS_FONT_DECORATION_NONE, which is 0. Although this does leave a gap in the structure, I don't see any opportunities for reordering members to actually shrink nsFont.
gfx/src/nsFont.cpp
gfx/src/nsFont.h
layout/style/nsRuleNode.cpp
layout/style/nsStyleStruct.cpp
--- a/gfx/src/nsFont.cpp
+++ b/gfx/src/nsFont.cpp
@@ -43,34 +43,32 @@ nsFont::nsFont(FontFamilyType aGenericTy
 void
 nsFont::Init()
 {
   systemFont = false;
   smoothing = NS_FONT_SMOOTHING_AUTO;
   sizeAdjust = -1.0f;
   kerning = NS_FONT_KERNING_AUTO;
   synthesis = NS_FONT_SYNTHESIS_WEIGHT | NS_FONT_SYNTHESIS_STYLE;
-  decorations = 0;
 
   variantAlternates = 0;
   variantCaps = NS_FONT_VARIANT_CAPS_NORMAL;
   variantEastAsian = 0;
   variantLigatures = 0;
   variantNumeric = 0;
   variantPosition = NS_FONT_VARIANT_POSITION_NORMAL;
 }
 
 nsFont::nsFont(const nsFont& aOther)
   : fontlist(aOther.fontlist)
 {
   style = aOther.style;
   systemFont = aOther.systemFont;
   weight = aOther.weight;
   stretch = aOther.stretch;
-  decorations = aOther.decorations;
   smoothing = aOther.smoothing;
   size = aOther.size;
   sizeAdjust = aOther.sizeAdjust;
   kerning = aOther.kerning;
   synthesis = aOther.synthesis;
   fontFeatureSettings = aOther.fontFeatureSettings;
   languageOverride = aOther.languageOverride;
   variantAlternates = aOther.variantAlternates;
@@ -113,33 +111,23 @@ bool nsFont::BaseEquals(const nsFont& aO
       (alternateValues == aOther.alternateValues) &&
       (featureValueLookup == aOther.featureValueLookup) &&
       (smoothing == aOther.smoothing)) {
     return true;
   }
   return false;
 }
 
-bool nsFont::Equals(const nsFont& aOther) const
-{
-  if (BaseEquals(aOther) &&
-      (decorations == aOther.decorations)) {
-    return true;
-  }
-  return false;
-}
-
 nsFont& nsFont::operator=(const nsFont& aOther)
 {
   fontlist = aOther.fontlist;
   style = aOther.style;
   systemFont = aOther.systemFont;
   weight = aOther.weight;
   stretch = aOther.stretch;
-  decorations = aOther.decorations;
   smoothing = aOther.smoothing;
   size = aOther.size;
   sizeAdjust = aOther.sizeAdjust;
   kerning = aOther.kerning;
   synthesis = aOther.synthesis;
   fontFeatureSettings = aOther.fontFeatureSettings;
   languageOverride = aOther.languageOverride;
   variantAlternates = aOther.variantAlternates;
--- a/gfx/src/nsFont.h
+++ b/gfx/src/nsFont.h
@@ -61,20 +61,16 @@ struct nsFont {
 
   // Some font-variant-alternates property values require
   // font-specific settings defined via @font-feature-values rules.
   // These are resolved *after* font matching occurs.
 
   // -- bitmask for both enumerated and functional propvals
   uint16_t variantAlternates;
 
-  // The decorations on the font (underline, overline,
-  // line-through). The decorations can be binary or'd together.
-  uint8_t decorations;
-
   // Smoothing - controls subpixel-antialiasing (currently OSX only)
   uint8_t smoothing;
 
   // The weight of the font; see gfxFontConstants.h.
   uint16_t weight;
 
   // The stretch of the font (the sum of various NS_FONT_STRETCH_*
   // constants; see gfxFontConstants.h).
@@ -122,18 +118,21 @@ struct nsFont {
 
   nsFont();
   ~nsFont();
 
   bool operator==(const nsFont& aOther) const {
     return Equals(aOther);
   }
 
-  bool Equals(const nsFont& aOther) const ;
-  // Compare ignoring differences in 'variant' and 'decoration'
+  // FIXME (in patch 3): These are now the same.  Remove BaseEquals!
+  bool Equals(const nsFont& aOther) const
+  {
+    return BaseEquals(aOther);
+  }
   bool BaseEquals(const nsFont& aOther) const;
 
   nsFont& operator=(const nsFont& aOther);
 
   void CopyAlternates(const nsFont& aOther);
 
   // Add featureSettings into style
   void AddFontFeaturesToStyle(gfxFontStyle *aStyle) const;
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -3408,17 +3408,16 @@ nsRuleNode::SetFont(nsPresContext* aPres
     if (LookAndFeel::GetFont(fontID, systemFontName, fontStyle, devPerCSS)) {
       systemFontName.Trim("\"'");
       systemFont.fontlist = FontFamilyList(systemFontName, eUnquotedName);
       systemFont.fontlist.SetDefaultFontType(eFamily_none);
       systemFont.style = fontStyle.style;
       systemFont.systemFont = fontStyle.systemFont;
       systemFont.weight = fontStyle.weight;
       systemFont.stretch = fontStyle.stretch;
-      systemFont.decorations = NS_FONT_DECORATION_NONE;
       systemFont.size =
         NSFloatPixelsToAppUnits(fontStyle.size,
                                 aPresContext->DeviceContext()->
                                   AppUnitsPerDevPixelAtUnitFullZoom());
       //systemFont.langGroup = fontStyle.langGroup;
       systemFont.sizeAdjust = fontStyle.sizeAdjust;
 
 #ifdef XP_WIN
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -246,20 +246,17 @@ nsChangeHint nsStyleFont::CalcFontDiffer
       (aFont1.variantCaps == aFont2.variantCaps) &&
       (aFont1.variantEastAsian == aFont2.variantEastAsian) &&
       (aFont1.variantLigatures == aFont2.variantLigatures) &&
       (aFont1.variantNumeric == aFont2.variantNumeric) &&
       (aFont1.variantPosition == aFont2.variantPosition) &&
       (aFont1.fontFeatureSettings == aFont2.fontFeatureSettings) &&
       (aFont1.languageOverride == aFont2.languageOverride) &&
       (aFont1.systemFont == aFont2.systemFont)) {
-    if ((aFont1.decorations == aFont2.decorations)) {
-      return NS_STYLE_HINT_NONE;
-    }
-    return nsChangeHint_RepaintFrame;
+    return NS_STYLE_HINT_NONE;
   }
   return NS_STYLE_HINT_REFLOW;
 }
 
 static bool IsFixedData(const nsStyleSides& aSides, bool aEnumOK)
 {
   NS_FOR_CSS_SIDES(side) {
     if (!IsFixedUnit(aSides.Get(side), aEnumOK))