Bug 256090

Summary: Un-necessary text track reconfigurations causes full re-layout
Product: WebKit Reporter: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Component: MediaAssignee: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Jean-Yves Avenard [:jya] 2023-04-28 06:46:17 PDT
Whenever the MediaPlayer notifies that the characteristics of the player changed, the code checks if the current subtitle track language is different to the current primary audio track language. And if so we configure the text tracks, leading to the RenderVideo to call updatePlayer [1]

Upon initialisation, and if no subtitle is selected/activated, m_subtitleTrackLanguage is an empty string and as such will always be different to MediaPlayer::languageOfPrimaryAudioTrack(), and so `HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured` will be called each time `HTMLMediaElement::mediaPlayerCharacteristicChanged which will call `HTMLMediaElement::configureTextTracks()` which calls `HTMLMediaElement::updateCaptionContainer();` which will update the media controls and cause re-layout of the player and the media control.


We should only call `markCaptionAndSubtitleTracksAsUnconfigured` again if the MediaPlayer audio track has changed.

[1] https://searchfox.org/wubkat/rev/6fa5a22eeca90d4396d6e6a14e600b672aab49a4/Source/WebCore/html/HTMLMediaElement.cpp#5718-5719
Comment 1 Jean-Yves Avenard [:jya] 2023-04-28 06:46:30 PDT
rdar://108381732
Comment 2 Jean-Yves Avenard [:jya] 2023-04-28 06:52:08 PDT
Pull request: https://github.com/WebKit/WebKit/pull/13273
Comment 3 EWS 2023-04-28 16:55:01 PDT
Committed 263521@main (81f8f7f4b684): <https://commits.webkit.org/263521@main>

Reviewed commits have been landed. Closing PR #13273 and removing active labels.