Index: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
index e200c3874e32a3d1206fbff9d60d5c385760297f..951bf30410c87870446c7606ea6ccb1a48457529 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
@@ -3636,20 +3636,30 @@ bool HTMLMediaElement::TextTracksVisible() const { |
return text_tracks_visible_; |
} |
-static void AssertShadowRootChildren(ShadowRoot& shadow_root) { |
+// static |
+void HTMLMediaElement::AssertShadowRootChildren(ShadowRoot& shadow_root) { |
#if DCHECK_IS_ON() |
// There can be up to two children, either or both of the text |
liberato (no reviews please)
2017/04/12 21:57:44
s/two/three/
xjz
2017/04/13 00:08:48
Done. Also rewrite the comment. I missed this afte
|
// track container and media controls. If both are present, the |
// text track container must be the first child. |
unsigned number_of_children = shadow_root.CountChildren(); |
- DCHECK_LE(number_of_children, 2u); |
+ DCHECK_LE(number_of_children, 3u); |
Node* first_child = shadow_root.FirstChild(); |
Node* last_child = shadow_root.LastChild(); |
if (number_of_children == 1) { |
DCHECK(first_child->IsTextTrackContainer() || |
- first_child->IsMediaControls()); |
+ first_child->IsMediaControls() || |
+ first_child->IsMediaRemotingInterstitial()); |
} else if (number_of_children == 2) { |
- DCHECK(first_child->IsTextTrackContainer()); |
+ DCHECK(first_child->IsTextTrackContainer() || |
+ first_child->IsMediaRemotingInterstitial()); |
+ DCHECK(last_child->IsTextTrackContainer() || last_child->IsMediaControls()); |
+ if (first_child->IsTextTrackContainer()) |
+ DCHECK(last_child->IsMediaControls()); |
+ } else if (number_of_children == 3) { |
+ Node* second_child = first_child->nextSibling(); |
+ DCHECK(first_child->IsMediaRemotingInterstitial()); |
+ DCHECK(second_child->IsTextTrackContainer()); |
DCHECK(last_child->IsMediaControls()); |
} |
#endif |
@@ -3662,12 +3672,20 @@ TextTrackContainer& HTMLMediaElement::EnsureTextTrackContainer() { |
Node* first_child = shadow_root.FirstChild(); |
if (first_child && first_child->IsTextTrackContainer()) |
return ToTextTrackContainer(*first_child); |
+ Node* to_be_inserted = first_child; |
+ |
+ if (first_child && first_child->IsMediaRemotingInterstitial()) { |
+ Node* second_child = first_child->nextSibling(); |
+ if (second_child && second_child->IsTextTrackContainer()) |
+ return ToTextTrackContainer(*second_child); |
+ to_be_inserted = second_child; |
+ } |
TextTrackContainer* text_track_container = TextTrackContainer::Create(*this); |
// The text track container should be inserted before the media controls, |
// so that they are rendered behind them. |
- shadow_root.InsertBefore(text_track_container, first_child); |
+ shadow_root.InsertBefore(text_track_container, to_be_inserted); |
AssertShadowRootChildren(shadow_root); |