Backout 94f06c75c3b5 for lack of reviewer.
authorScott Johnson <sjohnson@mozilla.com>
Mon, 15 Oct 2012 14:13:35 -0500
changeset 110446 811a86ca567e7a2e2cff1fb072d72bf596767251
parent 110445 9dfd547f21dd52ea14e5f7c675e2f3508fb2d850
child 110447 d5496f32f2e40ebf34298af22bf326d2e1c163c2
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
milestone19.0a1
backs out94f06c75c3b5c5f1138c87ad4af596f9243e453a
Backout 94f06c75c3b5 for lack of reviewer.
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
layout/base/nsPresContext.cpp
layout/reftests/font-inflation/maxRatio-1-ref.html
layout/reftests/font-inflation/maxRatio-1.html
layout/reftests/font-inflation/reftest.list
modules/libpref/src/init/all.js
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -101,18 +101,17 @@ bool nsLayoutUtils::gPreventAssertInComp
 #endif // DEBUG
 
 typedef gfxPattern::GraphicsFilter GraphicsFilter;
 typedef FrameMetrics::ViewID ViewID;
 
 /* static */ uint32_t nsLayoutUtils::sFontSizeInflationEmPerLine;
 /* static */ uint32_t nsLayoutUtils::sFontSizeInflationMinTwips;
 /* static */ uint32_t nsLayoutUtils::sFontSizeInflationLineThreshold;
-/* static */ int32_t  nsLayoutUtils::sFontSizeInflationMappingIntercept;
-/* static */ uint32_t nsLayoutUtils::sFontSizeInflationMaxRatio;
+/* static */ int32_t nsLayoutUtils::sFontSizeInflationMappingIntercept;
 
 static ViewID sScrollIdCounter = FrameMetrics::START_SCROLL_ID;
 
 #ifdef MOZ_FLEXBOX
 // These are indices into kDisplayKTable.  They'll be initialized
 // the first time that FlexboxEnabledPrefChangeCallback() is invoked.
 static int32_t sIndexOfFlexInDisplayTable;
 static int32_t sIndexOfInlineFlexInDisplayTable;
@@ -4675,18 +4674,16 @@ nsLayoutUtils::SizeOfTextRunsForFrames(n
   }
   return total;
 }
 
 /* static */
 void
 nsLayoutUtils::Initialize()
 {
-  Preferences::AddUintVarCache(&sFontSizeInflationMaxRatio,
-                               "font.size.inflation.maxRatio");
   Preferences::AddUintVarCache(&sFontSizeInflationEmPerLine,
                                "font.size.inflation.emPerLine");
   Preferences::AddUintVarCache(&sFontSizeInflationMinTwips,
                                "font.size.inflation.minTwips");
   Preferences::AddUintVarCache(&sFontSizeInflationLineThreshold,
                                "font.size.inflation.lineThreshold");
   Preferences::AddIntVarCache(&sFontSizeInflationMappingIntercept,
                               "font.size.inflation.mappingIntercept");
@@ -4958,20 +4955,18 @@ nsLayoutUtils::FontSizeInflationInner(co
           stylePosHeight.GetUnit() != eStyleUnit_Auto) {
 
         return 1.0;
       }
     }
   }
 
   int32_t interceptParam = nsLayoutUtils::FontSizeInflationMappingIntercept();
-  float maxRatio = (float)nsLayoutUtils::FontSizeInflationMaxRatio() / 100.0f;
 
   float ratio = float(styleFontSize) / float(aMinFontSize);
