Bug 1546374 - Do not adjust position of popup windows on Wayland; r=stransky

Because adjusting position in the Wayland does not work
(because of unknown absolute position of the window), do not try
to adjust popup position under Wayland.

Differential Revision: https://phabricator.services.mozilla.com/D28480

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jan Horak 2019-04-26 17:57:36 +00:00
Родитель b0b0ebea7e
Коммит 9b1a629d95
2 изменённых файлов: 17 добавлений и 3 удалений

Просмотреть файл

@ -74,6 +74,9 @@ if CONFIG['MOZ_XUL']:
if CONFIG['MOZ_XUL']:
DIRS += ['tree', 'grid']
CFLAGS += CONFIG['TK_CFLAGS']
CXXFLAGS += CONFIG['TK_CFLAGS']
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'

Просмотреть файл

@ -56,6 +56,11 @@
#include "mozilla/dom/KeyboardEvent.h"
#include "mozilla/dom/KeyboardEventBinding.h"
#include <algorithm>
#ifdef MOZ_WAYLAND
# include <gdk/gdk.h>
# include <gdk/gdkx.h>
# include <gdk/gdkwayland.h>
#endif /* MOZ_WAYLAND */
using namespace mozilla;
using mozilla::dom::Document;
@ -1494,14 +1499,20 @@ nsresult nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame,
nscoord oldAlignmentOffset = mAlignmentOffset;
bool inWayland = false;
#ifdef MOZ_WAYLAND
inWayland = !GDK_IS_X11_DISPLAY(gdk_display_get_default());
#endif
// If a panel is being moved or has flip="none", don't constrain or flip it,
// in order to avoid visual noise when moving windows between screens.
// However, if a panel is already constrained or flipped (mIsOffset), then we
// want to continue to calculate this. Also, always do this for content
// shells, so that the popup doesn't extend outside the containing frame.
if (mInContentShell ||
if (!inWayland &&
(mInContentShell ||
(mFlip != FlipType_None &&
(!aIsMove || mIsOffset || mPopupType != ePopupTypePanel))) {
(!aIsMove || mIsOffset || mPopupType != ePopupTypePanel)))) {
int32_t appPerDev = presContext->AppUnitsPerDevPixel();
LayoutDeviceIntRect anchorRectDevPix =
LayoutDeviceIntRect::FromAppUnitsToNearest(anchorRect, appPerDev);