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 2204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2215 m_lastTimeUpdateEventWallTime = now; | 2215 m_lastTimeUpdateEventWallTime = now; |
2216 m_lastTimeUpdateEventMovieTime = movieTime; | 2216 m_lastTimeUpdateEventMovieTime = movieTime; |
2217 } | 2217 } |
2218 } | 2218 } |
2219 | 2219 |
2220 bool HTMLMediaElement::canPlay() const | 2220 bool HTMLMediaElement::canPlay() const |
2221 { | 2221 { |
2222 return paused() || ended() || m_readyState < HAVE_METADATA; | 2222 return paused() || ended() || m_readyState < HAVE_METADATA; |
2223 } | 2223 } |
2224 | 2224 |
| 2225 void HTMLMediaElement::togglePlayState() |
| 2226 { |
| 2227 ASSERT(controls()); |
| 2228 // The activation behavior of a media element that is exposing a user interf
ace to the user |
| 2229 if (m_mediaController) { |
| 2230 if (m_mediaController->isRestrained()) |
| 2231 m_mediaController->play(); |
| 2232 else if (m_mediaController->paused()) |
| 2233 m_mediaController->unpause(); |
| 2234 else |
| 2235 m_mediaController->pause(); |
| 2236 } else { |
| 2237 if (paused()) |
| 2238 play(); |
| 2239 else |
| 2240 pause(); |
| 2241 } |
| 2242 } |
| 2243 |
2225 void HTMLMediaElement::mediaPlayerDidAddTextTrack(WebInbandTextTrack* webTrack) | 2244 void HTMLMediaElement::mediaPlayerDidAddTextTrack(WebInbandTextTrack* webTrack) |
2226 { | 2245 { |
2227 if (!RuntimeEnabledFeatures::videoTrackEnabled()) | 2246 if (!RuntimeEnabledFeatures::videoTrackEnabled()) |
2228 return; | 2247 return; |
2229 | 2248 |
2230 // 4.8.10.12.2 Sourcing in-band text tracks | 2249 // 4.8.10.12.2 Sourcing in-band text tracks |
2231 // 1. Associate the relevant data with a new text track and its correspondin
g new TextTrack object. | 2250 // 1. Associate the relevant data with a new text track and its correspondin
g new TextTrack object. |
2232 RefPtr<InbandTextTrack> textTrack = InbandTextTrack::create(document(), webT
rack); | 2251 RefPtr<InbandTextTrack> textTrack = InbandTextTrack::create(document(), webT
rack); |
2233 | 2252 |
2234 // 2. Set the new text track's kind, label, and language based on the semant
ics of the relevant data, | 2253 // 2. Set the new text track's kind, label, and language based on the semant
ics of the relevant data, |
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3416 for (unsigned i = 0; i < m_textTracks->length(); ++i) { | 3435 for (unsigned i = 0; i < m_textTracks->length(); ++i) { |
3417 RefPtr<TextTrack> textTrack = m_textTracks->item(i); | 3436 RefPtr<TextTrack> textTrack = m_textTracks->item(i); |
3418 String kind = textTrack->kind(); | 3437 String kind = textTrack->kind(); |
3419 | 3438 |
3420 if (kind == TextTrack::subtitlesKeyword() || kind == TextTrack::captions
Keyword()) | 3439 if (kind == TextTrack::subtitlesKeyword() || kind == TextTrack::captions
Keyword()) |
3421 textTrack->setHasBeenConfigured(false); | 3440 textTrack->setHasBeenConfigured(false); |
3422 } | 3441 } |
3423 configureTextTracks(); | 3442 configureTextTracks(); |
3424 } | 3443 } |
3425 | 3444 |
| 3445 bool HTMLMediaElement::willRespondToMouseClickEvents() |
| 3446 { |
| 3447 return controls(); |
| 3448 } |
3426 | 3449 |
3427 void* HTMLMediaElement::preDispatchEventHandler(Event* event) | 3450 void* HTMLMediaElement::preDispatchEventHandler(Event* event) |
3428 { | 3451 { |
3429 if (event && event->type() == EventTypeNames::webkitfullscreenchange) | 3452 if (event && event->type() == EventTypeNames::webkitfullscreenchange) |
3430 configureMediaControls(); | 3453 configureMediaControls(); |
3431 | 3454 |
3432 return 0; | 3455 return 0; |
3433 } | 3456 } |
3434 | 3457 |
| 3458 void HTMLMediaElement::defaultEventHandler(Event* event) |
| 3459 { |
| 3460 if (event->type() == EventTypeNames::click && willRespondToMouseClickEvents(
)) { |
| 3461 togglePlayState(); |
| 3462 event->setDefaultHandled(); |
| 3463 return; |
| 3464 } |
| 3465 HTMLElement::defaultEventHandler(event); |
| 3466 } |
| 3467 |
3435 void HTMLMediaElement::createMediaPlayer() | 3468 void HTMLMediaElement::createMediaPlayer() |
3436 { | 3469 { |
3437 #if ENABLE(WEB_AUDIO) | 3470 #if ENABLE(WEB_AUDIO) |
3438 if (m_audioSourceNode) | 3471 if (m_audioSourceNode) |
3439 m_audioSourceNode->lock(); | 3472 m_audioSourceNode->lock(); |
3440 #endif | 3473 #endif |
3441 | 3474 |
3442 if (m_mediaSource) | 3475 if (m_mediaSource) |
3443 closeMediaSource(); | 3476 closeMediaSource(); |
3444 | 3477 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3653 { | 3686 { |
3654 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource)); | 3687 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource)); |
3655 } | 3688 } |
3656 | 3689 |
3657 bool HTMLMediaElement::isInteractiveContent() const | 3690 bool HTMLMediaElement::isInteractiveContent() const |
3658 { | 3691 { |
3659 return fastHasAttribute(controlsAttr); | 3692 return fastHasAttribute(controlsAttr); |
3660 } | 3693 } |
3661 | 3694 |
3662 } | 3695 } |
OLD | NEW |