summaryrefslogtreecommitdiffstats
path: root/mobile/android/actors
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /mobile/android/actors
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mobile/android/actors')
-rw-r--r--mobile/android/actors/GeckoViewContentChild.sys.mjs85
1 files changed, 37 insertions, 48 deletions
diff --git a/mobile/android/actors/GeckoViewContentChild.sys.mjs b/mobile/android/actors/GeckoViewContentChild.sys.mjs
index 97691c97fd..50d799e131 100644
--- a/mobile/android/actors/GeckoViewContentChild.sys.mjs
+++ b/mobile/android/actors/GeckoViewContentChild.sys.mjs
@@ -23,7 +23,6 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
PrivacyFilter: "resource://gre/modules/sessionstore/PrivacyFilter.sys.mjs",
SessionHistory: "resource://gre/modules/sessionstore/SessionHistory.sys.mjs",
- Utils: "resource://gre/modules/sessionstore/Utils.sys.mjs",
});
export class GeckoViewContentChild extends GeckoViewActorChild {
@@ -154,36 +153,7 @@ export class GeckoViewContentChild extends GeckoViewActorChild {
}, "apz-repaints-flushed");
};
- const { force } = message.data;
-
- let gotResize = false;
- const onResize = function () {
- gotResize = true;
- if (dwu.isMozAfterPaintPending) {
- contentWindow.windowRoot.addEventListener(
- "MozAfterPaint",
- () => zoomToFocusedInput(),
- { capture: true, once: true }
- );
- } else {
- zoomToFocusedInput();
- }
- };
-
- contentWindow.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.
- contentWindow.setTimeout(() => {
- contentWindow.removeEventListener("resize", onResize, {
- capture: true,
- });
- if (!gotResize && force) {
- onResize();
- }
- }, 500);
+ zoomToFocusedInput();
break;
}
case "RestoreSessionState": {
@@ -271,29 +241,48 @@ export class GeckoViewContentChild extends GeckoViewActorChild {
const { contentWindow } = this;
const { formdata, scrolldata } = message.data;
- if (formdata) {
- lazy.Utils.restoreFrameTreeData(
- contentWindow,
- formdata,
- (frame, data) => {
- // restore() will return false, and thus abort restoration for the
- // current |frame| and its descendants, if |data.url| is given but
- // doesn't match the loaded document's URL.
- return SessionStoreUtils.restoreFormData(frame.document, data);
+ /**
+ * Restores frame tree |data|, starting at the given root |frame|. As the
+ * function recurses into descendant frames it will call cb(frame, data) for
+ * each frame it encounters, starting with the given root.
+ */
+ function restoreFrameTreeData(frame, data, cb) {
+ // Restore data for the root frame.
+ // The callback can abort by returning false.
+ if (cb(frame, data) === false) {
+ return;
+ }
+
+ if (!data.hasOwnProperty("children")) {
+ return;
+ }
+
+ // Recurse into child frames.
+ SessionStoreUtils.forEachNonDynamicChildFrame(
+ frame,
+ (subframe, index) => {
+ if (data.children[index]) {
+ restoreFrameTreeData(subframe, data.children[index], cb);
+ }
}
);
}
+ if (formdata) {
+ restoreFrameTreeData(contentWindow, formdata, (frame, data) => {
+ // restore() will return false, and thus abort restoration for the
+ // current |frame| and its descendants, if |data.url| is given but
+ // doesn't match the loaded document's URL.
+ return SessionStoreUtils.restoreFormData(frame.document, data);
+ });
+ }
+
if (scrolldata) {
- lazy.Utils.restoreFrameTreeData(
- contentWindow,
- scrolldata,
- (frame, data) => {
- if (data.scroll) {
- SessionStoreUtils.restoreScrollPosition(frame, data);
- }
+ restoreFrameTreeData(contentWindow, scrolldata, (frame, data) => {
+ if (data.scroll) {
+ SessionStoreUtils.restoreScrollPosition(frame, data);
}
- );
+ });
}
if (scrolldata && scrolldata.zoom && scrolldata.zoom.displaySize) {