Backout 94f06c75c3b5 for lack of reviewer.

This commit is contained in:
Scott Johnson 2012-10-15 14:13:35 -05:00
parent d5613c03e2
commit 929cb0551e
7 changed files with 4 additions and 67 deletions

View File

@ -106,8 +106,7 @@ 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;
@ -4680,8 +4679,6 @@ nsLayoutUtils::SizeOfTextRunsForFrames(nsIFrame* aFrame,
void
nsLayoutUtils::Initialize()
{
Preferences::AddUintVarCache(&sFontSizeInflationMaxRatio,
"font.size.inflation.maxRatio");
Preferences::AddUintVarCache(&sFontSizeInflationEmPerLine,
"font.size.inflation.emPerLine");
Preferences::AddUintVarCache(&sFontSizeInflationMinTwips,
@ -4963,10 +4960,8 @@ nsLayoutUtils::FontSizeInflationInner(const nsIFrame *aFrame,
}
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).
@ -4989,18 +4984,12 @@ nsLayoutUtils::FontSizeInflationInner(const nsIFrame *aFrame,
// 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;
}
}

View File

@ -1611,14 +1611,6 @@ public:
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 .
@ -1759,8 +1751,7 @@ 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>

View File

@ -997,9 +997,6 @@ nsPresContext::Init(nsDeviceContext* aDeviceContext)
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);

View File

@ -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>

View File

@ -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>

View File

@ -5,7 +5,6 @@
# 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

View File

@ -1814,19 +1814,6 @@ pref("font.size.inflation.lineThreshold", 400);
*/
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.