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

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

Issue 1931363002: Autoplay experiment: ignore viewport visibility requirements for audio. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@autoplay-htmlmedialement
Patch Set: update tests Created 4 years, 7 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/html/AutoplayExperimentHelper.h" 5 #include "core/html/AutoplayExperimentHelper.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/frame/Settings.h" 8 #include "core/frame/Settings.h"
9 #include "core/html/HTMLMediaElement.h" 9 #include "core/html/HTMLMediaElement.h"
10 #include "core/layout/LayoutBox.h" 10 #include "core/layout/LayoutBox.h"
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 return; 490 return;
491 491
492 m_recordedElement = true; 492 m_recordedElement = true;
493 recordAutoplayMetric(client().isHTMLVideoElement() 493 recordAutoplayMetric(client().isHTMLVideoElement()
494 ? AnyVideoElement 494 ? AnyVideoElement
495 : AnyAudioElement); 495 : AnyAudioElement);
496 } 496 }
497 497
498 bool AutoplayExperimentHelper::requiresViewportVisibility() const 498 bool AutoplayExperimentHelper::requiresViewportVisibility() const
499 { 499 {
500 return enabled(IfViewport) || enabled(IfPartialViewport); 500 return client().isHTMLVideoElement() && (enabled(IfViewport) || enabled(IfPa rtialViewport));
501 } 501 }
502 502
503 bool AutoplayExperimentHelper::isExperimentEnabled() 503 bool AutoplayExperimentHelper::isExperimentEnabled()
504 { 504 {
505 return m_mode != Mode::ExperimentOff; 505 return m_mode != Mode::ExperimentOff;
506 } 506 }
507 507
508 } // namespace blink 508 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698