forked from mirrors/gecko-dev
Bug 1651050 - Add a logging module for code that sets displayports. r=tnikkel
This is useful for debugging purposes. Depends on D82778 Differential Revision: https://phabricator.services.mozilla.com/D82779
This commit is contained in:
parent
aa7d787c6e
commit
0cf65adf2b
3 changed files with 51 additions and 0 deletions
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
static mozilla::LazyLogModule sApzHlpLog("apz.helper");
|
||||
#define APZCCH_LOG(...) MOZ_LOG(sApzHlpLog, LogLevel::Debug, (__VA_ARGS__))
|
||||
static mozilla::LazyLogModule sDisplayportLog("apz.displayport");
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
|
@ -256,6 +257,17 @@ static void SetDisplayPortMargins(PresShell* aPresShell, nsIContent* aContent,
|
|||
}
|
||||
|
||||
bool hadDisplayPort = nsLayoutUtils::HasDisplayPort(aContent);
|
||||
if (MOZ_LOG_TEST(sDisplayportLog, LogLevel::Debug)) {
|
||||
if (!hadDisplayPort) {
|
||||
mozilla::layers::ScrollableLayerGuid::ViewID viewID =
|
||||
mozilla::layers::ScrollableLayerGuid::NULL_SCROLL_ID;
|
||||
nsLayoutUtils::FindIDFor(aContent, &viewID);
|
||||
MOZ_LOG(
|
||||
sDisplayportLog, LogLevel::Debug,
|
||||
("APZCCH installing displayport margins %s on scrollId=%" PRIu64 "\n",
|
||||
Stringify(aDisplayPortMargins).c_str(), viewID));
|
||||
}
|
||||
}
|
||||
nsLayoutUtils::SetDisplayPortMargins(aContent, aPresShell,
|
||||
aDisplayPortMargins, 0);
|
||||
if (!hadDisplayPort) {
|
||||
|
|
@ -417,6 +429,9 @@ void APZCCallbackHelper::InitializeRootDisplayport(PresShell* aPresShell) {
|
|||
} else if (pc) {
|
||||
baseRect = nsRect(nsPoint(0, 0), pc->GetVisibleArea().Size());
|
||||
}
|
||||
MOZ_LOG(
|
||||
sDisplayportLog, LogLevel::Debug,
|
||||
("Initializing root displayport on scrollId=%" PRIu64 "\n", viewId));
|
||||
nsLayoutUtils::SetDisplayPortBaseIfNotSet(content, baseRect);
|
||||
// Note that we also set the base rect that goes with these margins in
|
||||
// nsRootBoxFrame::BuildDisplayList.
|
||||
|
|
@ -614,6 +629,9 @@ static bool PrepareForSetTargetAPZCNotification(
|
|||
|
||||
APZCCH_LOG("%p didn't have a displayport, so setting one...\n",
|
||||
dpElement.get());
|
||||
MOZ_LOG(sDisplayportLog, LogLevel::Debug,
|
||||
("Activating displayport on scrollId=%" PRIu64 " for SetTargetAPZC\n",
|
||||
guid.mScrollId));
|
||||
bool activated = nsLayoutUtils::CalculateAndSetDisplayPortMargins(
|
||||
scrollAncestor, nsLayoutUtils::RepaintMode::Repaint);
|
||||
if (!activated) {
|
||||
|
|
|
|||
|
|
@ -183,6 +183,7 @@ typedef ScrollableLayerGuid::ViewID ViewID;
|
|||
typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox;
|
||||
|
||||
static ViewID sScrollIdCounter = ScrollableLayerGuid::START_SCROLL_ID;
|
||||
static mozilla::LazyLogModule sDisplayportLog("apz.displayport");
|
||||
|
||||
typedef nsDataHashtable<nsUint64HashKey, nsIContent*> ContentMap;
|
||||
static ContentMap* sContentMap = nullptr;
|
||||
|
|
@ -1384,6 +1385,18 @@ bool nsLayoutUtils::SetDisplayPortMargins(nsIContent* aContent,
|
|||
GetHighResolutionDisplayPort(aContent, &newDisplayPort);
|
||||
MOZ_ASSERT(hasDisplayPort);
|
||||
|
||||
if (MOZ_LOG_TEST(sDisplayportLog, LogLevel::Debug)) {
|
||||
if (!hadDisplayPort) {
|
||||
mozilla::layers::ScrollableLayerGuid::ViewID viewID =
|
||||
mozilla::layers::ScrollableLayerGuid::NULL_SCROLL_ID;
|
||||
nsLayoutUtils::FindIDFor(aContent, &viewID);
|
||||
MOZ_LOG(sDisplayportLog, LogLevel::Debug,
|
||||
("SetDisplayPortMargins %s on scrollId=%" PRIu64 ", newDp=%s\n",
|
||||
Stringify(aMargins).c_str(), viewID,
|
||||
Stringify(newDisplayPort).c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
InvalidateForDisplayPortChange(aContent, hadDisplayPort, oldDisplayPort,
|
||||
newDisplayPort, aRepaintMode);
|
||||
|
||||
|
|
@ -3465,6 +3478,15 @@ bool nsLayoutUtils::MaybeCreateDisplayPort(nsDisplayListBuilder* aBuilder,
|
|||
scrollableFrame->WantAsyncScroll()) {
|
||||
// If we don't already have a displayport, calculate and set one.
|
||||
if (!haveDisplayPort) {
|
||||
// We only use the viewId for logging purposes, but create it
|
||||
// unconditionally to minimize impact of enabling logging. If we don't
|
||||
// assign a viewId here it will get assigned later anyway so functionally
|
||||
// there should be no difference.
|
||||
ViewID viewId = nsLayoutUtils::FindOrCreateIDFor(content);
|
||||
MOZ_LOG(
|
||||
sDisplayportLog, LogLevel::Debug,
|
||||
("Setting DP on first-encountered scrollId=%" PRIu64 "\n", viewId));
|
||||
|
||||
CalculateAndSetDisplayPortMargins(scrollableFrame, aRepaintMode);
|
||||
#ifdef DEBUG
|
||||
haveDisplayPort = HasDisplayPort(content);
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ static mozilla::LazyLogModule sRootScrollbarsLog("rootscrollbars");
|
|||
if (mHelper.mIsRoot) { \
|
||||
MOZ_LOG(sRootScrollbarsLog, LogLevel::Debug, (__VA_ARGS__)); \
|
||||
}
|
||||
static mozilla::LazyLogModule sDisplayportLog("apz.displayport");
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
|
@ -7312,6 +7313,16 @@ void ScrollFrameHelper::ApzSmoothScrollTo(const nsPoint& aDestination,
|
|||
// APZC instance for it and so there won't be anything to process
|
||||
// this smooth scroll request. We should set a displayport on this
|
||||
// frame to force an APZC which can handle the request.
|
||||
if (MOZ_LOG_TEST(sDisplayportLog, LogLevel::Debug)) {
|
||||
mozilla::layers::ScrollableLayerGuid::ViewID viewID =
|
||||
mozilla::layers::ScrollableLayerGuid::NULL_SCROLL_ID;
|
||||
nsLayoutUtils::FindIDFor(mOuter->GetContent(), &viewID);
|
||||
MOZ_LOG(
|
||||
sDisplayportLog, LogLevel::Debug,
|
||||
("ApzSmoothScrollTo setting displayport on scrollId=%" PRIu64 "\n",
|
||||
viewID));
|
||||
}
|
||||
|
||||
nsLayoutUtils::CalculateAndSetDisplayPortMargins(
|
||||
mOuter->GetScrollTargetFrame(), nsLayoutUtils::RepaintMode::Repaint);
|
||||
nsIFrame* frame = do_QueryFrame(mOuter->GetScrollTargetFrame());
|
||||
|
|
|
|||
Loading…
Reference in a new issue