mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 11:36:10 +00:00
LibWeb: Add default user agent style sheet for Fullscreen API
Make sure matches_pseudo_class also returns for the pseudo-class :fullscreen. Also added a new invalidation reason, for when we want to update due to invalidation (after we "set" the pseudo-class :fullscreen on our element(s)). For now Element::is_fullscreen_element just returns false. In future commits, `Element` will receive a fullscreen flag that can be set.
This commit is contained in:
parent
c0cbd439a2
commit
a901bf45dc
6 changed files with 41 additions and 0 deletions
|
@ -959,6 +959,31 @@ button, meter, progress, select {
|
|||
animation-fill-mode: inherit;
|
||||
animation-delay: 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 {
|
||||
|
|
|
@ -44,6 +44,9 @@
|
|||
"focus-within": {
|
||||
"argument": ""
|
||||
},
|
||||
"fullscreen": {
|
||||
"argument": ""
|
||||
},
|
||||
"has": {
|
||||
"argument": "<relative-selector-list>"
|
||||
},
|
||||
|
|
|
@ -8,6 +8,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>
|
||||
|
@ -461,6 +462,9 @@ static inline bool matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoCla
|
|||
auto* focused_element = element.document().focused_element();
|
||||
return focused_element && element.is_inclusive_ancestor_of(*focused_element);
|
||||
}
|
||||
case CSS::PseudoClass::Fullscreen: {
|
||||
return element.is_fullscreen_element();
|
||||
}
|
||||
case CSS::PseudoClass::FirstChild:
|
||||
if (context.collect_per_element_selector_involvement_metadata) {
|
||||
const_cast<DOM::Element&>(element).set_affected_by_first_or_last_child_pseudo_class(true);
|
||||
|
|
|
@ -3235,6 +3235,11 @@ size_t Element::ordinal_value() const
|
|||
return numbering;
|
||||
}
|
||||
|
||||
bool Element::is_fullscreen_element() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Element::id_reference_exists(String const& id_reference) const
|
||||
{
|
||||
return document().get_element_by_id(id_reference);
|
||||
|
|
|
@ -471,6 +471,8 @@ public:
|
|||
void release_pointer_capture(WebIDL::Long pointer_id);
|
||||
bool has_pointer_capture(WebIDL::Long pointer_id);
|
||||
|
||||
bool is_fullscreen_element() const;
|
||||
|
||||
protected:
|
||||
Element(Document&, DOM::QualifiedName);
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
|
|
@ -59,6 +59,8 @@ enum class ShouldComputeRole {
|
|||
X(EditingInsertion) \
|
||||
X(ElementAttributeChange) \
|
||||
X(ElementSetShadowRoot) \
|
||||
X(FocusedElementChange) \
|
||||
X(Fullscreen) \
|
||||
X(HTMLHyperlinkElementHrefChange) \
|
||||
X(HTMLIFrameElementGeometryChange) \
|
||||
X(HTMLInputElementSetChecked) \
|
||||
|
|
Loading…
Add table
Reference in a new issue