WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
171227
Indicate presence of audio when handling autoplay events
https://bugs.webkit.org/show_bug.cgi?id=171227
Summary
Indicate presence of audio when handling autoplay events
Matt Rajca
Reported
2017-04-24 09:47:02 PDT
When notifying clients of autoplay events, indicate whether there is audio.
Attachments
Patch
(20.92 KB, patch)
2017-04-24 13:03 PDT
,
Matt Rajca
no flags
Details
Formatted Diff
Diff
Patch
(22.13 KB, patch)
2017-04-24 14:00 PDT
,
Matt Rajca
no flags
Details
Formatted Diff
Diff
Patch
(25.10 KB, patch)
2017-04-25 09:51 PDT
,
Matt Rajca
achristensen
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Matt Rajca
Comment 1
2017-04-24 13:03:32 PDT
Created
attachment 307998
[details]
Patch
Sam Weinig
Comment 2
2017-04-24 13:12:53 PDT
Comment on
attachment 307998
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=307998&action=review
> Source/WebCore/page/AutoplayEvent.h:41 > +enum AutoplayEventFlags { > + AutoplayEventFlagsNone = 0, > + AutoplayEventFlagsHasAudio = 1 << 0, > +};
Generally we are using enum class for things like this theses days.
> Source/WebKit2/UIProcess/API/C/WKPage.cpp:2249 > + m_client.handleAutoplayEvent(toAPI(&page), static_cast<WKAutoplayEvent>(event), static_cast<WKAutoplayEventFlags>(flags), m_client.base.clientInfo);
This should use an explicit conversion function that enumerates the enums, rather than assuming the WebCore type and the API type will have the same bit values. This is also true for WKAutoplayEvent.
Matt Rajca
Comment 3
2017-04-24 13:35:50 PDT
(In reply to Sam Weinig from
comment #2
)
> Comment on
attachment 307998
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=307998&action=review
> > > Source/WebCore/page/AutoplayEvent.h:41 > > +enum AutoplayEventFlags { > > + AutoplayEventFlagsNone = 0, > > + AutoplayEventFlagsHasAudio = 1 << 0, > > +}; > > Generally we are using enum class for things like this theses days.
I didn't use an enum class because this is used as a set of options (bitmask) and we can't use the usual operators like | and & with enum classes.
> > > Source/WebKit2/UIProcess/API/C/WKPage.cpp:2249 > > + m_client.handleAutoplayEvent(toAPI(&page), static_cast<WKAutoplayEvent>(event), static_cast<WKAutoplayEventFlags>(flags), m_client.base.clientInfo); > > This should use an explicit conversion function that enumerates the enums, > rather than assuming the WebCore type and the API type will have the same > bit values. This is also true for WKAutoplayEvent.
I'll add one.
Matt Rajca
Comment 4
2017-04-24 14:00:59 PDT
Created
attachment 308007
[details]
Patch
Sam Weinig
Comment 5
2017-04-24 15:55:17 PDT
(In reply to Matt Rajca from
comment #3
)
> (In reply to Sam Weinig from
comment #2
) > > Comment on
attachment 307998
[details]
> > Patch > > > > View in context: > >
https://bugs.webkit.org/attachment.cgi?id=307998&action=review
> > > > > Source/WebCore/page/AutoplayEvent.h:41 > > > +enum AutoplayEventFlags { > > > + AutoplayEventFlagsNone = 0, > > > + AutoplayEventFlagsHasAudio = 1 << 0, > > > +}; > > > > Generally we are using enum class for things like this theses days. > > I didn't use an enum class because this is used as a set of options > (bitmask) and we can't use the usual operators like | and & with enum > classes.
If you want to use it as a bit set, then we have the OptionSet<> wrapper for that, which can use an enum class.
Matt Rajca
Comment 6
2017-04-24 16:41:48 PDT
(In reply to Sam Weinig from
comment #5
)
> (In reply to Matt Rajca from
comment #3
) > > (In reply to Sam Weinig from
comment #2
) > > > Comment on
attachment 307998
[details]
> > > Patch > > > > > > View in context: > > >
https://bugs.webkit.org/attachment.cgi?id=307998&action=review
> > > > > > > Source/WebCore/page/AutoplayEvent.h:41 > > > > +enum AutoplayEventFlags { > > > > + AutoplayEventFlagsNone = 0, > > > > + AutoplayEventFlagsHasAudio = 1 << 0, > > > > +}; > > > > > > Generally we are using enum class for things like this theses days. > > > > I didn't use an enum class because this is used as a set of options > > (bitmask) and we can't use the usual operators like | and & with enum > > classes. > > If you want to use it as a bit set, then we have the OptionSet<> wrapper for > that, which can use an enum class.
Thanks, didn't know about that.
Matt Rajca
Comment 7
2017-04-25 09:51:51 PDT
Created
attachment 308109
[details]
Patch
Matt Rajca
Comment 8
2017-04-25 17:03:03 PDT
Committed
r215771
: <
http://trac.webkit.org/changeset/215771
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug