Commit graph

1390 commits

Author SHA1 Message Date
Edgar Chen
1e0a194368 Bug 1801391 - Avoid handling multiple widget fullscreen at the same time; r=smaug
We had some protection in https://searchfox.org/mozilla-central/rev/2fc2ccf960c2f7c419262ac7215715c5235948db/dom/base/nsGlobalWindowOuter.cpp#4259-4265,
but it isn't enough, it is still possible that fullscreen state get confused if
there are multiple request happens at a short time.

This patch tries to improve how we handle multiple request, we don't need to
track each request, but need to ensure widget matches with the latest fullscreen
state specified.

Differential Revision: https://phabricator.services.mozilla.com/D163311
2022-12-21 12:49:18 +00:00
Marian-Vasile Laza
b3bfaeb915 Backed out changeset 903719ec824e (bug 1801391) for causing wpt failures on element-request-fullscreen-timing.html. 2022-12-21 04:18:53 +02:00
Edgar Chen
9b2d8200a8 Bug 1801391 - Avoid handling multiple widget fullscreen at the same time; r=smaug
We had some protection in https://searchfox.org/mozilla-central/rev/2fc2ccf960c2f7c419262ac7215715c5235948db/dom/base/nsGlobalWindowOuter.cpp#4259-4265,
but it isn't enough, it is still possible that fullscreen state get confused if
there are multiple request happens at a short time.

This patch tries to improve how we handle multiple request, we don't need to
track each request, but need to ensure widget matches with the latest fullscreen
state specified.

Differential Revision: https://phabricator.services.mozilla.com/D163311
2022-12-20 20:17:33 +00:00
Cosmin Sabou
441a13eec1 Backed out changeset 337925bb04cf (bug 1801391) for causing fullscreen related wpt failures. CLOSED TREE 2022-12-15 14:31:57 +02:00
Edgar Chen
2e047ca037 Bug 1801391 - Avoid handling multiple widget fullscreen at the same time; r=smaug
We had some protection in https://searchfox.org/mozilla-central/rev/2fc2ccf960c2f7c419262ac7215715c5235948db/dom/base/nsGlobalWindowOuter.cpp#4259-4265,
but it isn't enough, it is still possible that fullscreen state get confused if
there are multiple request happens at a short time.

This patch tries to improve how we handle multiple request, we don't need to
track each request, but need to ensure widget matches with the latest fullscreen
state specified.

Differential Revision: https://phabricator.services.mozilla.com/D163311
2022-12-15 10:19:24 +00:00
stransky
07fa4069a7 Bug 1772073 [Wayland] Call gtk_window_set_transient_for() only if widget parent is changed r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D164194
2022-12-08 10:49:13 +00:00
Emilio Cobos Álvarez
5b9f9d24c6 Bug 1798131 - Fix leave-notify handling on X11 (and stop doing pointer grabbing there). r=stransky
The main issue is the confusion between mGdkWindow and the toplevel when
we draw with client decorations. Though something else broke since we
enabled them and now even with MOZ_GTK_TITLEBAR_DECORATION=system the
bug reproduces.

The thing that's supposed to hide the tooltip on nsXULTooltipListener is
the mouseout event handler, but without this fix we would upgrade the
eMouseExitFromWidget to a synthesized mouse move here:

  https://searchfox.org/mozilla-central/rev/2fc2ccf960c2f7c419262ac7215715c5235948db/dom/events/EventStateManager.cpp#721-732

Make leave-notify handling properly parallel to enter-notify in order to
properly notify gecko of the mouse leaving the window, thus fixing the
bug.

We also need to stop doing pointer grabs. Reasoning:

 * We already don't do it on Wayland (see bug 1377084).
 * The APIs we use are deprecated.
 * The pointer grabs send spurious top-level leave/enter-notify pairs
   which aren't detectable (the leave/enter event pair sent to the
   toplevel window doesn't have the GDK_POINTER_{GRAB,UNGRAB} reasons).
 * The code we had to avoid them (bug 369599) no longer works with CSD:
   * The window gets hit even though it's behind other windows.
   * The hit-test still returns true when hitting the window decorations.

