You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ma...@apache.org on 2026/09/27 16:19:40 UTC
(cordova-android) 01/01: Adjust dispatched window insets for WebView margins
This is an automated email from the ASF dual-hosted git repository.
GitToTheHub pushed a commit to branch pr-adjust-dispatched-window-insets-for-webview-margins
in repository https://gitbox.apache.org/repos/asf/cordova-android.git
commit fe0222362cc4aff671f105d755fdb26af5eb3f43
Author: Manuel Beck <ma...@outlook.de>
AuthorDate: Sun Sep 27 18:19:26 2026 +0200
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..2191712a 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;
+ // Consume the portion of the insets already accounted for by the webview's margins so the
+ // webview (and its `env(safe-area-inset-*)` CSS values) don't also report insets for space it
+ // no longer overlaps. Any side left un-consumed (e.g. edge-to-edge or fullscreen) still reports
+ // its real inset since the webview genuinely extends beneath that system bar.
+ return insets.inset(left, top, right, bottom);
});
rootLayout.addView(webView);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org