Use doc element's scrollHeight as ClientWebView's preferred height

This seems to be a bit more accurate than the previous calculation.
Force the doc element's border to zero as well to make using
scrollHeight more reliable.
This commit is contained in:
Michael Gratton 2018-10-14 11:55:46 +11:00
parent 07c4133b11
commit 1e3fbdc69a
2 changed files with 2 additions and 11 deletions

View file

@ -71,17 +71,7 @@ PageState.prototype = {
}, false); // load does not bubble
},
getPreferredHeight: function() {
let html = window.document.documentElement;
let height = html.offsetHeight;
let computed = window.getComputedStyle(html);
let top = computed.getPropertyValue('margin-top');
let bot = computed.getPropertyValue('margin-bottom');
return (
height
+ parseInt(top.substring(0, top.length - 2))
+ parseInt(bot.substring(0, bot.length - 2))
);
return window.document.documentElement.scrollHeight;
},
loaded: function() {
this.isLoaded = true;

View file

@ -24,6 +24,7 @@ html {
expanding web view */
box-sizing: border-box !important;
margin: 0 !important;
border-width: 0 !important;
}
body {