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

Side by Side Diff: Source/core/html/track/TextTrackContainer.cpp

Issue 949203002: Separate the text track container from the media controls (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: address nits 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/shadow/MediaControls.cpp ('k') | Source/core/layout/LayoutMedia.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 27 matching lines...) Expand all
38 38
39 TextTrackContainer::TextTrackContainer(Document& document) 39 TextTrackContainer::TextTrackContainer(Document& document)
40 : HTMLDivElement(document) 40 : HTMLDivElement(document)
41 { 41 {
42 } 42 }
43 43
44 PassRefPtrWillBeRawPtr<TextTrackContainer> TextTrackContainer::create(Document& document) 44 PassRefPtrWillBeRawPtr<TextTrackContainer> TextTrackContainer::create(Document& document)
45 { 45 {
46 RefPtrWillBeRawPtr<TextTrackContainer> element = adoptRefWillBeNoop(new Text TrackContainer(document)); 46 RefPtrWillBeRawPtr<TextTrackContainer> element = adoptRefWillBeNoop(new Text TrackContainer(document));
47 element->setShadowPseudoId(AtomicString("-webkit-media-text-track-container" , AtomicString::ConstructFromLiteral)); 47 element->setShadowPseudoId(AtomicString("-webkit-media-text-track-container" , AtomicString::ConstructFromLiteral));
48 element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone);
49 return element.release(); 48 return element.release();
50 } 49 }
51 50
52 LayoutObject* TextTrackContainer::createLayoutObject(const LayoutStyle&) 51 LayoutObject* TextTrackContainer::createLayoutObject(const LayoutStyle&)
53 { 52 {
54 return new LayoutTextTrackContainer(this); 53 return new LayoutTextTrackContainer(this);
55 } 54 }
56 55
57 void TextTrackContainer::updateDisplay(HTMLMediaElement& mediaElement) 56 void TextTrackContainer::updateDisplay(HTMLMediaElement& mediaElement)
58 { 57 {
59 if (!mediaElement.closedCaptionsVisible()) { 58 if (!mediaElement.closedCaptionsVisible()) {
60 removeChildren(); 59 removeChildren();
61 return; 60 return;
62 } 61 }
63 62
64 // http://dev.w3.org/html5/webvtt/#dfn-rules-for-updating-the-display-of-web vtt-text-tracks 63 // http://dev.w3.org/html5/webvtt/#dfn-rules-for-updating-the-display-of-web vtt-text-tracks
65 64
66 // 1. If the media element is an audio element, or is another playback 65 // 1. If the media element is an audio element, or is another playback
67 // mechanism with no rendering area, abort these steps. There is nothing to 66 // mechanism with no rendering area, abort these steps. There is nothing to
68 // render. 67 // render.
69 if (isHTMLAudioElement(mediaElement)) 68 if (isHTMLAudioElement(mediaElement))
70 return; 69 return;
71 70
72 // 2. Let video be the media element or other playback mechanism. 71 // 2. Let video be the media element or other playback mechanism.
73 HTMLVideoElement& video = toHTMLVideoElement(mediaElement); 72 HTMLVideoElement& video = toHTMLVideoElement(mediaElement);
74 73
75 // 3. Let output be an empty list of absolutely positioned CSS block boxes. 74 // 3. Let output be an empty list of absolutely positioned CSS block boxes.
76 75
76 // Note: This is a layout algorithm, expressed terms of appending CSS block
77 // boxes to output, and the "apply WebVTT cue settings" part is implemented
78 // in LayoutVTTCue. Here we merely create the DOM tree from which the layout
79 // tree is built and append it to this TextTrackContainer.
80
77 // 4. If the user agent is exposing a user interface for video, add to 81 // 4. If the user agent is exposing a user interface for video, add to
78 // output one or more completely transparent positioned CSS block boxes that 82 // output one or more completely transparent positioned CSS block boxes that
79 // cover the same region as the user interface. 83 // cover the same region as the user interface.
80 84
81 // 5. If the last time these rules were run, the user agent was not exposing 85 // 5. If the last time these rules were run, the user agent was not exposing
82 // a user interface for video, but now it is, let reset be true. Otherwise, 86 // a user interface for video, but now it is, let reset be true. Otherwise,
83 // let reset be false. 87 // let reset be false.
84 88
85 // There is nothing to be done explicitly for 4th and 5th steps, as 89 // TODO(philipj): Implement step 4 and 5.
86 // everything is handled through CSS. The caption box is on top of the
87 // controls box, in a container set with the -webkit-box display property.
88 90
89 // 6. Let tracks be the subset of video's list of text tracks that have as 91 // 6. Let tracks be the subset of video's list of text tracks that have as
90 // their rules for updating the text track rendering these rules for 92 // their rules for updating the text track rendering these rules for
91 // updating the display of WebVTT text tracks, and whose text track mode is 93 // updating the display of WebVTT text tracks, and whose text track mode is
92 // showing or showing by default. 94 // showing or showing by default.
93 // 7. Let cues be an empty list of text track cues. 95 // 7. Let cues be an empty list of text track cues.
94 // 8. For each track track in tracks, append to cues all the cues from 96 // 8. For each track track in tracks, append to cues all the cues from
95 // track's list of cues that have their text track cue active flag set. 97 // track's list of cues that have their text track cue active flag set.
96 const CueList& activeCues = video.cueTimeline().currentlyActiveCues(); 98 const CueList& activeCues = video.cueTimeline().currentlyActiveCues();
97 99
(...skipping 14 matching lines...) Expand all
112 114
113 ASSERT(cue->isActive()); 115 ASSERT(cue->isActive());
114 if (!cue->track() || !cue->track()->isRendered() || !cue->isActive()) 116 if (!cue->track() || !cue->track()->isRendered() || !cue->isActive())
115 continue; 117 continue;
116 118
117 cue->updateDisplay(*this); 119 cue->updateDisplay(*this);
118 cue->updatePastAndFutureNodes(movieTime); 120 cue->updatePastAndFutureNodes(movieTime);
119 } 121 }
120 122
121 // 11. Return output. 123 // 11. Return output.
122 if (hasChildren()) 124 // See the note for step 3 for why there is no output to return.
123 removeInlineStyleProperty(CSSPropertyDisplay);
124 else
125 setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone);
126 } 125 }
127 126
128 } // namespace blink 127 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/shadow/MediaControls.cpp ('k') | Source/core/layout/LayoutMedia.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698