Bug 83135 - [Qt] Improve the tap gesture recognizer
Summary: [Qt] Improve the tap gesture recognizer
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kenneth Rohde Christiansen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-04 03:17 PDT by Kenneth Rohde Christiansen
Modified: 2012-04-04 04:00 PDT (History)
5 users (show)

See Also:


Attachments
Patch (9.69 KB, patch)
2012-04-04 03:19 PDT, Kenneth Rohde Christiansen
hausmann: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kenneth Rohde Christiansen 2012-04-04 03:17:13 PDT
The current code is messy and it emits single taps in cases where it shouldn't
Comment 1 Kenneth Rohde Christiansen 2012-04-04 03:19:06 PDT
Created attachment 135547 [details]
Patch
Comment 2 Simon Hausmann 2012-04-04 03:29:33 PDT
Comment on attachment 135547 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=135547&action=review

r=me

We really need unit tests for this state machine though :(

> Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.cpp:71
> +            if (!withinDistance(touchPoint, maxDoubleTapDistance)) {
> +                reset(); // Received a new tap, that is unrelated to the previous one. Ignore previous.
>                  m_tapState = SingleTapStarted;
> -            }
> -        } else
> -            m_tapState = SingleTapStarted;
> -        m_touchBeginEventForTap = adoptPtr(new QTouchEvent(*event));
> +            } else
> +                m_tapState = DoubleTapCandidate;

I kind of like logic the "positive" way, i.e.

if (withinDistance(touchPoint, ...)
    m_tapState = DoubleTapCandidate;
} else {
    reset();
    m_tapState = SingleTapStarted;
}

But that's also a kind of nitpick which you can freely ignore if you want :)
Comment 3 Kenneth Rohde Christiansen 2012-04-04 04:00:55 PDT
Landed in 113165