OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 , m_haveFiredLoadedData(false) | 247 , m_haveFiredLoadedData(false) |
248 , m_inActiveDocument(true) | 248 , m_inActiveDocument(true) |
249 , m_autoplaying(true) | 249 , m_autoplaying(true) |
250 , m_muted(false) | 250 , m_muted(false) |
251 , m_paused(true) | 251 , m_paused(true) |
252 , m_seeking(false) | 252 , m_seeking(false) |
253 , m_sentStalledEvent(false) | 253 , m_sentStalledEvent(false) |
254 , m_sentEndEvent(false) | 254 , m_sentEndEvent(false) |
255 , m_pausedInternal(false) | 255 , m_pausedInternal(false) |
256 , m_sendProgressEvents(true) | 256 , m_sendProgressEvents(true) |
257 , m_isFullscreen(false) | |
258 , m_closedCaptionsVisible(false) | 257 , m_closedCaptionsVisible(false) |
259 , m_dispatchingCanPlayEvent(false) | 258 , m_dispatchingCanPlayEvent(false) |
260 , m_loadInitiatedByUserGesture(false) | 259 , m_loadInitiatedByUserGesture(false) |
261 , m_completelyLoaded(false) | 260 , m_completelyLoaded(false) |
262 , m_havePreparedToPlay(false) | 261 , m_havePreparedToPlay(false) |
263 , m_parsingInProgress(createdByParser) | 262 , m_parsingInProgress(createdByParser) |
264 , m_tracksAreReady(true) | 263 , m_tracksAreReady(true) |
265 , m_haveVisibleTextTrack(false) | 264 , m_haveVisibleTextTrack(false) |
266 , m_processingPreferenceChange(false) | 265 , m_processingPreferenceChange(false) |
267 , m_lastTextTrackUpdateTime(-1) | 266 , m_lastTextTrackUpdateTime(-1) |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 else if (name == onstalledAttr) | 426 else if (name == onstalledAttr) |
428 setAttributeEventListener(eventNames().stalledEvent, createAttributeEven
tListener(this, name, value)); | 427 setAttributeEventListener(eventNames().stalledEvent, createAttributeEven
tListener(this, name, value)); |
429 else if (name == onsuspendAttr) | 428 else if (name == onsuspendAttr) |
430 setAttributeEventListener(eventNames().suspendEvent, createAttributeEven
tListener(this, name, value)); | 429 setAttributeEventListener(eventNames().suspendEvent, createAttributeEven
tListener(this, name, value)); |
431 else if (name == ontimeupdateAttr) | 430 else if (name == ontimeupdateAttr) |
432 setAttributeEventListener(eventNames().timeupdateEvent, createAttributeE
ventListener(this, name, value)); | 431 setAttributeEventListener(eventNames().timeupdateEvent, createAttributeE
ventListener(this, name, value)); |
433 else if (name == onvolumechangeAttr) | 432 else if (name == onvolumechangeAttr) |
434 setAttributeEventListener(eventNames().volumechangeEvent, createAttribut
eEventListener(this, name, value)); | 433 setAttributeEventListener(eventNames().volumechangeEvent, createAttribut
eEventListener(this, name, value)); |
435 else if (name == onwaitingAttr) | 434 else if (name == onwaitingAttr) |
436 setAttributeEventListener(eventNames().waitingEvent, createAttributeEven
tListener(this, name, value)); | 435 setAttributeEventListener(eventNames().waitingEvent, createAttributeEven
tListener(this, name, value)); |
437 else if (name == onwebkitbeginfullscreenAttr) | |
438 setAttributeEventListener(eventNames().webkitbeginfullscreenEvent, creat
eAttributeEventListener(this, name, value)); | |
439 else if (name == onwebkitendfullscreenAttr) | |
440 setAttributeEventListener(eventNames().webkitendfullscreenEvent, createA
ttributeEventListener(this, name, value)); | |
441 else | 436 else |
442 HTMLElement::parseAttribute(name, value); | 437 HTMLElement::parseAttribute(name, value); |
443 } | 438 } |
444 | 439 |
445 void HTMLMediaElement::finishParsingChildren() | 440 void HTMLMediaElement::finishParsingChildren() |
446 { | 441 { |
447 HTMLElement::finishParsingChildren(); | 442 HTMLElement::finishParsingChildren(); |
448 m_parsingInProgress = false; | 443 m_parsingInProgress = false; |
449 | 444 |
450 if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled()) | 445 if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled()) |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 return InsertionDone; | 485 return InsertionDone; |
491 } | 486 } |
492 | 487 |
493 void HTMLMediaElement::removedFrom(ContainerNode* insertionPoint) | 488 void HTMLMediaElement::removedFrom(ContainerNode* insertionPoint) |
494 { | 489 { |
495 if (insertionPoint->inDocument()) { | 490 if (insertionPoint->inDocument()) { |
496 LOG(Media, "HTMLMediaElement::removedFromDocument"); | 491 LOG(Media, "HTMLMediaElement::removedFromDocument"); |
497 configureMediaControls(); | 492 configureMediaControls(); |
498 if (m_networkState > NETWORK_EMPTY) | 493 if (m_networkState > NETWORK_EMPTY) |
499 pause(); | 494 pause(); |
500 if (m_isFullscreen) | |
501 exitFullscreen(); | |
502 } | 495 } |
503 | 496 |
504 HTMLElement::removedFrom(insertionPoint); | 497 HTMLElement::removedFrom(insertionPoint); |
505 } | 498 } |
506 | 499 |
507 void HTMLMediaElement::attach() | 500 void HTMLMediaElement::attach() |
508 { | 501 { |
509 ASSERT(!attached()); | 502 ASSERT(!attached()); |
510 | 503 |
511 HTMLElement::attach(); | 504 HTMLElement::attach(); |
(...skipping 3184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3696 } | 3689 } |
3697 | 3690 |
3698 bool HTMLMediaElement::canSuspend() const | 3691 bool HTMLMediaElement::canSuspend() const |
3699 { | 3692 { |
3700 return true; | 3693 return true; |
3701 } | 3694 } |
3702 | 3695 |
3703 void HTMLMediaElement::stop() | 3696 void HTMLMediaElement::stop() |
3704 { | 3697 { |
3705 LOG(Media, "HTMLMediaElement::stop"); | 3698 LOG(Media, "HTMLMediaElement::stop"); |
3706 if (m_isFullscreen) | |
3707 exitFullscreen(); | |
3708 | 3699 |
3709 m_inActiveDocument = false; | 3700 m_inActiveDocument = false; |
3710 userCancelledLoad(); | 3701 userCancelledLoad(); |
3711 | 3702 |
3712 // Stop the playback without generating events | 3703 // Stop the playback without generating events |
3713 m_playing = false; | 3704 m_playing = false; |
3714 setPausedInternal(true); | 3705 setPausedInternal(true); |
3715 | 3706 |
3716 if (renderer()) | 3707 if (renderer()) |
3717 renderer()->updateFromElement(); | 3708 renderer()->updateFromElement(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3773 } | 3764 } |
3774 | 3765 |
3775 void HTMLMediaElement::setTextTrackRepresentation(TextTrackRepresentation* repre
sentation) | 3766 void HTMLMediaElement::setTextTrackRepresentation(TextTrackRepresentation* repre
sentation) |
3776 { | 3767 { |
3777 if (m_player) | 3768 if (m_player) |
3778 m_player->setTextTrackRepresentation(representation); | 3769 m_player->setTextTrackRepresentation(representation); |
3779 } | 3770 } |
3780 | 3771 |
3781 bool HTMLMediaElement::isFullscreen() const | 3772 bool HTMLMediaElement::isFullscreen() const |
3782 { | 3773 { |
3783 if (m_isFullscreen) | 3774 return document()->webkitIsFullScreen() && document()->webkitCurrentFullScre
enElement() == this; |
3784 return true; | |
3785 | |
3786 if (document()->webkitIsFullScreen() && document()->webkitCurrentFullScreenE
lement() == this) | |
3787 return true; | |
3788 | |
3789 return false; | |
3790 } | 3775 } |
3791 | 3776 |
3792 void HTMLMediaElement::enterFullscreen() | 3777 void HTMLMediaElement::enterFullscreen() |
3793 { | 3778 { |
3794 LOG(Media, "HTMLMediaElement::enterFullscreen"); | 3779 LOG(Media, "HTMLMediaElement::enterFullscreen"); |
3795 | 3780 |
3796 if (document() && document()->settings() && document()->settings()->fullScre
enEnabled()) { | 3781 if (document()->settings() && document()->settings()->fullScreenEnabled()) |
3797 document()->requestFullScreenForElement(this, 0, Document::ExemptIFrameA
llowFullScreenRequirement); | 3782 document()->requestFullScreenForElement(this, 0, Document::ExemptIFrameA
llowFullScreenRequirement); |
3798 return; | |
3799 } | |
3800 | |
3801 ASSERT(!m_isFullscreen); | |
3802 m_isFullscreen = true; | |
3803 if (hasMediaControls()) | |
3804 mediaControls()->enteredFullscreen(); | |
3805 if (document() && document()->page()) { | |
3806 document()->page()->chrome()->client()->enterFullscreenForNode(this); | |
3807 scheduleEvent(eventNames().webkitbeginfullscreenEvent); | |
3808 } | |
3809 } | 3783 } |
3810 | 3784 |
3811 void HTMLMediaElement::exitFullscreen() | 3785 void HTMLMediaElement::exitFullscreen() |
3812 { | 3786 { |
3813 LOG(Media, "HTMLMediaElement::exitFullscreen"); | 3787 LOG(Media, "HTMLMediaElement::exitFullscreen"); |
3814 | 3788 |
3815 if (document() && document()->settings() && document()->settings()->fullScre
enEnabled()) { | 3789 if (document()->settings() && document()->settings()->fullScreenEnabled() &&
isFullscreen()) |
3816 if (document()->webkitIsFullScreen() && document()->webkitCurrentFullScr
eenElement() == this) | 3790 document()->webkitCancelFullScreen(); |
3817 document()->webkitCancelFullScreen(); | |
3818 return; | |
3819 } | |
3820 | |
3821 ASSERT(m_isFullscreen); | |
3822 m_isFullscreen = false; | |
3823 if (hasMediaControls()) | |
3824 mediaControls()->exitedFullscreen(); | |
3825 if (document() && document()->page()) { | |
3826 document()->page()->chrome()->client()->exitFullscreenForNode(this); | |
3827 scheduleEvent(eventNames().webkitendfullscreenEvent); | |
3828 } | |
3829 } | 3791 } |
3830 | 3792 |
3831 void HTMLMediaElement::didBecomeFullscreenElement() | 3793 void HTMLMediaElement::didBecomeFullscreenElement() |
3832 { | 3794 { |
3833 if (hasMediaControls()) | 3795 if (hasMediaControls()) |
3834 mediaControls()->enteredFullscreen(); | 3796 mediaControls()->enteredFullscreen(); |
3835 } | 3797 } |
3836 | 3798 |
3837 void HTMLMediaElement::willStopBeingFullscreenElement() | 3799 void HTMLMediaElement::willStopBeingFullscreenElement() |
3838 { | 3800 { |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4433 info.addMember(m_mediaGroup, "mediaGroup"); | 4395 info.addMember(m_mediaGroup, "mediaGroup"); |
4434 info.addMember(m_mediaController, "mediaController"); | 4396 info.addMember(m_mediaController, "mediaController"); |
4435 | 4397 |
4436 #if ENABLE(WEB_AUDIO) | 4398 #if ENABLE(WEB_AUDIO) |
4437 info.addMember(m_audioSourceNode, "audioSourceNode"); | 4399 info.addMember(m_audioSourceNode, "audioSourceNode"); |
4438 #endif | 4400 #endif |
4439 | 4401 |
4440 } | 4402 } |
4441 | 4403 |
4442 } | 4404 } |
OLD | NEW |