[Spice-devel] [spice-html5][PATCH 10/12] resize_helper, no message box case

Cédric Bosdonnat cbosdonnat at suse.com
Mon Feb 11 17:48:03 UTC 2019


The resize_handler need to check for the existence of the message box
before computing it's size.
---
 src/resize.js | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/resize.js b/src/resize.js
index 32282fd..c8d87d9 100644
--- a/src/resize.js
+++ b/src/resize.js
@@ -42,16 +42,19 @@ function resize_helper(sc)
     var h = window.innerHeight - 20;
 
     /* Screen height based on debug console visibility  */
-    if (window.getComputedStyle(m).getPropertyValue("display") == 'none')
+    if (m != null)
     {
-        /* Get console height from spice.css .spice-message */
-        var mh = parseInt(window.getComputedStyle(m).getPropertyValue("height"), 10);
-        h = h - mh;
-    }
-    else
-    {
-        /* Show both div elements - spice-area and message-div */
-        h = h - m.offsetHeight - m.clientHeight;
+        if (window.getComputedStyle(m).getPropertyValue("display") == 'none')
+        {
+            /* Get console height from spice.css .spice-message */
+            var mh = parseInt(window.getComputedStyle(m).getPropertyValue("height"), 10);
+            h = h - mh;
+        }
+        else
+        {
+            /* Show both div elements - spice-area and message-div */
+            h = h - m.offsetHeight - m.clientHeight;
+        }
     }
 
 
-- 
2.19.2



More information about the Spice-devel mailing list