Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 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 |
| 77 // 4. If the user agent is exposing a user interface for video, add to | 76 // 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 | 77 // output one or more completely transparent positioned CSS block boxes that |
| 79 // cover the same region as the user interface. | 78 // cover the same region as the user interface. |
| 80 | 79 |
| 81 // 5. If the last time these rules were run, the user agent was not exposing | 80 // 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, | 81 // a user interface for video, but now it is, let reset be true. Otherwise, |
| 83 // let reset be false. | 82 // let reset be false. |
| 84 | 83 |
| 85 // There is nothing to be done explicitly for 4th and 5th steps, as | 84 // 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 | 85 |
| 89 // 6. Let tracks be the subset of video's list of text tracks that have as | 86 // 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 | 87 // 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 | 88 // updating the display of WebVTT text tracks, and whose text track mode is |
| 92 // showing or showing by default. | 89 // showing or showing by default. |
| 93 // 7. Let cues be an empty list of text track cues. | 90 // 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 | 91 // 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. | 92 // track's list of cues that have their text track cue active flag set. |
| 96 const CueList& activeCues = video.cueTimeline().currentlyActiveCues(); | 93 const CueList& activeCues = video.cueTimeline().currentlyActiveCues(); |
| 97 | 94 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 111 TextTrackCue* cue = activeCues[i].data(); | 108 TextTrackCue* cue = activeCues[i].data(); |
| 112 | 109 |
| 113 ASSERT(cue->isActive()); | 110 ASSERT(cue->isActive()); |
| 114 if (!cue->track() || !cue->track()->isRendered() || !cue->isActive()) | 111 if (!cue->track() || !cue->track()->isRendered() || !cue->isActive()) |
| 115 continue; | 112 continue; |
| 116 | 113 |
| 117 cue->updateDisplay(*this); | 114 cue->updateDisplay(*this); |
| 118 cue->updatePastAndFutureNodes(movieTime); | 115 cue->updatePastAndFutureNodes(movieTime); |
| 119 } | 116 } |
| 120 | 117 |
| 121 // 11. Return output. | 118 // 11. Return output. |
|
sof
2015/03/20 08:02:14
Unmoored comment.
philipj_slow
2015/03/20 15:26:11
Thanks, I have added two comments explaining why t
| |
| 122 if (hasChildren()) | |
| 123 removeInlineStyleProperty(CSSPropertyDisplay); | |
| 124 else | |
| 125 setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); | |
| 126 } | 119 } |
| 127 | 120 |
| 128 } // namespace blink | 121 } // namespace blink |
| OLD | NEW |