Bug 155141 - Add separate WK and WK2 preferences for requiring user gestures for video media, distinct from user gestures for media generally
Summary: Add separate WK and WK2 preferences for requiring user gestures for video med...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jer Noble
URL:
Keywords:
Depends on:
Blocks: 163244
  Show dependency treegraph
 
Reported: 2016-03-07 15:13 PST by Jer Noble
Modified: 2016-10-10 14:47 PDT (History)
4 users (show)

See Also:


Attachments
Patch (47.12 KB, patch)
2016-03-07 15:25 PST, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (46.53 KB, patch)
2016-03-08 10:43 PST, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (11.13 KB, patch)
2016-03-08 22:42 PST, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (53.50 KB, patch)
2016-03-08 22:48 PST, Jer Noble
no flags Details | Formatted Diff | Diff
Patch for EWS (59.22 KB, patch)
2016-03-09 08:52 PST, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (35.17 KB, patch)
2016-03-09 14:20 PST, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (61.49 KB, patch)
2016-03-09 14:36 PST, Jer Noble
no flags Details | Formatted Diff | Diff
Patch (76.85 KB, patch)
2016-03-10 12:28 PST, Jer Noble
bdakin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jer Noble 2016-03-07 15:13:50 PST
Add separate WK and WK2 preferences for requiring user gestures for video media, distinct from user gestures for media generally
Comment 1 Jer Noble 2016-03-07 15:25:35 PST
Created attachment 273227 [details]
Patch
Comment 2 Eric Carlson 2016-03-07 18:36:54 PST
Comment on attachment 273227 [details]
Patch

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

> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:3766
> +//    ASSERT(obscuredInsets.top >= 0);
> +//    ASSERT(obscuredInsets.left >= 0);
> +//    ASSERT(obscuredInsets.bottom >= 0);
> +//    ASSERT(obscuredInsets.right >= 0);

Oops!
Comment 3 Jer Noble 2016-03-08 10:43:01 PST
Created attachment 273305 [details]
Patch
Comment 4 Jer Noble 2016-03-08 22:42:34 PST
Created attachment 273397 [details]
Patch

Fixed some broken layout tests, and added a TestWebKitAPI test to ensure these new preferences don't break clients of our existing APIs.
Comment 5 Jer Noble 2016-03-08 22:48:29 PST
Created attachment 273398 [details]
Patch
Comment 6 Anders Carlsson 2016-03-09 08:00:21 PST
Comment on attachment 273398 [details]
Patch

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

> Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:65
> +@property (nonatomic) BOOL allowsInlineMediaPlayback;
> +@property (nonatomic) BOOL requiresUserActionForMediaPlayback;

If this is SPI it needs to be prefixed with _.
Comment 7 Eric Carlson 2016-03-09 08:10:27 PST
Comment on attachment 273398 [details]
Patch

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

> Tools/ChangeLog:10
> +        * TestWebKitAPI/Tests/WebKit/ios/video-with-audio.html:
> +        * TestWebKitAPI/Tests/WebKit/ios/video-without-audio.html:

Should these still be in the ios directory?

> Tools/ChangeLog:32
> +2016-03-07  Jer Noble  <jer.noble@apple.com>
> +
> +        Add separate WK and WK2 preferences for requiring user gestures for video media, distinct from user gestures for media generally
> +        https://bugs.webkit.org/show_bug.cgi?id=155141
> +
> +        Reviewed by NOBODY (OOPS!).
> +
> +        Set the default values for media preferences unconditionally, not just on PLATFORM(IOS). Set "video requires user gesture"
> +        to sane defaults in addition to "audio requires user gesture" and (in the case of DumpREnderTree) instead of "media requires user gesture".
> +
> +        * DumpRenderTree/mac/DumpRenderTree.mm:
> +        (resetWebPreferencesToConsistentValues):
> +        * TestWebKitAPI/Tests/WebKit2Cocoa/Coding.mm:
> +        (TEST):

Double entry.

> Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:331
> +		CD47E7971C8F6FF6004BCFDC /* RequireUserGestureForPlayback.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD47E7961C8F6FF6004BCFDC /* RequireUserGestureForPlayback.mm */; };

It looks like you forgot to add this new test to the repository.
Comment 8 Jer Noble 2016-03-09 08:50:17 PST
Comment on attachment 273398 [details]
Patch

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

>> Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfigurationPrivate.h:65
>> +@property (nonatomic) BOOL requiresUserActionForMediaPlayback;
> 
> If this is SPI it needs to be prefixed with _.

They're not really SPI, in that they exist as API for TARGET_OS_IPHONE. I was trying to avoid modifying the WKWebViewConfiguration API (to remove the TARGET_OS_IPHONE conditional), which is why they're here.  Should I add a note saying so, just remove the conditional in the public header, or prefix the !TARGET_OS_IPHONE properties and add a bunch of #if TARGET_OS_IPHOSE conditionals where they're accessed?
Comment 9 Jer Noble 2016-03-09 08:52:52 PST
Created attachment 273432 [details]
Patch for EWS
Comment 10 Jer Noble 2016-03-09 14:20:28 PST
Created attachment 273478 [details]
Patch

Removed the non-underscore-prefixed SPI properties from WKWebViewConfigurationPrivate.h and replaced them with nothing.
Comment 11 Jer Noble 2016-03-09 14:36:19 PST
Created attachment 273484 [details]
Patch
Comment 12 Jer Noble 2016-03-10 12:28:39 PST
Created attachment 273600 [details]
Patch
Comment 13 Eric Carlson 2016-03-10 12:38:46 PST
Comment on attachment 273600 [details]
Patch

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

> Tools/ChangeLog:9
> +        to sane defaults in addition to "audio requires user gesture" and (in the case of DumpREnderTree) instead of "media requires user gesture".

Nit: DumpREnderTree
Comment 14 Eric Carlson 2016-03-10 12:50:52 PST
Comment on attachment 273600 [details]
Patch

These changes look good to  me, but a WK2 reviewer should give it the final nod.
Comment 15 Jer Noble 2016-03-10 13:00:47 PST
The gtk-wk2 failure is unrelated; the mac build failures are due to changing Settings.in and not having the derived InternalSettingsGenerated.idl get updated by DerivedSources.make. A clean build will solve that build issue.
Comment 16 Beth Dakin 2016-03-10 13:28:23 PST
Comment on attachment 273600 [details]
Patch

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

r+ for WK2

> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:404
> +#endif

You should add a comment after the #endif to say what the #if was. That will make this more readable.

> Source/WebKit2/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:-110
> -#endif

This might also benefit from a comment for what the #if was.
Comment 17 Jer Noble 2016-03-10 13:35:03 PST
Committed r197953: <http://trac.webkit.org/changeset/197953>
Comment 18 Simon Fraser (smfr) 2016-03-10 18:39:24 PST
This broke windows:
https://build.webkit.org/builders/Apple%20Win%20Debug%20%28Build%29/builds/93666/steps/compile-webkit/logs/stdio
C:\cygwin\home\buildbot\slave\win-debug\build\Source\WebKit\win\WebView.cpp(5308): error C2039: 'setRequiresUserGestureForVideoPlayback': is not a member of 'WebCore::Settings' [C:\cygwin\home\buildbot\slave\win-debug\build\WebKitBuild\Debug\Source\WebKit\WebKit.vcxproj]
Comment 19 Simon Fraser (smfr) 2016-03-10 18:40:27 PST
The test is also crashing in debug:
https://build.webkit.org/results/Apple%20Yosemite%20Debug%20WK2%20(Tests)/r197955%20(10663)/results.html
Comment 20 Jer Noble 2016-03-10 20:12:10 PST
On it.
Comment 21 Jer Noble 2016-03-10 20:17:00 PST
Committed build-fix, r197988: <http://trac.webkit.org/changeset/197988>
Comment 22 Jer Noble 2016-03-10 20:19:13 PST
And the crash is the same as <https://bugs.webkit.org/show_bug.cgi?id=155209>, which I'm about to land a fix for.