[Spice-devel] [spice-html5 2/3] Use document.documentElement.scrollXXX if document.body.scrollXXX is not present.

Jeremy White jwhite at codeweavers.com
Fri Apr 19 11:13:32 PDT 2013


Provides compatibility for IE10.

Signed-off-by: Jeremy White <jwhite at codeweavers.com>
---
 spicemsg.js |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/spicemsg.js b/spicemsg.js
index 31e54a0..365fdf7 100644
--- a/spicemsg.js
+++ b/spicemsg.js
@@ -639,8 +639,11 @@ function SpiceMsgcMousePosition(sc, e)
     this.buttons_state = sc.buttons_state;
     if (e)
     {
-        this.x = e.clientX - sc.display.surfaces[sc.display.primary_surface].canvas.offsetLeft + document.body.scrollLeft;
-        this.y = e.clientY - sc.display.surfaces[sc.display.primary_surface].canvas.offsetTop + document.body.scrollTop;
+        var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
+        var scrollLeft = document.body.scrollLeft || document.documentElement.scrollLeft;
+
+        this.x = e.clientX - sc.display.surfaces[sc.display.primary_surface].canvas.offsetLeft + scrollLeft;
+        this.y = e.clientY - sc.display.surfaces[sc.display.primary_surface].canvas.offsetTop + scrollTop;
         sc.mousex = this.x;
         sc.mousey = this.y; 
     }
-- 
1.7.10.4





More information about the Spice-devel mailing list