This reverts commit 312ba34b1e.
Revert "Bug 2039903 - Use nsIWidget::NativeModifiers for SynthesizeNativeKeyEvent. r=masayuki,win-reviewers,gstoll"
This reverts commit cdcd922a07.
Revert "Bug 2039903 - Use proper types for PBrowser::SynthesizeNativeMouseEvent. r=masayuki"
This reverts commit 45369938ed.
Revert "Bug 2039903 - Change from nsIWidget::Modifiers to nsIWidget::NativeModifiers. r=masayuki,geckoview-reviewers,win-reviewers,m_kato,gstoll"
This reverts commit 479f174ddb.
And remove unused includes of nsGkAtoms.h in the process. The few
dependencies have been moved to ServoStyleConstsInlines.h
The used command to remove the now unused dependency was:
git grep -l nsGkAtoms.h | while read line; do grep -v nsGkAtoms.h $line | grep -q -E '\<nsGkAtoms\>' || sed -i -e '/nsGkAtoms.h/d' $line ; done
Differential Revision: https://phabricator.services.mozilla.com/D292697
And remove unused includes of nsGkAtoms.h in the process. The few
dependencies have been moved to ServoStyleConstsInlines.h
The used command to remove the now unused dependency was:
git grep -l nsGkAtoms.h | while read line; do grep -v nsGkAtoms.h $line | grep -q -E '\<nsGkAtoms\>' || sed -i -e '/nsGkAtoms.h/d' $line ; done
Differential Revision: https://phabricator.services.mozilla.com/D292697
`LayerViewSupport` has a race condition by disposing this object and
calling JNI methods. According to the crash reports, `onBoundsChanged`
and `onSafeAreaChanged` are possible called after `LayerViewSupport` is
disposed. In other word, some methods that notify Gecko of changing
window size etc by `onGlobalLayout` or `onApplyWindowInsets`) might be
called after window is being destroyed.
So we should use proxy method and `WindowEvent` class to avoid it.
`WindowEvent` will check if the object is attached during
`Runnable::Run`.
Differential Revision: https://phabricator.services.mozilla.com/D289083
To fulfil multiple GeckoDisplay.capturePixels() requests, Android
nsWindow's LayerViewSupport class maintains a queue of CaptureRequests
to be completed and sends one request at a time to the
compositor. When the result is returned from the compositor it pops
the first request from the queue and completes its GeckoResult.
In some circumstances, however, such as when the compositor is paused,
LayerViewSupport will immediately clear the CaptureRequest queue,
completing the GeckoResults with an error. If the compositor
subsequently returns the result for this request, the queue will now
be empty. Or worse, if a new request was received in the meantime, the
queue will contain a CaptureRequest corresponding to an entirely
different screenshot request, and we will incorrectly resolve its
GeckoResult with the result of the previous request. If the two
requests were for different sizes of screenshot this will even trigger
the sanity check assertions prior to copying the pixel data into the
bitmap.
This patch ensures that we ignore results returned from the compositor
if their corresponding GeckoResult has already been completed.
To achieve this, UiCompositorControllerChild::RequestScreenPixels()
now returns a MozPromise which resolves with the screen pixels
result. This is Track()ed with a MozPromiseRequestHolder, and when we
choose to clear the CaptureRequest queue early without waiting for the
result from the compositor then we must Disconnect() the request. This
ensures that when the promise callback actually runs it will always
correspond to the CaptureRequest at the front of the queue.
Differential Revision: https://phabricator.services.mozilla.com/D282437
Rather than allocating a Shmem and performing a glReadPixels(),
instead allocate a HardwareBuffer which is bound to a framebuffer via
an EGL image, then blit to this from the main framebuffer. The
hardware buffer and a fence for synchronization are returned to the
child side via file descriptors. This avoids the existing synchronous
glReadPixels, and is more efficient than even an asynchronous
glReadPixels to a PBO would be as it only requires one copy.
This also allows us to handle the y-flip and cropping/scaling on the
GPU rather than performing this on the CPU.
On the client side we map the hardware buffer and perform a final copy
in to the target Bitmap. As the hardware buffer may have a different
stride than the Bitmap we can no longer use the Java function
Bitmap.copyPixelsFromBuffer(). Instead we use the NDK's
AndroidBitmap_getInfo() to determine the Bitmap's stride and memcpy()
line by line if required.
For now we only use RendererOGL::RequestScreenPixels() and related
functions on Android, so we just use the AndroidHardwareBuffer type
directly in the required function and type declarations and hide them
behind ifdefs. If we choose to make use of this infrastructure on
other platforms going forward we can implement a more generic
interface. If possible it would additionally be good to unify this
with the other screenshotting mechanisms (profiler screenshots and
composition recording).
Differential Revision: https://phabricator.services.mozilla.com/D281495
UiCompositorBridgeParent::RecvRequestScreenPixels() is used by GeckoView
to screenshot the current session (for Fenix's tab thumbnails, etc).
Currently this works by requesting a composite and calling
WebRenderBridgeParent::RequestScreenPixels(). This will generate a
frame for the requested composite, and then call
MaybeCaptureScreenPixels(), which calls WebRenderAPI::Readback() to
capture the pixels.
WebRenderAPI::Readback() was designed to be used with
WebRenderBridgeParent::RecvSnapshot() which must return the snapshot
synchronously. It therefore dispatches a synchronous task to the
renderer thread and performs a render before performing the
readback. Not only that, it also disables webrender debug flags prior
to this render, then re-enables them afterwards, each of which causes
a render. This means it does 3 renders in total, in addition to the
normal render for the frame that we generated.
RecvRequestScreenPixels does not need to return synchronously. Instead
of using WebRenderAPI::Readback this patch therefore posts an
asynchronous message to the render thread to ensure the next rendered
frame is read back, making sure to post this message just *before*
generating the frame rather than just after.
The newly added functions use promises to return the results from the
render thread to WebRenderBridgeParent. And as an additional tidy up
the communication between UiCompositorControllerParent and
WebRenderBridgeParent was also switched to using promises.
Note that the actual readback is still performed using a synchronous
glReadPixels() call. This will be improved upon in subsequent patches.
Differential Revision: https://phabricator.services.mozilla.com/D281493
In the past we were opening the URL classifier DB on demand when
we made the first network request. This delays the first network
request slightly. Warming it up earlier will let the first request
go out sooner.
Differential Revision: https://phabricator.services.mozilla.com/D272041
This patch makes it so that we silently fail to setup the GPU process
and its associated IPDL actors on Android when we are in the background.
This is because Android limits our ability to keep a GPU process when
backgrounded, and the higher levels should have an ability to recover
from this situation for content processes when brought back into the
foreground. It also resets the unstable and launch attempt counters when
the fore/background state changes to be more forgiving of GPU process
crashes during the transitions.
When the GPU process is relaunched, it will also destroy the fallback
renderers created on Android, so that the next paint will properly
request remote compositing.
Differential Revision: https://phabricator.services.mozilla.com/D267679
We no longer have child windows which means that all widgets use desktop
pixels. Make the type system enforce that.
We want to start storing coordinates in DesktopPixels for GTK, to deal
correctly with fractional scaling, so move mBounds to the relevant
subclasses.
There's no behavior change. Some of the changes uncover coordinate
system confusions in Windows that I plan to fix in followups.
Android / iOS / PuppetWidgets don't care about the coordinate
differences, because their DesktopToLayoutDeviceScale is 1.0. Still I
made puppet widgets go through the coordinate conversion because it
seemed easier than casting or what not.
Differential Revision: https://phabricator.services.mozilla.com/D269091
widget/cocoa was already dereferencing without checking. There were two
callers with null init data which were for headless / puppet widgets,
but this is clearer.
Differential Revision: https://phabricator.services.mozilla.com/D268978
The distinction between nsBaseWidget and nsIWidget is useless as all our
implementations use the former.
So just merge both.
Differential Revision: https://phabricator.services.mozilla.com/D268518
Originally, media keys were dispatched to `AudioManager` if web content
doesn’t consume it by bug 730192. But after GeckoView (moving to e10s),
we always call `GeckoEditable.onDefaultKeyEvent()` if focused element
isn't editable even if web content consumes it.
`DispatchKeyboardEvent` is asynchronous and it doesn't wait for
whether the event is consumed or not. Also, even if we set the flag for
"waiting reply from remote process", its flag will reset in
`DispatchKeyboardEventInternal`.
So I would like to inhibit this. Then if media key, we set the flag if
on parent process.
Differential Revision: https://phabricator.services.mozilla.com/D256739
This patch refactors the C++/JS side of EventDispatcher into a new
EventDispatcherBase class, which has no dependencies on jni or Android thanks
to passing around JS::Value. This will allow the iOS implementation in part 2
to be much smaller and share more code with the Android implementation.
When refactoring the EventDispatcher logic, I also noticed some small
simplifications (such as using `nsTObserverArray` rather than the hand-rolled
observer logic from the previous version of the patch), which have been
applied. The code was also updated to use proper thread-safety annotations.
Differential Revision: https://phabricator.services.mozilla.com/D241287
This reverts commit 23eb1407b7.
Revert "Bug 1953595 - Part 1: Refactor EventDispatcher to be more embedder-agnostic, r=geckoview-reviewers,nalexander"
This reverts commit 13b598fec0.
This patch refactors the C++/JS side of EventDispatcher into a new
EventDispatcherBase class, which has no dependencies on jni or Android thanks
to passing around JS::Value. This will allow the iOS implementation in part 2
to be much smaller and share more code with the Android implementation.
When refactoring the EventDispatcher logic, I also noticed some small
simplifications (such as using `nsTObserverArray` rather than the hand-rolled
observer logic from the previous version of the patch), which have been
applied. The code was also updated to use proper thread-safety annotations.
Differential Revision: https://phabricator.services.mozilla.com/D241287
This reverts commit 843fc1fc8a.
Revert "Bug 1953595 - Part 1: Refactor EventDispatcher to be more embedder-agnostic, r=geckoview-reviewers,nalexander"
This reverts commit 3582db2329.
This patch refactors the C++/JS side of EventDispatcher into a new
EventDispatcherBase class, which has no dependencies on jni or Android thanks
to passing around JS::Value. This will allow the iOS implementation in part 2
to be much smaller and share more code with the Android implementation.
When refactoring the EventDispatcher logic, I also noticed some small
simplifications (such as using `nsTObserverArray` rather than the hand-rolled
observer logic from the previous version of the patch), which have been
applied. The code was also updated to use proper thread-safety annotations.
Differential Revision: https://phabricator.services.mozilla.com/D241287
The observer is always notified with null subject and data, and use different
topics for different events, but not all call sites check the topic. So it could
be just a callback with no arguments, would also clean up the code a bit.
Differential Revision: https://phabricator.services.mozilla.com/D251080
This issue is a possible crash case.
Actually `SessionAccessibility.NativeProvider.setAttached` is called in
C++ constructor of `SessionAccessibility`. But native handle is set
after calling the constructor. So when `NativeProvider.setAttached` is
called, C++ side might not set native handle yet.
So we should not call `setAttached` in the constructor.
Differential Revision: https://phabricator.services.mozilla.com/D246070
This allows re-using the comparison logic in operator== in contexts where
we are only working with the scroll offset and zoom, and not a Source.
Differential Revision: https://phabricator.services.mozilla.com/D245524
When the window is destroyed, Java object of GeckoViewSupport will be disposed.
So before using GeckoViewSupport, we should check whether the window is
destroyed.
Differential Revision: https://phabricator.services.mozilla.com/D243766
This makes it easier to extend the struct in the future.
Also rename some related APIs to have CompositorScrollUpdate in their
name for consistency.
(It would be nice to rename GeckoSession.ScrollPositionUpdate to
CompositorScrollUpdate as well, but that's public API.)
Differential Revision: https://phabricator.services.mozilla.com/D242835