[gnome-shell/wip/carlosg/magnifier-improvements: 4/11] magnifier: Sanity check coordinates in scrollContentsTo



commit 1a04f406b01c68f345ad0465a1cd668163c71724
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Feb 6 10:52:24 2020 +0100

    magnifier: Sanity check coordinates in scrollContentsTo
    
    We may receive a11y events with bogus coordinates (eg. x/y = minint),
    so ensure the coordinates are sane before scrolling there.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/984

 js/ui/magnifier.js | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js
index 7250ce530b..4978196409 100644
--- a/js/ui/magnifier.js
+++ b/js/ui/magnifier.js
@@ -1168,6 +1168,10 @@ var ZoomRegion = class ZoomRegion {
      * @param {number} y: The y-coord of the point to center on.
      */
     scrollContentsTo(x, y) {
+        if (x < 0 || x > global.screen_width ||
+            y < 0 || y > global.screen_height)
+            return;
+
         this._clearScrollContentsTimer();
 
         this._followingCursor = false;


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