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

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

Issue 77853002: Move VTT functionality from TextTrackCue.* to VTTCue.* (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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
Index: Source/core/html/shadow/MediaControlElements.cpp
diff --git a/Source/core/html/shadow/MediaControlElements.cpp b/Source/core/html/shadow/MediaControlElements.cpp
index be6779c55324872696413abccf8029f093a151b9..a0b67fee661092e71287a6b9fb738a029bb00bbc 100644
--- a/Source/core/html/shadow/MediaControlElements.cpp
+++ b/Source/core/html/shadow/MediaControlElements.cpp
@@ -735,28 +735,33 @@ void MediaControlTextTrackContainerElement::updateDisplay()
if (!cue->track() || !cue->track()->isRendered() || !cue->isActive())
continue;
- RefPtr<TextTrackCueBox> displayBox = cue->getDisplayTree(m_videoDisplaySize.size());
- VTTRegion* region = 0;
- if (cue->track()->regions())
- region = cue->track()->regions()->getRegionById(cue->regionId());
-
- if (!region) {
- // If cue has an empty text track cue region identifier or there is no
- // WebVTT region whose region identifier is identical to cue's text
- // track cue region identifier, run the following substeps:
- if (displayBox->hasChildNodes() && !contains(displayBox.get()))
- // Note: the display tree of a cue is removed when the active flag of the cue is unset.
- appendChild(displayBox);
- } else {
- // Let region be the WebVTT region whose region identifier
- // matches the text track cue region identifier of cue.
- RefPtr<HTMLDivElement> regionNode = region->getDisplayTree(document());
-
- // Append the region to the viewport, if it was not already.
- if (!contains(regionNode.get()))
- appendChild(regionNode);
-
- region->appendTextTrackCueBox(displayBox);
+ if (cue->isVTTCue()) {
acolwell GONE FROM CHROMIUM 2013/11/20 18:38:45 It feels like this logic should be inside VTTCue.
gasubic 2013/11/21 03:07:38 Done
+ RefPtr<TextTrackCueBox> displayBox = cue->getDisplayTree(m_videoDisplaySize.size());
+ VTTRegion* region = 0;
+ if (cue->track()->regions()) {
+ VTTCue* vttCue = toVTTCue(cue);
+ region = cue->track()->regions()->getRegionById(vttCue->regionId());
+ }
+
+ if (!region) {
+ // If cue has an empty text track cue region identifier or there is no
+ // WebVTT region whose region identifier is identical to cue's text
+ // track cue region identifier, run the following substeps:
+ if (displayBox->hasChildNodes() && !contains(displayBox.get())) {
+ // Note: the display tree of a cue is removed when the active flag of the cue is unset.
+ appendChild(displayBox);
+ }
+ } else {
+ // Let region be the WebVTT region whose region identifier
+ // matches the text track cue region identifier of cue.
+ RefPtr<HTMLDivElement> regionNode = region->getDisplayTree(document());
+
+ // Append the region to the viewport, if it was not already.
+ if (!contains(regionNode.get()))
+ appendChild(regionNode);
+
+ region->appendTextTrackCueBox(displayBox);
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698