Skip to content

Commit

Permalink
[iOS] premierleague.com enters video fullscreen from element fullscre…
Browse files Browse the repository at this point in the history
…en on iPhone

https://bugs.webkit.org/show_bug.cgi?id=270329
rdar://123721211

Reviewed by Eric Carlson.

premierleague.com does not include a `playsinline` attribute on their video elements,
which causes them to attempt to enter video fullscreen when playing, even in element
fullscreen. Exempt premierleague.com from the `playsinline` attribute (and consider
removing that requirement on iPhone generally).

* Source/WebCore/html/MediaElementSession.cpp:
(WebCore::MediaElementSession::requiresFullscreenForVideoPlayback const):
* Source/WebCore/page/Quirks.cpp:
(WebCore::Quirks::shouldIgnorePlaysInlineRequirementQuirk const):
* Source/WebCore/page/Quirks.h:

Canonical link: https://commits.webkit.org/275556@main
  • Loading branch information
jernoble committed Mar 1, 2024
1 parent bd9231e commit 568a30c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Source/WebCore/html/MediaElementSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,9 @@ bool MediaElementSession::requiresFullscreenForVideoPlayback() const
if (!m_element.document().settings().inlineMediaPlaybackRequiresPlaysInlineAttribute())
return false;

if (m_element.document().quirks().shouldIgnorePlaysInlineRequirementQuirk())
return false;

#if PLATFORM(IOS_FAMILY)
if (CocoaApplication::isIBooks())
return !m_element.hasAttributeWithoutSynchronization(HTMLNames::webkit_playsinlineAttr) && !m_element.hasAttributeWithoutSynchronization(HTMLNames::playsinlineAttr);
Expand Down
18 changes: 18 additions & 0 deletions Source/WebCore/page/Quirks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1819,4 +1819,22 @@ bool Quirks::needsIpadMiniUserAgent(StringView host)
return false;
}


bool Quirks::shouldIgnorePlaysInlineRequirementQuirk() const
{
#if PLATFORM(IOS_FAMILY)
if (!needsQuirks())
return false;

if (m_shouldIgnorePlaysInlineRequirementQuirk)
return *m_shouldIgnorePlaysInlineRequirementQuirk;

m_shouldIgnorePlaysInlineRequirementQuirk = isDomain("premierleague.com"_s);

return *m_shouldIgnorePlaysInlineRequirementQuirk;
#else
return false;
#endif
}

}
2 changes: 2 additions & 0 deletions Source/WebCore/page/Quirks.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ class Quirks {
bool needsDisableDOMPasteAccessQuirk() const;

bool shouldDisableElementFullscreenQuirk() const;
bool shouldIgnorePlaysInlineRequirementQuirk() const;

private:
bool needsQuirks() const;
Expand Down Expand Up @@ -257,6 +258,7 @@ class Quirks {
mutable std::optional<bool> m_shouldDisableDataURLPaddingValidation;
mutable std::optional<bool> m_needsDisableDOMPasteAccessQuirk;
mutable std::optional<bool> m_shouldDisableElementFullscreen;
mutable std::optional<bool> m_shouldIgnorePlaysInlineRequirementQuirk;

Vector<RegistrableDomain> m_subFrameDomainsForStorageAccessQuirk;
};
Expand Down

0 comments on commit 568a30c

Please sign in to comment.