Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 54e267670df1b6c7e018bcf853d798fad33c2577
      
https://github.com/WebKit/WebKit/commit/54e267670df1b6c7e018bcf853d798fad33c2577
  Author: Brent Fulgham <[email protected]>
  Date:   2025-12-11 (Thu, 11 Dec 2025)

  Changed paths:
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/page/Quirks.cpp
    M Source/WebCore/page/Quirks.h
    M Source/WebCore/page/QuirksData.h
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/VisibilityState.mm
    A Tools/TestWebKitAPI/Tests/WebKitCocoa/twitch_quirk.html

  Log Message:
  -----------
  twitch.tv: Create a visibilityState Quirk to support play/pause of PIP videos 
when another tab is in the foreground
https://bugs.webkit.org/show_bug.cgi?id=303674
<rdar://problem/102420527>

Reviewed by Jer Noble and Youenn Fablet.

Some media players use the VisibilityState API as part of their media controls 
logic. This
creates a problem for some PIP flows, where the PIP video might be owned by a 
tab the user
has moved away from.

Since switching from one tab to another while in PIP is a very common use case, 
this patch
creates a quirk that adjusts the behavior of visibilityState to indicate that 
the document
is visible if it has an active PIP window.

Test: Tools/TestWebKitAPI/Tests/WebKitCocoa/VisibilityState.mm

* Source/WebCore/dom/Document.cpp:
(WebCore::Document::visibilityState const): Check if the current document 
requires the
new ShouldReportDocumentAsVisibleIfActivePIPQuirk. If it does, and the document 
has an
active PIP window, report the document as visible.
* Source/WebCore/page/Quirks.cpp:
(WebCore::handleTwitchQuirks): Add quirk for twitch.tv
(WebCore::Quirks::determineRelevantQuirks): Add quirk for twitch.tv.
* Source/WebCore/page/Quirks.h:
(WebCore::Quirks::shouldReportVisibleDueToActivePictureInPictureContent const): 
Added.
* Source/WebCore/page/QuirksData.h: Add new 
ShouldReportDocumentAsVisibleIfActivePIPQuirk
* Tools/TestWebKitAPI/Tests/WebKitCocoa/VisibilityState.mm:
(TEST(VisibilityState, PIPKeepsDocumentVisibleQuirk)): Added.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/twitch_quirk.html: Added.

Canonical link: https://commits.webkit.org/304308@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to