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



commit 5ded2876da6976764312e401f773e19d7abe17ee
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.

 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]