Commit 2ae1dd39 authored by Maksim Sisov's avatar Maksim Sisov Committed by Commit Bot

ozone/wayland: use 1x1 size for popups when empty bounds are passed

After https://crrev.com/c/2385279 landed, the factory stopped creating
WaylandToplevelWindow instead of WaylandPopup for requests that
asked for kPopup windows (which is correct). However, some tests
may pass bounds with the size parameter set to 0, 0.

That resulted in closing of WaylandPopups and tests crashed. Thus,
to fix this problem, readjust bounds when shell popup is created.

Bug: 1125924
Change-Id: Icd7179e8f5ab1d9c2e96fee3dbb167e67b9e753d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2397695
Commit-Queue: Maksim Sisov (GMT+3) <msisov@igalia.com>
Reviewed-by: default avatarNick Yamane <nickdiego@igalia.com>
Cr-Commit-Position: refs/heads/master@{#804913}
parent 22cb11f7
......@@ -19,9 +19,6 @@ WaylandPopup::WaylandPopup(PlatformWindowDelegate* delegate,
WaylandPopup::~WaylandPopup() = default;
bool WaylandPopup::CreateShellPopup() {
if (GetBounds().IsEmpty())
return false;
DCHECK(parent_window() && !shell_popup_);
auto subsurface_bounds_dip =
......
......@@ -297,10 +297,17 @@ bool XDGPopupWrapperImpl::Initialize(WaylandConnection* connection,
if (!xdg_surface_ || !parent_xdg_surface)
return false;
auto new_bounds = bounds;
// Wayland doesn't allow empty bounds. If a zero or negative size is set, the
// invalid_input error is raised. Thus, use the least possible one.
// WaylandPopup will update its bounds upon the following configure event.
if (new_bounds.IsEmpty())
new_bounds.set_size({1, 1});
if (connection->shell())
return InitializeStable(connection, bounds, parent_xdg_surface);
return InitializeStable(connection, new_bounds, parent_xdg_surface);
else if (connection->shell_v6())
return InitializeV6(connection, bounds, parent_xdg_surface);
return InitializeV6(connection, new_bounds, parent_xdg_surface);
return false;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment