diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
commit | def92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch) | |
tree | 2ef34b9ad8bb9a9220e05d60352558b15f513894 /mobile/android/modules/geckoview/GeckoViewContent.sys.mjs | |
parent | Adding debian version 125.0.3-1. (diff) | |
download | firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mobile/android/modules/geckoview/GeckoViewContent.sys.mjs')
-rw-r--r-- | mobile/android/modules/geckoview/GeckoViewContent.sys.mjs | 48 |
1 files changed, 41 insertions, 7 deletions
diff --git a/mobile/android/modules/geckoview/GeckoViewContent.sys.mjs b/mobile/android/modules/geckoview/GeckoViewContent.sys.mjs index 240aea0cbe..35ffb76d90 100644 --- a/mobile/android/modules/geckoview/GeckoViewContent.sys.mjs +++ b/mobile/android/modules/geckoview/GeckoViewContent.sys.mjs @@ -193,14 +193,48 @@ export class GeckoViewContent extends GeckoViewModule { } break; } - case "GeckoView:ZoomToInput": - // For ZoomToInput we just need to send the message to the current focused one. - const actor = - Services.focus.focusedContentBrowsingContext.currentWindowGlobal.getActor( - "GeckoViewContent" - ); - actor.sendAsyncMessage(aEvent, aData); + case "GeckoView:ZoomToInput": { + const sendZoomToFocusedInputMessage = function () { + // For ZoomToInput we just need to send the message to the current focused one. + const actor = + Services.focus.focusedContentBrowsingContext.currentWindowGlobal.getActor( + "GeckoViewContent" + ); + + actor.sendAsyncMessage(aEvent, aData); + }; + + const { force } = aData; + let gotResize = false; + const onResize = function () { + gotResize = true; + if (this.window.windowUtils.isMozAfterPaintPending) { + this.window.addEventListener( + "MozAfterPaint", + () => sendZoomToFocusedInputMessage(), + { capture: true, once: true } + ); + } else { + sendZoomToFocusedInputMessage(); + } + }; + + this.window.addEventListener("resize", onResize, { capture: true }); + + // When the keyboard is displayed, we can get one resize event, + // multiple resize events, or none at all. Try to handle all these + // cases by allowing resizing within a set interval, and still zoom to + // input if there is no resize event at the end of the interval. + this.window.setTimeout(() => { + this.window.removeEventListener("resize", onResize, { + capture: true, + }); + if (!gotResize && force) { + onResize(); + } + }, 500); break; + } case "GeckoView:ScrollBy": // Unclear if that actually works with oop iframes? this.sendToAllChildren(aEvent, aData); |