From 5ade494a9966c7a9675af86dc42aca62fb4d806d Mon Sep 17 00:00:00 2001 From: Tom Anderson 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 Commit-Queue: Scott Violet Reviewed-by: Scott Violet 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(x); + auto x32 = static_cast(x); return x32 * 1.0 / (1 << 16); }