cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [1/3] cordova-plugin-inappbrowser git commit: CB-8432 Correct styles for browser wrapper to display it correctly on some pages
Date Tue, 31 Mar 2015 17:58:16 GMT
Repository: cordova-plugin-inappbrowser
Updated Branches:
  refs/heads/old-ID ed1227f61 -> 805d43d61


CB-8432 Correct styles for browser wrapper to display it correctly on some pages

* Force z-order for wrapper to show it on top of the whole page
* Apply CSS reset rules to browser wrapper
* Disable parent window scrollbars when browser is shown


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/commit/57f94267
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/tree/57f94267
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/diff/57f94267

Branch: refs/heads/old-ID
Commit: 57f942670c84412b61bc05dd67c5b505edb4b67d
Parents: ed1227f
Author: Vladimir Kotikov <v-vlkoti@microsoft.com>
Authored: Thu Feb 5 17:14:41 2015 +0300
Committer: Vladimir Kotikov <v-vlkoti@microsoft.com>
Committed: Tue Mar 17 14:18:04 2015 +0300

----------------------------------------------------------------------
 src/windows/InAppBrowserProxy.js | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser/blob/57f94267/src/windows/InAppBrowserProxy.js
----------------------------------------------------------------------
diff --git a/src/windows/InAppBrowserProxy.js b/src/windows/InAppBrowserProxy.js
index 07fa79e..da5eb82 100644
--- a/src/windows/InAppBrowserProxy.js
+++ b/src/windows/InAppBrowserProxy.js
@@ -110,20 +110,30 @@ var IAB = {
             // "_blank" or anything else
             if (!browserWrap) {
                 browserWrap = document.createElement("div");
-                browserWrap.style.position = "absolute";
-                browserWrap.style.borderWidth = "40px";
-                browserWrap.style.width = "calc(100% - 80px)";
-                browserWrap.style.height = "calc(100% - 80px)";
-                browserWrap.style.borderStyle = "solid";
-                browserWrap.style.borderColor = "rgba(0,0,0,0.25)";
+                // First reset all styles for inappbrowser wrapper element
+                browserWrap.style.cssText = "margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:
0 0;";
+                browserWrap.style.position = "fixed";
+                browserWrap.style.top = "0px";
+                browserWrap.style.left = "0px";
+                browserWrap.style.width = "100%";
+                browserWrap.style.height = "100%";
+                browserWrap.style.zIndex = 9999;
+                browserWrap.style.border = "40px solid rgba(0,0,0,0.25)";
+
+                // Save body overflow style to be able to reset it back later
+                var bodyOverflow = document.body.style.msOverflowStyle;
 
                 browserWrap.onclick = function () {
                     setTimeout(function () {
+                        // Reset body overflow style to initial value
+                        document.body.style.msOverflowStyle = bodyOverflow;
                         IAB.close(win);
                     }, 0);
                 };
 
                 document.body.appendChild(browserWrap);
+                // Hide scrollbars for the whole body while inappbrowser's window is open
+                document.body.style.msOverflowStyle = "none";
             }
 
             if (features.indexOf("hidden=yes") !== -1) {
@@ -131,6 +141,11 @@ var IAB = {
             }
 
             popup = document.createElement(isWebViewAvailable ? "x-ms-webview" : "iframe");
+            if (popup instanceof HTMLIFrameElement) {
+                // For iframe we need to override bacground color of parent element here
+                // otherwise pages without background color set will have transparent background
+                popup.style.backgroundColor = "white";
+            }
             popup.style.borderWidth = "0px";
             popup.style.width = "100%";
 
@@ -257,4 +272,4 @@ var IAB = {
 
 module.exports = IAB;
 
-require("cordova/exec/proxy").add("InAppBrowser", module.exports);
\ No newline at end of file
+require("cordova/exec/proxy").add("InAppBrowser", module.exports);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message