Bug 127675

Summary: [EFL][WK2] Add a logic for checking multi touch in GestureRecognizer::noGesture
Product: WebKit Reporter: Sanghyup Lee <sh53.lee>
Component: WebKit EFLAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bunhere, cdumez, commit-queue, gyuyoung.kim, gyuyoung.kim, lucas.de.marchi
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch for landing
none
Patch none

Description Sanghyup Lee 2014-01-27 01:19:35 PST
If UIGestureRecognizer::Gesture called by touchStart event, it is always processed as single Tap Gesture. 
even though there are two or more touch points.
So we should add a logic for checking multi touch in GestureRecognizer::noGesture
Comment 1 Sanghyup Lee 2014-01-27 01:25:22 PST
Created attachment 222308 [details]
Patch
Comment 2 Sanghyup Lee 2014-01-27 01:37:13 PST
Created attachment 222310 [details]
Patch
Comment 3 Ryuan Choi 2014-01-27 02:14:05 PST
Comment on attachment 222310 [details]
Patch

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

Good point, but please consider my comments.

> Source/WebKit2/ChangeLog:8
> +        If UIGestureRecognizer::Gesture called by touchStart event, it is always

UIGestureRecognizer? Is it mistake?

> Source/WebKit2/ChangeLog:9
> +        processed as single Tap Gesture. even though there are two or more touch 

single *t*ap *g*esture

> Source/WebKit2/UIProcess/API/efl/GestureRecognizer.cpp:359
> +        {

Interesting, style bot does not complain this.

But, I think that below is correct.
case kWKEventTypeTouchStart: {
   ...
}

> Source/WebKit2/UIProcess/API/efl/GestureRecognizer.cpp:369
> +            WKArrayRef touchPoints = WKTouchEventGetTouchPoints(eventRef);
> +            size_t numberOfTouchPoints = WKArrayGetSize(touchPoints);
> +
> +            switch (numberOfTouchPoints) {
> +            case 1:
> +                break;
> +            case 2:
> +                m_recognizerFunction = &GestureRecognizer::pinchGesture;
> +                m_gestureHandler->handlePinchStarted(createVectorWithWKArray(touchPoints, 2));
> +                return;

How about 3 points? Is it fine?

And, can you just check numberOfTouchPoints?
if (WKArrayGetSize(WKTouchEventGetTouchPoints(eventRef)) > 1) ?

> Source/WebKit2/UIProcess/API/efl/GestureRecognizer.cpp:375
> +            }
> +        }
>          m_gestureHandler->reset();
>  

Please include whole kWKEventTypeTouchStart case into the block.
Comment 4 Sanghyup Lee 2014-01-27 02:31:50 PST
Created attachment 222315 [details]
Patch
Comment 5 Jinwoo Song 2014-01-27 02:42:01 PST
Comment on attachment 222315 [details]
Patch

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

> Source/WebKit2/ChangeLog:3
> +        [EFL] Add a logic for checking multi touch in GestureRecognizer::noGesture

Add [WK2] keyword in the title.

> Source/WebKit2/ChangeLog:8
> +        If GestureRecognizer::noGesture called by touchStart event, it is always

It seems that you can improve the description more clearly. 
When processing TouchStart event in GestureRecognizer::noGesture(), we should check the number of touch points
to distinguish if the gesture is single tap or pinch zoom. Current logic only considers the event as single tap.
Comment 6 Sanghyup Lee 2014-01-27 02:55:57 PST
Created attachment 222316 [details]
Patch
Comment 7 Sanghyup Lee 2014-01-27 03:05:40 PST
Comment on attachment 222310 [details]
Patch

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

>> Source/WebKit2/ChangeLog:8
>> +        If UIGestureRecognizer::Gesture called by touchStart event, it is always
> 
> UIGestureRecognizer? Is it mistake?

Yes. it is my mistake. I fixed.

>> Source/WebKit2/ChangeLog:9
>> +        processed as single Tap Gesture. even though there are two or more touch 
> 
> single *t*ap *g*esture

ditto

>> Source/WebKit2/UIProcess/API/efl/GestureRecognizer.cpp:369
>> +                return;
> 
> How about 3 points? Is it fine?
> 
> And, can you just check numberOfTouchPoints?
> if (WKArrayGetSize(WKTouchEventGetTouchPoints(eventRef)) > 1) ?

I think we have to check three case. one point, two points, more than two points.
In three or more points case, There are no proper gesture. So nothing to do.
Comment 8 Sanghyup Lee 2014-01-27 03:06:43 PST
Comment on attachment 222315 [details]
Patch

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

>> Source/WebKit2/ChangeLog:3
>> +        [EFL] Add a logic for checking multi touch in GestureRecognizer::noGesture
> 
> Add [WK2] keyword in the title.

Thanks, I fixed.

>> Source/WebKit2/ChangeLog:8
>> +        If GestureRecognizer::noGesture called by touchStart event, it is always
> 
> It seems that you can improve the description more clearly. 
> When processing TouchStart event in GestureRecognizer::noGesture(), we should check the number of touch points
> to distinguish if the gesture is single tap or pinch zoom. Current logic only considers the event as single tap.

ditto
Comment 9 Eunmi Lee 2014-01-27 16:22:51 PST
Comment on attachment 222316 [details]
Patch

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

