[geary/cherry-pick-119846c6] Merge branch 'wip/message-body-hight' into 'mainline'



commit 4f8c8bed9e4243b857dcfefefc657a632aa48ceb
Author: Michael Gratton <mike vee net>
Date:   Tue Jul 16 03:30:22 2019 +0000

    Merge branch 'wip/message-body-hight' into 'mainline'
    
    Message body hight fixes
    
    See merge request GNOME/geary!253
    
    (cherry picked from commit 119846c6e645fd84b80809e31d71a3d253546c98)
    
    66fb9618 ClientWebView: Don't update preferred height on height change
    c27d2500 ClientWebView: Use HTML element's height to determine preferred

 ui/client-web-view.js | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/ui/client-web-view.js b/ui/client-web-view.js
index 0d8a10de..a56de11c 100644
--- a/ui/client-web-view.js
+++ b/ui/client-web-view.js
@@ -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;


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