RESOLVED FIXED227031
Update Media Accessibility preferences in the WebContent process from the UI process
https://bugs.webkit.org/show_bug.cgi?id=227031
Summary Update Media Accessibility preferences in the WebContent process from the UI ...
Per Arne Vollan
Reported 2021-06-15 09:24:08 PDT
Due to stricter sandboxing in the WebContent process, Media Accessibility preferences should be updated from the UI process.
Attachments
Patch (19.10 KB, patch)
2021-06-15 09:32 PDT, Per Arne Vollan
eric.carlson: review+
ews-feeder: commit-queue-
Patch (19.10 KB, patch)
2021-06-16 01:07 PDT, Per Arne Vollan
no flags
Per Arne Vollan
Comment 1 2021-06-15 09:25:19 PDT
Per Arne Vollan
Comment 2 2021-06-15 09:32:44 PDT
Eric Carlson
Comment 3 2021-06-15 10:26:55 PDT
Comment on attachment 431447 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=431447&action=review > Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp:222 > + case kMACaptionAppearanceDisplayTypeForcedOnly: > + return ForcedOnly; > + > + case kMACaptionAppearanceDisplayTypeAutomatic: > + return Automatic; > + > + case kMACaptionAppearanceDisplayTypeAlwaysOn: > + return AlwaysOn; > + } I think it is a mistake to have the one method sometimes return the cached value and sometimes call the system because the caller always knows if it to do one thing or the other, so I would split this into two methods. > Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp:527 > + if (cachedPreferredLanguages().has_value()) > + return cachedPreferredLanguages().value(); > + > + auto captionLanguages = adoptCF(MACaptionAppearanceCopySelectedLanguages(kMACaptionAppearanceDomainUser)); > + CFIndex captionLanguagesCount = captionLanguages ? CFArrayGetCount(captionLanguages.get()) : 0; > + > + Vector<String> preferredLanguages; > + preferredLanguages.reserveInitialCapacity(captionLanguagesCount); > + for (CFIndex i = 0; i < captionLanguagesCount; i++) > + preferredLanguages.uncheckedAppend(static_cast<CFStringRef>(CFArrayGetValueAtIndex(captionLanguages.get(), i))); > + > + return preferredLanguages; Ditto.
Per Arne Vollan
Comment 4 2021-06-16 01:07:16 PDT
EWS
Comment 5 2021-06-16 01:56:37 PDT
Committed r278927 (238858@main): <https://commits.webkit.org/238858@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 431524 [details].
Per Arne Vollan
Comment 6 2021-06-16 02:05:07 PDT
(In reply to Eric Carlson from comment #3) > Comment on attachment 431447 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=431447&action=review > > > Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp:222 > > + case kMACaptionAppearanceDisplayTypeForcedOnly: > > + return ForcedOnly; > > + > > + case kMACaptionAppearanceDisplayTypeAutomatic: > > + return Automatic; > > + > > + case kMACaptionAppearanceDisplayTypeAlwaysOn: > > + return AlwaysOn; > > + } > > I think it is a mistake to have the one method sometimes return the cached > value and sometimes call the system because the caller always knows if it to > do one thing or the other, so I would split this into two methods. > > > Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp:527 > > + if (cachedPreferredLanguages().has_value()) > > + return cachedPreferredLanguages().value(); > > + > > + auto captionLanguages = adoptCF(MACaptionAppearanceCopySelectedLanguages(kMACaptionAppearanceDomainUser)); > > + CFIndex captionLanguagesCount = captionLanguages ? CFArrayGetCount(captionLanguages.get()) : 0; > > + > > + Vector<String> preferredLanguages; > > + preferredLanguages.reserveInitialCapacity(captionLanguagesCount); > > + for (CFIndex i = 0; i < captionLanguagesCount; i++) > > + preferredLanguages.uncheckedAppend(static_cast<CFStringRef>(CFArrayGetValueAtIndex(captionLanguages.get(), i))); > > + > > + return preferredLanguages; > > Ditto. Fixed by moving the check outside the method. Thanks for reviewing!
Note You need to log in before you can comment on or make changes to this bug.