Chromium Code Reviews| Index: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
| diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
| index 26a0c879ca69182999a93fcefe9c9d1258c13e6b..5c322c5665496a0f19ab9ec89bd5852851f5dab9 100644 |
| --- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
| +++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
| @@ -2035,7 +2035,7 @@ bool HTMLMediaElement::autoplay() const { |
| return fastHasAttribute(autoplayAttr); |
| } |
| -bool HTMLMediaElement::shouldAutoplay() { |
| +bool HTMLMediaElement::shouldAutoplay() const { |
| if (document().isSandboxed(SandboxAutomaticFeatures)) |
| return false; |
| return m_autoplaying && m_paused && autoplay(); |
| @@ -2147,7 +2147,9 @@ ScriptPromise HTMLMediaElement::playForBindings(ScriptState* scriptState) { |
| Nullable<ExceptionCode> HTMLMediaElement::play() { |
| BLINK_MEDIA_LOG << "play(" << (void*)this << ")"; |
| - if (!UserGestureIndicator::processingUserGesture()) { |
| + if (UserGestureIndicator::utilizeUserGesture()) { |
|
Rick Byers
2016/11/25 15:51:59
This is just a semantics-preserving cleanup, right
foolip
2016/11/28 15:13:05
This preserved behavior, yes.
If utilizeUserGestu
mlamouri (slow - plz ping)
2016/12/01 10:24:50
I'm not Rick, but reading the header file, I would
|
| + unlockUserGesture(); |
| + } else { |
| m_autoplayUmaHelper->onAutoplayInitiated(AutoplaySource::Method); |
| if (isGestureNeededForPlayback()) { |
| // If we're already playing, then this play would do nothing anyway. |
| @@ -2164,9 +2166,6 @@ Nullable<ExceptionCode> HTMLMediaElement::play() { |
| JSMessageSource, WarningMessageLevel, message)); |
| return NotAllowedError; |
| } |
| - } else { |
| - UserGestureIndicator::utilizeUserGesture(); |
| - unlockUserGesture(); |
| } |
| if (m_error && m_error->code() == MediaError::kMediaErrSrcNotSupported) |
| @@ -2351,7 +2350,7 @@ void HTMLMediaElement::setMuted(bool muted) { |
| bool wasPendingAutoplayMuted = m_autoplayVisibilityObserver && paused() && |
| m_muted && isLockedPendingUserGesture(); |
| - if (UserGestureIndicator::processingUserGesture()) |
| + if (UserGestureIndicator::utilizeUserGesture()) |
|
Rick Byers
2016/11/25 15:51:59
It's not clear to me that utilizeUserGesture is ap
foolip
2016/11/28 15:13:05
The documentation says "consider calling utilizeUs
mlamouri (slow - plz ping)
2016/12/01 10:24:50
That one is harder because we eagerly unlock but d
|
| unlockUserGesture(); |
| m_muted = muted; |