LibWeb: Add default user agent style sheet for Fullscreen API

Matching the fullscreen pseudo class is currently a stub that will be
implemented in a future commit.
This commit is contained in:
Simon Farre 2026-02-02 18:44:37 +00:00 committed by Luke Wilde
parent 41ef9c2754
commit 53eae831e2
4 changed files with 35 additions and 0 deletions

View file

@ -914,6 +914,32 @@ button, meter, progress, select {
animation-play-state: inherit;
}
/* Fullscreen API defaults https://fullscreen.spec.whatwg.org/#user-agent-level-style-sheet-defaults */
*|*:not(:root):fullscreen {
position:fixed !important;
inset:0 !important;
margin:0 !important;
box-sizing:border-box !important;
min-width:0 !important;
max-width:none !important;
min-height:0 !important;
max-height:none !important;
width:100% !important;
height:100% !important;
transform:none !important;
/* intentionally not !important */
object-fit:contain;
}
iframe:fullscreen {
border:none !important;
padding:0 !important;
}
*|*:not(:root):fullscreen::backdrop {
background:black;
}
/* Default cross-fade transition */
@keyframes -ua-view-transition-fade-out {
to { opacity: 0; }

View file

@ -53,6 +53,9 @@
"focus-within": {
"argument": ""
},
"fullscreen": {
"argument": ""
},
"has": {
"argument": "<relative-selector-list>"
},

View file

@ -9,6 +9,7 @@
#include <LibWeb/CSS/ComputedProperties.h>
#include <LibWeb/CSS/Keyword.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/PseudoClass.h>
#include <LibWeb/CSS/SelectorEngine.h>
#include <LibWeb/DOM/Attr.h>
#include <LibWeb/DOM/Document.h>
@ -557,6 +558,10 @@ static inline bool matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoCla
auto focused_area = element.document().focused_area();
return focused_area && element.is_inclusive_ancestor_of(*focused_area);
}
case CSS::PseudoClass::Fullscreen: {
// FIXME: Add fullscreen support
return false;
}
case CSS::PseudoClass::FirstChild:
if (context.collect_per_element_selector_involvement_metadata) {
const_cast<DOM::Element&>(element).set_affected_by_sibling_position_or_count_pseudo_class(true);

View file

@ -25,6 +25,7 @@ namespace Web::DOM {
X(EditingDeletion) \
X(ElementAttributeChange) \
X(ElementSetShadowRoot) \
X(Fullscreen) \
X(HTMLDialogElementSetIsModal) \
X(HTMLDetailsOrDialogOpenAttributeChange) \
X(HTMLHyperlinkElementHrefChange) \