Bug 1717451 [Linux] Guard logging code with MOZ_LOG_TEST macro, r=jhorak

Depends on D119030

Differential Revision: https://phabricator.services.mozilla.com/D119031
This commit is contained in:
stransky
2021-07-15 09:48:03 +00:00
parent a90cb6ea38
commit 66f8b9ab67
2 changed files with 19 additions and 9 deletions

View File

@@ -1573,15 +1573,17 @@ void nsWindow::WaylandPopupHierarchyCalculatePositions() {
(int)(popup->mBounds.width / FractionalScaleFactor()),
(int)(popup->mBounds.height / FractionalScaleFactor())));
#ifdef MOZ_LOGGING
nsMenuPopupFrame* popupFrame = GetMenuPopupFrame(GetFrame());
if (popupFrame) {
auto pos = popupFrame->GetPosition();
auto size = popupFrame->GetSize();
int32_t p2a =
AppUnitsPerCSSPixel() / gfxPlatformGtk::GetFontScaleFactor();
LOG_POPUP((" popup [%p] layout [%d, %d] -> [%d x %d]", popup,
pos.x / p2a, pos.y / p2a, size.width / p2a,
size.height / p2a));
if (LOG_ENABLED()) {
nsMenuPopupFrame* popupFrame = GetMenuPopupFrame(GetFrame());
if (popupFrame) {
auto pos = popupFrame->GetPosition();
auto size = popupFrame->GetSize();
int32_t p2a =
AppUnitsPerCSSPixel() / gfxPlatformGtk::GetFontScaleFactor();
LOG_POPUP((" popup [%p] layout [%d, %d] -> [%d x %d]", popup,
pos.x / p2a, pos.y / p2a, size.width / p2a,
size.height / p2a));
}
}
#endif
if (popup->mPopupContextMenu && !popup->mPopupAnchored) {
@@ -1712,6 +1714,10 @@ void nsWindow::GetParentPosition(int* aX, int* aY) {
#ifdef MOZ_LOGGING
void nsWindow::LogPopupHierarchy() {
if (!LOG_ENABLED()) {
return;
}
LOG_POPUP(("Widget Popup Hierarchy:\n"));
if (!mWaylandToplevel->mWaylandPopupNext) {
LOG_POPUP((" Empty\n"));

View File

@@ -57,6 +57,9 @@ extern mozilla::LazyLogModule gWidgetPopupLog;
# define LOGDRAG(args) MOZ_LOG(gWidgetDragLog, mozilla::LogLevel::Debug, args)
# define LOG_POPUP(args) \
MOZ_LOG(gWidgetPopupLog, mozilla::LogLevel::Debug, args)
# define LOG_ENABLED() \
(MOZ_LOG_TEST(gWidgetPopupLog, mozilla::LogLevel::Debug) || \
MOZ_LOG_TEST(gWidgetLog, mozilla::LogLevel::Debug))
#else
@@ -64,6 +67,7 @@ extern mozilla::LazyLogModule gWidgetPopupLog;
# define LOGW(args)
# define LOGDRAG(args)
# define LOG_POPUP(args)
# define LOG_ENABLED() false
#endif /* MOZ_LOGGING */