Merge branch 'wip/message-body-hight' into 'mainline'

Message body hight fixes

See merge request GNOME/geary!253
This commit is contained in:
Michael Gratton 2019-07-16 03:30:22 +00:00
commit 119846c6e6

View file

@ -71,9 +71,16 @@ PageState.prototype = {
}, true); // load does not bubble
// Queues an update if the window changes size, e.g. if the
// user resized the window
// user resized the window. Only trigger when the width has
// changed however since the height should only change as the
// body is being loaded.
let width = window.innerWidth;
window.addEventListener("resize", function(e) {
queuePreferredHeightUpdate();
let currentWidth = window.innerWidth;
if (width != currentWidth) {
width = currentWidth;
queuePreferredHeightUpdate();
}
}, false); // load does not bubble
// Queues an update when a transition has completed, e.g. if the
@ -83,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;