So we're effectively eating virtually all useful leave-notify events,
which is obviously not great. Also gtk4 apps don't seem to have the same
pointer-grabbing on context menus etc.

Differential Revision: https://phabricator.services.mozilla.com/D163646
2022-12-06 22:54:49 +00:00
stransky
f2dd95dadb Bug 1795851 [Wayland] Update EGL window size/scale in moz_container_wayland_get_egl_window() r=emilio
We need to return correct EGLWindow from moz_container_wayland_get_egl_window() with correct scale/size
and also keep the EGLWindow up to date. In this patch we do:

- Implement moz_container_wayland_egl_window_needs_size_update() and use it in nsWindow::SetEGLNativeWindowSize().
  Avoid redundant moz_container_wayland_egl_window_set_size()/moz_container_wayland_set_scale_factor() calls as it may lead to resize callback calls to MESA.
- If wl_container::eglwindow is present, check its size/scale in moz_container_wayland_get_egl_window() and update size/scale if needed.
- Use nsIntSize single param instead of width/height pairs in some moz_container_* functions.
- Assert when gtk_widget_get_window(container) returns null.

Differential Revision: https://phabricator.services.mozilla.com/D163698
2022-12-06 15:18:32 +00:00
Cosmin Sabou
49a2e8b82c Backed out changeset 7c3b662ef3fc (bug 1798131) for turning bug 1775659 into permafail on linux. 2022-12-03 01:15:55 +02:00
Emilio Cobos Álvarez
68004d0eb9 Bug 1798131 - Fix leave-notify handling on X11. r=stransky
The main issue is the confusion between mGdkWindow and the toplevel when
we draw with client decorations. Though something else broke since we
enabled them and now even with MOZ_GTK_TITLEBAR_DECORATION=system the
bug reproduces.

The thing that's supposed to hide the tooltip on nsXULTooltipListener is
the mouseout event handler, but without this fix we would upgrade the
eMouseExitFromWidget to a synthesized mouse move here:

  https://searchfox.org/mozilla-central/rev/2fc2ccf960c2f7c419262ac7215715c5235948db/dom/events/EventStateManager.cpp#721-732

Make leave-notify handling properly parallel to enter-notify in order to
properly notify gecko of the mouse leaving the window, thus fixing the
bug.

Differential Revision: https://phabricator.services.mozilla.com/D163646
2022-12-02 17:06:28 +00:00
Martin Robinson
abb5044ca7 Bug 1803377 - Rename the values of the IntrinsicDirty enum r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D163607
2022-12-02 12:27:31 +00:00
stransky
2fc2ccf960 Bug 1802977 [Linux] Release nsWindow referenced by GtkCompositorWidget from main thread by NS_ReleaseOnMainThread() r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D163330
2022-11-30 10:26:00 +00:00
stransky
f339bc9425 Bug 1802327 [Linux] Activate nsWindow by SetUserTimeAndStartupTokenForActivatedWindow() after gtk_widget_show() to make sure it's visible r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D163310
2022-11-30 10:17:02 +00:00
Botond Ballo
68c71a503c Bug 1802225 - Remove Layers.{h,cpp}. r=tnikkel,geckoview-reviewers,jgilbert,media-playback-reviewers,padenot,m_kato
Where appropriate, `#include "Layers.h"` is replaced with
more specific inclusions.

Differential Revision: https://phabricator.services.mozilla.com/D162934
2022-11-29 01:52:03 +00:00
stransky
2c4aa1bf79 Bug 1801888 [Linux] Allow to call nsWindow destructor from other threads if nsWindow is already destroyed r=emilio
We can delete nsWindow but reference to it is kept by GtkCompositorWidget and nsWindow destructor may be called from Compositor thread where GtkCompositorWidget may be deleted.
Allow such scenario if nsWindow is already an empty shell and only nsWindow memory is released from Compositor thread.

Differential Revision: https://phabricator.services.mozilla.com/D163145
2022-11-28 11:10:38 +00:00
stransky
c2c8c4709e Bug 1791779 [Wayland] Enable maximized window resize workaround for Wayland too r=emilio
https://gitlab.gnome.org/GNOME/gtk/-/issues/1044 is supposed fixed in gtk3-3.24 but it isn't so let's enable it again.

