diff --git a/layout/style/res/html.css b/layout/style/res/html.css index 43ad323536a2..8025b380590d 100644 --- a/layout/style/res/html.css +++ b/layout/style/res/html.css @@ -886,3 +886,34 @@ ruby, rb, rt, rtc { slot { display: contents; } + +/* Popover UA style, https://html.spec.whatwg.org/#flow-content-3 */ +@media (-moz-popover-enabled) { + [popover]:closed:not(dialog[open]) { + display: none; + } + + dialog[popover]:not(:closed) { + display: block; + } + + [popover] { + position: fixed; + inset: 0; + width: fit-content; + height: fit-content; + margin: auto; + border: solid; + padding: 0.25em; + overflow: auto; + color: CanvasText; + background-color: Canvas; + } + + [popover]:open::backdrop { + position: fixed; + inset: 0; + pointer-events: none !important; + background-color: transparent; + } +} diff --git a/servo/components/style/gecko/media_features.rs b/servo/components/style/gecko/media_features.rs index ba1f0c8845ab..7b014b241594 100644 --- a/servo/components/style/gecko/media_features.rs +++ b/servo/components/style/gecko/media_features.rs @@ -643,7 +643,7 @@ macro_rules! bool_pref_feature { /// to support new types in these entries and (2) ensuring that either /// nsPresContext::MediaFeatureValuesChanged is called when the value that /// would be returned by the evaluator function could change. -pub static MEDIA_FEATURES: [QueryFeatureDescription; 64] = [ +pub static MEDIA_FEATURES: [QueryFeatureDescription; 65] = [ feature!( atom!("width"), AllowsRanges::Yes, @@ -957,4 +957,9 @@ pub static MEDIA_FEATURES: [QueryFeatureDescription; 64] = [ atom!("-moz-mathml-core-ms"), "mathml.ms_lquote_rquote_attributes.disabled" ), + // media query for popover attribute + bool_pref_feature!( + atom!("-moz-popover-enabled"), + "dom.element.popover.enabled" + ), ]; diff --git a/servo/components/style/gecko/non_ts_pseudo_class_list.rs b/servo/components/style/gecko/non_ts_pseudo_class_list.rs index 0a7fce462635..90533295b810 100644 --- a/servo/components/style/gecko/non_ts_pseudo_class_list.rs +++ b/servo/components/style/gecko/non_ts_pseudo_class_list.rs @@ -39,7 +39,7 @@ macro_rules! apply_non_ts_list { ("active", Active, ACTIVE, _), ("autofill", Autofill, AUTOFILL, _), ("checked", Checked, CHECKED, _), - ("closed", Closed, CLOSED, _), + ("closed", Closed, CLOSED, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME), ("defined", Defined, DEFINED, _), ("disabled", Disabled, DISABLED, _), ("enabled", Enabled, ENABLED, _), @@ -70,7 +70,7 @@ macro_rules! apply_non_ts_list { ("-moz-math-increment-script-level", MozMathIncrementScriptLevel, INCREMENT_SCRIPT_LEVEL, _), ("required", Required, REQUIRED, _), - ("open", Open, OPEN, _), + ("open", Open, OPEN, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME), ("optional", Optional, OPTIONAL_, _), ("valid", Valid, VALID, _), ("invalid", Invalid, INVALID, _), diff --git a/testing/web-platform/meta/html/semantics/popovers/popover-focus-child-dialog.html.ini b/testing/web-platform/meta/html/semantics/popovers/popover-focus-child-dialog.html.ini index 424a3c19dc66..3d4bebe7af65 100644 --- a/testing/web-platform/meta/html/semantics/popovers/popover-focus-child-dialog.html.ini +++ b/testing/web-platform/meta/html/semantics/popovers/popover-focus-child-dialog.html.ini @@ -2,5 +2,6 @@ expected: if (os == "android") and fission: [ERROR, TIMEOUT] ERROR + max-asserts: 2 [Popovers should not initially focus child popover elements.] expected: NOTRUN diff --git a/testing/web-platform/meta/html/semantics/popovers/popover-hidden-display.html.ini b/testing/web-platform/meta/html/semantics/popovers/popover-hidden-display.html.ini deleted file mode 100644 index 0023014490ab..000000000000 --- a/testing/web-platform/meta/html/semantics/popovers/popover-hidden-display.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[popover-hidden-display.html] - expected: FAIL diff --git a/testing/web-platform/meta/html/semantics/popovers/popover-stacking-context.html.ini b/testing/web-platform/meta/html/semantics/popovers/popover-stacking-context.html.ini deleted file mode 100644 index 69f9fb7e370e..000000000000 --- a/testing/web-platform/meta/html/semantics/popovers/popover-stacking-context.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[popover-stacking-context.html] - expected: FAIL diff --git a/testing/web-platform/tests/html/semantics/popovers/popover-and-svg-ref.html b/testing/web-platform/tests/html/semantics/popovers/popover-and-svg-ref.html new file mode 100644 index 000000000000..db52e77d2be7 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/popovers/popover-and-svg-ref.html @@ -0,0 +1,11 @@ + + +