forked from mirrors/gecko-dev
Bug 1825807: part 1) Replace popover's ':open' and ':closed' pseudo-classes with ':popover-open'. r=emilio
See https://github.com/whatwg/html/pull/9077. Differential Revision: https://phabricator.services.mozilla.com/D175223
This commit is contained in:
parent
5b77c8cf62
commit
c47bb134d2
6 changed files with 18 additions and 29 deletions
|
|
@ -124,13 +124,9 @@ bitflags! {
|
||||||
const VALUE_EMPTY = 1u64 << 47;
|
const VALUE_EMPTY = 1u64 << 47;
|
||||||
/// For :-moz-revealed.
|
/// For :-moz-revealed.
|
||||||
const REVEALED = 1u64 << 48;
|
const REVEALED = 1u64 << 48;
|
||||||
/// https://html.spec.whatwg.org/#selector-open
|
/// https://html.spec.whatwg.org/#selector-popover-open
|
||||||
/// Match element's popover visibility state of showing
|
/// Match element's popover visibility state of showing
|
||||||
const OPEN = 1u64 << 49;
|
const POPOVER_OPEN = 1u64 << 49;
|
||||||
/// https://html.spec.whatwg.org/#selector-closed
|
|
||||||
/// Match element's popover visibility state of hidden
|
|
||||||
const CLOSED = 1u64 << 50;
|
|
||||||
|
|
||||||
|
|
||||||
/// Some convenience unions.
|
/// Some convenience unions.
|
||||||
const DIR_STATES = Self::LTR.bits | Self::RTL.bits;
|
const DIR_STATES = Self::LTR.bits | Self::RTL.bits;
|
||||||
|
|
@ -142,8 +138,6 @@ bitflags! {
|
||||||
|
|
||||||
const DISABLED_STATES = Self::DISABLED.bits | Self::ENABLED.bits;
|
const DISABLED_STATES = Self::DISABLED.bits | Self::ENABLED.bits;
|
||||||
|
|
||||||
const POPOVER_STATES = Self::OPEN.bits | Self::CLOSED.bits;
|
|
||||||
|
|
||||||
const REQUIRED_STATES = Self::REQUIRED.bits | Self::OPTIONAL_.bits;
|
const REQUIRED_STATES = Self::REQUIRED.bits | Self::OPTIONAL_.bits;
|
||||||
|
|
||||||
/// Event states that can be added and removed through
|
/// Event states that can be added and removed through
|
||||||
|
|
@ -171,7 +165,7 @@ bitflags! {
|
||||||
Self::FOCUSRING.bits |
|
Self::FOCUSRING.bits |
|
||||||
Self::FOCUS_WITHIN.bits |
|
Self::FOCUS_WITHIN.bits |
|
||||||
Self::FULLSCREEN.bits |
|
Self::FULLSCREEN.bits |
|
||||||
Self::POPOVER_STATES.bits |
|
Self::POPOVER_OPEN.bits |
|
||||||
Self::HOVER.bits |
|
Self::HOVER.bits |
|
||||||
Self::URLTARGET.bits |
|
Self::URLTARGET.bits |
|
||||||
Self::MODAL.bits |
|
Self::MODAL.bits |
|
||||||
|
|
|
||||||
|
|
@ -692,7 +692,7 @@ nsresult nsGenericHTMLElement::AfterSetAttr(
|
||||||
PopoverPseudoStateUpdate(false, true);
|
PopoverPseudoStateUpdate(false, true);
|
||||||
} else {
|
} else {
|
||||||
ClearPopoverData();
|
ClearPopoverData();
|
||||||
RemoveStates(ElementState::OPEN | ElementState::CLOSED);
|
RemoveStates(ElementState::POPOVER_OPEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (aName == nsGkAtoms::dir) {
|
} else if (aName == nsGkAtoms::dir) {
|
||||||
|
|
@ -3208,17 +3208,14 @@ PopoverState nsGenericHTMLElement::GetPopoverState() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsGenericHTMLElement::PopoverPseudoStateUpdate(bool aOpen, bool aNotify) {
|
void nsGenericHTMLElement::PopoverPseudoStateUpdate(bool aOpen, bool aNotify) {
|
||||||
ElementState popoverStates;
|
ElementState newPopoverState;
|
||||||
if (aOpen) {
|
if (aOpen) {
|
||||||
popoverStates |= ElementState::OPEN;
|
newPopoverState = ElementState::POPOVER_OPEN;
|
||||||
popoverStates &= ~ElementState::CLOSED;
|
|
||||||
} else {
|
|
||||||
popoverStates |= ElementState::CLOSED;
|
|
||||||
popoverStates &= ~ElementState::OPEN;
|
|
||||||
}
|
}
|
||||||
ElementState oldPopoverStates = State() & ElementState::POPOVER_STATES;
|
|
||||||
ElementState changedStates = popoverStates ^ oldPopoverStates;
|
ElementState oldPopoverState = State() & ElementState::POPOVER_OPEN;
|
||||||
ToggleStates(changedStates, aNotify);
|
ElementState changedState = newPopoverState ^ oldPopoverState;
|
||||||
|
ToggleStates(changedState, aNotify);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsGenericHTMLElement::FireBeforeToggle(bool aIsOpen) {
|
bool nsGenericHTMLElement::FireBeforeToggle(bool aIsOpen) {
|
||||||
|
|
|
||||||
|
|
@ -906,12 +906,12 @@ slot {
|
||||||
|
|
||||||
/* Popover UA style, https://html.spec.whatwg.org/#flow-content-3 */
|
/* Popover UA style, https://html.spec.whatwg.org/#flow-content-3 */
|
||||||
@media (-moz-popover-enabled) {
|
@media (-moz-popover-enabled) {
|
||||||
[popover]:closed:not(dialog[open]) {
|
[popover]:not(:popover-open):not(dialog[open]) {
|
||||||
display: none;
|
display:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog[popover]:not(:closed) {
|
dialog:popover-open {
|
||||||
display: block;
|
display:block;
|
||||||
}
|
}
|
||||||
|
|
||||||
[popover] {
|
[popover] {
|
||||||
|
|
@ -927,7 +927,7 @@ slot {
|
||||||
background-color: Canvas;
|
background-color: Canvas;
|
||||||
}
|
}
|
||||||
|
|
||||||
[popover]:open::backdrop {
|
:popover-open::backdrop {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
pointer-events: none !important;
|
pointer-events: none !important;
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ macro_rules! apply_non_ts_list {
|
||||||
("active", Active, ACTIVE, _),
|
("active", Active, ACTIVE, _),
|
||||||
("autofill", Autofill, AUTOFILL, _),
|
("autofill", Autofill, AUTOFILL, _),
|
||||||
("checked", Checked, CHECKED, _),
|
("checked", Checked, CHECKED, _),
|
||||||
("closed", Closed, CLOSED, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
|
|
||||||
("defined", Defined, DEFINED, _),
|
("defined", Defined, DEFINED, _),
|
||||||
("disabled", Disabled, DISABLED, _),
|
("disabled", Disabled, DISABLED, _),
|
||||||
("enabled", Enabled, ENABLED, _),
|
("enabled", Enabled, ENABLED, _),
|
||||||
|
|
@ -70,7 +69,7 @@ macro_rules! apply_non_ts_list {
|
||||||
("-moz-math-increment-script-level", MozMathIncrementScriptLevel, INCREMENT_SCRIPT_LEVEL, _),
|
("-moz-math-increment-script-level", MozMathIncrementScriptLevel, INCREMENT_SCRIPT_LEVEL, _),
|
||||||
|
|
||||||
("required", Required, REQUIRED, _),
|
("required", Required, REQUIRED, _),
|
||||||
("open", Open, OPEN, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
|
("popover-open", PopoverOpen, POPOVER_OPEN, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
|
||||||
("optional", Optional, OPTIONAL_, _),
|
("optional", Optional, OPTIONAL_, _),
|
||||||
("valid", Valid, VALID, _),
|
("valid", Valid, VALID, _),
|
||||||
("invalid", Invalid, INVALID, _),
|
("invalid", Invalid, INVALID, _),
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ impl NonTSPseudoClass {
|
||||||
/// Returns whether the pseudo-class is enabled in content sheets.
|
/// Returns whether the pseudo-class is enabled in content sheets.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn is_enabled_in_content(&self) -> bool {
|
fn is_enabled_in_content(&self) -> bool {
|
||||||
if matches!(*self, Self::Open | Self::Closed) {
|
if matches!(*self, Self::PopoverOpen) {
|
||||||
return static_prefs::pref!("dom.element.popover.enabled");
|
return static_prefs::pref!("dom.element.popover.enabled");
|
||||||
}
|
}
|
||||||
!self.has_any_flag(NonTSPseudoClassFlag::PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME)
|
!self.has_any_flag(NonTSPseudoClassFlag::PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME)
|
||||||
|
|
|
||||||
|
|
@ -2001,11 +2001,10 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
NonTSPseudoClass::Enabled |
|
NonTSPseudoClass::Enabled |
|
||||||
NonTSPseudoClass::Disabled |
|
NonTSPseudoClass::Disabled |
|
||||||
NonTSPseudoClass::Checked |
|
NonTSPseudoClass::Checked |
|
||||||
NonTSPseudoClass::Closed |
|
|
||||||
NonTSPseudoClass::Fullscreen |
|
NonTSPseudoClass::Fullscreen |
|
||||||
NonTSPseudoClass::Indeterminate |
|
NonTSPseudoClass::Indeterminate |
|
||||||
NonTSPseudoClass::MozInert |
|
NonTSPseudoClass::MozInert |
|
||||||
NonTSPseudoClass::Open |
|
NonTSPseudoClass::PopoverOpen |
|
||||||
NonTSPseudoClass::PlaceholderShown |
|
NonTSPseudoClass::PlaceholderShown |
|
||||||
NonTSPseudoClass::Target |
|
NonTSPseudoClass::Target |
|
||||||
NonTSPseudoClass::Valid |
|
NonTSPseudoClass::Valid |
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue