Bug 103092 - [chromium] Allow plugins to opt-in to receive synthetic mouse events out of touch events.
Summary: [chromium] Allow plugins to opt-in to receive synthetic mouse events out of t...
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-11-22 14:34 PST by Sadrul Habib Chowdhury
Modified: 2013-04-10 10:02 PDT (History)
10 users (show)

See Also:


Attachments
Patch (11.17 KB, patch)
2012-11-22 14:39 PST, Sadrul Habib Chowdhury
no flags Details | Formatted Diff | Diff
Patch (17.91 KB, patch)
2012-11-23 07:46 PST, Sadrul Habib Chowdhury
no flags Details | Formatted Diff | Diff
Renamed the enum members. Thanks! (17.88 KB, patch)
2012-11-26 10:46 PST, Sadrul Habib Chowdhury
no flags Details | Formatted Diff | Diff
Build fix! (17.90 KB, patch)
2012-11-26 13:56 PST, Sadrul Habib Chowdhury
tony: review+
Details | Formatted Diff | Diff
Patch (20.36 KB, patch)
2012-11-27 10:38 PST, Sadrul Habib Chowdhury
tony: review+
tony: commit-queue-
Details | Formatted Diff | Diff
Used DEFINE_STATIC_LOCAL. Thanks! (20.38 KB, patch)
2012-11-27 12:20 PST, 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-11-22 14:34:51 PST
[chromium] Allow plugins to opt-in to receive synthetic mouse events out of touch events.
Comment 1 Sadrul Habib Chowdhury 2012-11-22 14:39:18 PST
Created attachment 175712 [details]
Patch
Comment 2 WebKit Review Bot 2012-11-22 14:41:21 PST
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
Comment 3 Sadrul Habib Chowdhury 2012-11-22 14:42:05 PST
Hi! Does this approach look reasonable? I can add tests if so. The corresponding chromium change is: https://codereview.chromium.org/11418134/

A subsequent webkit CL will remove the deprecated WebPluginContainer::setIsAcceptingTouchEvents()
Comment 4 Adam Barth 2012-11-22 22:58:05 PST
Comment on attachment 175712 [details]
Patch

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

> Source/WebKit/chromium/public/WebPluginContainer.h:53
> +        TOUCH_EVENT_REQUEST_NONE,
> +        TOUCH_EVENT_REQUEST_RAW,
> +        TOUCH_EVENT_REQUEST_SYNTHESIZED_MOUSE

This is the wrong style for enums.  Take a look at how we do other enums in the API.
Comment 5 Sadrul Habib Chowdhury 2012-11-23 07:46:50 PST
Created attachment 175809 [details]
Patch
Comment 6 Sadrul Habib Chowdhury 2012-11-23 07:48:24 PST
Comment on attachment 175712 [details]
Patch

Added a new test for the synthesized mouse events.

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

>> Source/WebKit/chromium/public/WebPluginContainer.h:53
>> +        TOUCH_EVENT_REQUEST_SYNTHESIZED_MOUSE
> 
> This is the wrong style for enums.  Take a look at how we do other enums in the API.

Whoops, my bad. Sorry. Fixed.

(I almost expected webkit-patch/style EWS bot to catch this)
Comment 7 Adam Barth 2012-11-26 10:31:04 PST
Comment on attachment 175809 [details]
Patch

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

> Source/WebKit/chromium/public/WebPluginContainer.h:53
> +        TouchEventRequestNone,
> +        TouchEventRequestRaw,
> +        TouchEventRequestSynthesizedMouse,

TouchEventRequestNone -> TouchEventRequestTypeNone

We reiterate the name of the enum in the values.  See, for example, MovieLoadType.
Comment 8 Adam Barth 2012-11-26 10:33:58 PST
Other than the nit above, the API change LGTM.
Comment 9 Sadrul Habib Chowdhury 2012-11-26 10:46:11 PST
Created attachment 176032 [details]
Renamed the enum members. Thanks!
Comment 10 Peter Beverloo (cr-android ews) 2012-11-26 11:59:29 PST
Comment on attachment 176032 [details]
Renamed the enum members. Thanks!

Attachment 176032 [details] did not pass cr-android-ews (chromium-android):
Output: http://queues.webkit.org/results/14987796
Comment 11 WebKit Review Bot 2012-11-26 13:10:11 PST
Comment on attachment 176032 [details]
Renamed the enum members. Thanks!

Attachment 176032 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/14989738
Comment 12 Sadrul Habib Chowdhury 2012-11-26 13:56:44 PST
Created attachment 176057 [details]
Build fix!
Comment 13 Sadrul Habib Chowdhury 2012-11-26 21:37:20 PST
Hi Tony! Would you please review this patch? Thanks!
Comment 14 Tony Chang 2012-11-27 10:02:13 PST
Comment on attachment 176057 [details]
Build fix!

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

> Source/WebKit/chromium/public/WebPluginContainer.h:121
> +    // Notifies when the plugin starts/stops accepting touch events. This is deprecated, use requestTouchEventType instead.
>      virtual void setIsAcceptingTouchEvents(bool) = 0;

The plan is to remove this after updating all the callers on the Chromium side, right?

> Source/WebKit/chromium/src/WebPluginContainerImpl.cpp:527
>  void WebPluginContainerImpl::setIsAcceptingTouchEvents(bool acceptingTouchEvents)
>  {
> -    if (m_isAcceptingTouchEvents == acceptingTouchEvents)
> +    requestTouchEventType(acceptingTouchEvents ? TouchEventRequestTypeRaw : TouchEventRequestTypeNone);
> +}

Do tests still call this?  Could you replace the body with a NOT_REACHED()?

> Tools/DumpRenderTree/chromium/TestWebPlugin.cpp:124
> +    static const WebString kPrimitiveTrue = WebString::fromUTF8("true");
> +    static const WebString kPrimitiveSynthetic = WebString::fromUTF8("synthetic");

I would update the old tests to use "raw" instead of "true".  It's confusing that the valid values for the attribute are "true" or "synthetic".

Also, this should probably just be const char* to avoid initialization (operator== is defined for String, const char* so you can still use == below).
Comment 15 Sadrul Habib Chowdhury 2012-11-27 10:38:45 PST
Created attachment 176295 [details]
Patch
Comment 16 Sadrul Habib Chowdhury 2012-11-27 10:39:15 PST
Comment on attachment 176057 [details]
Build fix!

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

>> Source/WebKit/chromium/public/WebPluginContainer.h:121
>>      virtual void setIsAcceptingTouchEvents(bool) = 0;
> 
> The plan is to remove this after updating all the callers on the Chromium side, right?

Correct. Once this change is gardened for chromium, and the chromium CL can land, and once the chromium CL is gardened for webkit, I will put up the CL to remove this function.

>> Source/WebKit/chromium/src/WebPluginContainerImpl.cpp:527
>> +}
> 
> Do tests still call this?  Could you replace the body with a NOT_REACHED()?

This is still called by chromium. So when this patch is gardened in for chromium, replacing this function with NOT_REACHED will cause crash/misbehaviour.

>> Tools/DumpRenderTree/chromium/TestWebPlugin.cpp:124
>> +    static const WebString kPrimitiveSynthetic = WebString::fromUTF8("synthetic");
> 
> I would update the old tests to use "raw" instead of "true".  It's confusing that the valid values for the attribute are "true" or "synthetic".
> 
> Also, this should probably just be const char* to avoid initialization (operator== is defined for String, const char* so you can still use == below).

I tried doing that. Looks like == is overloaded for String, but not for WebString. I also tried converting the WebString into a WTF::String first, but the WebString -> WTF::String conversion doesn't seem to be available for the test. So I have kept this unchanged (this is also the pattern used in other such parsing functions in this file). Does that sound reasonable?
Comment 17 Sadrul Habib Chowdhury 2012-11-27 10:42:24 PST
Comment on attachment 176057 [details]
Build fix!

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

>>> Tools/DumpRenderTree/chromium/TestWebPlugin.cpp:124
>>> +    static const WebString kPrimitiveSynthetic = WebString::fromUTF8("synthetic");
>> 
>> I would update the old tests to use "raw" instead of "true".  It's confusing that the valid values for the attribute are "true" or "synthetic".
>> 
>> Also, this should probably just be const char* to avoid initialization (operator== is defined for String, const char* so you can still use == below).
> 
> I tried doing that. Looks like == is overloaded for String, but not for WebString. I also tried converting the WebString into a WTF::String first, but the WebString -> WTF::String conversion doesn't seem to be available for the test. So I have kept this unchanged (this is also the pattern used in other such parsing functions in this file). Does that sound reasonable?

Oh, and I have changed "true" to "raw" for this. Thanks
Comment 18 Tony Chang 2012-11-27 12:02:47 PST
Comment on attachment 176295 [details]
Patch

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

> Tools/DumpRenderTree/chromium/TestWebPlugin.cpp:124
> +    static const WebString kPrimitiveRaw = WebString::fromUTF8("raw");
> +    static const WebString kPrimitiveSynthetic = WebString::fromUTF8("synthetic");

Please use DEFINE_STATIC_LOCAL or use a const char* and convert it to a WebString during the if condition.  I'm pretty sure clang will complain about this as is.
Comment 19 Sadrul Habib Chowdhury 2012-11-27 12:20:57 PST
Created attachment 176324 [details]
Used DEFINE_STATIC_LOCAL. Thanks!
Comment 20 Sadrul Habib Chowdhury 2012-11-27 19:08:34 PST
(In reply to comment #19)
> Created an attachment (id=176324) [details]
> Used DEFINE_STATIC_LOCAL. Thanks!

Requesting cq?
Comment 21 WebKit Review Bot 2012-11-28 08:29:40 PST
Comment on attachment 176324 [details]
Used DEFINE_STATIC_LOCAL. Thanks!

Clearing flags on attachment: 176324

Committed r136013: <http://trac.webkit.org/changeset/136013>