I did some cleanup while here: This now uses the callback's lParam
instead of a global, and does the enumeration of all windows only if
the foreground window doesn't already belong to this process (which
was proposed in bug 259816 comment 68 but didn't make it into the patch).
Differential Revision: https://phabricator.services.mozilla.com/D57922
--HG--
extra : moz-landing-system : lando
nsWindow::UpdateOpaqueRegion() is used from Main thread and it collides with
moz_container_get_wl_surface() where opaque region is used and which is called from Compositor thread.
As a fix don't set opaque region directly for mozcontainer but rather just use a flag to signalize
there's an update needed and calculare/set the opaque region at moz_container_get_wl_surface() or
moz_container_egl_window_set_size().
Differential Revision: https://phabricator.services.mozilla.com/D58840
--HG--
extra : moz-landing-system : lando
This looks like a large change, but it's really just moving stuff
around.
It takes the logic in WinCompositorWidget and duplicates it into
its only 2 subclasses: InProcessWinCompositorWidget and
CompositorWidgetParent.
This is because CompositorWidgetParent is about to change *a lot*, but
InProcessWinCompositorWidget will basically stay the same. This is an
easy way to verify that I don't accidently break
InProcessWinCompositorWidget.
Differential Revision: https://phabricator.services.mozilla.com/D57428
--HG--
extra : moz-landing-system : lando
The idle-inhibit protocol allows idle wake locks on Wayland
without any of the supported D-Bus interfaces running.
Differential Revision: https://phabricator.services.mozilla.com/D49095
--HG--
extra : moz-landing-system : lando
Showing a new notification with the same name of an existing notification
replaces the old notification so we must unregister it from Windows at that
point.
Differential Revision: https://phabricator.services.mozilla.com/D58270
--HG--
extra : moz-landing-system : lando
Other platforms send out the finished notification when the notification is
programmatically cancelled. This patch ensures that finished is always sent.
Differential Revision: https://phabricator.services.mozilla.com/D58269
--HG--
extra : moz-landing-system : lando
By making the IStream object free-threaded (or "agile"), IStream::Read will be
called off the main thread. So we can wait until favicon is created.
Depends on D56478
Differential Revision: https://phabricator.services.mozilla.com/D56479
--HG--
extra : moz-landing-system : lando
nsTouchBar.h/.mm were getting a bit unwieldy, particularly after the TouchBarInputBaseType enum from the next part of this patch was added. This part splits out TouchBarInput into its own files. This makes the Touch Bar's file structure similar to that of the menu bar's: nsMenuBarX, nsMenuBarItemX, and nsMenuBarItemIconX contrasted with nsTouchBar, nsTouchBarInput, and nsTouchBarInputIcon.
Differential Revision: https://phabricator.services.mozilla.com/D56589
--HG--
extra : moz-landing-system : lando
This allows GfxInfoX11 to get GLES3 and Mesa version from Wayland-EGL, which
allows automatic enablement of acceleration to work without Xwayland.
This also fixes bug 1578598 - WebRender did not work correctly
without this GL version information.
Differential Revision: https://phabricator.services.mozilla.com/D57474
--HG--
extra : moz-landing-system : lando
Over in bug 1604761 I realized that GTK has a high-contrast accessibility
setting, that GTK does not honor the same way as windows does.
There's no good reason for that IMO, and high contrast mode on windows is
getting some love.
This hooks the relevant parts of the GTK widget code so that we also avoid
websites overriding high contrast colors (via PreferenceStyleSheet and co).
Differential Revision: https://phabricator.services.mozilla.com/D58278
--HG--
extra : moz-landing-system : lando
Calculate and set correct opaque regions for all wl_surfaces, which are:
- mShell - toplevel window with CSD decorations, opaque mask needs to be shifted by titlebar/CSD size and subtracted transparent corners.
- mContainer - child window with subtracted transparent corners.
Differential Revision: https://phabricator.services.mozilla.com/D57797
--HG--
extra : moz-landing-system : lando
On macOS 10.12.1+, we use `MediaPlayer` library, which has better media key integration, to replace the implementation of `CG EventLoop`.
Differential Revision: https://phabricator.services.mozilla.com/D46890
--HG--
extra : moz-landing-system : lando
This makes it more similar to how SwapBuffers was used.
This patch also makes us call glFlush directly when using native layers, rather than going through the misleadingly-named GLContext::SwapBuffers method.
Differential Revision: https://phabricator.services.mozilla.com/D57062
--HG--
extra : moz-landing-system : lando
All usage of `synthesizeDragStart()` is, starting drag, cancel `dragstart`,
and finally compares `dataTransfer` items and given expected data. So,
we can make the users use `synthesizePlainDragAndDrop()` instead. It's
better API because it computes position of mouse operations at runtime and
checks whether the drag start was succeeded with optional logging feature
(i.e., it's easier to debug of intermittent failures).
This patch creates `synthesizePlainDragAndCancel()` for convenience. It
handles `dragstart` instead of the callers.
Differential Revision: https://phabricator.services.mozilla.com/D58214
--HG--
extra : moz-landing-system : lando
The failures which you see running the tests on high DPI display are caused by
`synthesizeQuery*` returns device pixels, but some of the failures
calculating/comparing with CSS pixels, or the other of them caused just
rounding error. This patch makes they refer `window.devicePixelRatio` and/or
use `isfuzzy` to compare.
The patched tests pass on 100%, 125%, 150%, 175%, 200% and 225% on Win10-ja.
Differential Revision: https://phabricator.services.mozilla.com/D58197
--HG--
extra : moz-landing-system : lando
The x and y tweaks weren't getting used, because they were not being copied to
the local `x` and `y` variables too. With that fixed, this seems to work
nicely.
I want to enable outline-style: auto both for parity with other browsers but
also because it unblocks stuff like bug 1583381 / bug 1311444.
Differential Revision: https://phabricator.services.mozilla.com/D57934
--HG--
extra : moz-landing-system : lando
Calculate and set correct opaque regions for all wl_surfaces, which are:
- mShell - toplevel window with CSD decorations, opaque mask needs to be shifted by titlebar/CSD size and subtracted transparent corners.
- mContainer - child window with subtracted transparent corners.
Differential Revision: https://phabricator.services.mozilla.com/D57797
--HG--
extra : moz-landing-system : lando
The oldest Mac that we support is 10.9, so we no longer need these defines.
Differential Revision: https://phabricator.services.mozilla.com/D58005
--HG--
extra : moz-landing-system : lando
`synthesizePlainDragAndDrop()` synthesizes drag events with `DataTransfer`
object which is set to `DragEvent.dataTransfer` of `dragstart` after starting
drag session explicitly. However, this causes
`EventStateManager::DoDefaltDragStart()` does not initialize `nsIDragService`
instance. Therefore, synthesized drag events cannot work with editor because
`DragEvent::GetMozSourceNode()` returns `nullptr` due to
`nsIDragSession::GetSourceNode()` returning `nullptr`.
On the other hand, synthesized drag events cannot use
`nsIDragService::InvodeDragSession()` normally because of hitting an assertion.
https://searchfox.org/mozilla-central/rev/690e903ef689a4eca335b96bd903580394864a1c/widget/nsBaseDragService.cpp#230-233
This patch does:
- mark drag events caused by synthesized mouse events as "synthesized for tests"
- make `synthesizePlainDragAndDrop()` stop using
`nsIDragService.startDragSession()`
- make `nsBaseDragService` initialize and start session even for synthesized
`dragstart` event
- make `synthesizePlainDragAndDrop()` stop synthesizing drag events with
`DataTransfer` object since it's normal behavior and it'll be initialized
with `nsIDragService::GetDataTransfer()`
- make `nsBaseDragService` store `effectAllowed` for the session only when
it's synthesized session because it's required at initializing synthesized
default `dropEffect` value of `dragenter`, `dragover`, `dragexit` and `drop`
events' `dataTransfer`
- make all tests which use `nsIDragService.startDragSession()` use new
API, `nsIDragService.startDragSessionForTests()` to initialize session's
`effectAllowed` value
- make `EventStateManager::PostHandleEvent()` set drag end point of the test
session to `eDrop` event's screen point
- make `synthesizePlainDragAndDrop()` set drag end point of the session if
it does not synthesize `drop` event because following `endDragSession()`
use it at dispatching `dragend` event on the source element
Additionally, this adds `dumpFunc` new param to `synthesizePlainDragAndDrop()`
because it's really useful to investigate the reason why requesting DnD isn't
performed as expected.
Differential Revision: https://phabricator.services.mozilla.com/D57425
--HG--
extra : moz-landing-system : lando
Inheriting from `nsISupports` is too complicated if we just want to support refcounting. Instead, we can use `NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING` to declare `Add/RemoveRef()` as pure virtual functions in order to create ref-counted abstract classes.
Differential Revision: https://phabricator.services.mozilla.com/D57714
--HG--
extra : moz-landing-system : lando
While windows toast notifications are active there is a reference cycle between
MSCOM and XPCOM objects that the cycle collector cannot break. Fix this by
breaking the reference cycle at any point where we expect the toast notification
to be destroyed.
Differential Revision: https://phabricator.services.mozilla.com/D58001
--HG--
extra : moz-landing-system : lando
This changeset is a simple find and replace of `MOZ_FALLTHROUGH` and `[[fallthrough]]`.
Unfortunately, the MOZ_FALLTHROUGH_ASSERT macro (to assert on case fallthrough in debug builds) is still necessary after switching from [[clang::fallthrough]] to [[fallthrough]] because:
* MOZ_ASSERT(false) followed by [[fallthrough]] triggers a -Wunreachable-code warning in DEBUG builds
* but MOZ_ASSERT(false) without [[fallthrough]] triggers a -Wimplicit-fallthrough warning in NDEBUG builds.
Differential Revision: https://phabricator.services.mozilla.com/D56440
--HG--
extra : moz-landing-system : lando
- Invalidate mBounds when window state is changed. That ensures we get new window size from configure event.
- Join Resize() routines and use ResizeInt() for the actual resize work.
- Add more logging to nsWindow file.
Differential Revision: https://phabricator.services.mozilla.com/D57763
--HG--
extra : moz-landing-system : lando
Don't use CSD decoration size to get ClientOffset at UpdateClientOffsetFromCSDWindow()
but rather get it from gdk_window_get_position() which is more universal and it's available on Gtk < 3.20.
As we can't call gdk_window_get_position() right after titlebar on/off switch (mContainer is not positioned yet),
use mClientOffsetCSDNeedsUpdate flag to delay it.
Also request ClientOffset update on scale change which is missing now.
Rename UpdateClientOffset() to UpdateClientOffsetFromFrameExtents() to explicitly
state its function and make it similar to UpdateClientOffsetFromCSDWindow().
It depends on https://phabricator.services.mozilla.com/D57763 which needs to be checked first.
Differential Revision: https://phabricator.services.mozilla.com/D57302
--HG--
extra : moz-landing-system : lando
On GTK changing gtk-enable-animation in a process doesn't affect in different
processes for some reasons. So we take the same approach as what we did for
OSX[1] that is when SetPrefersReducedMotionOverrideForTest is called we set the
given value as a cache in the parent process and send a notification to system
as if the value changed thus the notification kicks PBroser.ThemeChanged to
update the cache in the content process, thus we can use the cache value on
querying the corresponding value in the content process.
[1] https://hg.mozilla.org/mozilla-central/rev/67a5acf7363d
Differential Revision: https://phabricator.services.mozilla.com/D57260
--HG--
extra : moz-landing-system : lando
On GTK changing gtk-enable-animation in a process doesn't affect in different
processes for some reasons. So we take the same approach as what we did for
OSX[1] that is when SetPrefersReducedMotionOverrideForTest is called we set the
given value as a cache in the parent process and send a notification to system
as if the value changed thus the notification kicks PBroser.ThemeChanged to
update the cache in the content process, thus we can use the cache value on
querying the corresponding value in the content process.
[1] https://hg.mozilla.org/mozilla-central/rev/67a5acf7363d
Differential Revision: https://phabricator.services.mozilla.com/D57260
--HG--
extra : moz-landing-system : lando
Once we start supporting different model IDs for different windows of the same
application we need to make sure that the normal windows have a model ID and
the jump lists and recent documents are tagged with the same ID. We do this by
always having an app default model ID, when no window specific model ID is set
the app default is used.
At some point we may want to extend the jump list stuff to support using a
different model ID but that isn't needed right now.
Differential Revision: https://phabricator.services.mozilla.com/D57152
--HG--
extra : moz-landing-system : lando
There are multiple SurfacePools: Main thread painting and the non-WebRender compositors create a new pool per window, and WebRender creates one shared pool across all windows. The non-WebRender users set the pool size limit to zero, i.e. no recycling across paints. This preserves the pre-existing behavior.
WebRender's pool size is configurable with the gfx.webrender.compositor.surface-pool-size pref.
Every window holds on to a SurfacePoolHandle. A SurfacePoolHandle has an owning reference to the pool, via a surface pool wrapper. Once all handles are gone, the surface pool goes away, too.
The SurfacePool holds on to IOSurfaces and MozFramebuffers. Both are created on demand, independently, but are associated with each other.
A given NativeLayer uses only one surface pool handle during its lifetime. The native layer no longer influences which GLContext its framebuffers are created for; the GL context is now managed by the surface pool handle.
As a result, a NativeLayer can no longer change which GLContext its framebuffers are created by.
So in the future, if we ever need to migrate a window frome one GLContext to another, we will need to recreate the NativeLayers inside it. I think that's ok.
Differential Revision: https://phabricator.services.mozilla.com/D54859
--HG--
extra : moz-landing-system : lando
This also fixes a lifetime issue where we may have been leaking the
native instance of `WebResponse.Support`.
Differential Revision: https://phabricator.services.mozilla.com/D56994
--HG--
extra : moz-landing-system : lando
Once we start supporting different model IDs for different windows of the same
application we need to make sure that the normal windows have a model ID and
the jump lists and recent documents are tagged with the same ID. We do this by
always having an app default model ID, when no window specific model ID is set
the app default is used.
At some point we may want to extend the jump list stuff to support using a
different model ID but that isn't needed right now.
Differential Revision: https://phabricator.services.mozilla.com/D57152
--HG--
extra : moz-landing-system : lando
This also fixes a lifetime issue where we may have been leaking the
native instance of `WebResponse.Support`.
Differential Revision: https://phabricator.services.mozilla.com/D56994
--HG--
extra : moz-landing-system : lando
We should be using `GetCurrentProcess` as the default, not `nullptr`.
`VirtualProtectEx` fails with a `nullptr` process handle.
Differential Revision: https://phabricator.services.mozilla.com/D57512
--HG--
extra : moz-landing-system : lando
Usually we update mBounds from OnSizeAllocate() which is called
by Gtk when mContainer changes its actual size.
However we need to set mBounds in advance at Resize() as JS
code expect immediate window size change. When Resize() is called between
SetSizeMode() calls (which maximize/unmaximize the window) we can miss
OnSizeAllocate() Gtk call as actual mContainer size may not change
from Gtk perspective and we end up with incorrect mBounds.
To compensate it call OnSizeAllocate() explicitly also
from OnConfigureEvent() after size mode change.
Differential Revision: https://phabricator.services.mozilla.com/D55941
--HG--
extra : moz-landing-system : lando
Usually we update mBounds from OnSizeAllocate() which is called
by Gtk when mContainer changes its actual size.
However we need to set mBounds in advance at Resize() as JS
code expect immediate window size change. When Resize() is called between
SetSizeMode() calls (which maximize/unmaximize the window) we can miss
OnSizeAllocate() Gtk call as actual mContainer size may not change
from Gtk perspective and we end up with incorrect mBounds.
To compensate it call OnSizeAllocate() explicitly also
from OnConfigureEvent().
Differential Revision: https://phabricator.services.mozilla.com/D55941
--HG--
extra : moz-landing-system : lando
This is generally pretty straightforward, and rewrites nearly all calls. It
skips the ones that it can detect using frame script globals like
`sendAsyncMessage`, though.
Differential Revision: https://phabricator.services.mozilla.com/D53740
--HG--
extra : moz-landing-system : lando
It calls `Document::FlushPendingNotification()` so that we should mark it
as `MOZ_CAN_RUN_SCRIPT`.
And the method calls it of `mDocument` and `mDocument` is never modified
after it's initialized. Therefore, we can move the initializer to the
constructor and make `RefPtr<Document>` to `RefPtr<Document> const`. Thus,
we can avoid unnecessary auto `RefPtr`.
Differential Revision: https://phabricator.services.mozilla.com/D55803
--HG--
extra : moz-landing-system : lando
`MediaControlKeysEvent` should represent possible control key events, so adding a non-existing `eNone` in this class is not good.
Differential Revision: https://phabricator.services.mozilla.com/D57022
--HG--
extra : moz-landing-system : lando
Currently, it's possible for testFetchStreamError to finish receiving data
before the error is received and throws.
Differential Revision: https://phabricator.services.mozilla.com/D56797
--HG--
extra : moz-landing-system : lando
This will allow us to know whether a certain window is controlled GeckoView or
not in the content process.
Differential Revision: https://phabricator.services.mozilla.com/D56651
--HG--
extra : moz-landing-system : lando
`TextInputHandler::HandleFlagsChanged()` dispatches `keydown` and `keyup`
events even if the native key code is not set properly because web apps
and our internal component like EventStateManager may cache modifier
state with listening to `keydown` and `keyup` events.
If native event does not have proper key code value, it computes key code
from recorded key code value for each flag, but one modifier key may
set 2 or more flags. Therefore, it should check whether the computed
key code's event has already been dispatched or not.
Differential Revision: https://phabricator.services.mozilla.com/D56138
--HG--
extra : moz-landing-system : lando
NOTIFY_IME_OF_FOCUS performs lazy initialization for text dispatcher. When
GeckoViewSupport attaches GeckoEditable during initialization,
GeckoEditableSupport destroys myself.
If GeckoEditable already has focus, don't destroy GeckoEditable child.
Also, I want to add debug warning to debug like this issue.
Differential Revision: https://phabricator.services.mozilla.com/D55914
--HG--
extra : moz-landing-system : lando
This is generally pretty straightforward, and rewrites nearly all calls. It
skips the ones that it can detect using frame script globals like
`sendAsyncMessage`, though.
Differential Revision: https://phabricator.services.mozilla.com/D53740
--HG--
extra : moz-landing-system : lando