Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7e532f6ae20014b45fc62f2c3b246878236d9e3f
      
https://github.com/WebKit/WebKit/commit/7e532f6ae20014b45fc62f2c3b246878236d9e3f
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-07-06 (Mon, 06 Jul 2026)

  Changed paths:
    A LayoutTests/media/media-usage-outside-fullscreen-expected.txt
    A LayoutTests/media/media-usage-outside-fullscreen.html
    M Source/WebCore/html/MediaElementSession.cpp

  Log Message:
  -----------
  MediaUsageInfo::outsideOfFullscreen is inverted, reporting media inside 
fullscreen as outside (and vice versa)
https://bugs.webkit.org/show_bug.cgi?id=318204
rdar://181007466

Reviewed by Brent Fulgham.

MediaElementSession::updateMediaUsageIfChanged() computes the
outsideOfFullscreen flag as `element->isDescendantOf(*fullscreenElement)`,
which is true when the media element is *inside* the fullscreen element --
the opposite of what the flag name and its consumer mean. The value flows
through MediaUsageInfo::outsideOfFullscreen to the 
USVideoMetadataKeyOutsideOfFullscreen
key consumed by the UsageTracking (ScreenTime) framework, so ScreenTime was
fed inverted fullscreen metadata.

The negation was present when the flag was introduced (210518) and matches
the sibling idiom in canShowControlsManager() ("Elements which are not
descendants of the current fullscreen element cannot be main content"), but
the `!` was dropped in 273330@main during the mechanical refactor that
wrapped the access in fullscreenManagerIfExists().

Restore the negation so the flag is true exactly when the media element is
not nested within the current fullscreen element. Added test case so we don't
regress this in future.

Test: media/media-usage-outside-fullscreen.html

* LayoutTests/media/media-usage-outside-fullscreen-expected.txt: Added.
* LayoutTests/media/media-usage-outside-fullscreen.html: Added.
* Source/WebCore/html/MediaElementSession.cpp:
(WebCore::MediaElementSession::updateMediaUsageIfChanged):

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



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

Reply via email to