Changeset 287803 in webkit
- Timestamp:
- Jan 7, 2022, 6:20:37 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/dom/Element.cpp (modified) (1 diff)
-
WebCore/dom/FullscreenManager.cpp (modified) (6 diffs)
-
WebCore/dom/FullscreenManager.h (modified) (1 diff)
-
WebCore/html/HTMLMediaElement.cpp (modified) (1 diff)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r287802 r287803 1 2022-01-07 Alex Christensen <achristensen@webkit.org> 2 3 Make FullscreenManager::requestFullscreenForElement more robust 4 https://bugs.webkit.org/show_bug.cgi?id=234995 5 6 Reviewed by Darin Adler. 7 8 I think this may fix the Windows crashes after bug 233963 lands, and it makes things more robust anyways. 9 10 * dom/Element.cpp: 11 (WebCore::Element::webkitRequestFullscreen): 12 * dom/FullscreenManager.cpp: 13 (WebCore::FullscreenManager::requestFullscreenForElement): 14 * dom/FullscreenManager.h: 15 * html/HTMLMediaElement.cpp: 16 (WebCore::HTMLMediaElement::enterFullscreen): 17 1 18 2022-01-07 Alexey Shvayka <ashvayka@apple.com> 2 19 -
trunk/Source/WebCore/dom/Element.cpp
r287802 r287803 3870 3870 void Element::webkitRequestFullscreen() 3871 3871 { 3872 document().fullscreenManager().requestFullscreenForElement( this, FullscreenManager::EnforceIFrameAllowFullscreenRequirement);3872 document().fullscreenManager().requestFullscreenForElement(*this, FullscreenManager::EnforceIFrameAllowFullscreenRequirement); 3873 3873 } 3874 3874 -
trunk/Source/WebCore/dom/FullscreenManager.cpp
r284093 r287803 59 59 FullscreenManager::~FullscreenManager() = default; 60 60 61 void FullscreenManager::requestFullscreenForElement(Element* element, FullscreenCheckType checkType) 62 { 63 if (!element) 64 element = documentElement(); 65 66 auto failedPreflights = [this, weakThis = WeakPtr { *this }](auto element) mutable { 61 void FullscreenManager::requestFullscreenForElement(Ref<Element>&& element, FullscreenCheckType checkType) 62 { 63 auto failedPreflights = [this, weakThis = WeakPtr { *this }](Ref<Element>&& element) mutable { 64 if (!weakThis) 65 return; 67 66 m_fullscreenErrorEventTargetQueue.append(WTFMove(element)); 68 67 m_document.eventLoop().queueTask(TaskSource::MediaElement, [weakThis = WTFMove(weakThis)]() mutable { … … 103 102 104 103 bool hasKeyboardAccess = true; 105 if (!page()->chrome().client().supportsFullScreenForElement( *element, hasKeyboardAccess)) {104 if (!page()->chrome().client().supportsFullScreenForElement(element, hasKeyboardAccess)) { 106 105 // The new full screen API does not accept a "flags" parameter, so fall back to disallowing 107 106 // keyboard input if the chrome client refuses to allow keyboard input. 108 107 hasKeyboardAccess = false; 109 108 110 if (!page()->chrome().client().supportsFullScreenForElement( *element, hasKeyboardAccess)) {109 if (!page()->chrome().client().supportsFullScreenForElement(element, hasKeyboardAccess)) { 111 110 ERROR_LOG(LOGIDENTIFIER, "page does not support fullscreen for element; failing."); 112 111 failedPreflights(WTFMove(element)); … … 115 114 } 116 115 117 m_pendingFullscreenElement = element;118 119 m_document.eventLoop().queueTask(TaskSource::MediaElement, [this, weakThis = WeakPtr { *this }, element = RefPtr { element }, checkType, hasKeyboardAccess, failedPreflights, identifier = LOGIDENTIFIER] () mutable {116 m_pendingFullscreenElement = RefPtr { element.ptr() }; 117 118 m_document.eventLoop().queueTask(TaskSource::MediaElement, [this, weakThis = WeakPtr { *this }, element = WTFMove(element), checkType, hasKeyboardAccess, failedPreflights, identifier = LOGIDENTIFIER] () mutable { 120 119 if (!weakThis) 121 120 return; … … 123 122 // Don't allow fullscreen if it has been cancelled or a different fullscreen element 124 123 // has requested fullscreen. 125 if (m_pendingFullscreenElement != element ) {124 if (m_pendingFullscreenElement != element.ptr()) { 126 125 ERROR_LOG(identifier, "task - pending element mismatch; failing."); 127 126 failedPreflights(WTFMove(element)); … … 206 205 // set to true on the document. 207 206 if (!followingDoc) { 208 currentDoc->fullscreenManager().pushFullscreenElementStack( *element);207 currentDoc->fullscreenManager().pushFullscreenElementStack(element); 209 208 addDocumentToFullscreenChangeEventQueue(*currentDoc); 210 209 continue; … … 234 233 235 234 auto page = this->page(); 236 if (!page || document().hidden() || m_pendingFullscreenElement != element || !element->isConnected()) {235 if (!page || document().hidden() || m_pendingFullscreenElement != element.ptr() || !element->isConnected()) { 237 236 ERROR_LOG(identifier, "task - page, document, or element mismatch; failing."); 238 failedPreflights( element);237 failedPreflights(WTFMove(element)); 239 238 return; 240 239 } 241 240 INFO_LOG(identifier, "task - success"); 242 page->chrome().client().enterFullScreenForElement( *element.get());241 page->chrome().client().enterFullScreenForElement(element); 243 242 }); 244 243 -
trunk/Source/WebCore/dom/FullscreenManager.h
r284857 r287803 70 70 ExemptIFrameAllowFullscreenRequirement, 71 71 }; 72 WEBCORE_EXPORT void requestFullscreenForElement( Element*, FullscreenCheckType);72 WEBCORE_EXPORT void requestFullscreenForElement(Ref<Element>&&, FullscreenCheckType); 73 73 74 74 WEBCORE_EXPORT bool willEnterFullscreen(Element&); -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r287604 r287803 6304 6304 m_temporarilyAllowingInlinePlaybackAfterFullscreen = false; 6305 6305 m_waitingToEnterFullscreen = true; 6306 document().fullscreenManager().requestFullscreenForElement( this, FullscreenManager::ExemptIFrameAllowFullscreenRequirement);6306 document().fullscreenManager().requestFullscreenForElement(*this, FullscreenManager::ExemptIFrameAllowFullscreenRequirement); 6307 6307 return; 6308 6308 } -
trunk/Source/WebKit/ChangeLog
r287794 r287803 1 2022-01-07 Alex Christensen <achristensen@webkit.org> 2 3 Make FullscreenManager::requestFullscreenForElement more robust 4 https://bugs.webkit.org/show_bug.cgi?id=234995 5 6 Reviewed by Darin Adler. 7 8 * WebProcess/FullScreen/WebFullScreenManager.cpp: 9 (WebKit::WebFullScreenManager::requestEnterFullScreen): 10 1 11 2022-01-07 Chris Lord <clord@igalia.com> 2 12 -
trunk/Source/WebKit/WebProcess/FullScreen/WebFullScreenManager.cpp
r280500 r287803 243 243 244 244 WebCore::UserGestureIndicator gestureIndicator(WebCore::ProcessingUserGesture); 245 m_element->document().fullscreenManager().requestFullscreenForElement( m_element.get(), WebCore::FullscreenManager::ExemptIFrameAllowFullscreenRequirement);245 m_element->document().fullscreenManager().requestFullscreenForElement(*m_element, WebCore::FullscreenManager::ExemptIFrameAllowFullscreenRequirement); 246 246 } 247 247
Note:
See TracChangeset
for help on using the changeset viewer.