Bug 98110 - [chromium] Make sure the touch-points in the touch-events have the correct state.
Summary: [chromium] Make sure the touch-points in the touch-events have the correct st...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sadrul Habib Chowdhury
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-01 21:27 PDT by Sadrul Habib Chowdhury
Modified: 2012-10-02 12:35 PDT (History)
3 users (show)

See Also:


Attachments
Patch (11.63 KB, patch)
2012-10-01 21:32 PDT, Sadrul Habib Chowdhury
no flags Details | Formatted Diff | Diff
Patch (12.43 KB, patch)
2012-10-02 00:03 PDT, Sadrul Habib Chowdhury
no flags Details | Formatted Diff | Diff
Patch (12.44 KB, patch)
2012-10-02 09:55 PDT, Sadrul Habib Chowdhury
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sadrul Habib Chowdhury 2012-10-01 21:27:43 PDT
[chromium] Make sure the touch-points in the touch-events have the correct state.
Comment 1 Sadrul Habib Chowdhury 2012-10-01 21:32:41 PDT
Created attachment 166600 [details]
Patch
Comment 2 Adam Barth 2012-10-01 23:04:05 PDT
Comment on attachment 166600 [details]
Patch

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

> Source/WebKit/chromium/src/WebInputEventConversion.cpp:339
> +static inline WebTouchPoint::State toWebTouchPointState(const AtomicString& type)

static and inline are redundant.

> Tools/DumpRenderTree/chromium/TestWebPlugin.cpp:94
> +    switch (state) {
> +    case WebKit::WebTouchPoint::StateReleased:   return stateReleased.data();
> +    case WebKit::WebTouchPoint::StatePressed:    return statePressed.data();
> +    case WebKit::WebTouchPoint::StateMoved:      return stateMoved.data();
> +    case WebKit::WebTouchPoint::StateCancelled:  return stateCancelled.data();
> +    default:                                     break;
> +    }

This switch statement is not in the proper style.

Why are you creating these CStrings?  You can just return pointers to the string literals.

> Tools/DumpRenderTree/chromium/TestWebPlugin.cpp:108
> +        const WebKit::WebTouchEvent& touch = reinterpret_cast<const WebKit::WebTouchEvent&>(event);

reinterpret_cast -> static_cast

Please read up on the differences between these two kinds of C++ casts, especially as they related to multi-inheritance.  Using the wrong cast can result is subtle, dangerous bugs!
Comment 3 Sadrul Habib Chowdhury 2012-10-02 00:02:47 PDT
Comment on attachment 166600 [details]
Patch

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

>> Source/WebKit/chromium/src/WebInputEventConversion.cpp:339
>> +static inline WebTouchPoint::State toWebTouchPointState(const AtomicString& type)
> 
> static and inline are redundant.

Fixed (also fixed the other cases of the same issue in this file).

>> Tools/DumpRenderTree/chromium/TestWebPlugin.cpp:94
>> +    }
> 
> This switch statement is not in the proper style.
> 
> Why are you creating these CStrings?  You can just return pointers to the string literals.

Fixed.

>> Tools/DumpRenderTree/chromium/TestWebPlugin.cpp:108
>> +        const WebKit::WebTouchEvent& touch = reinterpret_cast<const WebKit::WebTouchEvent&>(event);
> 
> reinterpret_cast -> static_cast
> 
> Please read up on the differences between these two kinds of C++ casts, especially as they related to multi-inheritance.  Using the wrong cast can result is subtle, dangerous bugs!

Whoops. My bad. Fixed. Thanks!
Comment 4 Sadrul Habib Chowdhury 2012-10-02 00:03:00 PDT
Created attachment 166622 [details]
Patch
Comment 5 Adam Barth 2012-10-02 09:46:29 PDT
Comment on attachment 166622 [details]
Patch

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

> Tools/DumpRenderTree/chromium/TestWebPlugin.cpp:80
> +const char* pointState(WebKit::WebTouchPoint::State state)

This function should probably be static

> Tools/DumpRenderTree/chromium/TestWebPlugin.cpp:99
> +void printTouchList(const WebKit::WebTouchPoint* points, int length)

ditto

> Tools/DumpRenderTree/chromium/TestWebPlugin.cpp:105
> +void printEventDetails(const WebKit::WebInputEvent& event)

ditto
Comment 6 Sadrul Habib Chowdhury 2012-10-02 09:55:46 PDT
Created attachment 166703 [details]
Patch
Comment 7 Sadrul Habib Chowdhury 2012-10-02 09:56:31 PDT
Comment on attachment 166622 [details]
Patch

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

>> Tools/DumpRenderTree/chromium/TestWebPlugin.cpp:80
>> +const char* pointState(WebKit::WebTouchPoint::State state)
> 
> This function should probably be static

My bad. Fixed all cases.
Comment 8 Adam Barth 2012-10-02 12:16:43 PDT
Comment on attachment 166703 [details]
Patch

Thanks!
Comment 9 WebKit Review Bot 2012-10-02 12:35:12 PDT
Comment on attachment 166703 [details]
Patch

Clearing flags on attachment: 166703

Committed r130197: <http://trac.webkit.org/changeset/130197>
Comment 10 WebKit Review Bot 2012-10-02 12:35:16 PDT
All reviewed patches have been landed.  Closing bug.