This is an automated email from the ASF dual-hosted git repository.
GitToTheHub pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-android.git
The following commit(s) were added to refs/heads/master by this push:
new 52e41820 fix(CordovaActivity): adjust dispatched window insets for
WebView margins (#2022)
52e41820 is described below
commit 52e418202a012496e8527d3b55248fbd54eb1726
Author: Manuel Beck <[email protected]>
AuthorDate: Tue Oct 27 19:04:56 2026 +0100
fix(CordovaActivity): adjust dispatched window insets for WebView margins
(#2022)
* Adjust dispatched window insets for WebView margins
- Cordova moved the WebView away from system bars using margins, but the
WebView could still receive those same insets. Pages using
env(safe-area-inset-*) could then apply extra spacing for areas the WebView no
longer overlapped.
- `CordovaActivity` applies system-bar, display-cutout, and IME insets to
the WebView’s margins and sizes the status-bar overlay. It then now dispatches
adjusted insets to child views, subtracting the margin offsets already applied
so those same offsets aren’t reported again to the WebView. Insets for areas
where the WebView still draws edge-to-edge remain available to it.
- Fixes `safe-area-inset-*` vars not 0 when `AndroidEdgeToEdge` is `false`
- Fixes #2021
- Generated-By: GPT-6 Luna
---
framework/src/org/apache/cordova/CordovaActivity.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/framework/src/org/apache/cordova/CordovaActivity.java
b/framework/src/org/apache/cordova/CordovaActivity.java
index b196f225..f186da0e 100755
--- a/framework/src/org/apache/cordova/CordovaActivity.java
+++ b/framework/src/org/apache/cordova/CordovaActivity.java
@@ -258,7 +258,11 @@ public class CordovaActivity extends AppCompatActivity {
);
statusBarView.setLayoutParams(statusBarParams);
- return insets;
+ // Subtract the margins already applied to the WebView from every
inset type before dispatch.
+ // This prevents CSS env(safe-area-inset-*) from reporting space
excluded by those margins.
+ // It also reduces IME insets by the bottom margin used to
accommodate the keyboard.
+ // Any inset portion beyond the applied margins remains available
to child views.
+ return insets.inset(left, top, right, bottom);
});
rootLayout.addView(webView);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]