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

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

Issue 2047433003: Update autoplay settings when moving media elements between documents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed nits in tests Created 4 years, 6 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
« no previous file with comments | « third_party/WebKit/LayoutTests/media/autoplay-document-move.html ('k') | no next file » | 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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 // doesn't get dispatched during the object destruction. 480 // doesn't get dispatched during the object destruction.
481 // See Document::isDelayingLoadEvent(). 481 // See Document::isDelayingLoadEvent().
482 // Also see http://crbug.com/275223 for more details. 482 // Also see http://crbug.com/275223 for more details.
483 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); 483 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking();
484 } 484 }
485 485
486 void HTMLMediaElement::didMoveToNewDocument(Document& oldDocument) 486 void HTMLMediaElement::didMoveToNewDocument(Document& oldDocument)
487 { 487 {
488 DVLOG(MEDIA_LOG_LEVEL) << "didMoveToNewDocument(" << (void*)this << ")"; 488 DVLOG(MEDIA_LOG_LEVEL) << "didMoveToNewDocument(" << (void*)this << ")";
489 489
490 // If any experiment is enabled, then we want to enable a user gesture by
491 // default, otherwise the experiment does nothing.
492 bool oldDocumentRequiresUserGesture = (oldDocument.settings() && oldDocument .settings()->mediaPlaybackRequiresUserGesture())
493 || m_autoplayHelper->isExperimentEnabled();
494 bool newDocumentRequiresUserGesture = (document().settings() && document().s ettings()->mediaPlaybackRequiresUserGesture())
495 || m_autoplayHelper->isExperimentEnabled();
496 if (newDocumentRequiresUserGesture && !oldDocumentRequiresUserGesture) {
497 m_lockedPendingUserGesture = true;
498 }
499
490 if (m_shouldDelayLoadEvent) { 500 if (m_shouldDelayLoadEvent) {
491 document().incrementLoadEventDelayCount(); 501 document().incrementLoadEventDelayCount();
492 // Note: Keeping the load event delay count increment on oldDocument tha t was added 502 // Note: Keeping the load event delay count increment on oldDocument tha t was added
493 // when m_shouldDelayLoadEvent was set so that destruction of m_webMedia Player can not 503 // when m_shouldDelayLoadEvent was set so that destruction of m_webMedia Player can not
494 // cause load event dispatching in oldDocument. 504 // cause load event dispatching in oldDocument.
495 } else { 505 } else {
496 // Incrementing the load event delay count so that destruction of m_webM ediaPlayer can not 506 // Incrementing the load event delay count so that destruction of m_webM ediaPlayer can not
497 // cause load event dispatching in oldDocument. 507 // cause load event dispatching in oldDocument.
498 oldDocument.incrementLoadEventDelayCount(); 508 oldDocument.incrementLoadEventDelayCount();
499 } 509 }
(...skipping 3381 matching lines...) Expand 10 before | Expand all | Expand 10 after
3881 3891
3882 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst 3892 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst
3883 { 3893 {
3884 IntRect result; 3894 IntRect result;
3885 if (LayoutObject* object = m_element->layoutObject()) 3895 if (LayoutObject* object = m_element->layoutObject())
3886 result = object->absoluteBoundingBoxRect(); 3896 result = object->absoluteBoundingBoxRect();
3887 return result; 3897 return result;
3888 } 3898 }
3889 3899
3890 } // namespace blink 3900 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/media/autoplay-document-move.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698