Differential Revision: https://phabricator.services.mozilla.com/D163079
2022-11-25 14:26:23 +00:00
Hiroyuki Ikezoe
f7ce055162 Bug 1794070 - Refer mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection flag instead of calling SwipeTrackker::CanTriggerSwipe(). r=botond
And rename mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection to
mMayTriggerSwipe.

So basically once after the flag is set, we should use it.

Differential Revision: https://phabricator.services.mozilla.com/D160436
2022-11-22 06:52:52 +00:00
Hiroyuki Ikezoe
ebfe7e293e Bug 1794070 - Make mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection private. r=botond
And initialized it only in ctors so that in the next change we can use it to
tell whether this pan event may trigger swipe or not without calling
SwipeTracker::CanTriggerSwipe every time.

There's an unintuitive change in a GTest sending a horizontal pan-start event.
With this changeset, all incomming pan-start events on desktop platforms
basically set mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection
to true even if the event is generated in GTests. So the pan start event runs
into the short circuit path for swipe-to-navigation. This is a good thing because
it means the GTest replicates what our browser does properly.

Differential Revision: https://phabricator.services.mozilla.com/D160435
2022-11-22 06:52:51 +00:00
Butkovits Atila
887a77ba5f Backed out 13 changesets (bug 1794070) for causing failures at browser_test_swipe_gesture.js. CLOSED TREE
Backed out changeset afe487b23e1c (bug 1794070)
Backed out changeset b119052f690d (bug 1794070)
Backed out changeset 733188f6b7ca (bug 1794070)
Backed out changeset 53273c86140a (bug 1794070)
Backed out changeset e2e39e61efbe (bug 1794070)
Backed out changeset 93b240feb781 (bug 1794070)
Backed out changeset 78aea5c32e14 (bug 1794070)
Backed out changeset 158008a6363b (bug 1794070)
Backed out changeset 3c3e76c8bf49 (bug 1794070)
Backed out changeset 39beb7abc321 (bug 1794070)
Backed out changeset 0ded01fbbd9e (bug 1794070)
Backed out changeset cf4552e5e11b (bug 1794070)
Backed out changeset 317ee240609d (bug 1794070)
2022-11-21 13:41:34 +02:00
Hiroyuki Ikezoe
5b39846aeb Bug 1794070 - Refer mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection flag instead of calling SwipeTrackker::CanTriggerSwipe(). r=botond
And rename mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection to
mMayTriggerSwipe.

So basically once after the flag is set, we should use it.

Differential Revision: https://phabricator.services.mozilla.com/D160436
2022-11-21 03:10:07 +00:00
Hiroyuki Ikezoe
ae5bdfff82 Bug 1794070 - Make mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection private. r=botond
And initialized it only in ctors so that in the next change we can use it to
tell whether this pan event may trigger swipe or not without calling
SwipeTracker::CanTriggerSwipe every time.

There's an unintuitive change in a GTest sending a horizontal pan-start event.
With this changeset, all incomming pan-start events on desktop platforms
basically set mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection
to true even if the event is generated in GTests. So the pan start event runs
into the short circuit path for swipe-to-navigation. This is a good thing because
it means the GTest replicates what our browser does properly.

Differential Revision: https://phabricator.services.mozilla.com/D160435
2022-11-21 03:10:07 +00:00
stransky
88a8b923bd Bug 1800211 [XWayland] Keep open drag source popups on XWayland too r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D162029
2022-11-15 08:14:45 +00:00
stransky
7d2d31927b Bug 1761877 [Linux] Add isWaylandDragSource and isWaylandPopup attributes to XULPopupElement r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D161127
2022-11-08 20:43:17 +00:00
Emilio Cobos Álvarez
ad59f2bd10 Bug 1767546 - Support XDG_ACTIVATION_TOKEN. r=stransky
Differential Revision: https://phabricator.services.mozilla.com/D159968
2022-11-08 12:43:24 +00:00
Razvan Cojocaru
1629218702 Bug 1060421 - Change the type of [Int]PointTyped::[x|y] back to [Int]CoordTyped. r=botond
[Int]CoordTyped no longer inherits Units because otherwise
instances of [Int]IntPointTyped may get one Base subobject because
it inherits Units, and others because of BasePoint's Coord members,
which end up increasing the [Int]CoordTyped's objects size (since
according to the ISO C++ standard, different Base subobject are
required to have different addresses).

