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

Unified Diff: Source/core/html/track/TextTrackContainer.cpp

Issue 1018593004: Implement <video controls> dodging for text track layout (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ready for review 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
Index: Source/core/html/track/TextTrackContainer.cpp
diff --git a/Source/core/html/track/TextTrackContainer.cpp b/Source/core/html/track/TextTrackContainer.cpp
index c5d0b2e5d0e751f9de6f1dbfbf4ce0d7f5efbb70..5fc85742859ed123f671bc9d7aef2da504efcb30 100644
--- a/Source/core/html/track/TextTrackContainer.cpp
+++ b/Source/core/html/track/TextTrackContainer.cpp
@@ -53,7 +53,7 @@ LayoutObject* TextTrackContainer::createLayoutObject(const LayoutStyle&)
return new LayoutTextTrackContainer(this);
}
-void TextTrackContainer::updateDisplay(HTMLMediaElement& mediaElement)
+void TextTrackContainer::updateDisplay(HTMLMediaElement& mediaElement, ExposingControls exposingControls)
{
if (!mediaElement.closedCaptionsVisible()) {
removeChildren();
@@ -77,11 +77,13 @@ void TextTrackContainer::updateDisplay(HTMLMediaElement& mediaElement)
// 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.
+ // Note: Overlap checking for the controls is implemented in LayoutVTTCue
+ // without a placeholder box (element or layout object).
- // TODO(philipj): Implement step 4 and 5.
+ // 5. If the last time these rules were run, the user agent was not exposing
+ // a user interface for video, but now it is, optionally let reset be true.
+ // Otherwise, let reset be false.
+ bool reset = exposingControls == DidStartExposingControls;
// 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
@@ -96,9 +98,11 @@ void TextTrackContainer::updateDisplay(HTMLMediaElement& mediaElement)
// 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.
+ // Note: Removing all children will cause them to be re-inserted below,
+ // invalidating the layout.
+ // effect
+ if (reset)
+ removeChildren();
// 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

Powered by Google App Engine
This is Rietveld 408576698