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

Unified Diff: Source/core/html/shadow/MediaControlElements.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/MediaControlElements.h ('k') | Source/core/html/shadow/MediaControls.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/shadow/MediaControlElements.cpp
diff --git a/Source/core/html/shadow/MediaControlElements.cpp b/Source/core/html/shadow/MediaControlElements.cpp
index 0df9105e67e42169e8bac21e6c60e19ad58172f7..ee622ee2f1a88a96a48112a0ced859d6c182be91 100644
--- a/Source/core/html/shadow/MediaControlElements.cpp
+++ b/Source/core/html/shadow/MediaControlElements.cpp
@@ -40,12 +40,7 @@
#include "core/html/MediaController.h"
#include "core/html/TimeRanges.h"
#include "core/html/shadow/MediaControls.h"
-#include "core/html/track/CueTimeline.h"
-#include "core/html/track/TextTrack.h"
-#include "core/html/track/TextTrackCue.h"
-#include "core/html/track/vtt/VTTRegionList.h"
#include "core/layout/LayoutSlider.h"
-#include "core/layout/LayoutTextTrackContainerElement.h"
#include "core/layout/LayoutTheme.h"
#include "core/layout/LayoutVideo.h"
#include "core/page/EventHandler.h"
@@ -603,118 +598,4 @@ PassRefPtrWillBeRawPtr<MediaControlCurrentTimeDisplayElement> MediaControlCurren
return element.release();
}
-// ----------------------------
-
-MediaControlTextTrackContainerElement::MediaControlTextTrackContainerElement(MediaControls& mediaControls)
- : MediaControlDivElement(mediaControls, MediaTextTrackDisplayContainer)
- , m_fontSize(0)
-{
-}
-
-PassRefPtrWillBeRawPtr<MediaControlTextTrackContainerElement> MediaControlTextTrackContainerElement::create(MediaControls& mediaControls)
-{
- RefPtrWillBeRawPtr<MediaControlTextTrackContainerElement> element = adoptRefWillBeNoop(new MediaControlTextTrackContainerElement(mediaControls));
- element->setShadowPseudoId(AtomicString("-webkit-media-text-track-container", AtomicString::ConstructFromLiteral));
- element->hide();
- return element.release();
-}
-
-LayoutObject* MediaControlTextTrackContainerElement::createLayoutObject(const LayoutStyle&)
-{
- return new LayoutTextTrackContainerElement(this);
-}
-
-void MediaControlTextTrackContainerElement::updateDisplay()
-{
- if (!mediaElement().closedCaptionsVisible()) {
- removeChildren();
- return;
- }
-
- // 1. If the media element is an audio element, or is another playback
- // mechanism with no rendering area, abort these steps. There is nothing to
- // render.
- if (isHTMLAudioElement(mediaElement()))
- return;
-
- // 2. Let video be the media element or other playback mechanism.
- HTMLVideoElement& video = toHTMLVideoElement(mediaElement());
-
- // 3. Let output be an empty list of absolutely positioned CSS block boxes.
-
- // 4. If the user agent is exposing a user interface for video, add to
- // output one or more completely transparent positioned CSS block boxes that
- // cover the same region as the user interface.
-
- // 5. If the last time these rules were run, the user agent was not exposing
- // a user interface for video, but now it is, let reset be true. Otherwise,
- // let reset be false.
-
- // There is nothing to be done explicitly for 4th and 5th steps, as
- // everything is handled through CSS. The caption box is on top of the
- // controls box, in a container set with the -webkit-box display property.
-
- // 6. Let tracks be the subset of video's list of text tracks that have as
- // their rules for updating the text track rendering these rules for
- // updating the display of WebVTT text tracks, and whose text track mode is
- // showing or showing by default.
- // 7. Let cues be an empty list of text track cues.
- // 8. For each track track in tracks, append to cues all the cues from
- // track's list of cues that have their text track cue active flag set.
- CueList activeCues = video.cueTimeline().currentlyActiveCues();
-
- // 9. If reset is false, then, for each text track cue cue in cues: if cue's
- // text track cue display state has a set of CSS boxes, then add those boxes
- // to output, and remove cue from cues.
-
- // There is nothing explicitly to be done here, as all the caching occurs
- // within the TextTrackCue instance itself. If parameters of the cue change,
- // the display tree is cleared.
-
- // 10. For each text track cue cue in cues that has not yet had
- // corresponding CSS boxes added to output, in text track cue order, run the
- // following substeps:
- for (size_t i = 0; i < activeCues.size(); ++i) {
- TextTrackCue* cue = activeCues[i].data();
-
- ASSERT(cue->isActive());
- if (!cue->track() || !cue->track()->isRendered() || !cue->isActive())
- continue;
-
- cue->updateDisplay(*this);
- }
-
- // 11. Return output.
- if (hasChildren())
- show();
- else
- hide();
-}
-
-void MediaControlTextTrackContainerElement::updateSizes()
-{
- if (!document().isActive())
- return;
-
- IntRect videoBox;
-
- if (!mediaElement().layoutObject() || !mediaElement().layoutObject()->isVideo())
- return;
- videoBox = toLayoutVideo(mediaElement().layoutObject())->videoBox();
-
- if (m_videoDisplaySize == videoBox)
- return;
- m_videoDisplaySize = videoBox;
-
- float smallestDimension = std::min(m_videoDisplaySize.size().height(), m_videoDisplaySize.size().width());
-
- float fontSize = smallestDimension * 0.05f;
- if (fontSize != m_fontSize) {
- m_fontSize = fontSize;
- setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue::CSS_PX);
- }
-}
-
-// ----------------------------
-
} // namespace blink
« no previous file with comments | « Source/core/html/shadow/MediaControlElements.h ('k') | Source/core/html/shadow/MediaControls.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698