Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Make fullscreen API use the top layer
https://bugs.webkit.org/show_bug.cgi?id=84798 rdar://11313423 Reviewed by Darin Adler. The fullscreen API should use the top layer instead of the fullscreen stack. Some notes: - Pushing to the top layer causes visual changes, so we need to update the DOM methods to follow spec order to prevent unintended effects. Visual changes can't happen before `willEnterFullscreen` and can't happen before `didExitFullscreen` when fully entering/exiting fullscreen. - Since top layer handles visual z-ordering, we can remove old style hacks of clobbering the ancestor chain with special styling, and the associated containsFullscreenElement node flag. Spec: https://fullscreen.spec.whatwg.org * LayoutTests/fullscreen/full-screen-enter-while-exiting-expected.txt: Events are now scheduled and dispatched in didExitFullscreen instead of exitFullscreen(), hence the order change. * Source/WebCore/css/CSSSelector.cpp: (WebCore::CSSSelector::selectorText const): * Source/WebCore/css/CSSSelector.h: * Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in: * Source/WebCore/cssjit/SelectorCompiler.cpp: (WebCore::SelectorCompiler::addPseudoClassType): Remove temporary backdrop workaround that was landed in https://commits.webkit.org/256226@main . * Source/WebCore/css/SelectorChecker.cpp: (WebCore::SelectorChecker::checkOne const): * Source/WebCore/css/SelectorCheckerTestFunctions.h: (WebCore::matchesFullScreenPseudoClass): (WebCore::matchesFullScreenAncestorPseudoClass): Rewrite selector checker functions to account for removal of containsFullscreenElement flag. Since :-webkit-fullscreen-ancestor main usage was for the UA stylesheet, we may be able to remove it in a followup clean up. (WebCore::matchesFullScreenParentPseudoClass): Deleted. (part of the backdrop workaround) * Source/WebCore/css/fullscreen.css: (#if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API): (:root:-webkit-full-screen-document:not(:-webkit-full-screen)): Only keep overflow: hidden; since top layer does not make the root element unscrollable. (iframe:-webkit-full-screen): Match the spec. (:not(:root):-webkit-full-screen::backdrop): Match the spec by making the fullscreen backdrops black. (:-webkit-full-screen): Deleted. (not needed with top layer) (:root:-webkit-full-screen-document:not(:-webkit-full-screen), :root:-webkit-full-screen-ancestor): Deleted. (:-webkit-full-screen-ancestor:not(iframe)): Deleted. (not needed with top layer) (video:-webkit-full-screen, audio:-webkit-full-screen): Deleted. (to match the spec) (:-webkit-full-screen-parent::before): Deleted. (fake backdrop workaround) * Source/WebCore/dom/Document.cpp: (WebCore::Document::nodeChildrenWillBeRemoved): (WebCore::Document::nodeWillBeRemoved): Move element removal handling to `Element::removedFromAncestor()` * Source/WebCore/dom/Element.cpp: (WebCore::Element::insertedIntoAncestor): (WebCore::Element::removedFromAncestor): (WebCore::Element::setFullscreenFlag): (WebCore::Element::setIframeFullscreenFlag): (WebCore::parentCrossingFrameBoundaries): Deleted. (WebCore::Element::setContainsFullScreenElement): Deleted. (WebCore::Element::setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries): Deleted. Removed the containsFullscreenElement flag and replace it with fullscreen flag and iframe fullscreen flag. * Source/WebCore/dom/Element.h: Ditto (WebCore::Element::hasFullscreenFlag const): (WebCore::Element::hasIframeFullscreenFlag const): (WebCore::Element::containsFullScreenElement const): Deleted. * Source/WebCore/dom/FullscreenManager.cpp: (WebCore::FullscreenManager::fullscreenElement const): Rewrite it to iterate through top layer instead of fullscreen stack. (WebCore::FullscreenManager::requestFullscreenForElement): Removed all fullscreen stack handling. Top layer handling is now in `willEnterFullscreen` since it performs visual changes. (WebCore::FullscreenManager::cancelFullscreen): Basically exitFullscreen() but always exits everything. (WebCore::documentsToUnfullscreen): "collecting documents to unfullscreen" algorithm from spec (WebCore::FullscreenManager::exitFullscreen): Steps 1 - 8 of exit fullscreen algorithm from spec (WebCore::FullscreenManager::finishExitFullscreen): Steps 12 - 15 of exit fullscreen algorithm from spec (WebCore::FullscreenManager::willEnterFullscreen): Push documents to top layer, add fullscreen flag & emit events (Step 12 of request fullscreen in spec) (WebCore::FullscreenManager::didExitFullscreen): Everything else that is needed when fully exiting fullscreen. (WebCore::FullscreenManager::exitRemovedFullscreenElementIfNeeded): "removing steps" for element from spec (except for top layer removal which is already done later on in Element::removedFromAncestor) (WebCore::FullscreenManager::isSimpleFullscreenDocument const): "Simple fullscreen document" as defined by the spec, e.g. a document with only one fullscreen element in the top layer. (WebCore::FullscreenManager::adjustFullscreenElementOnNodeRemoval): Deleted. Replaced by exitRemovedFullscreenElementIfNeeded called from Element::removedFromAncestor(). (WebCore::FullscreenManager::clearFullscreenElementStack): Deleted. (WebCore::FullscreenManager::popFullscreenElementStack): Deleted. (WebCore::FullscreenManager::pushFullscreenElementStack): Deleted. (WebCore::FullscreenManager::clear): Remove fullscreen stack remainders. * Source/WebCore/dom/FullscreenManager.h: * Source/WebCore/dom/Node.h: Add IsFullscreen/IsIframeFullscreen flags, remove ContainsFullScreenElement. Shuffle flags around, since Bit 31 is actually not usable (causes integer overflow when using it). Canonical link: https://commits.webkit.org/257456@main
- Loading branch information
Showing
14 changed files
with
205 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.