bool MediaElementSession::canControlControlsManager(const HTMLMediaElement& element) const { if (!element.hasAudio()) { LOG(Media, "MediaElementSession::canControlControlsManager - returning FALSE: No audio"); return false; } if (element.muted()) { LOG(Media, "MediaElementSession::canControlControlsManager - returning FALSE: Muted"); return false; } if (element.ended()) { LOG(Media, "MediaElementSession::canControlControlsManager - returning FALSE: Ended"); return false; } if (element.document().activeDOMObjectsAreSuspended()) { LOG(Media, "MediaElementSession::canControlControlsManager - returning FALSE: activeDOMObjectsAreSuspended()"); return false; } if (!playbackPermitted(element)) { LOG(Media, "MediaElementSession::canControlControlsManager - returning FALSE: Playback not permitted"); return false; } if (element.isVideo()) { if (!element.renderer()) { LOG(Media, "MediaElementSession::canControlControlsManager - returning FALSE: No renderer"); return false; } if (!element.hasVideo()) { LOG(Media, "MediaElementSession::canControlControlsManager - returning FALSE: No video"); return false; } if (isElementLargeEnoughForMainContent(element)) { LOG(Media, "MediaElementSession::canControlControlsManager - returning TRUE: Is main content"); return true; } } if (m_restrictions & RequireUserGestureToControlControlsManager && !ScriptController::processingUserGestureForMedia()) { LOG(Media, "MediaElementSession::canControlControlsManager - returning FALSE: No user gesture"); return false; } LOG(Media, "MediaElementSession::canControlControlsManager - returning TRUE: All criteria met"); return true; }
bool MediaElementSession::canControlControlsManager(const HTMLMediaElement& element) const { if (!element.hasAudio()) return false; if (!playbackPermitted(element)) return false; RenderBox* renderer = downcast<RenderBox>(element.renderer()); if (!renderer) return false; if (isElementLargeEnoughForMainContent(element)) return true; if (ScriptController::processingUserGestureForMedia()) return true; return false; }
bool MediaElementSession::canControlControlsManager() const { if (m_element.isFullscreen()) { LOG(Media, "MediaElementSession::canControlControlsManager - returning TRUE: Is fullscreen"); return true; } if (!m_element.hasAudio()) { LOG(Media, "MediaElementSession::canControlControlsManager - returning FALSE: No audio"); return false; } if (m_element.ended()) { LOG(Media, "MediaElementSession::canControlControlsManager - returning FALSE: Ended"); return false; } if (m_element.document().activeDOMObjectsAreSuspended()) { LOG(Media, "MediaElementSession::canControlControlsManager - returning FALSE: activeDOMObjectsAreSuspended()"); return false; } if (!playbackPermitted(m_element)) { LOG(Media, "MediaElementSession::canControlControlsManager - returning FALSE: Playback not permitted"); return false; } if (!hasBehaviorRestriction(RequireUserGestureToControlControlsManager) || ScriptController::processingUserGestureForMedia()) { LOG(Media, "MediaElementSession::canControlControlsManager - returning TRUE: No user gesture required"); return true; } if (hasBehaviorRestriction(RequirePlaybackToControlControlsManager) && !m_element.isPlaying()) { LOG(Media, "MediaElementSession::canControlControlsManager - returning FALSE: Needs to be playing"); return false; } if (m_element.muted()) { LOG(Media, "MediaElementSession::canControlControlsManager - returning FALSE: Muted"); return false; } if (m_element.isVideo()) { if (!m_element.renderer()) { LOG(Media, "MediaElementSession::canControlControlsManager - returning FALSE: No renderer"); return false; } if (m_element.document().isMediaDocument()) { LOG(Media, "MediaElementSession::canControlControlsManager - returning TRUE: Is media document"); return true; } if (!m_element.hasVideo()) { LOG(Media, "MediaElementSession::canControlControlsManager - returning FALSE: No video"); return false; } if (isElementLargeEnoughForMainContent(m_element)) { LOG(Media, "MediaElementSession::canControlControlsManager - returning TRUE: Is main content"); return true; } } LOG(Media, "MediaElementSession::canControlControlsManager - returning FALSE: No user gesture"); return false; }