mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 1030115 - fix apz.printtree caching to use gfxPrefs. r=kats, bas
This commit is contained in:
parent
7c98880020
commit
69b99988f1
@ -166,11 +166,11 @@ public:
|
||||
mDepth(0),
|
||||
mStartOfLine(true),
|
||||
mConditionedOnPref(false),
|
||||
mPref(nullptr) {}
|
||||
mPrefFunction(nullptr) {}
|
||||
|
||||
template <typename T>
|
||||
TreeLog& operator<<(const T& aObject) {
|
||||
if (mConditionedOnPref && !*mPref) {
|
||||
if (mConditionedOnPref && !mPrefFunction()) {
|
||||
return *this;
|
||||
}
|
||||
if (mStartOfLine) {
|
||||
@ -190,9 +190,9 @@ public:
|
||||
void IncreaseIndent() { ++mDepth; }
|
||||
void DecreaseIndent() { --mDepth; }
|
||||
|
||||
void ConditionOnPref(bool* aPref) {
|
||||
void ConditionOnPrefFunction(bool(*aPrefFunction)()) {
|
||||
mConditionedOnPref = true;
|
||||
mPref = aPref;
|
||||
mPrefFunction = aPrefFunction;
|
||||
}
|
||||
private:
|
||||
Log<LOG_DEBUG> mLog;
|
||||
@ -200,7 +200,7 @@ private:
|
||||
uint32_t mDepth;
|
||||
bool mStartOfLine;
|
||||
bool mConditionedOnPref;
|
||||
bool* mPref;
|
||||
bool (*mPrefFunction)();
|
||||
|
||||
template <typename T>
|
||||
static bool EndsInNewline(const T& aObject) {
|
||||
|
@ -34,9 +34,6 @@ namespace layers {
|
||||
|
||||
float APZCTreeManager::sDPI = 160.0;
|
||||
|
||||
// Pref that enables printing of the APZC tree for debugging.
|
||||
static bool gPrintApzcTree = false;
|
||||
|
||||
APZCTreeManager::APZCTreeManager()
|
||||
: mTreeLock("APZCTreeLock"),
|
||||
mInOverscrolledApzc(false),
|
||||
@ -46,8 +43,7 @@ APZCTreeManager::APZCTreeManager()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
AsyncPanZoomController::InitializeGlobalState();
|
||||
Preferences::AddBoolVarCache(&gPrintApzcTree, "apz.printtree", gPrintApzcTree);
|
||||
mApzcTreeLog.ConditionOnPref(&gPrintApzcTree);
|
||||
mApzcTreeLog.ConditionOnPrefFunction(gfxPrefs::APZPrintTree);
|
||||
}
|
||||
|
||||
APZCTreeManager::~APZCTreeManager()
|
||||
|
@ -132,6 +132,7 @@ private:
|
||||
DECL_GFX_PREF(Live, "apz.overscroll.snap_back.spring_friction", APZOverscrollSnapBackSpringFriction, float, 0.1f);
|
||||
DECL_GFX_PREF(Live, "apz.overscroll.snap_back.mass", APZOverscrollSnapBackMass, float, 1000.0f);
|
||||
DECL_GFX_PREF(Live, "apz.pan_repaint_interval", APZPanRepaintInterval, int32_t, 250);
|
||||
DECL_GFX_PREF(Live, "apz.printtree", APZPrintTree, bool, false);
|
||||
DECL_GFX_PREF(Live, "apz.subframe.enabled", APZSubframeEnabled, bool, false);
|
||||
DECL_GFX_PREF(Once, "apz.test.logging_enabled", APZTestLoggingEnabled, bool, false);
|
||||
DECL_GFX_PREF(Live, "apz.touch_start_tolerance", APZTouchStartTolerance, float, 1.0f/4.5f);
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "nsStyleStructInlines.h"
|
||||
#include "nsStyleTransformMatrix.h"
|
||||
#include "gfxMatrix.h"
|
||||
#include "gfxPrefs.h"
|
||||
#include "nsSVGIntegrationUtils.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
@ -616,17 +617,6 @@ static void UnmarkFrameForDisplay(nsIFrame* aFrame) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool gPrintApzcTree = false;
|
||||
|
||||
static bool GetApzcTreePrintPref() {
|
||||
static bool initialized = false;
|
||||
if (!initialized) {
|
||||
Preferences::AddBoolVarCache(&gPrintApzcTree, "apz.printtree", gPrintApzcTree);
|
||||
initialized = true;
|
||||
}
|
||||
return gPrintApzcTree;
|
||||
}
|
||||
|
||||
static void RecordFrameMetrics(nsIFrame* aForFrame,
|
||||
nsIFrame* aScrollFrame,
|
||||
const nsIFrame* aReferenceFrame,
|
||||
@ -799,7 +789,7 @@ static void RecordFrameMetrics(nsIFrame* aForFrame,
|
||||
nsLayoutUtils::CalculateRootCompositionSize(aScrollFrame ? aScrollFrame : aForFrame,
|
||||
isRootContentDocRootScrollFrame, metrics));
|
||||
|
||||
if (GetApzcTreePrintPref()) {
|
||||
if (gfxPrefs::APZPrintTree()) {
|
||||
if (nsIContent* content = frameForCompositionBoundsCalculation->GetContent()) {
|
||||
nsAutoString contentDescription;
|
||||
content->Describe(contentDescription);
|
||||
|
Loading…
Reference in New Issue
Block a user