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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 , m_haveFiredLoadedData(false) | 289 , m_haveFiredLoadedData(false) |
290 , m_active(true) | 290 , m_active(true) |
291 , m_autoplaying(true) | 291 , m_autoplaying(true) |
292 , m_muted(false) | 292 , m_muted(false) |
293 , m_paused(true) | 293 , m_paused(true) |
294 , m_seeking(false) | 294 , m_seeking(false) |
295 , m_sentStalledEvent(false) | 295 , m_sentStalledEvent(false) |
296 , m_sentEndEvent(false) | 296 , m_sentEndEvent(false) |
297 , m_pausedInternal(false) | 297 , m_pausedInternal(false) |
298 , m_closedCaptionsVisible(false) | 298 , m_closedCaptionsVisible(false) |
299 , m_loadInitiatedByUserGesture(false) | |
300 , m_completelyLoaded(false) | 299 , m_completelyLoaded(false) |
301 , m_havePreparedToPlay(false) | 300 , m_havePreparedToPlay(false) |
302 , m_tracksAreReady(true) | 301 , m_tracksAreReady(true) |
303 , m_haveVisibleTextTrack(false) | 302 , m_haveVisibleTextTrack(false) |
304 , m_processingPreferenceChange(false) | 303 , m_processingPreferenceChange(false) |
305 , m_lastTextTrackUpdateTime(-1) | 304 , m_lastTextTrackUpdateTime(-1) |
306 , m_textTracks(0) | 305 , m_textTracks(0) |
307 , m_ignoreTrackDisplayUpdate(0) | 306 , m_ignoreTrackDisplayUpdate(0) |
308 #if ENABLE(WEB_AUDIO) | 307 #if ENABLE(WEB_AUDIO) |
309 , m_audioSourceNode(0) | 308 , m_audioSourceNode(0) |
310 #endif | 309 #endif |
311 , m_emeMode(EmeModeNotSelected) | 310 , m_emeMode(EmeModeNotSelected) |
312 { | 311 { |
313 ASSERT(RuntimeEnabledFeatures::mediaEnabled()); | 312 ASSERT(RuntimeEnabledFeatures::mediaEnabled()); |
314 | 313 |
315 WTF_LOG(Media, "HTMLMediaElement::HTMLMediaElement"); | 314 WTF_LOG(Media, "HTMLMediaElement::HTMLMediaElement"); |
316 ScriptWrappable::init(this); | 315 ScriptWrappable::init(this); |
317 | 316 |
318 if (document.settings()) { | 317 if (document.settings()) { |
319 if (document.settings()->mediaPlaybackRequiresUserGesture()) { | 318 if (document.settings()->mediaPlaybackRequiresUserGesture()) |
320 addBehaviorRestriction(RequireUserGestureForPlayRestriction); | 319 addBehaviorRestriction(RequireUserGestureForPlayRestriction); |
321 addBehaviorRestriction(RequireUserGestureForLoadRestriction); | 320 if (document.settings()->mediaFullscreenRequiresUserGesture()) |
322 } | |
323 if (document.settings()->mediaFullscreenRequiresUserGesture()) { | |
324 addBehaviorRestriction(RequireUserGestureForFullscreenRestriction); | 321 addBehaviorRestriction(RequireUserGestureForFullscreenRestriction); |
325 } | |
326 } | 322 } |
327 | 323 |
328 // We must always have a ShadowRoot so children like <source> will not rende
r | 324 // We must always have a ShadowRoot so children like <source> will not rende
r |
329 // as they never have an insertion point. | 325 // as they never have an insertion point. |
330 ensureUserAgentShadowRoot(); | 326 ensureUserAgentShadowRoot(); |
331 setHasCustomStyleCallbacks(); | 327 setHasCustomStyleCallbacks(); |
332 addElementToDocumentMap(this, &document); | 328 addElementToDocumentMap(this, &document); |
333 } | 329 } |
334 | 330 |
335 HTMLMediaElement::~HTMLMediaElement() | 331 HTMLMediaElement::~HTMLMediaElement() |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 | 618 |
623 void HTMLMediaElement::load() | 619 void HTMLMediaElement::load() |
624 { | 620 { |
625 RefPtr<HTMLMediaElement> protect(this); // loadInternal may result in a 'bef
oreload' event, which can make arbitrary DOM mutations. | 621 RefPtr<HTMLMediaElement> protect(this); // loadInternal may result in a 'bef
oreload' event, which can make arbitrary DOM mutations. |
626 | 622 |
627 WTF_LOG(Media, "HTMLMediaElement::load()"); | 623 WTF_LOG(Media, "HTMLMediaElement::load()"); |
628 | 624 |
629 if (document().settings() && !document().settings()->mediaEnabled()) | 625 if (document().settings() && !document().settings()->mediaEnabled()) |
630 return; | 626 return; |
631 | 627 |
632 if (userGestureRequiredForLoad() && !UserGestureIndicator::processingUserGes
ture()) | 628 if (UserGestureIndicator::processingUserGesture()) |
633 return; | 629 removeBehaviorsRestrictionsAfterFirstUserGesture(); |
634 | 630 |
635 m_loadInitiatedByUserGesture = UserGestureIndicator::processingUserGesture()
; | |
636 if (m_loadInitiatedByUserGesture) | |
637 removeBehaviorsRestrictionsAfterFirstUserGesture(); | |
638 prepareForLoad(); | 631 prepareForLoad(); |
639 loadInternal(); | 632 loadInternal(); |
640 prepareToPlay(); | 633 prepareToPlay(); |
641 } | 634 } |
642 | 635 |
643 void HTMLMediaElement::prepareForLoad() | 636 void HTMLMediaElement::prepareForLoad() |
644 { | 637 { |
645 WTF_LOG(Media, "HTMLMediaElement::prepareForLoad"); | 638 WTF_LOG(Media, "HTMLMediaElement::prepareForLoad"); |
646 | 639 |
647 // Perform the cleanup required for the resource load algorithm to run. | 640 // Perform the cleanup required for the resource load algorithm to run. |
(...skipping 3289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3937 { | 3930 { |
3938 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource)); | 3931 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource)); |
3939 } | 3932 } |
3940 | 3933 |
3941 bool HTMLMediaElement::isInteractiveContent() const | 3934 bool HTMLMediaElement::isInteractiveContent() const |
3942 { | 3935 { |
3943 return fastHasAttribute(controlsAttr); | 3936 return fastHasAttribute(controlsAttr); |
3944 } | 3937 } |
3945 | 3938 |
3946 } | 3939 } |
OLD | NEW |