Bug 814778: Disable font inflation for the b2g master process. r=dbaron

This commit is contained in:
Chris Jones 2012-11-28 12:16:01 -08:00
Родитель cab40637a3
Коммит a821d1f0e5
6 изменённых файлов: 40 добавлений и 4 удалений

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

@ -585,6 +585,8 @@ pref("jsloader.reuseGlobal", true);
// Enable font inflation for browser tab content.
pref("font.size.inflation.minTwips", 120);
// And disable it for lingering master-process UI.
pref("font.size.inflation.disabledInMasterProcess", true);
// Enable freeing dirty pages when minimizing memory; this reduces memory
// consumption when applications are sent to the background.

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

@ -1298,6 +1298,10 @@ public:
return mFontSizeInflationForceEnabled;
}
bool FontSizeInflationDisabledInMasterProcess() const {
return mFontSizeInflationDisabledInMasterProcess;
}
virtual void AddInvalidateHiddenPresShellObserver(nsRefreshDriver *aDriver) = 0;
void InvalidatePresShellIfHidden();
@ -1450,6 +1454,7 @@ protected:
uint32_t mFontSizeInflationMinTwips;
uint32_t mFontSizeInflationLineThreshold;
bool mFontSizeInflationForceEnabled;
bool mFontSizeInflationDisabledInMasterProcess;
// The maximum width of a line box. Text on a single line that exceeds this
// width will be wrapped. A value of 0 indicates that no limit is enforced.

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

@ -111,6 +111,7 @@ typedef FrameMetrics::ViewID ViewID;
/* static */ int32_t nsLayoutUtils::sFontSizeInflationMappingIntercept;
/* static */ uint32_t nsLayoutUtils::sFontSizeInflationMaxRatio;
/* static */ bool nsLayoutUtils::sFontSizeInflationForceEnabled;
/* static */ bool nsLayoutUtils::sFontSizeInflationDisabledInMasterProcess;
static ViewID sScrollIdCounter = FrameMetrics::START_SCROLL_ID;
@ -4773,6 +4774,8 @@ nsLayoutUtils::Initialize()
"font.size.inflation.mappingIntercept");
Preferences::AddBoolVarCache(&sFontSizeInflationForceEnabled,
"font.size.inflation.forceEnabled");
Preferences::AddBoolVarCache(&sFontSizeInflationDisabledInMasterProcess,
"font.size.inflation.disabledInMasterProcess");
#ifdef MOZ_FLEXBOX
Preferences::RegisterCallback(FlexboxEnabledPrefChangeCallback,
@ -5157,10 +5160,20 @@ nsLayoutUtils::FontSizeInflationEnabled(nsPresContext *aPresContext)
aPresContext->IsChrome()) {
return false;
}
if (TabChild* tab = GetTabChildFrom(presShell)) {
if (!presShell->FontSizeInflationForceEnabled() &&
!tab->IsAsyncPanZoomEnabled()) {
return false;
// Force-enabling font inflation always trumps the heuristics here.
if (!presShell->FontSizeInflationForceEnabled()) {
if (TabChild* tab = GetTabChildFrom(presShell)) {
// We're in a child process. Cancel inflation if we're not
// async-pan zoomed.
if (!tab->IsAsyncPanZoomEnabled()) {
return false;
}
} else if (XRE_GetProcessType() == GeckoProcessType_Default) {
// We're in the master process. Cancel inflation if it's been
// explicitly disabled.
if (presShell->FontSizeInflationDisabledInMasterProcess()) {
return false;
}
}
}

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

@ -1652,6 +1652,10 @@ public:
return sFontSizeInflationForceEnabled;
}
static bool FontSizeInflationDisabledInMasterProcess() {
return sFontSizeInflationDisabledInMasterProcess;
}
/**
* See comment above "font.size.inflation.mappingIntercept" in
* modules/libpref/src/init/all.js .
@ -1771,6 +1775,7 @@ private:
static int32_t sFontSizeInflationMappingIntercept;
static uint32_t sFontSizeInflationMaxRatio;
static bool sFontSizeInflationForceEnabled;
static bool sFontSizeInflationDisabledInMasterProcess;
};
template<typename PointType, typename RectType, typename CoordType>

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

@ -9196,6 +9196,7 @@ PresShell::SetupFontInflation()
mFontSizeInflationMinTwips = nsLayoutUtils::FontSizeInflationMinTwips();
mFontSizeInflationLineThreshold = nsLayoutUtils::FontSizeInflationLineThreshold();
mFontSizeInflationForceEnabled = nsLayoutUtils::FontSizeInflationForceEnabled();
mFontSizeInflationDisabledInMasterProcess = nsLayoutUtils::FontSizeInflationDisabledInMasterProcess();
}
void

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

@ -1796,6 +1796,16 @@ pref("font.size.inflation.minTwips", 0);
* either of the prefs above. It has no meaning in single-mode UIs.
*/
pref("font.size.inflation.forceEnabled", false);
/*
* In products with multi-mode pan-and-zoom and non-pan-and-zoom UIs,
* this pref disables font inflation in master-process contexts where
* existing heuristics can't be used determine enabled-ness.
*
* This pref has no effect if font inflation is not enabled through
* either of the prefs above. The "forceEnabled" pref above overrides
* this pref.
*/
pref("font.size.inflation.disabledInMasterProcess", false);
/*
* Since the goal of font size inflation is to avoid having to
* repeatedly scroll side to side to read a block of text, and there are