ClientWebView: Use HTML element's height to determine preferred

Return the scroll height of the HTML element since the BODY
may have margin/border/padding and we want to know
precisely how high the widget needs to be to avoid
scrolling.
This commit is contained in:
Michael Gratton 2019-05-06 21:43:06 +10:00 committed by Michael James Gratton
parent 66fb96181c
commit c27d250032

View file

@ -90,7 +90,11 @@ PageState.prototype = {
}, false); // load does not bubble
},
getPreferredHeight: function() {
return window.document.body.scrollHeight;
// Return the scroll height of the HTML element since the BODY
// may have margin/border/padding and we want to know
// precisely how high the widget needs to be to avoid
// scrolling.
return window.document.documentElement.scrollHeight;
},
getHtml: function() {
return document.body.innerHTML;