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 3414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3425 | 3425 |
3426 return false; | 3426 return false; |
3427 } | 3427 } |
3428 | 3428 |
3429 bool HTMLMediaElement::isFullscreen() const { | 3429 bool HTMLMediaElement::isFullscreen() const { |
3430 return Fullscreen::isFullscreenElement(*this); | 3430 return Fullscreen::isFullscreenElement(*this); |
3431 } | 3431 } |
3432 | 3432 |
3433 void HTMLMediaElement::didEnterFullscreen() { | 3433 void HTMLMediaElement::didEnterFullscreen() { |
3434 configureMediaControls(); | 3434 configureMediaControls(); |
3435 if (mediaControls()) | |
3436 mediaControls()->enteredFullscreen(); | |
3437 // FIXME: There is no embedder-side handling in layout test mode. | 3435 // FIXME: There is no embedder-side handling in layout test mode. |
3438 if (webMediaPlayer() && !LayoutTestSupport::isRunningLayoutTest()) | 3436 if (webMediaPlayer() && !LayoutTestSupport::isRunningLayoutTest()) |
3439 webMediaPlayer()->enteredFullscreen(); | 3437 webMediaPlayer()->enteredFullscreen(); |
3440 // Cache this in case the player is destroyed before leaving fullscreen. | 3438 // Cache this in case the player is destroyed before leaving fullscreen. |
3441 m_inOverlayFullscreenVideo = usesOverlayFullscreenVideo(); | 3439 m_inOverlayFullscreenVideo = usesOverlayFullscreenVideo(); |
3442 if (m_inOverlayFullscreenVideo) | 3440 if (m_inOverlayFullscreenVideo) |
3443 document().layoutViewItem().compositor()->setNeedsCompositingUpdate( | 3441 document().layoutViewItem().compositor()->setNeedsCompositingUpdate( |
3444 CompositingUpdateRebuildTree); | 3442 CompositingUpdateRebuildTree); |
3445 } | 3443 } |
3446 | 3444 |
3447 void HTMLMediaElement::didExitFullscreen() { | 3445 void HTMLMediaElement::didExitFullscreen() { |
3448 configureMediaControls(); | 3446 configureMediaControls(); |
3449 if (mediaControls()) | |
3450 mediaControls()->exitedFullscreen(); | |
3451 if (webMediaPlayer()) | 3447 if (webMediaPlayer()) |
3452 webMediaPlayer()->exitedFullscreen(); | 3448 webMediaPlayer()->exitedFullscreen(); |
3453 if (m_inOverlayFullscreenVideo) | 3449 if (m_inOverlayFullscreenVideo) |
3454 document().layoutViewItem().compositor()->setNeedsCompositingUpdate( | 3450 document().layoutViewItem().compositor()->setNeedsCompositingUpdate( |
3455 CompositingUpdateRebuildTree); | 3451 CompositingUpdateRebuildTree); |
3456 m_inOverlayFullscreenVideo = false; | 3452 m_inOverlayFullscreenVideo = false; |
3457 } | 3453 } |
3458 | 3454 |
3459 WebLayer* HTMLMediaElement::platformLayer() const { | 3455 WebLayer* HTMLMediaElement::platformLayer() const { |
3460 return m_webLayer; | 3456 return m_webLayer; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3615 } | 3611 } |
3616 | 3612 |
3617 return nullptr; | 3613 return nullptr; |
3618 } | 3614 } |
3619 | 3615 |
3620 void HTMLMediaElement::ensureMediaControls() { | 3616 void HTMLMediaElement::ensureMediaControls() { |
3621 if (mediaControls()) | 3617 if (mediaControls()) |
3622 return; | 3618 return; |
3623 | 3619 |
3624 MediaControls* mediaControls = MediaControls::create(*this); | 3620 MediaControls* mediaControls = MediaControls::create(*this); |
3625 | |
3626 mediaControls->reset(); | 3621 mediaControls->reset(); |
3627 if (isFullscreen()) | |
3628 mediaControls->enteredFullscreen(); | |
3629 | 3622 |
3630 ShadowRoot& shadowRoot = ensureUserAgentShadowRoot(); | 3623 ShadowRoot& shadowRoot = ensureUserAgentShadowRoot(); |
3631 assertShadowRootChildren(shadowRoot); | 3624 assertShadowRootChildren(shadowRoot); |
3632 | 3625 |
3633 // The media controls should be inserted after the text track container, | 3626 // The media controls should be inserted after the text track container, |
3634 // so that they are rendered in front of captions and subtitles. | 3627 // so that they are rendered in front of captions and subtitles. |
3635 shadowRoot.appendChild(mediaControls); | 3628 shadowRoot.appendChild(mediaControls); |
3636 | 3629 |
3637 assertShadowRootChildren(shadowRoot); | 3630 assertShadowRootChildren(shadowRoot); |
3638 | 3631 |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4119 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); | 4112 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); |
4120 } | 4113 } |
4121 | 4114 |
4122 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { | 4115 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { |
4123 m_mostlyFillingViewport = true; | 4116 m_mostlyFillingViewport = true; |
4124 if (m_webMediaPlayer) | 4117 if (m_webMediaPlayer) |
4125 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); | 4118 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); |
4126 } | 4119 } |
4127 | 4120 |
4128 } // namespace blink | 4121 } // namespace blink |
OLD | NEW |