Bug 1384181 - Add utility dump functions for debugging. r?
MozReview-Commit-ID: 5YJLGhnMkwG
--- a/gfx/layers/wr/WebRenderScrollData.cpp
+++ b/gfx/layers/wr/WebRenderScrollData.cpp
@@ -1,16 +1,17 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/layers/WebRenderScrollData.h"
#include "Layers.h"
+#include "LayersLogging.h"
#include "mozilla/layout/RenderFrameParent.h"
#include "mozilla/Unused.h"
#include "nsTArray.h"
#include "UnitTransforms.h"
namespace mozilla {
namespace layers {
@@ -123,16 +124,37 @@ WebRenderLayerScrollData::GetScrollMetad
}
CSSTransformMatrix
WebRenderLayerScrollData::GetTransformTyped() const
{
return ViewAs<CSSTransformMatrix>(GetTransform());
}
+void
+WebRenderLayerScrollData::Dump(const WebRenderScrollData& aOwner) const
+{
+ printf_stderr("LayerScrollData(%p) descendants %d\n", this, mDescendantCount);
+ for (size_t i : mScrollIds) {
+ printf_stderr(" metadata: %s\n", Stringify(aOwner.GetScrollMetadata(i)).c_str());
+ }
+ printf_stderr(" transform: %s perspective: %d visible: %s\n",
+ Stringify(mTransform).c_str(), mTransformIsPerspective,
+ Stringify(mVisibleRegion).c_str());
+ printf_stderr(" event regions: %s override: 0x%x\n",
+ Stringify(mEventRegions).c_str(), mEventRegionsOverride);
+ printf_stderr(" ref layers id: %" PRIu64 "\n", mReferentId.valueOr(0));
+ //printf_stderr(" scroll thumb: %s animation: %" PRIu64 "\n",
+ // Stringify(mScrollThumbData).c_str(), mScrollbarAnimationId);
+ printf_stderr(" scroll container: %d target: %" PRIu64 "\n",
+ mIsScrollbarContainer, mScrollbarTargetContainerId);
+ printf_stderr(" fixed pos container: %" PRIu64 "\n",
+ mFixedPosScrollContainerId);
+}
+
WebRenderScrollData::WebRenderScrollData()
: mIsFirstPaint(false)
, mPaintSequenceNumber(0)
{
}
WebRenderScrollData::~WebRenderScrollData()
{
@@ -222,10 +244,20 @@ WebRenderScrollData::SetPaintSequenceNum
}
uint32_t
WebRenderScrollData::GetPaintSequenceNumber() const
{
return mPaintSequenceNumber;
}
+void
+WebRenderScrollData::Dump() const
+{
+ printf_stderr("WebRenderScrollData with %zu layers firstpaint: %d\n",
+ mLayerScrollData.Length(), mIsFirstPaint);
+ for (size_t i = 0; i < mLayerScrollData.Length(); i++) {
+ mLayerScrollData.ElementAt(i).Dump(*this);
+ }
+}
+
} // namespace layers
} // namespace mozilla
--- a/gfx/layers/wr/WebRenderScrollData.h
+++ b/gfx/layers/wr/WebRenderScrollData.h
@@ -63,16 +63,18 @@ public:
Maybe<uint64_t> GetReferentId() const { return mReferentId; }
EventRegionsOverride GetEventRegionsOverride() const { return mEventRegionsOverride; }
const ScrollThumbData& GetScrollThumbData() const { return mScrollThumbData; }
const uint64_t& GetScrollbarAnimationId() const { return mScrollbarAnimationId; }
FrameMetrics::ViewID GetScrollbarTargetContainerId() const { return mScrollbarTargetContainerId; }
bool IsScrollbarContainer() const { return mIsScrollbarContainer; }
FrameMetrics::ViewID GetFixedPositionScrollContainerId() const { return mFixedPosScrollContainerId; }
+ void Dump(const WebRenderScrollData& aOwner) const;
+
friend struct IPC::ParamTraits<WebRenderLayerScrollData>;
private:
// The number of descendants this layer has (not including the layer itself).
// This is needed to reconstruct the depth-first layer tree traversal
// efficiently. Leaf layers should always have 0 descendants.
int32_t mDescendantCount;
@@ -133,16 +135,18 @@ public:
void SetIsFirstPaint();
bool IsFirstPaint() const;
void SetPaintSequenceNumber(uint32_t aPaintSequenceNumber);
uint32_t GetPaintSequenceNumber() const;
friend struct IPC::ParamTraits<WebRenderScrollData>;
+ void Dump() const;
+
private:
// Internal data structure used to maintain uniqueness of mScrollMetadatas.
// This is not serialized/deserialized over IPC because there's no need for it,
// as the parent side doesn't need this at all. Also because we don't have any
// IPC-friendly hashtable implementation lying around.
// The key into this map is the scrollId of a ScrollMetadata, and the value is
// an index into the mScrollMetadatas array.
std::map<FrameMetrics::ViewID, size_t> mScrollIdMap;