WebKit Bugzilla
Attachment 338781 Details for
Bug 184993
: Add lazy initialization of caption display mode for videos.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-184993-20180425133207.patch (text/plain), 5.03 KB, created by
Per Arne Vollan
on 2018-04-25 13:32:08 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Per Arne Vollan
Created:
2018-04-25 13:32:08 PDT
Size:
5.03 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 231014) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,23 @@ >+2018-04-25 Per Arne Vollan <pvollan@apple.com> >+ >+ Add lazy initialization of caption display mode for videos. >+ https://bugs.webkit.org/show_bug.cgi?id=184993 >+ >+ The call to MACaptionAppearanceGetDisplayType in CaptionUserPreferencesMediaAF::captionDisplayMode() >+ is showing up in samples when called from HTMLMediaElement::finishInitialization(). >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ No new tests, covered by existing tests. >+ >+ * html/HTMLMediaElement.cpp: >+ (WebCore::HTMLMediaElement::finishInitialization): >+ (WebCore::HTMLMediaElement::setSelectedTextTrack): >+ (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): >+ (WebCore::HTMLMediaElement::captionPreferencesChanged): >+ (WebCore::HTMLMediaElement::captionDisplayMode): >+ * html/HTMLMediaElement.h: >+ > 2018-04-25 Zalan Bujtas <zalan@apple.com> > > [LFC] Implement Layout::Container functions. >Index: Source/WebCore/html/HTMLMediaElement.cpp >=================================================================== >--- Source/WebCore/html/HTMLMediaElement.cpp (revision 230915) >+++ Source/WebCore/html/HTMLMediaElement.cpp (working copy) >@@ -560,11 +560,6 @@ void HTMLMediaElement::finishInitializat > } > #endif > >-#if ENABLE(VIDEO_TRACK) >- if (page) >- m_captionDisplayMode = page->group().captionPreferences().captionDisplayMode(); >-#endif >- > #if ENABLE(MEDIA_SESSION) > m_elementID = nextElementID(); > elementIDsToElements().add(m_elementID, this); >@@ -4376,13 +4371,13 @@ void HTMLMediaElement::setSelectedTextTr > return; > > if (trackToSelect == TextTrack::captionMenuAutomaticItem()) { >- if (m_captionDisplayMode != CaptionUserPreferences::Automatic) >+ if (captionDisplayMode() != CaptionUserPreferences::Automatic) > m_textTracks->scheduleChangeEvent(); > } else if (trackToSelect == TextTrack::captionMenuOffItem()) { > for (int i = 0, length = trackList.length(); i < length; ++i) > trackList.item(i)->setMode(TextTrack::Mode::Disabled); > >- if (m_captionDisplayMode != CaptionUserPreferences::ForcedOnly && !trackList.isChangeEventScheduled()) >+ if (captionDisplayMode() != CaptionUserPreferences::ForcedOnly && !trackList.isChangeEventScheduled()) > m_textTracks->scheduleChangeEvent(); > } else { > if (!trackToSelect || !trackList.contains(*trackToSelect)) >@@ -5016,7 +5011,7 @@ void HTMLMediaElement::mediaPlayerCharac > beginProcessingMediaPlayerCallback(); > > #if ENABLE(VIDEO_TRACK) >- if (m_captionDisplayMode == CaptionUserPreferences::Automatic && m_subtitleTrackLanguage != m_player->languageOfPrimaryAudioTrack()) >+ if (captionDisplayMode() == CaptionUserPreferences::Automatic && m_subtitleTrackLanguage != m_player->languageOfPrimaryAudioTrack()) > markCaptionAndSubtitleTracksAsUnconfigured(AfterDelay); > #endif > >@@ -6424,11 +6419,23 @@ void HTMLMediaElement::captionPreference > return; > > CaptionUserPreferences::CaptionDisplayMode displayMode = document().page()->group().captionPreferences().captionDisplayMode(); >- if (m_captionDisplayMode == displayMode) >+ if (captionDisplayMode() == displayMode) > return; > > m_captionDisplayMode = displayMode; >- setWebkitClosedCaptionsVisible(m_captionDisplayMode == CaptionUserPreferences::AlwaysOn); >+ setWebkitClosedCaptionsVisible(captionDisplayMode() == CaptionUserPreferences::AlwaysOn); >+} >+ >+CaptionUserPreferences::CaptionDisplayMode HTMLMediaElement::captionDisplayMode() >+{ >+ if (!m_captionDisplayMode.has_value()) { >+ if (document().page()) >+ m_captionDisplayMode = document().page()->group().captionPreferences().captionDisplayMode(); >+ else >+ m_captionDisplayMode = CaptionUserPreferences::Automatic; >+ } >+ >+ return m_captionDisplayMode.value(); > } > > void HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured(ReconfigureMode mode) >Index: Source/WebCore/html/HTMLMediaElement.h >=================================================================== >--- Source/WebCore/html/HTMLMediaElement.h (revision 230915) >+++ Source/WebCore/html/HTMLMediaElement.h (working copy) >@@ -772,6 +772,7 @@ private: > }; > void markCaptionAndSubtitleTracksAsUnconfigured(ReconfigureMode); > void captionPreferencesChanged() override; >+ CaptionUserPreferences::CaptionDisplayMode captionDisplayMode(); > #endif > > // These "internal" functions do not check user gesture restrictions. >@@ -1087,7 +1088,7 @@ private: > String m_subtitleTrackLanguage; > MediaTime m_lastTextTrackUpdateTime { -1, 1 }; > >- CaptionUserPreferences::CaptionDisplayMode m_captionDisplayMode { CaptionUserPreferences::Automatic }; >+ std::optional<CaptionUserPreferences::CaptionDisplayMode> m_captionDisplayMode; > > RefPtr<AudioTrackList> m_audioTracks; > RefPtr<TextTrackList> m_textTracks;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 184993
: 338781