| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights | 2  * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights | 
| 3  * reserved. | 3  * 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  * 1. Redistributions of source code must retain the above copyright | 8  * 1. Redistributions of source code must retain the above copyright | 
| 9  *    notice, this list of conditions and the following disclaimer. | 9  *    notice, this list of conditions and the following disclaimer. | 
| 10  * 2. Redistributions in binary form must reproduce the above copyright | 10  * 2. Redistributions in binary form must reproduce the above copyright | 
| (...skipping 3544 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3555       return true; | 3555       return true; | 
| 3556   } | 3556   } | 
| 3557 | 3557 | 
| 3558   return false; | 3558   return false; | 
| 3559 } | 3559 } | 
| 3560 | 3560 | 
| 3561 bool HTMLMediaElement::textTracksVisible() const { | 3561 bool HTMLMediaElement::textTracksVisible() const { | 
| 3562   return m_textTracksVisible; | 3562   return m_textTracksVisible; | 
| 3563 } | 3563 } | 
| 3564 | 3564 | 
| 3565 static void assertShadowRootChildren(ShadowRoot& shadowRoot) { | 3565 // static | 
|  | 3566 void HTMLMediaElement::assertShadowRootChildren(ShadowRoot& shadowRoot) { | 
| 3566 #if DCHECK_IS_ON() | 3567 #if DCHECK_IS_ON() | 
| 3567   // There can be up to two children, either or both of the text | 3568   // There can be up to three children: media remoting interstitial, text track | 
| 3568   // track container and media controls. If both are present, the | 3569   // container, media controls. The mediaControls has to be the last child if | 
| 3569   // text track container must be the first child. | 3570   // present, and has to be the next sibling of the text track container if both | 
|  | 3571   // present. | 
| 3570   unsigned numberOfChildren = shadowRoot.countChildren(); | 3572   unsigned numberOfChildren = shadowRoot.countChildren(); | 
| 3571   DCHECK_LE(numberOfChildren, 2u); | 3573   DCHECK_LE(numberOfChildren, 3u); | 
| 3572   Node* firstChild = shadowRoot.firstChild(); | 3574   Node* firstChild = shadowRoot.firstChild(); | 
| 3573   Node* lastChild = shadowRoot.lastChild(); | 3575   Node* lastChild = shadowRoot.lastChild(); | 
| 3574   if (numberOfChildren == 1) { | 3576   if (numberOfChildren == 1) { | 
| 3575     DCHECK(firstChild->isTextTrackContainer() || firstChild->isMediaControls()); | 3577     DCHECK(firstChild->isTextTrackContainer() || | 
|  | 3578            firstChild->isMediaControls() || | 
|  | 3579            firstChild->isMediaRemotingInterstitial()); | 
| 3576   } else if (numberOfChildren == 2) { | 3580   } else if (numberOfChildren == 2) { | 
| 3577     DCHECK(firstChild->isTextTrackContainer()); | 3581     DCHECK(firstChild->isTextTrackContainer() || | 
|  | 3582            firstChild->isMediaRemotingInterstitial()); | 
|  | 3583     DCHECK(lastChild->isTextTrackContainer() || lastChild->isMediaControls()); | 
|  | 3584     if (firstChild->isTextTrackContainer()) | 
|  | 3585       DCHECK(lastChild->isMediaControls()); | 
|  | 3586   } else if (numberOfChildren == 3) { | 
|  | 3587     Node* secondChild = firstChild->nextSibling(); | 
|  | 3588     DCHECK(firstChild->isMediaRemotingInterstitial()); | 
|  | 3589     DCHECK(secondChild->isTextTrackContainer()); | 
| 3578     DCHECK(lastChild->isMediaControls()); | 3590     DCHECK(lastChild->isMediaControls()); | 
| 3579   } | 3591   } | 
| 3580 #endif | 3592 #endif | 
| 3581 } | 3593 } | 
| 3582 | 3594 | 
| 3583 TextTrackContainer& HTMLMediaElement::ensureTextTrackContainer() { | 3595 TextTrackContainer& HTMLMediaElement::ensureTextTrackContainer() { | 
| 3584   ShadowRoot& shadowRoot = ensureUserAgentShadowRoot(); | 3596   ShadowRoot& shadowRoot = ensureUserAgentShadowRoot(); | 
| 3585   assertShadowRootChildren(shadowRoot); | 3597   assertShadowRootChildren(shadowRoot); | 
| 3586 | 3598 | 
| 3587   Node* firstChild = shadowRoot.firstChild(); | 3599   Node* firstChild = shadowRoot.firstChild(); | 
| 3588   if (firstChild && firstChild->isTextTrackContainer()) | 3600   if (firstChild && firstChild->isTextTrackContainer()) | 
| 3589     return toTextTrackContainer(*firstChild); | 3601     return toTextTrackContainer(*firstChild); | 
|  | 3602   Node* toBeInsertedBefore = firstChild; | 
|  | 3603 | 
|  | 3604   if (firstChild->isMediaRemotingInterstitial()) { | 
|  | 3605     Node* secondChild = firstChild->nextSibling(); | 
|  | 3606     if (secondChild && secondChild->isTextTrackContainer()) | 
|  | 3607       return toTextTrackContainer(*secondChild); | 
|  | 3608     toBeInsertedBefore = secondChild; | 
|  | 3609   } | 
| 3590 | 3610 | 
| 3591   TextTrackContainer* textTrackContainer = | 3611   TextTrackContainer* textTrackContainer = | 
| 3592       TextTrackContainer::create(document()); | 3612       TextTrackContainer::create(document()); | 
| 3593 | 3613 | 
| 3594   // The text track container should be inserted before the media controls, | 3614   // The text track container should be inserted before the media controls, | 
| 3595   // so that they are rendered behind them. | 3615   // so that they are rendered behind them. | 
| 3596   shadowRoot.insertBefore(textTrackContainer, firstChild); | 3616   shadowRoot.insertBefore(textTrackContainer, toBeInsertedBefore); | 
| 3597 | 3617 | 
| 3598   assertShadowRootChildren(shadowRoot); | 3618   assertShadowRootChildren(shadowRoot); | 
| 3599 | 3619 | 
| 3600   return *textTrackContainer; | 3620   return *textTrackContainer; | 
| 3601 } | 3621 } | 
| 3602 | 3622 | 
| 3603 void HTMLMediaElement::updateTextTrackDisplay() { | 3623 void HTMLMediaElement::updateTextTrackDisplay() { | 
| 3604   BLINK_MEDIA_LOG << "updateTextTrackDisplay(" << (void*)this << ")"; | 3624   BLINK_MEDIA_LOG << "updateTextTrackDisplay(" << (void*)this << ")"; | 
| 3605 | 3625 | 
| 3606   ensureTextTrackContainer().updateDisplay( | 3626   ensureTextTrackContainer().updateDisplay( | 
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4192       kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); | 4212       kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); | 
| 4193 } | 4213 } | 
| 4194 | 4214 | 
| 4195 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { | 4215 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { | 
| 4196   m_mostlyFillingViewport = true; | 4216   m_mostlyFillingViewport = true; | 
| 4197   if (m_webMediaPlayer) | 4217   if (m_webMediaPlayer) | 
| 4198     m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); | 4218     m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); | 
| 4199 } | 4219 } | 
| 4200 | 4220 | 
| 4201 }  // namespace blink | 4221 }  // namespace blink | 
| OLD | NEW | 
|---|