Differential Revision: https://phabricator.services.mozilla.com/D160713
2022-11-04 18:29:35 +00:00
stransky
c8f69c9460 Bug 1795645 [Wayland] Check nsWindow returned by get_window_for_gtk_widget() r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D160886
2022-11-04 09:40:09 +00:00
stransky
3cc418b893 Bug 1796751 [Wayland] Apply negative coordinates workaround to GdkWindow too r=emilio
Depends on D160343

Differential Revision: https://phabricator.services.mozilla.com/D160344
2022-10-26 11:47:33 +00:00
stransky
5e9381b0ad Bug 1796751 [Wayland] Apply negative coordinates workaround to GDK_WINDOW_TEMP GdkWindow r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D160343
2022-10-26 11:47:33 +00:00
stransky
c5fd68828c Bug 1794613 [Wayland] Don't make tooltips modal r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D160328
2022-10-26 09:01:16 +00:00
stransky
e5f83b8dd1 Bug 1796103 [Wayland] Log move-to-rect params r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D159691
2022-10-26 08:58:24 +00:00
stransky
fda76755db Bug 1797309 [Wayland] Use correct popup to calculate parent position for wl_subsurface popups r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D160223
2022-10-25 18:36:51 +00:00
stransky
0970447a78 Bug 1797046 [Wayland] Use mBounds to get Wayland popup coordinates for nsWindow::WidgetToScreenOffset() r=emilio
Due to https://gitlab.gnome.org/GNOME/gtk/-/issues/5287 we can't use gdk_window_get_origin() on wl_subsurface Wayland popups.
In this patch we switch to mBounds to return popup position by nsWindow::WidgetToScreenOffset().

Differential Revision: https://phabricator.services.mozilla.com/D160048
2022-10-25 12:00:32 +00:00
stransky
5e70d08ce3 Bug 1796392 [Wayland] Don't assert if there's tooltip in popup hierarchy r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D159843
2022-10-20 10:49:26 +00:00
stransky
e0b9399c0f Bug 1794597 [Wayland] Apply popup drop position workaround to both drag motion and drag drop operations r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D159674
2022-10-19 11:41:43 +00:00
stransky
599b985afe Bug 1795849 [Linux] Chancel D&D operation on Wayland and XWayland when D&D source window is closing r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D159588
2022-10-19 06:39:11 +00:00
stransky
f02086d01e Bug 1795822 [Wayland] Use correct popup for move-to-rect check r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D159570
2022-10-18 09:45:11 +00:00
stransky
f5c3b87f9c Bug 1695227 [Wayland] Set the OcclusionStateChanged() when inactive r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D159250
2022-10-14 07:38:07 +00:00
stransky
7e5ed8ab5f Bug 1786247 [Wayland] Print nsWindow as part of Vsync logs r=rmader
Differential Revision: https://phabricator.services.mozilla.com/D159037
2022-10-13 08:41:34 +00:00
Matthias Camenzind
d18c0b5d1c Bug 1792839 - [Linux] Only update window size when also calling WindowResized. r=stransky
Updating mBounds.Size() without calling WindowResized leaves the window
temporarily in a state where inner and outer sizes are out of sync.

BrowserParent::UpdatePosition should call BrowserParent::UpdateDimension
with the size during the last update, rather than the current window
size. There is an edge case where a call can happen between a resize and
its reflow, and a second resize could prevent the reflow from changing
the frame loader size, leaving the BrowserChild with an outdated outer
size.

Differential Revision: https://phabricator.services.mozilla.com/D158343
2022-10-11 20:02:49 +00:00
Matthias Camenzind
e94c6cb964 Bug 1793609 - [Linux] Wait for OnSizeAllocate while the window becomes visible before updating window size. r=stransky
The first size-allocate is likely (or guaranteed) to be of the size at
the time of the first NativeShow(true) call. Any resize between show and
the first size-allocate will be accounted for in a second size-allocate
signal. If we update and dispatch the window size at the beginning of
such a resize, we end up reverting back to previous size from the first
size-allocate signal before dispatching the size for the resize again
from the second size-allocate signal.

