Bug 982141 - Factor out 'wantSubAPZC' into nsLayoutUtils. r=kats,tn

--HG--
extra : rebase_source : d651c8b224c31518816a29afc003ef5ac6ed7cc7
This commit is contained in:
Botond Ballo 2014-04-04 10:13:30 -04:00
parent 440fb03af4
commit 55a6ddb4d9
3 changed files with 21 additions and 8 deletions

View File

@ -41,6 +41,7 @@
#include "nsIWidget.h"
#include "gfxMatrix.h"
#include "gfxPoint3D.h"
#include "gfxPrefs.h"
#include "gfxTypes.h"
#include "nsTArray.h"
#include "mozilla/dom/HTMLCanvasElement.h"
@ -6398,6 +6399,19 @@ nsLayoutUtils::CalculateExpandedScrollableRect(nsIFrame* aFrame)
return scrollableRect;
}
/* static */ bool
nsLayoutUtils::WantSubAPZC()
{
// TODO Turn this on for inprocess OMTC on all platforms
bool wantSubAPZC = gfxPrefs::APZSubframeEnabled();
#ifdef MOZ_WIDGET_GONK
if (XRE_GetProcessType() != GeckoProcessType_Content) {
wantSubAPZC = false;
}
#endif
return wantSubAPZC;
}
nsLayoutUtils::SurfaceFromElementResult::SurfaceFromElementResult()
// Use safe default values here
: mIsWriteOnly(true), mIsStillLoading(false), mCORSUsed(false)

View File

@ -2133,6 +2133,12 @@ public:
static nsRect
CalculateExpandedScrollableRect(nsIFrame* aFrame);
/**
* Return whether we want to use APZ for subframes in this process.
* Currently we don't support APZ for the parent process on B2G.
*/
static bool WantSubAPZC();
private:
static uint32_t sFontSizeInflationEmPerLine;
static uint32_t sFontSizeInflationMinTwips;

View File

@ -2595,15 +2595,8 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
if (mShouldBuildScrollableLayer) {
shouldBuildLayer = true;
} else {
// TODO Turn this on for inprocess OMTC on all platforms
bool wantSubAPZC = gfxPrefs::APZSubframeEnabled();
#ifdef MOZ_WIDGET_GONK
if (XRE_GetProcessType() != GeckoProcessType_Content) {
wantSubAPZC = false;
}
#endif
shouldBuildLayer =
wantSubAPZC &&
nsLayoutUtils::WantSubAPZC() &&
WantAsyncScroll() &&
// If we are the root scroll frame for the display root then we don't need a scroll
// info layer to make a RecordFrameMetrics call for us as