-  float inflationRatio;
 
   // Given a minimum inflated font size m, a specified font size s, we want to
   // find the inflated font size i and then return the ratio of i to s (i/s).
   if (interceptParam >= 0) {
     // Since the mapping intercept parameter P is greater than zero, we use it
     // to determine the point where our mapping function intersects the i=s
     // line. This means that we have an equation of the form:
     //
@@ -4984,28 +4979,22 @@ nsLayoutUtils::FontSizeInflationInner(co
       return 1.0;
     }
 
     // The point (intercept, intercept) is where the part of the i vs. s graph
     // that's not slope 1 meets the i=s line.  (This part of the
     // graph is a line from (0, m), to that point). We calculate the
     // intersection point to be ((1+P/2)m, (1+P/2)m), where P is the
     // intercept parameter above. We then need to return i/s.
-    inflationRatio = (1.0f + (ratio * (intercept - 1) / intercept)) / ratio;
+    return (1.0f + (ratio * (intercept - 1) / intercept)) / ratio;
   } else {
     // This is the case where P is negative. We essentially want to implement
     // the case for P=infinity here, so we make i = s + m, which means that
     // i/s = s/s + m/s = 1 + 1/ratio
-    inflationRatio = 1 + 1.0f / ratio;
-  }
-
-  if (maxRatio > 1.0 && inflationRatio > maxRatio) {
-    return maxRatio;
-  } else {
-    return inflationRatio;
+    return 1 + 1.0f / ratio;
   }
 }
 
 static bool
 ShouldInflateFontsForContainer(const nsIFrame *aFrame)
 {
   // We only want to inflate fonts for text that is in a place
   // with room to expand.  The question is what the best heuristic for
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -1607,24 +1607,16 @@ public:
    *   InflationMinFontSizeFor methods above.
    */
   static float FontSizeInflationInner(const nsIFrame *aFrame,
                                       nscoord aMinFontSize);
 
   static bool FontSizeInflationEnabled(nsPresContext *aPresContext);
 
   /**
-   * See comment above "font.size.inflation.maxRatio" in
-   * modules/libpref/src/init/all.js .
-   */
-  static uint32_t FontSizeInflationMaxRatio() {
-    return sFontSizeInflationMaxRatio;
-  }
-
-  /**
    * See comment above "font.size.inflation.emPerLine" in
    * modules/libpref/src/init/all.js .
    */
   static uint32_t FontSizeInflationEmPerLine() {
     return sFontSizeInflationEmPerLine;
   }
 
   /**
@@ -1754,18 +1746,17 @@ public:
   static void
   AssertTreeOnlyEmptyNextInFlows(nsIFrame *aSubtreeRoot);
 #endif
 
 private:
   static uint32_t sFontSizeInflationEmPerLine;
   static uint32_t sFontSizeInflationMinTwips;
   static uint32_t sFontSizeInflationLineThreshold;
-  static int32_t  sFontSizeInflationMappingIntercept;
-  static uint32_t sFontSizeInflationMaxRatio;
+  static int32_t sFontSizeInflationMappingIntercept;
 };
 
 template<typename PointType, typename RectType, typename CoordType>
 /* static */ bool
 nsLayoutUtils::PointIsCloserToRect(PointType aPoint, const RectType& aRect,
                                    CoordType& aClosestXDistance,
                                    CoordType& aClosestYDistance)
 {
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -992,19 +992,16 @@ nsPresContext::Init(nsDeviceContext* aDe
                                 "gfx.font_rendering.",
                                 this);
   Preferences::RegisterCallback(nsPresContext::PrefChangedCallback,
                                 "layout.css.dpi",
                                 this);
   Preferences::RegisterCallback(nsPresContext::PrefChangedCallback,
                                 "layout.css.devPixelsPerPx",
                                 this);
-  Preferences::RegisterCallback(nsPresContext::PrefChangedCallback,
-                                "font.size.inflation",
-                                this);
 
   nsresult rv = mEventManager->Init();
   NS_ENSURE_SUCCESS(rv, rv);
 
   mEventManager->SetPresContext(this);
 
 #ifdef DEBUG
   mInitialized = true;
deleted file mode 100644
--- a/layout/reftests/font-inflation/maxRatio-1-ref.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML>
-<style>
-div { background: yellow }
-div { font-size: 24px; width: 450px }
-</style>
-<!--
-In a 450px container, the minimum font size at 15em per line is 30px.
-This means we map 0px-45px into 30px-45px, so 12px gets mapped to 34px.
-However, because we've enabled the maxRatio at a value of 2.0, the mapping
-function, which would normally return 34px/12px, or about 2.83, now
-returns a ratio capped at 2.0, thus the actual font size is 24px.
--->
-<div>Hello world</div>
deleted file mode 100644
--- a/layout/reftests/font-inflation/maxRatio-1.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!DOCTYPE HTML>
-<style>
-div { background: yellow }
-div { font-size: 12px; width: 450px }
-</style>
-<!--
-In a 450px container, the minimum font size at 15em per line is 30px.
-This means we map 0px-45px into 30px-45px, so 12px gets mapped to 34px.
-However, because we've enabled the maxRatio at a value of 2.0, the mapping
-function, which would normally return 34px/12px, or about 2.83, now
-returns a ratio capped at 2.0, thus the actual font size is 24px.
--->
-<div>Hello world</div>
--- a/layout/reftests/font-inflation/reftest.list
+++ b/layout/reftests/font-inflation/reftest.list
@@ -1,16 +1,15 @@
 # The following tests were written before
 # font.size.inflation.lineThreshold was implemented, and thus assumed
 # that there wasn't a threshold of text required for inflation.  To run
 # them compatibly without having to rewrite all of them, we run them
 # with the lineThreshold preference explicitly set to zero.  However,
 # newer tests should probably focus more on testing nonzero values of
 # that preference.
-test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) test-pref(font.size.inflation.maxRatio,200) == maxRatio-1.html maxRatio-1-ref.html
 test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == text-1.html text-1-ref.html
 test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == text-2.html text-2-ref.html
 test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == text-3.html text-3-ref.html
 test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == text-4.html text-4-ref.html
 test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == height-constraint-percent-1.html height-constraint-percent-1-ref.html
 test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == height-constraint-percent-2.html height-constraint-percent-2-ref.html
 test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == height-constraint-percent-3.html height-constraint-percent-3-ref.html
 test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == height-constraint-percent-4.html height-constraint-percent-4-ref.html
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -1809,29 +1809,16 @@ pref("font.size.inflation.lineThreshold"
  *
  * If the intercept parameter is non-negative, then the mapping function
  * is a function such that its graph meets the graph of i = s at the
  * point where both i and s are (1 + P/2) * m for values of s that are
  * large enough. This means that when s=0, i is always equal to m.
  */
 pref("font.size.inflation.mappingIntercept", 1);
 
-
-/*
- * This controls the percentage that fonts will be inflated, if font
- * size inflation is enabled. Essentially, if we have a specified font
- * size, s, and an inflated font size, i, this specifies that the ratio
- * i/s * 100 should never exceed the value of this preference.
- *
- * In order for this preference to have any effect, its value must be
- * greater than 100, since font inflation can never decrease the ratio
- * i/s.
- */
-pref("font.size.inflation.maxRatio", 0);
-
 /*
  * When enabled, the touch.radius and mouse.radius prefs allow events to be dispatched
  * to nearby elements that are sensitive to the event. See PositionedEventTargeting.cpp.
  * The 'mm' prefs define a rectangle around the nominal event target point within which
  * we will search for suitable elements. 'visitedWeight' is a percentage weight;
  * a value > 100 makes a visited link be treated as further away from the event target
  * than it really is, while a value < 100 makes a visited link be treated as closer
  * to the event target than it really is.