Differential Revision: https://phabricator.services.mozilla.com/D158580
2022-10-11 07:47:39 +00:00
stransky
256ffbd81f Bug 1766197 [Wayland] Update move-to-rect anchor for tooltips according to nsMenuPopupFrame::SetPopupPosition()/X11 r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D158566
2022-10-06 06:57:31 +00:00
stransky
930759b5f3 Bug 1791539 [Wayland] Use mShell Gdk window position for D&D r=emilio
Due to https://gitlab.gnome.org/GNOME/gtk/-/issues/4437 / Bug 1710344 we need to add popup window position to D&D coordinates provided by Gtk.
In this patch always use GdkWindow derived from mShell which is attached to parent window.
Don't use GdkWindow of mContainer which is nested child window and it's positioned at 0,0.

Differential Revision: https://phabricator.services.mozilla.com/D158653
2022-10-05 18:09:09 +00:00
stransky
f0ffbdcf82 Bug 1791856 [Wayland] Remove rounding error workaround r=emilio
The rounding error workaround is broken - on recent Gtk it produces needless stream of move-to-rect callback.
It's because we move popup of GDK_WINDOW_TYPE_HINT_POPUP_MENU type and this is positioned by Gtk by move-to-rect even if gtk_window_move() is called.

But it looks like we don't need this workaround any more due to recent fixes (1786525, 1786588, 1786525, 1765714).

Differential Revision: https://phabricator.services.mozilla.com/D158217
2022-09-29 07:29:17 +00:00
stransky
6fd20dd767 Bug 1792125 [Wayland] Don't use move-to-rect if there are more popup parents of wl_subsurface popup type r=emilio
We can't use move-to-rect if there are more parents of wl_subsurface popups types.
It's because wl_subsurface is ignored by xgd_popup (created by move-to-rect) so our popup scenario:

toplevel -> xgd_popup(1) -> wl_subsurface(2) -> xgd_popup(3)

looks for Wayland compositor as:

toplevel -> xgd_popup(1) -> xgd_popup(3)

If xgd_popup(1) and xgd_popup(3) are not adjacent then move-to-rect applied to xgd_popup(3) fails and we get missing popup.

Depends on D158120

Differential Revision: https://phabricator.services.mozilla.com/D158121
2022-09-27 10:20:09 +00:00
stransky
666c946a5b Bug 1792125 [Wayland] Always calculate relative popup coordinates for context menu r=emilio
Wne context menu is positioned by plain move, we need relative popup coordinates. So calculate them according to context menu parent popup.

Differential Revision: https://phabricator.services.mozilla.com/D158120
2022-09-27 10:20:09 +00:00
stransky
1e3bd4ab3e Bug 1792512 [Linux] Don't skip resize if recent window size is different than requested one r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D158190
2022-09-27 09:08:13 +00:00
stransky
a88baa8f03 Bug 1791977 [Linux] Don't expect CompositorWidget is always GtkCompositorWidget r=emilio
Don't crash/assert when mCompositorWidgetDelegate is different than GtkCompositorWidget.

Differential Revision: https://phabricator.services.mozilla.com/D158003
2022-09-23 09:42:50 +00:00
stransky
4b164391e1 Bug 1789956 [Wayland] Don't use move-to-rect offset for non-adjacent popups r=emilio
move-to-rect offset does not work realibly in mutter and can lead to invisible window.
It's used mainly for tooltips so let's skip it for now.

Differential Revision: https://phabricator.services.mozilla.com/D157926
2022-09-22 19:43:33 +00:00
stransky
a875f16df0 Bug 1791735 [Wayland] Don't paint to unmapped window by SW backend r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D157795
2022-09-22 18:42:01 +00:00
stransky
60f547bec1 Bug 1789956 [Wayland] Use mBounds to get parent popup position r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D157915
2022-09-22 18:32:16 +00:00