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

--HG--
extra : rebase_source : c23e9d3253991523f39d7437ab5f36172768813a
This commit is contained in:
Botond Ballo 2014-04-04 10:13:30 -04:00
parent ddb7114443
commit 61e1214277
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"
@ -6402,6 +6403,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