[geary/wip/message-quoting: 2/3] ClientWebView: Don't update preferred height on height change



commit 38053ea2a21f5f941011c9919f7a9a7f980620eb
Author: Michael Gratton <mike vee net>
Date:   Mon May 6 20:39:17 2019 +1000

    ClientWebView: Don't update preferred height on height change
    
    Only send an updated height change when the width has changed on
    receiving a JavaScript resize event to avoid getting into a feedback
    loop, as was happening with email from Mastodon instances.

 ui/client-web-view.js | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/ui/client-web-view.js b/ui/client-web-view.js
index b4f57ad4..8f71594f 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


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