[geary] Ensure ClientWebView's preferred height is updated after doc load.



commit d6ed3e3877d797389bf2027d00012ced7e2bd085
Author: Michael James Gratton <mike vee net>
Date:   Wed Feb 8 00:28:46 2017 +1100

    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 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/ui/client-web-view.js b/ui/client-web-view.js
index 92192ca..b9aa3d6 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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]