Bug 958596 - Print the APZC tree for debugging. r=kats

This commit is contained in:
Botond Ballo 2014-01-22 15:09:03 -05:00
parent d6421e976c
commit 4f009b21ac

View File

@ -20,6 +20,7 @@
#include "nsDebug.h" // for NS_WARNING
#include "nsPoint.h" // for nsIntPoint
#include "nsThreadUtils.h" // for NS_IsMainThread
#include "mozilla/gfx/Logging.h" // for gfx::TreeLog
#include <algorithm> // for std::stable_sort
@ -34,6 +35,8 @@ float APZCTreeManager::sDPI = 160.0;
// Pref that enables printing of the APZC tree for debugging.
static bool gPrintApzcTree = false;
gfx::TreeLog sApzcTreeLog("apzctree");
APZCTreeManager::APZCTreeManager()
: mTreeLock("APZCTreeLock"),
mTouchCount(0)
@ -41,6 +44,7 @@ APZCTreeManager::APZCTreeManager()
MOZ_ASSERT(NS_IsMainThread());
AsyncPanZoomController::InitializeGlobalState();
Preferences::AddBoolVarCache(&gPrintApzcTree, "apz.printtree", gPrintApzcTree);
sApzcTreeLog.ConditionOnPref(&gPrintApzcTree);
}
APZCTreeManager::~APZCTreeManager()
@ -121,6 +125,7 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor, Laye
mRootApzc = nullptr;
if (aRoot) {
sApzcTreeLog << "[start]\n";
UpdatePanZoomControllerTree(aCompositor,
aRoot,
// aCompositor is null in gtest scenarios
@ -128,6 +133,7 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor, Laye
gfx3DMatrix(), nullptr, nullptr,
aIsFirstPaint, aFirstPaintLayersId,
&apzcsToDestroy);
sApzcTreeLog << "[end]\n";
}
for (size_t i = 0; i < apzcsToDestroy.Length(); i++) {
@ -149,6 +155,7 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor,
ContainerLayer* container = aLayer->AsContainerLayer();
AsyncPanZoomController* apzc = nullptr;
sApzcTreeLog << aLayer->Name() << '\t';
if (container) {
if (container->GetFrameMetrics().IsScrollable()) {
const CompositorParent::LayerTreeState* state = CompositorParent::GetIndirectShadowTree(aLayersId);
@ -227,6 +234,11 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor,
visible.width, visible.height,
apzc);
sApzcTreeLog << "APZC "
<< "\tcb=" << visible
<< "\tsr=" << container->GetFrameMetrics().mScrollableRect
<< "\t" << container->GetFrameMetrics().GetContentDescription();
// Bind the APZC instance into the tree of APZCs
if (aNextSibling) {
aNextSibling->SetPrevSibling(apzc);
@ -261,6 +273,7 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor,
container->SetAsyncPanZoomController(apzc);
}
sApzcTreeLog << '\n';
// Accumulate the CSS transform between layers that have an APZC, but exclude any
// any layers that do have an APZC, and reset the accumulation at those layers.
@ -278,6 +291,7 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor,
// have our siblings as siblings.
AsyncPanZoomController* next = apzc ? nullptr : aNextSibling;
for (Layer* child = aLayer->GetLastChild(); child; child = child->GetPrevSibling()) {
gfx::TreeAutoIndent indent(sApzcTreeLog);
next = UpdatePanZoomControllerTree(aCompositor, child, childLayersId, aTransform, aParent, next,
aIsFirstPaint, aFirstPaintLayersId, aApzcsToDestroy);
}