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:
parent
07c4133b11
commit
1e3fbdc69a
2 changed files with 2 additions and 11 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ html {
|
|||
expanding web view */
|
||||
box-sizing: border-box !important;
|
||||
margin: 0 !important;
|
||||
border-width: 0 !important;
|
||||
}
|
||||
|
||||
body {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue