Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: Source/core/html/HTMLMediaElement.cpp

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLMapElement.cpp ('k') | Source/core/html/HTMLMetaElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 327
328 if (m_mediaController) 328 if (m_mediaController)
329 m_mediaController->removeMediaElement(this); 329 m_mediaController->removeMediaElement(this);
330 330
331 closeMediaSource(); 331 closeMediaSource();
332 332
333 #if ENABLE(ENCRYPTED_MEDIA_V2) 333 #if ENABLE(ENCRYPTED_MEDIA_V2)
334 setMediaKeys(0); 334 setMediaKeys(0);
335 #endif 335 #endif
336 336
337 removeElementFromDocumentMap(this, document()); 337 removeElementFromDocumentMap(this, &document());
338 338
339 // Destroying the player may cause a resource load to be canceled, 339 // Destroying the player may cause a resource load to be canceled,
340 // which could result in userCancelledLoad() being called back. 340 // which could result in userCancelledLoad() being called back.
341 // Setting m_completelyLoaded ensures that such a call will not cause 341 // Setting m_completelyLoaded ensures that such a call will not cause
342 // us to dispatch an abort event, which would result in a crash. 342 // us to dispatch an abort event, which would result in a crash.
343 // See http://crbug.com/233654 for more details. 343 // See http://crbug.com/233654 for more details.
344 m_completelyLoaded = true; 344 m_completelyLoaded = true;
345 m_player.clear(); 345 m_player.clear();
346 } 346 }
347 347
348 void HTMLMediaElement::didMoveToNewDocument(Document* oldDocument) 348 void HTMLMediaElement::didMoveToNewDocument(Document* oldDocument)
349 { 349 {
350 LOG(Media, "HTMLMediaElement::didMoveToNewDocument"); 350 LOG(Media, "HTMLMediaElement::didMoveToNewDocument");
351 351
352 if (m_shouldDelayLoadEvent) { 352 if (m_shouldDelayLoadEvent) {
353 if (oldDocument) 353 if (oldDocument)
354 oldDocument->decrementLoadEventDelayCount(); 354 oldDocument->decrementLoadEventDelayCount();
355 document()->incrementLoadEventDelayCount(); 355 document().incrementLoadEventDelayCount();
356 } 356 }
357 357
358 if (oldDocument) 358 if (oldDocument)
359 removeElementFromDocumentMap(this, oldDocument); 359 removeElementFromDocumentMap(this, oldDocument);
360 360
361 addElementToDocumentMap(this, document()); 361 addElementToDocumentMap(this, &document());
362 362
363 // FIXME: This is a temporary fix to prevent this object from causing the 363 // FIXME: This is a temporary fix to prevent this object from causing the
364 // MediaPlayer to dereference Frame and FrameLoader pointers from the 364 // MediaPlayer to dereference Frame and FrameLoader pointers from the
365 // previous document. A proper fix would provide a mechanism to allow this 365 // previous document. A proper fix would provide a mechanism to allow this
366 // object to refresh the MediaPlayer's Frame and FrameLoader references on 366 // object to refresh the MediaPlayer's Frame and FrameLoader references on
367 // document changes so that playback can be resumed properly. 367 // document changes so that playback can be resumed properly.
368 userCancelledLoad(); 368 userCancelledLoad();
369 369
370 HTMLElement::didMoveToNewDocument(oldDocument); 370 HTMLElement::didMoveToNewDocument(oldDocument);
371 } 371 }
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 m_loadState = LoadingFromSourceElement; 839 m_loadState = LoadingFromSourceElement;
840 loadResource(mediaURL, contentType, keySystem); 840 loadResource(mediaURL, contentType, keySystem);
841 } 841 }
842 842
843 void HTMLMediaElement::loadResource(const KURL& initialURL, ContentType& content Type, const String& keySystem) 843 void HTMLMediaElement::loadResource(const KURL& initialURL, ContentType& content Type, const String& keySystem)
844 { 844 {
845 ASSERT(isSafeToLoadURL(initialURL, Complain)); 845 ASSERT(isSafeToLoadURL(initialURL, Complain));
846 846
847 LOG(Media, "HTMLMediaElement::loadResource(%s, %s, %s)", urlForLoggingMedia( initialURL).utf8().data(), contentType.raw().utf8().data(), keySystem.utf8().dat a()); 847 LOG(Media, "HTMLMediaElement::loadResource(%s, %s, %s)", urlForLoggingMedia( initialURL).utf8().data(), contentType.raw().utf8().data(), keySystem.utf8().dat a());
848 848
849 Frame* frame = document()->frame(); 849 Frame* frame = document().frame();
850 if (!frame) { 850 if (!frame) {
851 mediaLoadingFailed(MediaPlayer::FormatError); 851 mediaLoadingFailed(MediaPlayer::FormatError);
852 return; 852 return;
853 } 853 }
854 854
855 KURL url = initialURL; 855 KURL url = initialURL;
856 if (!frame->loader()->willLoadMediaElementURL(url)) { 856 if (!frame->loader()->willLoadMediaElementURL(url)) {
857 mediaLoadingFailed(MediaPlayer::FormatError); 857 mediaLoadingFailed(MediaPlayer::FormatError);
858 return; 858 return;
859 } 859 }
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 } 1317 }
1318 1318
1319 1319
1320 bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionI fInvalid) 1320 bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionI fInvalid)
1321 { 1321 {
1322 if (!url.isValid()) { 1322 if (!url.isValid()) {
1323 LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%s) -> FALSE because url i s invalid", urlForLoggingMedia(url).utf8().data()); 1323 LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%s) -> FALSE because url i s invalid", urlForLoggingMedia(url).utf8().data());
1324 return false; 1324 return false;
1325 } 1325 }
1326 1326
1327 Frame* frame = document()->frame(); 1327 Frame* frame = document().frame();
1328 if (!frame || !document()->securityOrigin()->canDisplay(url)) { 1328 if (!frame || !document().securityOrigin()->canDisplay(url)) {
1329 if (actionIfInvalid == Complain) 1329 if (actionIfInvalid == Complain)
1330 FrameLoader::reportLocalLoadFailed(frame, url.elidedString()); 1330 FrameLoader::reportLocalLoadFailed(frame, url.elidedString());
1331 LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%s) -> FALSE rejected by S ecurityOrigin", urlForLoggingMedia(url).utf8().data()); 1331 LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%s) -> FALSE rejected by S ecurityOrigin", urlForLoggingMedia(url).utf8().data());
1332 return false; 1332 return false;
1333 } 1333 }
1334 1334
1335 if (!document()->contentSecurityPolicy()->allowMediaFromSource(url)) { 1335 if (!document().contentSecurityPolicy()->allowMediaFromSource(url)) {
1336 LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%s) -> rejected by Content Security Policy", urlForLoggingMedia(url).utf8().data()); 1336 LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%s) -> rejected by Content Security Policy", urlForLoggingMedia(url).utf8().data());
1337 return false; 1337 return false;
1338 } 1338 }
1339 1339
1340 return true; 1340 return true;
1341 } 1341 }
1342 1342
1343 void HTMLMediaElement::startProgressEventTimer() 1343 void HTMLMediaElement::startProgressEventTimer()
1344 { 1344 {
1345 if (m_progressEventTimer.isActive()) 1345 if (m_progressEventTimer.isActive())
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 1630
1631 if (m_readyState == HAVE_ENOUGH_DATA && oldState < HAVE_ENOUGH_DATA && track sAreReady) { 1631 if (m_readyState == HAVE_ENOUGH_DATA && oldState < HAVE_ENOUGH_DATA && track sAreReady) {
1632 if (oldState <= HAVE_CURRENT_DATA) 1632 if (oldState <= HAVE_CURRENT_DATA)
1633 scheduleEvent(eventNames().canplayEvent); 1633 scheduleEvent(eventNames().canplayEvent);
1634 1634
1635 scheduleEvent(eventNames().canplaythroughEvent); 1635 scheduleEvent(eventNames().canplaythroughEvent);
1636 1636
1637 if (isPotentiallyPlaying && oldState <= HAVE_CURRENT_DATA) 1637 if (isPotentiallyPlaying && oldState <= HAVE_CURRENT_DATA)
1638 scheduleEvent(eventNames().playingEvent); 1638 scheduleEvent(eventNames().playingEvent);
1639 1639
1640 if (m_autoplaying && m_paused && autoplay() && !document()->isSandboxed( SandboxAutomaticFeatures) && !userGestureRequiredForRateChange()) { 1640 if (m_autoplaying && m_paused && autoplay() && !document().isSandboxed(S andboxAutomaticFeatures) && !userGestureRequiredForRateChange()) {
1641 m_paused = false; 1641 m_paused = false;
1642 invalidateCachedTime(); 1642 invalidateCachedTime();
1643 scheduleEvent(eventNames().playEvent); 1643 scheduleEvent(eventNames().playEvent);
1644 scheduleEvent(eventNames().playingEvent); 1644 scheduleEvent(eventNames().playingEvent);
1645 } 1645 }
1646 1646
1647 shouldUpdateDisplayState = true; 1647 shouldUpdateDisplayState = true;
1648 } 1648 }
1649 1649
1650 if (shouldUpdateDisplayState) { 1650 if (shouldUpdateDisplayState) {
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
2146 2146
2147 void HTMLMediaElement::play() 2147 void HTMLMediaElement::play()
2148 { 2148 {
2149 LOG(Media, "HTMLMediaElement::play()"); 2149 LOG(Media, "HTMLMediaElement::play()");
2150 2150
2151 if (userGestureRequiredForRateChange() && !ScriptController::processingUserG esture()) 2151 if (userGestureRequiredForRateChange() && !ScriptController::processingUserG esture())
2152 return; 2152 return;
2153 if (ScriptController::processingUserGesture()) 2153 if (ScriptController::processingUserGesture())
2154 removeBehaviorsRestrictionsAfterFirstUserGesture(); 2154 removeBehaviorsRestrictionsAfterFirstUserGesture();
2155 2155
2156 Settings* settings = document()->settings(); 2156 Settings* settings = document().settings();
2157 if (settings && settings->needsSiteSpecificQuirks() && m_dispatchingCanPlayE vent && !m_loadInitiatedByUserGesture) { 2157 if (settings && settings->needsSiteSpecificQuirks() && m_dispatchingCanPlayE vent && !m_loadInitiatedByUserGesture) {
2158 // It should be impossible to be processing the canplay event while hand ling a user gesture 2158 // It should be impossible to be processing the canplay event while hand ling a user gesture
2159 // since it is dispatched asynchronously. 2159 // since it is dispatched asynchronously.
2160 ASSERT(!ScriptController::processingUserGesture()); 2160 ASSERT(!ScriptController::processingUserGesture());
2161 String host = document()->baseURL().host(); 2161 String host = document().baseURL().host();
2162 if (host.endsWith(".npr.org", false) || equalIgnoringCase(host, "npr.org ")) 2162 if (host.endsWith(".npr.org", false) || equalIgnoringCase(host, "npr.org "))
2163 return; 2163 return;
2164 } 2164 }
2165 2165
2166 playInternal(); 2166 playInternal();
2167 } 2167 }
2168 2168
2169 void HTMLMediaElement::playInternal() 2169 void HTMLMediaElement::playInternal()
2170 { 2170 {
2171 LOG(Media, "HTMLMediaElement::playInternal"); 2171 LOG(Media, "HTMLMediaElement::playInternal");
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
2323 } 2323 }
2324 2324
2325 void HTMLMediaElement::setLoop(bool b) 2325 void HTMLMediaElement::setLoop(bool b)
2326 { 2326 {
2327 LOG(Media, "HTMLMediaElement::setLoop(%s)", boolString(b)); 2327 LOG(Media, "HTMLMediaElement::setLoop(%s)", boolString(b));
2328 setBooleanAttribute(loopAttr, b); 2328 setBooleanAttribute(loopAttr, b);
2329 } 2329 }
2330 2330
2331 bool HTMLMediaElement::controls() const 2331 bool HTMLMediaElement::controls() const
2332 { 2332 {
2333 Frame* frame = document()->frame(); 2333 Frame* frame = document().frame();
2334 2334
2335 // always show controls when scripting is disabled 2335 // always show controls when scripting is disabled
2336 if (frame && !frame->script()->canExecuteScripts(NotAboutToExecuteScript)) 2336 if (frame && !frame->script()->canExecuteScripts(NotAboutToExecuteScript))
2337 return true; 2337 return true;
2338 2338
2339 // Always show controls when in full screen mode. 2339 // Always show controls when in full screen mode.
2340 if (isFullscreen()) 2340 if (isFullscreen())
2341 return true; 2341 return true;
2342 2342
2343 return fastHasAttribute(controlsAttr); 2343 return fastHasAttribute(controlsAttr);
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
2741 2741
2742 return trackScore + textTrackLanguageSelectionScore(track); 2742 return trackScore + textTrackLanguageSelectionScore(track);
2743 } 2743 }
2744 2744
2745 void HTMLMediaElement::configureTextTrackGroup(const TrackGroup& group) 2745 void HTMLMediaElement::configureTextTrackGroup(const TrackGroup& group)
2746 { 2746 {
2747 ASSERT(group.tracks.size()); 2747 ASSERT(group.tracks.size());
2748 2748
2749 LOG(Media, "HTMLMediaElement::configureTextTrackGroup(%d)", group.kind); 2749 LOG(Media, "HTMLMediaElement::configureTextTrackGroup(%d)", group.kind);
2750 2750
2751 Page* page = document()->page(); 2751 Page* page = document().page();
2752 Settings* settings = page ? &page->settings() : 0; 2752 Settings* settings = page ? &page->settings() : 0;
2753 2753
2754 // First, find the track in the group that should be enabled (if any). 2754 // First, find the track in the group that should be enabled (if any).
2755 Vector<RefPtr<TextTrack> > currentlyEnabledTracks; 2755 Vector<RefPtr<TextTrack> > currentlyEnabledTracks;
2756 RefPtr<TextTrack> trackToEnable; 2756 RefPtr<TextTrack> trackToEnable;
2757 RefPtr<TextTrack> defaultTrack; 2757 RefPtr<TextTrack> defaultTrack;
2758 RefPtr<TextTrack> fallbackTrack; 2758 RefPtr<TextTrack> fallbackTrack;
2759 int highestTrackScore = 0; 2759 int highestTrackScore = 0;
2760 for (size_t i = 0; i < group.tracks.size(); ++i) { 2760 for (size_t i = 0; i < group.tracks.size(); ++i) {
2761 RefPtr<TextTrack> textTrack = group.tracks[i]; 2761 RefPtr<TextTrack> textTrack = group.tracks[i];
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
2937 // If candidate does not have a src attribute, or if its src attribute's value is the empty string ... jump down to the failed step below 2937 // If candidate does not have a src attribute, or if its src attribute's value is the empty string ... jump down to the failed step below
2938 mediaURL = source->getNonEmptyURLAttribute(srcAttr); 2938 mediaURL = source->getNonEmptyURLAttribute(srcAttr);
2939 #if !LOG_DISABLED 2939 #if !LOG_DISABLED
2940 if (shouldLog) 2940 if (shouldLog)
2941 LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'src' is %s", urlForLoggingMedia(mediaURL).utf8().data()); 2941 LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'src' is %s", urlForLoggingMedia(mediaURL).utf8().data());
2942 #endif 2942 #endif
2943 if (mediaURL.isEmpty()) 2943 if (mediaURL.isEmpty())
2944 goto check_again; 2944 goto check_again;
2945 2945
2946 if (source->fastHasAttribute(mediaAttr)) { 2946 if (source->fastHasAttribute(mediaAttr)) {
2947 MediaQueryEvaluator screenEval("screen", document()->frame(), render er() ? renderer()->style() : 0); 2947 MediaQueryEvaluator screenEval("screen", document().frame(), rendere r() ? renderer()->style() : 0);
2948 RefPtr<MediaQuerySet> media = MediaQuerySet::create(source->media()) ; 2948 RefPtr<MediaQuerySet> media = MediaQuerySet::create(source->media()) ;
2949 #if !LOG_DISABLED 2949 #if !LOG_DISABLED
2950 if (shouldLog) 2950 if (shouldLog)
2951 LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'media' is %s", source->media().utf8().data()); 2951 LOG(Media, "HTMLMediaElement::selectNextSourceChild - 'media' is %s", source->media().utf8().data());
2952 #endif 2952 #endif
2953 if (!screenEval.eval(media.get())) 2953 if (!screenEval.eval(media.get()))
2954 goto check_again; 2954 goto check_again;
2955 } 2955 }
2956 2956
2957 type = source->type(); 2957 type = source->type();
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
3532 3532
3533 bool HTMLMediaElement::isFullscreen() const 3533 bool HTMLMediaElement::isFullscreen() const
3534 { 3534 {
3535 return FullscreenElementStack::isActiveFullScreenElement(this); 3535 return FullscreenElementStack::isActiveFullScreenElement(this);
3536 } 3536 }
3537 3537
3538 void HTMLMediaElement::enterFullscreen() 3538 void HTMLMediaElement::enterFullscreen()
3539 { 3539 {
3540 LOG(Media, "HTMLMediaElement::enterFullscreen"); 3540 LOG(Media, "HTMLMediaElement::enterFullscreen");
3541 3541
3542 if (document()->settings() && document()->settings()->fullScreenEnabled()) 3542 if (document().settings() && document().settings()->fullScreenEnabled())
3543 FullscreenElementStack::from(document())->requestFullScreenForElement(th is, 0, FullscreenElementStack::ExemptIFrameAllowFullScreenRequirement); 3543 FullscreenElementStack::from(&document())->requestFullScreenForElement(t his, 0, FullscreenElementStack::ExemptIFrameAllowFullScreenRequirement);
3544 } 3544 }
3545 3545
3546 void HTMLMediaElement::exitFullscreen() 3546 void HTMLMediaElement::exitFullscreen()
3547 { 3547 {
3548 LOG(Media, "HTMLMediaElement::exitFullscreen"); 3548 LOG(Media, "HTMLMediaElement::exitFullscreen");
3549 3549
3550 if (document()->settings() && document()->settings()->fullScreenEnabled() && isFullscreen()) 3550 if (document().settings() && document().settings()->fullScreenEnabled() && i sFullscreen())
3551 FullscreenElementStack::from(document())->webkitCancelFullScreen(); 3551 FullscreenElementStack::from(&document())->webkitCancelFullScreen();
3552 } 3552 }
3553 3553
3554 void HTMLMediaElement::didBecomeFullscreenElement() 3554 void HTMLMediaElement::didBecomeFullscreenElement()
3555 { 3555 {
3556 if (hasMediaControls()) 3556 if (hasMediaControls())
3557 mediaControls()->enteredFullscreen(); 3557 mediaControls()->enteredFullscreen();
3558 } 3558 }
3559 3559
3560 void HTMLMediaElement::willStopBeingFullscreenElement() 3560 void HTMLMediaElement::willStopBeingFullscreenElement()
3561 { 3561 {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
3653 3653
3654 void HTMLMediaElement::setShouldDelayLoadEvent(bool shouldDelay) 3654 void HTMLMediaElement::setShouldDelayLoadEvent(bool shouldDelay)
3655 { 3655 {
3656 if (m_shouldDelayLoadEvent == shouldDelay) 3656 if (m_shouldDelayLoadEvent == shouldDelay)
3657 return; 3657 return;
3658 3658
3659 LOG(Media, "HTMLMediaElement::setShouldDelayLoadEvent(%s)", boolString(shoul dDelay)); 3659 LOG(Media, "HTMLMediaElement::setShouldDelayLoadEvent(%s)", boolString(shoul dDelay));
3660 3660
3661 m_shouldDelayLoadEvent = shouldDelay; 3661 m_shouldDelayLoadEvent = shouldDelay;
3662 if (shouldDelay) 3662 if (shouldDelay)
3663 document()->incrementLoadEventDelayCount(); 3663 document().incrementLoadEventDelayCount();
3664 else 3664 else
3665 document()->decrementLoadEventDelayCount(); 3665 document().decrementLoadEventDelayCount();
3666 } 3666 }
3667 3667
3668 3668
3669 MediaControls* HTMLMediaElement::mediaControls() const 3669 MediaControls* HTMLMediaElement::mediaControls() const
3670 { 3670 {
3671 return toMediaControls(userAgentShadowRoot()->firstChild()); 3671 return toMediaControls(userAgentShadowRoot()->firstChild());
3672 } 3672 }
3673 3673
3674 bool HTMLMediaElement::hasMediaControls() const 3674 bool HTMLMediaElement::hasMediaControls() const
3675 { 3675 {
3676 if (ShadowRoot* userAgent = userAgentShadowRoot()) { 3676 if (ShadowRoot* userAgent = userAgentShadowRoot()) {
3677 Node* node = userAgent->firstChild(); 3677 Node* node = userAgent->firstChild();
3678 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isMediaControls()); 3678 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isMediaControls());
3679 return node; 3679 return node;
3680 } 3680 }
3681 3681
3682 return false; 3682 return false;
3683 } 3683 }
3684 3684
3685 bool HTMLMediaElement::createMediaControls() 3685 bool HTMLMediaElement::createMediaControls()
3686 { 3686 {
3687 if (hasMediaControls()) 3687 if (hasMediaControls())
3688 return true; 3688 return true;
3689 3689
3690 RefPtr<MediaControls> mediaControls = MediaControls::create(document()); 3690 RefPtr<MediaControls> mediaControls = MediaControls::create(&document());
3691 if (!mediaControls) 3691 if (!mediaControls)
3692 return false; 3692 return false;
3693 3693
3694 mediaControls->setMediaController(m_mediaController ? m_mediaController.get( ) : static_cast<MediaControllerInterface*>(this)); 3694 mediaControls->setMediaController(m_mediaController ? m_mediaController.get( ) : static_cast<MediaControllerInterface*>(this));
3695 mediaControls->reset(); 3695 mediaControls->reset();
3696 if (isFullscreen()) 3696 if (isFullscreen())
3697 mediaControls->enteredFullscreen(); 3697 mediaControls->enteredFullscreen();
3698 3698
3699 ensureUserAgentShadowRoot()->appendChild(mediaControls); 3699 ensureUserAgentShadowRoot()->appendChild(mediaControls);
3700 3700
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
3836 // 1. Let m [this] be the media element in question. 3836 // 1. Let m [this] be the media element in question.
3837 // 2. Let m have no current media controller, if it currently has one. 3837 // 2. Let m have no current media controller, if it currently has one.
3838 setController(0); 3838 setController(0);
3839 3839
3840 // 3. If m's mediagroup attribute is being removed, then abort these steps. 3840 // 3. If m's mediagroup attribute is being removed, then abort these steps.
3841 if (group.isNull() || group.isEmpty()) 3841 if (group.isNull() || group.isEmpty())
3842 return; 3842 return;
3843 3843
3844 // 4. If there is another media element whose Document is the same as m's Do cument (even if one or both 3844 // 4. If there is another media element whose Document is the same as m's Do cument (even if one or both
3845 // of these elements are not actually in the Document), 3845 // of these elements are not actually in the Document),
3846 HashSet<HTMLMediaElement*> elements = documentToElementSetMap().get(document ()); 3846 HashSet<HTMLMediaElement*> elements = documentToElementSetMap().get(&documen t());
3847 for (HashSet<HTMLMediaElement*>::iterator i = elements.begin(); i != element s.end(); ++i) { 3847 for (HashSet<HTMLMediaElement*>::iterator i = elements.begin(); i != element s.end(); ++i) {
3848 if (*i == this) 3848 if (*i == this)
3849 continue; 3849 continue;
3850 3850
3851 // and which also has a mediagroup attribute, and whose mediagroup attri bute has the same value as 3851 // and which also has a mediagroup attribute, and whose mediagroup attri bute has the same value as
3852 // the new value of m's mediagroup attribute, 3852 // the new value of m's mediagroup attribute,
3853 if ((*i)->mediaGroup() == group) { 3853 if ((*i)->mediaGroup() == group) {
3854 // then let controller be that media element's current media contro ller. 3854 // then let controller be that media element's current media contro ller.
3855 setController((*i)->controller()); 3855 setController((*i)->controller());
3856 return; 3856 return;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
3981 { 3981 {
3982 m_restrictions = NoRestrictions; 3982 m_restrictions = NoRestrictions;
3983 } 3983 }
3984 3984
3985 void HTMLMediaElement::mediaPlayerScheduleLayerUpdate() 3985 void HTMLMediaElement::mediaPlayerScheduleLayerUpdate()
3986 { 3986 {
3987 scheduleLayerUpdate(); 3987 scheduleLayerUpdate();
3988 } 3988 }
3989 3989
3990 } 3990 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLMapElement.cpp ('k') | Source/core/html/HTMLMetaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698