From d6ed3e3877d797389bf2027d00012ced7e2bd085 Mon Sep 17 00:00:00 2001 From: Michael James Gratton Date: Wed, 8 Feb 2017 00:28:46 +1100 Subject: [PATCH] Ensure ClientWebView's preferred height is updated after doc load. Should help/fix Bug 778025. * ui/client-web-view.js (PageView::init): Also add a load handler to the window, to (strangely) catch the final load event on the document. Expand and correct comments a bit. --- ui/client-web-view.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/ui/client-web-view.js b/ui/client-web-view.js index 92192ca3..b9aa3d6c 100644 --- a/ui/client-web-view.js +++ b/ui/client-web-view.js @@ -40,17 +40,23 @@ PageState.prototype = { state.loaded(); queuePreferredHeightUpdate(); }); - // Queues updates for not only the complete document, but also - // for any IMG elements loaded, hence handles resizing when - // the user later requests remote images loading. + + // Queues an update when the complete document is loaded. // - // Note also that the delay introduced here by the last call + // Note also that the delay introduced here by this last call // to queuePreferredHeightUpdate when the complete document is // loaded seems to be important to get an acurate idea of the // final document size. + window.addEventListener("load", function(e) { + queuePreferredHeightUpdate(); + }, true); // load does not bubble + + // Queues updates for any STYLE, IMG and other loaded + // elements, hence handles resizing when the user later + // requests remote images loading. document.addEventListener("load", function(e) { queuePreferredHeightUpdate(); - }, true); + }, true); // load does not bubble }, getPreferredHeight: function() { let html = window.document.documentElement;