| Index: Source/core/html/shadow/MediaControls.cpp
|
| diff --git a/Source/core/html/shadow/MediaControls.cpp b/Source/core/html/shadow/MediaControls.cpp
|
| index b0560f11dddbc156a7e77c71ccca1c75b39140a6..32fe7ffacfb00b8e4c135dc12eaf6d85f95671d3 100644
|
| --- a/Source/core/html/shadow/MediaControls.cpp
|
| +++ b/Source/core/html/shadow/MediaControls.cpp
|
| @@ -59,6 +59,8 @@ MediaControls::MediaControls(HTMLMediaElement& mediaElement)
|
| , m_muteButton(nullptr)
|
| , m_volumeSlider(nullptr)
|
| , m_toggleClosedCaptionsButton(nullptr)
|
| + , m_textTrackListContainer(nullptr)
|
| + , m_textTrackList(nullptr)
|
| , m_fullScreenButton(nullptr)
|
| , m_castButton(nullptr)
|
| , m_overlayCastButton(nullptr)
|
| @@ -95,6 +97,8 @@ PassRefPtrWillBeRawPtr<MediaControls> MediaControls::create(HTMLMediaElement& me
|
| // +-MediaControlMuteButtonElement (-webkit-media-controls-mute-button)
|
| // +-MediaControlVolumeSliderElement (-webkit-media-controls-volume-slider)
|
| // +-MediaControlToggleClosedCaptionsButtonElement (-webkit-media-controls-toggle-closed-captions-button)
|
| +// +-MediaControlTextTrackListContainerElement (-webkit-media-controls-text-track-list-container)
|
| +// +-MediaControlTextTrackListElement (-webkit-media-controls-text-track-list)
|
| // +-MediaControlCastButtonElement (-internal-media-controls-cast-button)
|
| // \-MediaControlFullscreenButtonElement (-webkit-media-controls-fullscreen-button)
|
| void MediaControls::initializeControls()
|
| @@ -148,6 +152,15 @@ void MediaControls::initializeControls()
|
| m_toggleClosedCaptionsButton = toggleClosedCaptionsButton.get();
|
| panel->appendChild(toggleClosedCaptionsButton.release());
|
|
|
| + RefPtrWillBeRawPtr<MediaControlTextTrackListContainerElement> textTrackListContainer =
|
| + MediaControlTextTrackListContainerElement::create(*this);
|
| + m_textTrackListContainer = textTrackListContainer.get();
|
| + RefPtrWillBeRawPtr<MediaControlTextTrackListElement> textTrackList =
|
| + MediaControlTextTrackListElement::create(*this);
|
| + m_textTrackList = textTrackList.get();
|
| + m_textTrackListContainer->appendChild(textTrackList.release());
|
| + panel->appendChild(textTrackListContainer.release());
|
| +
|
| RefPtrWillBeRawPtr<MediaControlCastButtonElement> castButton = MediaControlCastButtonElement::create(*this, false);
|
| m_castButton = castButton.get();
|
| panel->appendChild(castButton.release());
|
| @@ -354,6 +367,25 @@ void MediaControls::refreshClosedCaptionsButtonVisibility()
|
| m_toggleClosedCaptionsButton->hide();
|
| }
|
|
|
| +void MediaControls::toggleTextTrackList()
|
| +{
|
| + if (!mediaElement().hasClosedCaptions())
|
| + return;
|
| +
|
| + bool isTrackListVisible = m_textTrackListContainer->isVisible();
|
| + // Media controls panel has overflow set to hidden. To display track list,
|
| + // overflow has to be set to visible.
|
| + m_panel->setInlineStyleProperty(CSSPropertyOverflow, CSSValueVisible, isTrackListVisible);
|
| + if (isTrackListVisible) {
|
| + m_textTrackListContainer->hide();
|
| + m_textTrackList->hide();
|
| + } else {
|
| + m_textTrackListContainer->show();
|
| + m_textTrackList->refreshTextTrackListMenu();
|
| + m_textTrackList->show();
|
| + }
|
| +}
|
| +
|
| static Element* elementFromCenter(Element& element)
|
| {
|
| RefPtrWillBeRawPtr<ClientRect> clientRect = element.getBoundingClientRect();
|
|
|