Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(447)

Issue 2894503002: Fixes rounding error when calculating MOVE event (Closed)

Created:
3 years, 7 months ago by riq
Modified:
3 years, 6 months ago
CC:
chromium-reviews
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Fixes rounding error when calculating MOVE event In general, it is good practice to compare floats using an Epsilon. In particular, a mouse location_f() could differ between the MOUSE_PRESSED and MOUSE_RELEASED events. At MOUSE_RELEASED, it will have a targeter() already cached, while at MOUSE_PRESSED, it will have to calculate it passing through all windows, and that could generate rounding error. This patch fixes, that situation. It could be triggered when one of the window->layer()->bounds()'s origin is at a value bigger than 9000 BUG=723902 R=reveman@chromium.org Review-Url: https://codereview.chromium.org/2894503002 Cr-Commit-Position: refs/heads/master@{#474854} Committed: https://chromium.googlesource.com/chromium/src/+/0092647e4e34a209afc7f8715a9512c26a787457

Patch Set 1 #

Total comments: 2

Patch Set 2 : Fixes rounding error when calculating MOVE event #

Total comments: 1

Patch Set 3 : Fixes rounding error when calculating MOVE event #

Total comments: 1

Patch Set 4 : Fixes rounding error when calculating MOVE event #

Total comments: 2

Patch Set 5 : Fixes rounding error when calculating MOVE event #

Total comments: 1

Patch Set 6 : Fixes rounding error when calculating MOVE event #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+12 lines, -1 line) Patch
M components/exo/pointer.cc View 1 2 3 4 5 3 chunks +12 lines, -1 line 1 comment Download

Messages

Total messages: 29 (12 generated)
Luis Héctor Chávez
drive-by https://codereview.chromium.org/2894503002/diff/1/components/exo/pointer.cc File components/exo/pointer.cc (right): https://codereview.chromium.org/2894503002/diff/1/components/exo/pointer.cc#newcode51 components/exo/pointer.cc:51: static const float epsilon_scale = 0.0005f; nit: constants ...
3 years, 7 months ago (2017-05-17 23:57:11 UTC) #2
reveman
https://codereview.chromium.org/2894503002/diff/1/components/exo/pointer.cc File components/exo/pointer.cc (right): https://codereview.chromium.org/2894503002/diff/1/components/exo/pointer.cc#newcode51 components/exo/pointer.cc:51: static const float epsilon_scale = 0.0005f; On 2017/05/17 at ...
3 years, 7 months ago (2017-05-18 04:21:10 UTC) #9
Luis Héctor Chávez
one final nit https://codereview.chromium.org/2894503002/diff/20001/components/exo/pointer.cc File components/exo/pointer.cc (right): https://codereview.chromium.org/2894503002/diff/20001/components/exo/pointer.cc#newcode38 components/exo/pointer.cc:38: static const float kLocatedEventEpsilon = 1.0f ...
3 years, 7 months ago (2017-05-22 19:42:52 UTC) #10
riq
On 2017/05/22 19:42:52, Luis Héctor Chávez wrote: > one final nit > > https://codereview.chromium.org/2894503002/diff/20001/components/exo/pointer.cc > ...
3 years, 7 months ago (2017-05-22 19:52:09 UTC) #11
riq
> Yes, kLocatedEventEpsilon above is better. Also, maybe write this as 1.0f / > 2000.0f; ...
3 years, 7 months ago (2017-05-22 19:52:33 UTC) #12
riq
thanks, fixed all the suggested changes.
3 years, 7 months ago (2017-05-22 19:54:02 UTC) #13
reveman
https://codereview.chromium.org/2894503002/diff/40001/components/exo/pointer.cc File components/exo/pointer.cc (right): https://codereview.chromium.org/2894503002/diff/40001/components/exo/pointer.cc#newcode57 components/exo/pointer.cc:57: kLocatedEventEpsilon; how about: gfx::Vector2dF offset = event->location_f() - location; ...
3 years, 7 months ago (2017-05-22 20:12:28 UTC) #14
riq
thanks. using `vector.lenghtSquared()` as suggested.
3 years, 7 months ago (2017-05-24 00:35:29 UTC) #16
reveman
lgtm with nit https://codereview.chromium.org/2894503002/diff/60001/components/exo/pointer.cc File components/exo/pointer.cc (right): https://codereview.chromium.org/2894503002/diff/60001/components/exo/pointer.cc#newcode7 components/exo/pointer.cc:7: #include <utility> nit: what is this ...
3 years, 7 months ago (2017-05-24 13:14:01 UTC) #17
riq
thanks. fixed. using `KLocatedEventEpsilonSquared`. I'm still using the `2 *` in the calculation and not ...
3 years, 7 months ago (2017-05-24 16:59:55 UTC) #18
reveman
still lgtm https://codereview.chromium.org/2894503002/diff/100001/components/exo/pointer.cc File components/exo/pointer.cc (right): https://codereview.chromium.org/2894503002/diff/100001/components/exo/pointer.cc#newcode38 components/exo/pointer.cc:38: const double kLocatedEventEpsilonSquared = (1.0 / 2000.0) ...
3 years, 7 months ago (2017-05-25 11:12:01 UTC) #19
riq
thanks. I've just sent a final CL with the `(2000 * 2000)` suggestion. I'll commit ...
3 years, 6 months ago (2017-05-25 23:51:14 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2894503002/120001
3 years, 6 months ago (2017-05-25 23:53:00 UTC) #23
reveman
https://codereview.chromium.org/2894503002/diff/120001/components/exo/pointer.cc File components/exo/pointer.cc (right): https://codereview.chromium.org/2894503002/diff/120001/components/exo/pointer.cc#newcode7 components/exo/pointer.cc:7: #include <utility> why was this needed?
3 years, 6 months ago (2017-05-25 23:59:12 UTC) #24
riq
On 2017/05/25 23:59:12, reveman wrote: > https://codereview.chromium.org/2894503002/diff/120001/components/exo/pointer.cc > File components/exo/pointer.cc (right): > > https://codereview.chromium.org/2894503002/diff/120001/components/exo/pointer.cc#newcode7 > ...
3 years, 6 months ago (2017-05-26 00:27:38 UTC) #25
reveman
Ok, Thanks for explaining and fixing On May 25, 2017 8:27 PM, <ricardoq@chromium.org> wrote: > ...
3 years, 6 months ago (2017-05-26 00:34:19 UTC) #26
commit-bot: I haz the power
3 years, 6 months ago (2017-05-26 00:52:08 UTC) #29
Message was sent while issue was closed.
Committed patchset #6 (id:120001) as
https://chromium.googlesource.com/chromium/src/+/0092647e4e34a209afc7f8715a95...

Powered by Google App Engine
This is Rietveld 408576698