Calculate ClientWebView to include HTML element margins.

* ui/client-web-view.js (PageState::getPreferredHeight): Compute and use
  top and bottom when determining the height value.

* ui/conversation-web-view.css: Remove onerous style defaults now we
  can deal with HTML elements with margins.
This commit is contained in:
Michael James Gratton 2017-01-27 02:09:23 +11:00
parent 9e171d0db1
commit 5ff2d9b908
2 changed files with 16 additions and 25 deletions

View file

@ -53,7 +53,17 @@ PageState.prototype = {
}, true);
},
getPreferredHeight: function() {
return window.document.documentElement.offsetHeight;
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))
);
},
loaded: function() {
this.isLoaded = true;