RESOLVED FIXED 226213
Make MediaSession readystate enums all lowercase
https://bugs.webkit.org/show_bug.cgi?id=226213
Summary Make MediaSession readystate enums all lowercase
Jean-Yves Avenard [:jya]
Reported 2021-05-24 22:15:37 PDT
Make MediaSession readystate enums all lowercase
Attachments
Patch (8.80 KB, patch)
2021-05-24 23:37 PDT, Jean-Yves Avenard [:jya]
no flags
Patch (19.25 KB, patch)
2021-05-25 05:18 PDT, Jean-Yves Avenard [:jya]
no flags
Patch (18.04 KB, patch)
2021-05-25 18:41 PDT, Jean-Yves Avenard [:jya]
no flags
Radar WebKit Bug Importer
Comment 1 2021-05-24 22:16:22 PDT
Jean-Yves Avenard [:jya]
Comment 2 2021-05-24 23:37:18 PDT
Jean-Yves Avenard [:jya]
Comment 3 2021-05-25 05:18:41 PDT
Peng Liu
Comment 4 2021-05-25 10:10:26 PDT
Comment on attachment 429646 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=429646&action=review > Source/WebCore/Modules/mediasession/MediaSessionReadyState.h:37 > + Haveenoughdata, Oh? Why do we need these changes in C++ code?
Chris Dumez
Comment 5 2021-05-25 10:17:12 PDT
Comment on attachment 429646 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=429646&action=review >> Source/WebCore/Modules/mediasession/MediaSessionReadyState.h:37 >> + Haveenoughdata, > > Oh? Why do we need these changes in C++ code? That's what the C++ code generated by the IDL bindings generator expects based on the IDL enum values. I don't think there is a way around that at the moment sadly.
Chris Dumez
Comment 6 2021-05-25 10:19:47 PDT
Comment on attachment 429646 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=429646&action=review > Source/WebCore/Modules/mediasession/MediaSessionReadyState.idl:29 > + "havenothing", Are we trying to match a spec? If so, you could use '-' as separator to end up with nicer names on c++ side, e.g. 'havenothing' -> 'have-nothing'
Chris Dumez
Comment 7 2021-05-25 10:20:03 PDT
(In reply to Chris Dumez from comment #6) > Comment on attachment 429646 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=429646&action=review > > > Source/WebCore/Modules/mediasession/MediaSessionReadyState.idl:29 > > + "havenothing", > > Are we trying to match a spec? If so, you could use '-' as separator to end > up with nicer names on c++ side, e.g. 'havenothing' -> 'have-nothing' If so -> If NOT
Chris Dumez
Comment 8 2021-05-25 10:22:19 PDT
Comment on attachment 429646 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=429646&action=review >>> Source/WebCore/Modules/mediasession/MediaSessionReadyState.h:37 >>> + Haveenoughdata, >> >> Oh? Why do we need these changes in C++ code? > > That's what the C++ code generated by the IDL bindings generator expects based on the IDL enum values. I don't think there is a way around that at the moment sadly. I think we wouldn't need any C++ changes if we used '-' in the names in the IDL (e.g. 'have-nothing').
Eric Carlson
Comment 9 2021-05-25 10:26:28 PDT
Comment on attachment 429646 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=429646&action=review > LayoutTests/media/media-session/mock-coordinator-expected.txt:156 > -EXPECTED (latestChange == 'coordinatorStateChanged') OK > +EXPECTED (latestChange == 'playbackStateChanged') OK > +EXPECTED (latestChange == 'playbackStateChanged') OK > +EXPECTED (latestChange == 'playbackStateChanged') OK > +EXPECTED (latestChange == 'coordinatorStateChanged'), OBSERVED 'undefined', AFTER TIMEOUT FAIL Is this supposed to part of this change?
Jean-Yves Avenard [:jya]
Comment 10 2021-05-25 17:14:15 PDT
(In reply to Chris Dumez from comment #6) > Comment on attachment 429646 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=429646&action=review > > > Source/WebCore/Modules/mediasession/MediaSessionReadyState.idl:29 > > + "havenothing", > > Are we trying to match a spec? If so, you could use '-' as separator to end > up with nicer names on c++ side, e.g. 'havenothing' -> 'have-nothing' yes, currently Media Session states and actions use that format: "seekbackward" "previoustrack", "togglemicrophone" HTML Media events are also all in lowercase "loadedmetata"
Jean-Yves Avenard [:jya]
Comment 11 2021-05-25 17:15:51 PDT
(In reply to Peng Liu from comment #4) > Comment on attachment 429646 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=429646&action=review > > > Source/WebCore/Modules/mediasession/MediaSessionReadyState.h:37 > > + Haveenoughdata, > > Oh? Why do we need these changes in C++ code? The IDL binding code makes assumptions on how the actual C++ enum is named. It creates a 1:1 association between the IDL name and the C++ enum. Maybe there's an IDL settings to force which C++ enum watches.
Chris Dumez
Comment 12 2021-05-25 17:15:56 PDT
(In reply to Jean-Yves Avenard [:jya] from comment #10) > (In reply to Chris Dumez from comment #6) > > Comment on attachment 429646 [details] > > Patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=429646&action=review > > > > > Source/WebCore/Modules/mediasession/MediaSessionReadyState.idl:29 > > > + "havenothing", > > > > Are we trying to match a spec? If so, you could use '-' as separator to end > > up with nicer names on c++ side, e.g. 'havenothing' -> 'have-nothing' > > yes, currently Media Session states and actions use that format: > "seekbackward" "previoustrack", "togglemicrophone" > > HTML Media events are also all in lowercase "loadedmetata" how about picture-in-picture? Source/WebCore/html/HTMLVideoElement.idl:[Conditional=VIDEO_PRESENTATION_MODE] enum VideoPresentationMode { "inline", "fullscreen", "picture-in-picture" };
Chris Dumez
Comment 13 2021-05-25 17:18:57 PDT
(In reply to Chris Dumez from comment #12) > (In reply to Jean-Yves Avenard [:jya] from comment #10) > > (In reply to Chris Dumez from comment #6) > > > Comment on attachment 429646 [details] > > > Patch > > > > > > View in context: > > > https://bugs.webkit.org/attachment.cgi?id=429646&action=review > > > > > > > Source/WebCore/Modules/mediasession/MediaSessionReadyState.idl:29 > > > > + "havenothing", > > > > > > Are we trying to match a spec? If so, you could use '-' as separator to end > > > up with nicer names on c++ side, e.g. 'havenothing' -> 'have-nothing' > > > > yes, currently Media Session states and actions use that format: > > "seekbackward" "previoustrack", "togglemicrophone" > > > > HTML Media events are also all in lowercase "loadedmetata" > > how about picture-in-picture? > Source/WebCore/html/HTMLVideoElement.idl: > [Conditional=VIDEO_PRESENTATION_MODE] enum VideoPresentationMode { "inline", > "fullscreen", "picture-in-picture" }; MediaDecodingType also has "media-source". MediaKeysRequirement has "not-allowed". I am sure there are other examples.
Chris Dumez
Comment 14 2021-05-25 17:21:12 PDT
(In reply to Chris Dumez from comment #13) > (In reply to Chris Dumez from comment #12) > > (In reply to Jean-Yves Avenard [:jya] from comment #10) > > > (In reply to Chris Dumez from comment #6) > > > > Comment on attachment 429646 [details] > > > > Patch > > > > > > > > View in context: > > > > https://bugs.webkit.org/attachment.cgi?id=429646&action=review > > > > > > > > > Source/WebCore/Modules/mediasession/MediaSessionReadyState.idl:29 > > > > > + "havenothing", > > > > > > > > Are we trying to match a spec? If so, you could use '-' as separator to end > > > > up with nicer names on c++ side, e.g. 'havenothing' -> 'have-nothing' > > > > > > yes, currently Media Session states and actions use that format: > > > "seekbackward" "previoustrack", "togglemicrophone" > > > > > > HTML Media events are also all in lowercase "loadedmetata" > > > > how about picture-in-picture? > > Source/WebCore/html/HTMLVideoElement.idl: > > [Conditional=VIDEO_PRESENTATION_MODE] enum VideoPresentationMode { "inline", > > "fullscreen", "picture-in-picture" }; > > MediaDecodingType also has "media-source". MediaKeysRequirement has > "not-allowed". I am sure there are other examples. The fact is that there is plenty of precedent for using - as word separator in enum strings. I think it looks much nicer and our bindings generator deals with nicely with them. If we have control over the naming, seems unfortunate to end up with the ugly way :P
Jean-Yves Avenard [:jya]
Comment 15 2021-05-25 17:24:50 PDT
(In reply to Chris Dumez from comment #14) > The fact is that there is plenty of precedent for using - as word separator > in enum strings. I think it looks much nicer and our bindings generator > deals with nicely with them. If we have control over the naming, seems > unfortunate to end up with the ugly way :P From searching at the time in the spec (we had a discussion in #webkit), the use of "firstword" is much more prevalent than "first-word" and "firstWord". Sadly, it's all over the place.
Jean-Yves Avenard [:jya]
Comment 16 2021-05-25 18:41:33 PDT
EWS
Comment 17 2021-05-26 18:33:09 PDT
Committed r278143 (238187@main): <https://commits.webkit.org/238187@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 429724 [details].
Note You need to log in before you can comment on or make changes to this bug.