Remove support (style system only) for 'wider' and 'narrower' values of 'font-stretch'. (Bug 604816) r=jdaggett a2.0=joedrew
authorL. David Baron <dbaron@dbaron.org>
Wed, 10 Nov 2010 07:49:52 -0800
changeset 57237 68dcdaf45a0f759ad51f8978a1c8d578c6c695df
parent 57236 bdbef533364f1cdecbbefe16d8d8d9f5e0fd8100
child 57238 864ad777dba7365345e608df7b878a17d7fcb829
push id16847
push userdbaron@mozilla.com
push dateWed, 10 Nov 2010 15:50:38 +0000
treeherdermozilla-central@e250978a21be [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdaggett
bugs604816
milestone2.0b8pre
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
Remove support (style system only) for 'wider' and 'narrower' values of 'font-stretch'. (Bug 604816) r=jdaggett a2.0=joedrew
gfx/thebes/gfxFontConstants.h
layout/base/nsStyleConsts.h
layout/style/nsCSSParser.cpp
layout/style/nsCSSProps.cpp
layout/style/nsComputedDOMStyle.cpp
layout/style/nsRuleNode.cpp
layout/style/test/property_database.js
layout/style/test/test_transitions_per_property.html
--- a/gfx/thebes/gfxFontConstants.h
+++ b/gfx/thebes/gfxFontConstants.h
@@ -57,14 +57,10 @@
 #define NS_FONT_STRETCH_EXTRA_CONDENSED (-3)
 #define NS_FONT_STRETCH_CONDENSED       (-2)
 #define NS_FONT_STRETCH_SEMI_CONDENSED  (-1)
 #define NS_FONT_STRETCH_NORMAL          0
 #define NS_FONT_STRETCH_SEMI_EXPANDED   1
 #define NS_FONT_STRETCH_EXPANDED        2
 #define NS_FONT_STRETCH_EXTRA_EXPANDED  3
 #define NS_FONT_STRETCH_ULTRA_EXPANDED  4
-// These need to be more than double all of the values above so that we
-// can add any multiple of any of these values to the values above.
-#define NS_FONT_STRETCH_WIDER           10
-#define NS_FONT_STRETCH_NARROWER        (-10)
 
 #endif
--- a/layout/base/nsStyleConsts.h
+++ b/layout/base/nsStyleConsts.h
@@ -443,18 +443,16 @@ static inline mozilla::css::Side operato
 #define NS_STYLE_FONT_STRETCH_EXTRA_CONDENSED   NS_FONT_STRETCH_EXTRA_CONDENSED
 #define NS_STYLE_FONT_STRETCH_CONDENSED         NS_FONT_STRETCH_CONDENSED
 #define NS_STYLE_FONT_STRETCH_SEMI_CONDENSED    NS_FONT_STRETCH_SEMI_CONDENSED
 #define NS_STYLE_FONT_STRETCH_NORMAL            NS_FONT_STRETCH_NORMAL
 #define NS_STYLE_FONT_STRETCH_SEMI_EXPANDED     NS_FONT_STRETCH_SEMI_EXPANDED
 #define NS_STYLE_FONT_STRETCH_EXPANDED          NS_FONT_STRETCH_EXPANDED
 #define NS_STYLE_FONT_STRETCH_EXTRA_EXPANDED    NS_FONT_STRETCH_EXTRA_EXPANDED
 #define NS_STYLE_FONT_STRETCH_ULTRA_EXPANDED    NS_FONT_STRETCH_ULTRA_EXPANDED
-#define NS_STYLE_FONT_STRETCH_WIDER             NS_FONT_STRETCH_WIDER
-#define NS_STYLE_FONT_STRETCH_NARROWER          NS_FONT_STRETCH_NARROWER
 
 // See nsStyleFont - system fonts
 #define NS_STYLE_FONT_CAPTION                   1		// css2
 #define NS_STYLE_FONT_ICON                      2
 #define NS_STYLE_FONT_MENU                      3
 #define NS_STYLE_FONT_MESSAGE_BOX               4
 #define NS_STYLE_FONT_SMALL_CAPTION             5
 #define NS_STYLE_FONT_STATUS_BAR                6
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -6055,20 +6055,18 @@ CSSParserImpl::ParseFontDescriptorValue(
             aValue.GetUnit() != eCSSUnit_Inherit &&
             aValue.GetUnit() != eCSSUnit_Initial &&
             (aValue.GetUnit() != eCSSUnit_Enumerated ||
              (aValue.GetIntValue() != NS_STYLE_FONT_WEIGHT_BOLDER &&
               aValue.GetIntValue() != NS_STYLE_FONT_WEIGHT_LIGHTER)));
 
   case eCSSFontDesc_Stretch:
     // property is VARIANT_HK|VARIANT_SYSFONT
-    return (ParseVariant(aValue, VARIANT_KEYWORD,
-                         nsCSSProps::kFontStretchKTable) &&
-            (aValue.GetIntValue() != NS_STYLE_FONT_STRETCH_WIDER &&
-             aValue.GetIntValue() != NS_STYLE_FONT_STRETCH_NARROWER));
+    return ParseVariant(aValue, VARIANT_KEYWORD,
+                        nsCSSProps::kFontStretchKTable);
 
     // These two are unique to @font-face and have their own special grammar.
   case eCSSFontDesc_Src:
     return ParseFontSrc(aValue);
 
   case eCSSFontDesc_UnicodeRange:
     return ParseFontRanges(aValue);
 
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -922,18 +922,16 @@ const PRInt32 nsCSSProps::kFontSizeKTabl
   eCSSKeyword_x_large, NS_STYLE_FONT_SIZE_XLARGE,
   eCSSKeyword_xx_large, NS_STYLE_FONT_SIZE_XXLARGE,
   eCSSKeyword_larger, NS_STYLE_FONT_SIZE_LARGER,
   eCSSKeyword_smaller, NS_STYLE_FONT_SIZE_SMALLER,
   eCSSKeyword_UNKNOWN,-1
 };
 
 const PRInt32 nsCSSProps::kFontStretchKTable[] = {
-  eCSSKeyword_wider, NS_STYLE_FONT_STRETCH_WIDER,
-  eCSSKeyword_narrower, NS_STYLE_FONT_STRETCH_NARROWER,
   eCSSKeyword_ultra_condensed, NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED,
   eCSSKeyword_extra_condensed, NS_STYLE_FONT_STRETCH_EXTRA_CONDENSED,
   eCSSKeyword_condensed, NS_STYLE_FONT_STRETCH_CONDENSED,
   eCSSKeyword_semi_condensed, NS_STYLE_FONT_STRETCH_SEMI_CONDENSED,
   eCSSKeyword_normal, NS_STYLE_FONT_STRETCH_NORMAL,
   eCSSKeyword_semi_expanded, NS_STYLE_FONT_STRETCH_SEMI_EXPANDED,
   eCSSKeyword_expanded, NS_STYLE_FONT_STRETCH_EXPANDED,
   eCSSKeyword_extra_expanded, NS_STYLE_FONT_STRETCH_EXTRA_EXPANDED,
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -1271,34 +1271,18 @@ nsComputedDOMStyle::DoGetFontSizeAdjust(
 }
 
 nsresult
 nsComputedDOMStyle::DoGetFontStretch(nsIDOMCSSValue** aValue)
 {
   nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
   NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
 
-  const nsStyleFont* font = GetStyleFont();
-
-  // The computed value space isn't actually representable in string
-  // form, so just represent anything with widers or narrowers in it as
-  // 'wider' or 'narrower'.
-  PR_STATIC_ASSERT(NS_FONT_STRETCH_NARROWER % 2 == 0);
-  PR_STATIC_ASSERT(NS_FONT_STRETCH_WIDER % 2 == 0);
-  PR_STATIC_ASSERT(NS_FONT_STRETCH_NARROWER + NS_FONT_STRETCH_WIDER == 0);
-  PR_STATIC_ASSERT(NS_FONT_STRETCH_NARROWER < 0);
-  PRInt16 stretch = font->mFont.stretch;
-  if (stretch <= NS_FONT_STRETCH_NARROWER / 2) {
-    val->SetIdent(eCSSKeyword_narrower);
-  } else if (stretch >= NS_FONT_STRETCH_WIDER / 2) {
-    val->SetIdent(eCSSKeyword_wider);
-  } else {
-    val->SetIdent(
-      nsCSSProps::ValueToKeywordEnum(stretch, nsCSSProps::kFontStretchKTable));
-  }
+  val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleFont()->mFont.stretch,
+                                               nsCSSProps::kFontStretchKTable));
 
   NS_ADDREF(*aValue = val);
   return NS_OK;
 }
 
 nsresult
 nsComputedDOMStyle::DoGetFontStyle(nsIDOMCSSValue** aValue)
 {
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -1362,19 +1362,16 @@ CheckFontCallback(const nsRuleDataStruct
   if (size.IsRelativeLengthUnit() ||
       size.GetUnit() == eCSSUnit_Percent ||
       (size.GetUnit() == eCSSUnit_Enumerated &&
        (size.GetIntValue() == NS_STYLE_FONT_SIZE_SMALLER ||
         size.GetIntValue() == NS_STYLE_FONT_SIZE_LARGER)) ||
 #ifdef MOZ_MATHML
       fontData.mScriptLevel.GetUnit() == eCSSUnit_Integer ||
 #endif
-      (stretch.GetUnit() == eCSSUnit_Enumerated &&
-       (stretch.GetIntValue() == NS_FONT_STRETCH_NARROWER ||
-        stretch.GetIntValue() == NS_FONT_STRETCH_WIDER)) ||
       (weight.GetUnit() == eCSSUnit_Enumerated &&
        (weight.GetIntValue() == NS_STYLE_FONT_WEIGHT_BOLDER ||
         weight.GetIntValue() == NS_STYLE_FONT_WEIGHT_LIGHTER))) {
     NS_ASSERTION(aResult == nsRuleNode::eRulePartialReset ||
                  aResult == nsRuleNode::eRuleFullReset ||
                  aResult == nsRuleNode::eRulePartialMixed ||
                  aResult == nsRuleNode::eRuleFullMixed,
                  "we know we already have a reset-counted property");
@@ -3016,35 +3013,22 @@ nsRuleNode::SetFont(nsPresContext* aPres
     }
   } else
     SetDiscrete(aFontData.mWeight, aFont->mFont.weight, aCanStoreInRuleTree,
                 SETDSC_INTEGER | SETDSC_SYSTEM_FONT,
                 aParentFont->mFont.weight,
                 defaultVariableFont->weight,
                 0, 0, 0, systemFont.weight);
 
-  // font-stretch: enum, inherit
-  if (eCSSUnit_Enumerated == aFontData.mStretch.GetUnit()) {
-    PRInt32 value = aFontData.mStretch.GetIntValue();
-    switch (value) {
-      case NS_FONT_STRETCH_WIDER:
-      case NS_FONT_STRETCH_NARROWER:
-        aCanStoreInRuleTree = PR_FALSE;
-        aFont->mFont.stretch = aParentFont->mFont.stretch + value;
-        break;
-      default:
-        aFont->mFont.stretch = value;
-        break;
-    }
-  } else
-    SetDiscrete(aFontData.mStretch, aFont->mFont.stretch, aCanStoreInRuleTree,
-                SETDSC_SYSTEM_FONT,
-                aParentFont->mFont.stretch,
-                defaultVariableFont->stretch,
-                0, 0, 0, systemFont.stretch);
+  // font-stretch: enum, inherit, initial, -moz-system-font
+  SetDiscrete(aFontData.mStretch, aFont->mFont.stretch, aCanStoreInRuleTree,
+              SETDSC_SYSTEM_FONT | SETDSC_ENUMERATED,
+              aParentFont->mFont.stretch,
+              defaultVariableFont->stretch,
+              0, 0, 0, systemFont.stretch);
 
 #ifdef MOZ_MATHML
   // Compute scriptlevel, scriptminsize and scriptsizemultiplier now so
   // they're available for font-size computation.
 
   // -moz-script-min-size: length
   if (aFontData.mScriptMinSize.IsLengthUnit()) {
     // scriptminsize in font units (em, ex) has to be interpreted relative
--- a/layout/style/test/property_database.js
+++ b/layout/style/test/property_database.js
@@ -1769,17 +1769,17 @@ var gCSSProperties = {
 		other_values: [ "0.3", "0.5", "0.7" ],
 		invalid_values: []
 	},
 	"font-stretch": {
 		domProp: "fontStretch",
 		inherited: true,
 		type: CSS_TYPE_LONGHAND,
 		initial_values: [ "normal" ],
-		other_values: [ "wider", "narrower", "ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "semi-expanded", "expanded", "extra-expanded", "ultra-expanded" ],
+		other_values: [ "ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "semi-expanded", "expanded", "extra-expanded", "ultra-expanded" ],
 		invalid_values: []
 	},
 	"font-style": {
 		domProp: "fontStyle",
 		inherited: true,
 		type: CSS_TYPE_LONGHAND,
 		initial_values: [ "normal" ],
 		other_values: [ "italic", "oblique" ],
--- a/layout/style/test/test_transitions_per_property.html
+++ b/layout/style/test/test_transitions_per_property.html
@@ -642,22 +642,21 @@ function test_font_stretch(prop) {
   div.style.setProperty(prop, "normal", "");
   is(cs.getPropertyValue(prop), "normal",
      "font-stretch property " + prop + ": computed value before transition");
   div.style.setProperty("-moz-transition-property", prop, "");
   div.style.setProperty(prop, "ultra-expanded", "");
   is(cs.getPropertyValue(prop), "semi-expanded",
      "font-stretch property " + prop + ": interpolation of font-stretches");
   check_distance(prop, "normal", "semi-expanded", "ultra-expanded");
-  div.style.setProperty(prop, "wider", "");
-  is(cs.getPropertyValue(prop), "wider",
-     "font-stretch property " + prop + ": can't interpolate wider/narrower");
+  div.style.setProperty("-moz-transition-property", "none", "");
   div.style.setProperty(prop, "expanded", "");
   is(cs.getPropertyValue(prop), "expanded",
      "font-stretch property " + prop + ": computed value before transition");
+  div.style.setProperty("-moz-transition-property", prop, "");
   div.style.setProperty(prop, "extra-condensed", "");
   is(cs.getPropertyValue(prop), "normal",
      "font-stretch property " + prop + ": interpolation of font-stretches");
   check_distance(prop, "expanded", "semi-expanded", "condensed");
 }
 
 function test_font_weight(prop) {
   is(prop, "font-weight", "only designed for one property");