Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(588)

Unified Diff: Source/core/html/shadow/MediaControls.cpp

Issue 988763002: Start separating the text track container from the media controls (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/shadow/MediaControls.h ('k') | Source/core/html/track/TextTrackContainer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/shadow/MediaControls.cpp
diff --git a/Source/core/html/shadow/MediaControls.cpp b/Source/core/html/shadow/MediaControls.cpp
index 4571cdc9efeb489b10f569eb067fe1816bcdcd1b..8f4a18196a0a0f59693607c94eb25488c7867d84 100644
--- a/Source/core/html/shadow/MediaControls.cpp
+++ b/Source/core/html/shadow/MediaControls.cpp
@@ -33,6 +33,7 @@
#include "core/frame/Settings.h"
#include "core/html/HTMLMediaElement.h"
#include "core/html/MediaController.h"
+#include "core/html/track/TextTrackContainer.h"
#include "core/layout/LayoutTheme.h"
namespace blink {
@@ -50,7 +51,7 @@ MediaControls::MediaControls(HTMLMediaElement& mediaElement)
: HTMLDivElement(mediaElement.document())
, m_mediaElement(&mediaElement)
, m_panel(nullptr)
- , m_textDisplayContainer(nullptr)
+ , m_textTrackContainer(nullptr)
, m_overlayPlayButton(nullptr)
, m_overlayEnclosure(nullptr)
, m_playButton(nullptr)
@@ -83,7 +84,7 @@ PassRefPtrWillBeRawPtr<MediaControls> MediaControls::create(HTMLMediaElement& me
//
// MediaControls (-webkit-media-controls)
// +-MediaControlOverlayEnclosureElement (-webkit-media-controls-overlay-enclosure)
-// | +-MediaControlTextTrackContainerElement (-webkit-media-text-track-container)
+// | +-TextTrackContainer (-webkit-media-text-track-container)
// | | {when text tracks are enabled}
// | +-MediaControlOverlayPlayButtonElement (-webkit-media-controls-overlay-play-button)
// | | {if mediaControlsOverlayPlayButtonEnabled}
@@ -101,8 +102,8 @@ PassRefPtrWillBeRawPtr<MediaControls> MediaControls::create(HTMLMediaElement& me
// \-MediaControlFullscreenButtonElement (-webkit-media-controls-fullscreen-button)
//
// Most of the structure is built by MediaControls::initializeControls() - the
-// exception being MediaControlTextTrackContainerElement which is added
-// on-demand by MediaControls::createTextTrackDisplay().
+// exception being TextTrackContainer which is added on-demand by
+// MediaControls::textTrackContainer().
void MediaControls::initializeControls()
{
RefPtrWillBeRawPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = MediaControlOverlayEnclosureElement::create(*this);
@@ -516,31 +517,23 @@ bool MediaControls::containsRelatedTarget(Event* event)
return contains(relatedTarget->toNode());
}
-void MediaControls::createTextTrackDisplay()
+TextTrackContainer* MediaControls::textTrackContainer()
{
- if (m_textDisplayContainer)
- return;
-
- RefPtrWillBeRawPtr<MediaControlTextTrackContainerElement> textDisplayContainer = MediaControlTextTrackContainerElement::create(*this);
- m_textDisplayContainer = textDisplayContainer.get();
-
- // Insert it before (behind) all other control elements.
- m_overlayEnclosure->insertBefore(textDisplayContainer.release(), m_overlayEnclosure->firstChild());
-}
+ if (!m_textTrackContainer) {
+ RefPtrWillBeRawPtr<TextTrackContainer> textTrackContainer = TextTrackContainer::create(mediaElement().document());
+ m_textTrackContainer = textTrackContainer.get();
-void MediaControls::updateTextTrackDisplay()
-{
- if (!m_textDisplayContainer)
- createTextTrackDisplay();
-
- m_textDisplayContainer->updateDisplay();
+ // Insert it before (behind) all other control elements.
+ m_overlayEnclosure->insertBefore(textTrackContainer.release(), m_overlayEnclosure->firstChild());
+ }
+ return m_textTrackContainer.get();
}
DEFINE_TRACE(MediaControls)
{
visitor->trace(m_mediaElement);
visitor->trace(m_panel);
- visitor->trace(m_textDisplayContainer);
+ visitor->trace(m_textTrackContainer);
visitor->trace(m_overlayPlayButton);
visitor->trace(m_overlayEnclosure);
visitor->trace(m_playButton);
« no previous file with comments | « Source/core/html/shadow/MediaControls.h ('k') | Source/core/html/track/TextTrackContainer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698