> Source/WebKit2/UIProcess/API/efl/GestureRecognizer.cpp:359
> +        switch (WKArrayGetSize(WKTouchEventGetTouchPoints(eventRef))) {

You can make WKTouchEventGetTouchPoints() as a variable because it is used multiple times.

> Source/WebKit2/UIProcess/API/efl/GestureRecognizer.cpp:361
> +            break;

I think it is better to move codes for case 1 here, instead of "break" for readability.
Comment 10 Sanghyup Lee 2014-01-27 17:10:50 PST
Created attachment 222383 [details]
Patch
Comment 11 Sanghyup Lee 2014-01-27 17:12:39 PST
Comment on attachment 222316 [details]
Patch

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

>> Source/WebKit2/UIProcess/API/efl/GestureRecognizer.cpp:359
>> +        switch (WKArrayGetSize(WKTouchEventGetTouchPoints(eventRef))) {
> 
> You can make WKTouchEventGetTouchPoints() as a variable because it is used multiple times.

Ok, I fixed. thanks

>> Source/WebKit2/UIProcess/API/efl/GestureRecognizer.cpp:361
>> +            break;
> 
> I think it is better to move codes for case 1 here, instead of "break" for readability.

ditto
Comment 12 Gyuyoung Kim 2014-01-27 17:46:03 PST
Comment on attachment 222383 [details]
Patch

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

> Source/WebKit2/UIProcess/API/efl/GestureRecognizer.cpp:360
> +

Looks unneeded line.

> Source/WebKit2/UIProcess/API/efl/GestureRecognizer.cpp:364
> +

ditto.

> Source/WebKit2/UIProcess/API/efl/GestureRecognizer.cpp:374
> +            return;

Why do you use "return" instead of using "break" ?

> Source/WebKit2/UIProcess/API/efl/GestureRecognizer.cpp:375
> +        default:

Please add ASSERT_NOT_REACHED() to here.
Comment 13 Sanghyup Lee 2014-01-27 17:54:08 PST
Comment on attachment 222383 [details]
Patch

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

>> Source/WebKit2/UIProcess/API/efl/GestureRecognizer.cpp:360
>> +
> 
> Looks unneeded line.

Ok. I'll remove this line.

>> Source/WebKit2/UIProcess/API/efl/GestureRecognizer.cpp:374
>> +            return;
> 
> Why do you use "return" instead of using "break" ?

I'll change "return" to "break". thanks.
Comment 14 Sanghyup Lee 2014-01-27 17:55:14 PST
Created attachment 222391 [details]
Patch
Comment 15 Gyuyoung Kim 2014-01-27 18:16:34 PST
Comment on attachment 222391 [details]
Patch

LGTM, however, it would be good to get a final review from Eunmi.
Comment 16 Sanghyup Lee 2014-01-27 21:03:10 PST
Comment on attachment 222383 [details]
Patch

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

>>> Source/WebKit2/UIProcess/API/efl/GestureRecognizer.cpp:360
>>> +
>> 
>> Looks unneeded line.
> 
> Ok. I'll remove this line.

Ok. I'll remove this line.

>>> Source/WebKit2/UIProcess/API/efl/GestureRecognizer.cpp:374
>>> +            return;
>> 
>> Why do you use "return" instead of using "break" ?
> 
> I'll change "return" to "break". thanks.

I'll change "return" to "break". thanks.

>> Source/WebKit2/UIProcess/API/efl/GestureRecognizer.cpp:375
>> +        default:
> 
> Please add ASSERT_NOT_REACHED() to here.

I think we have to remove ASSERT_NOT_REACHED().
Because it is possible that when noGesture() called, there are 3 touch points.
Comment 17 Gyuyoung Kim 2014-01-27 21:06:44 PST
(In reply to comment #16)
> I think we have to remove ASSERT_NOT_REACHED().
> Because it is possible that when noGesture() called, there are 3 touch points.

If we need to handle 3 touch points as well, I prefer to add "case 3:". Then, you may add a notImplemented() or similar thing.
Comment 18 Sanghyup Lee 2014-01-27 21:24:18 PST
(In reply to comment #17)
> (In reply to comment #16)
> > I think we have to remove ASSERT_NOT_REACHED().
> > Because it is possible that when noGesture() called, there are 3 touch points.
> 
> If we need to handle 3 touch points as well, I prefer to add "case 3:". Then, you may add a notImplemented() or similar thing.

But four or more touch point also possible. 
So how about add a notImplemented() in "default:" case?
I think "default:" can cover 3 or more touch point case.
Comment 19 Gyuyoung Kim 2014-01-27 22:19:16 PST
(In reply to comment #18)
> (In reply to comment #17)
> > (In reply to comment #16)
> > > I think we have to remove ASSERT_NOT_REACHED().
> > > Because it is possible that when noGesture() called, there are 3 touch points.
> > 
> > If we need to handle 3 touch points as well, I prefer to add "case 3:". Then, you may add a notImplemented() or similar thing.
> 
> But four or more touch point also possible. 
> So how about add a notImplemented() in "default:" case?
> I think "default:" can cover 3 or more touch point case.

I see. If so, it would be good to add a comment as well for it.
Comment 20 Sanghyup Lee 2014-01-27 22:34:43 PST
Created attachment 222404 [details]
Patch for landing
Comment 21 Sanghyup Lee 2014-02-02 18:31:12 PST
Created attachment 222951 [details]
Patch
Comment 22 WebKit Commit Bot 2014-02-02 20:49:40 PST
Comment on attachment 222951 [details]
Patch

Clearing flags on attachment: 222951

Committed r163284: <http://trac.webkit.org/changeset/163284>
Comment 23 WebKit Commit Bot 2014-02-02 20:49:44 PST
All reviewed patches have been landed.  Closing bug.