Changeset 271470 in webkit
- Timestamp:
- Jan 13, 2021 3:32:21 PM (18 months ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
html/MediaElementSession.cpp (modified) (1 diff)
-
page/Quirks.cpp (modified) (2 diffs)
-
page/Quirks.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r271459 r271470 1 2021-01-13 Jer Noble <jer.noble@apple.com> 2 3 Facebook pauses video in PiP during scroll 4 https://bugs.webkit.org/show_bug.cgi?id=220581 5 <rdar://67273166> 6 7 Reviewed by Eric Carlson. 8 9 Add a Quirk which blocks Facebook from pausing videos in Picture-in-Picture mode without that 10 pause() occurring during a User Gesture. This blocks Facebook from pausing a PiP'd video when 11 the <video> element hosting that video scrolls out of the viewport, without blocking Facebook's 12 own custom pause control from working correctly. 13 14 * html/MediaElementSession.cpp: 15 (WebCore::MediaElementSession::playbackPermitted const): 16 * page/Quirks.cpp: 17 (WebCore::Quirks::requiresUserGestureToPauseInPictureInPicture const): 18 * page/Quirks.h: 19 1 20 2021-01-13 Wenson Hsieh <wenson_hsieh@apple.com> 2 21 -
trunk/Source/WebCore/html/MediaElementSession.cpp
r264355 r271470 316 316 // FIXME: Why are we checking top-level document only for PerDocumentAutoplayBehavior? 317 317 const auto& topDocument = document.topDocument(); 318 if (topDocument.quirks().requiresUserGestureToPauseInPictureInPicture() 319 && m_element.fullscreenMode() & HTMLMediaElementEnums::VideoFullscreenModePictureInPicture 320 && !m_element.paused() 321 && !document.processingUserGestureForMedia()) { 322 ALWAYS_LOG(LOGIDENTIFIER, "Returning FALSE because a quirk requires a user gesture to pause while in Picture-in-Picture"); 323 return MediaPlaybackDenialReason::UserGestureRequired; 324 } 325 318 326 if (topDocument.mediaState() & MediaProducer::HasUserInteractedWithMediaElement && topDocument.quirks().needsPerDocumentAutoplayBehavior()) 319 327 return { }; -
trunk/Source/WebCore/page/Quirks.cpp
r271074 r271470 46 46 #include "NetworkStorageSession.h" 47 47 #include "PlatformMouseEvent.h" 48 #include "RegistrableDomain.h" 48 49 #include "ResourceLoadObserver.h" 49 50 #include "RuntimeEnabledFeatures.h" … … 1259 1260 } 1260 1261 1261 } 1262 bool Quirks::requiresUserGestureToPauseInPictureInPicture() const 1263 { 1264 // Facebook will naively pause a <video> element that has scrolled out of the viewport, regardless of whether that element is currently in PiP mode. 1265 if (!needsQuirks()) 1266 return false; 1267 1268 if (!m_requiresUserGestureToPauseInPictureInPicture) { 1269 auto domain = RegistrableDomain(m_document->topDocument().url()); 1270 m_requiresUserGestureToPauseInPictureInPicture = domain.string() == "facebook.com"_s; 1271 } 1272 1273 return *m_requiresUserGestureToPauseInPictureInPicture; 1274 } 1275 1276 } -
trunk/Source/WebCore/page/Quirks.h
r271415 r271470 128 128 bool needsBlackFullscreenBackgroundQuirk() const; 129 129 130 bool requiresUserGestureToPauseInPictureInPicture() const; 131 130 132 #if ENABLE(RESOURCE_LOAD_STATISTICS) 131 133 static bool isMicrosoftTeamsRedirectURL(const URL&); … … 168 170 mutable Optional<bool> m_needsHDRPixelDepthQuirk; 169 171 mutable Optional<bool> m_needsBlackFullscreenBackgroundQuirk; 172 mutable Optional<bool> m_requiresUserGestureToPauseInPictureInPicture; 170 173 }; 171 174
Note: See TracChangeset
for help on using the changeset viewer.