summaryrefslogtreecommitdiffstats
path: root/xproto-fix-underflow-in-Fp1616ToDouble.patch
diff options
context:
space:
mode:
Diffstat (limited to 'xproto-fix-underflow-in-Fp1616ToDouble.patch')
-rw-r--r--xproto-fix-underflow-in-Fp1616ToDouble.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/xproto-fix-underflow-in-Fp1616ToDouble.patch b/xproto-fix-underflow-in-Fp1616ToDouble.patch
new file mode 100644
index 0000000..8fcbd72
--- /dev/null
+++ b/xproto-fix-underflow-in-Fp1616ToDouble.patch
@@ -0,0 +1,37 @@
+From 5ade494a9966c7a9675af86dc42aca62fb4d806d Mon Sep 17 00:00:00 2001
+From: Tom Anderson <thomasanderson@chromium.org>
+Date: Wed, 21 Oct 2020 22:02:35 +0000
+Subject: [PATCH] [XProto] Fix underflow in Fp1616ToDouble
+
+x11::Input::Fp1616 should be treated as a signed integer, otherwise
+-1 will underflow to 65535. When dragging a scrollbar, this would
+cause the scrollbar to snap to the bottom when the cursor is dragged
+above the window's y=0 coordinate. Verified that the issue is fixed
+after this CL.
+
+BUG=1139623,1136352
+R=sky
+
+Change-Id: Ie318006ceadde9b9ce3e267fb453ddeba0e81da0
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2485620
+Auto-Submit: Thomas Anderson <thomasanderson@chromium.org>
+Commit-Queue: Scott Violet <sky@chromium.org>
+Reviewed-by: Scott Violet <sky@chromium.org>
+Cr-Commit-Position: refs/heads/master@{#819538}
+---
+ ui/events/x/events_x_utils.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/ui/events/x/events_x_utils.cc b/ui/events/x/events_x_utils.cc
+index 3010db5f40c..856dfb221e7 100644
+--- a/ui/events/x/events_x_utils.cc
++++ b/ui/events/x/events_x_utils.cc
+@@ -376,7 +376,7 @@ base::TimeTicks TimeTicksFromXEvent(const x11::Event& xev) {
+
+ // This is ported from libxi's FP1616toDBL in XExtInt.c
+ double Fp1616ToDouble(x11::Input::Fp1616 x) {
+- auto x32 = static_cast<uint32_t>(x);
++ auto x32 = static_cast<int32_t>(x);
+ return x32 * 1.0 / (1 << 16);
+ }
+