Backed out 3 changesets (bug 1617600) for causing wpt failures in focus-visible-009.html CLOSED TREE

Backed out changeset 73d1a5e10337 (bug 1617600)
Backed out changeset b722714830cd (bug 1617600)
Backed out changeset 45464d926bf0 (bug 1617600)
This commit is contained in:
Noemi Erli 2020-02-26 01:46:31 +02:00
Родитель 9e4e8e56cf
Коммит 4fb19079c8
17 изменённых файлов: 117 добавлений и 154 удалений

Просмотреть файл

@ -872,8 +872,7 @@ nsresult nsFocusManager::ContentRemoved(Document* aDocument,
}
}
NotifyFocusStateChange(content, nullptr, shouldShowFocusRing, 0,
/* aGettingFocus = */ false);
NotifyFocusStateChange(content, nullptr, shouldShowFocusRing, false);
}
return NS_OK;
@ -976,7 +975,7 @@ nsFocusManager::WindowHidden(mozIDOMWindowProxy* aWindow) {
if (oldFocusedElement && oldFocusedElement->IsInComposedDoc()) {
NotifyFocusStateChange(oldFocusedElement, nullptr,
mFocusedWindow->ShouldShowFocusRing(), 0, false);
mFocusedWindow->ShouldShowFocusRing(), false);
window->UpdateCommands(NS_LITERAL_STRING("focus"), nullptr, 0);
if (presShell) {
@ -1089,41 +1088,10 @@ nsFocusManager::ParentActivated(mozIDOMWindowProxy* aWindow, bool aActive) {
return NS_OK;
}
static bool ShouldMatchFocusVisible(const Element& aElement,
int32_t aFocusFlags) {
if (StaticPrefs::browser_display_show_focus_rings()) {
// FIXME: Spec is ambiguous about whether we should take platform
// conventions into account. This branch does make us account for them.
return true;
}
switch (nsFocusManager::GetFocusMoveActionCause(aFocusFlags)) {
case InputContextAction::CAUSE_UNKNOWN:
case InputContextAction::CAUSE_KEY:
return true;
case InputContextAction::CAUSE_MOUSE:
case InputContextAction::CAUSE_TOUCH:
case InputContextAction::CAUSE_LONGPRESS:
break;
case InputContextAction::CAUSE_UNKNOWN_CHROME:
case InputContextAction::CAUSE_UNKNOWN_DURING_KEYBOARD_INPUT:
case InputContextAction::CAUSE_UNKNOWN_DURING_NON_KEYBOARD_INPUT:
// TODO(emilio): We could return some of these though, looking at
// UserActivation. We may want to suppress focus rings for unknown /
// programatic focus if the user is interacting with the page but not
// during keyboard input, or such.
MOZ_ASSERT_UNREACHABLE(
"These don't get returned by GetFocusMoveActionCause");
break;
}
return false;
}
/* static */
void nsFocusManager::NotifyFocusStateChange(nsIContent* aContent,
nsIContent* aContentToFocus,
bool aWindowShouldShowFocusRing,
int32_t aFlags,
bool aGettingFocus) {
MOZ_ASSERT_IF(aContentToFocus, !aGettingFocus);
if (!aContent->IsElement()) {
@ -1136,29 +1104,24 @@ void nsFocusManager::NotifyFocusStateChange(nsIContent* aContent,
aContent, aContentToFocus);
}
EventStates eventState = NS_EVENT_STATE_FOCUS;
if (aWindowShouldShowFocusRing) {
eventState |= NS_EVENT_STATE_FOCUSRING;
}
if (aGettingFocus) {
EventStates eventStateToAdd = NS_EVENT_STATE_FOCUS;
if (aWindowShouldShowFocusRing) {
eventStateToAdd |= NS_EVENT_STATE_FOCUSRING;
}
if (ShouldMatchFocusVisible(*aContent->AsElement(), aFlags)) {
eventStateToAdd |= NS_EVENT_STATE_FOCUS_VISIBLE;
}
aContent->AsElement()->AddStates(eventStateToAdd);
aContent->AsElement()->AddStates(eventState);
} else {
EventStates eventStateToRemove = NS_EVENT_STATE_FOCUS |
NS_EVENT_STATE_FOCUSRING |
NS_EVENT_STATE_FOCUS_VISIBLE;
aContent->AsElement()->RemoveStates(eventStateToRemove);
aContent->AsElement()->RemoveStates(eventState);
}
for (nsIContent* content = aContent; content && content != commonAncestor;
content = content->GetFlattenedTreeParent()) {
Element* element = Element::FromNode(content);
if (!element) {
if (!content->IsElement()) {
continue;
}
Element* element = content->AsElement();
if (aGettingFocus) {
if (element->State().HasState(NS_EVENT_STATE_FOCUS_WITHIN)) {
break;
@ -1987,7 +1950,7 @@ bool nsFocusManager::BlurImpl(BrowsingContext* aBrowsingContextToClear,
element && element->IsInComposedDoc() && !IsNonFocusableRoot(element);
if (element) {
if (sendBlurEvent) {
NotifyFocusStateChange(element, aContentToFocus, shouldShowFocusRing, 0,
NotifyFocusStateChange(element, aContentToFocus, shouldShowFocusRing,
false);
}
@ -2268,7 +2231,7 @@ void nsFocusManager::Focus(nsPIDOMWindowOuter* aWindow, Element* aElement,
nsPresContext* presContext = presShell->GetPresContext();
if (sendFocusEvent) {
NotifyFocusStateChange(aElement, nullptr, aWindow->ShouldShowFocusRing(),
aFlags, /* aGettingFocus = */ true);
true);
// if this is an object/plug-in/remote browser, focus its widget. Note
// that we might no longer be in the same document, due to the events we

Просмотреть файл

@ -671,7 +671,7 @@ class nsFocusManager final : public nsIFocusManager,
static void NotifyFocusStateChange(nsIContent* aContent,
nsIContent* aContentToFocus,
bool aWindowShouldShowFocusRing,
int32_t aFlags, bool aGettingFocus);
bool aGettingFocus);
void SetFocusedWindowInternal(nsPIDOMWindowOuter* aWindow);

Просмотреть файл

@ -2914,7 +2914,8 @@ bool CanvasRenderingContext2D::DrawCustomFocusRing(
return false;
}
if (nsFocusManager* fm = nsFocusManager::GetFocusManager()) {
nsFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm) {
// check that the element is focused
if (&aElement == fm->GetFocusedElement()) {
if (nsPIDOMWindowOuter* window = aElement.OwnerDoc()->GetWindow()) {

Просмотреть файл

@ -287,10 +287,9 @@ class EventStates {
#define NS_EVENT_STATE_AUTOFILL NS_DEFINE_EVENT_STATE_MACRO(50)
// Element is filled with preview data by Autofill feature.
#define NS_EVENT_STATE_AUTOFILL_PREVIEW NS_DEFINE_EVENT_STATE_MACRO(51)
// Element matches the :focus-visible pseudo-class.
//
// TODO(emilio): We should eventually unify this and FOCUSRING.
#define NS_EVENT_STATE_FOCUS_VISIBLE NS_DEFINE_EVENT_STATE_MACRO(52)
// Event state that is used for values that need to be parsed but do nothing.
#define NS_EVENT_STATE_IGNORE NS_DEFINE_EVENT_STATE_MACRO(63)
/**
* NOTE: do not go over 63 without updating EventStates::InternalType!
@ -325,8 +324,7 @@ class EventStates {
REQUIRED_STATES | NS_EVENT_STATE_ACTIVE | NS_EVENT_STATE_DEFINED | \
NS_EVENT_STATE_DRAGOVER | NS_EVENT_STATE_FOCUS | NS_EVENT_STATE_FOCUSRING | \
NS_EVENT_STATE_FOCUS_WITHIN | NS_EVENT_STATE_FULLSCREEN | \
NS_EVENT_STATE_HOVER | NS_EVENT_STATE_URLTARGET | \
NS_EVENT_STATE_FOCUS_VISIBLE)
NS_EVENT_STATE_HOVER | NS_EVENT_STATE_URLTARGET)
#define INTRINSIC_STATES (~EXTERNALLY_MANAGED_STATES)

Просмотреть файл

@ -2172,8 +2172,7 @@ void HTMLInputElement::SetFocusState(bool aIsFocused) {
return;
}
EventStates focusStates = NS_EVENT_STATE_FOCUS | NS_EVENT_STATE_FOCUSRING |
NS_EVENT_STATE_FOCUS_VISIBLE;
EventStates focusStates = NS_EVENT_STATE_FOCUS | NS_EVENT_STATE_FOCUSRING;
if (aIsFocused) {
AddStates(focusStates);
} else {

Просмотреть файл

@ -170,8 +170,14 @@ bool nsIConstraintValidation::ReportValidity() {
}
}
auto* inputElement = HTMLInputElement::FromNode(element);
if (inputElement && inputElement->State().HasState(NS_EVENT_STATE_FOCUS)) {
if (element->IsHTMLElement(nsGkAtoms::input) &&
// We don't use nsContentUtils::IsFocusedContent here, because it doesn't
// really do what we want for number controls: it's true for the
// anonymous textnode inside, but not the number control itself. We can
// use the focus state, though, because that gets synced to the number
// control by the anonymous text control.
element->State().HasState(NS_EVENT_STATE_FOCUS)) {
HTMLInputElement* inputElement = HTMLInputElement::FromNode(element);
inputElement->UpdateValidityUIBits(true);
}

Просмотреть файл

@ -5155,16 +5155,6 @@
mirror: always
rust: true
# Whether the `:focus-visible` pseudo-class is enabled.
#
# TODO: There are various ambiguities in the spec about this, so we shouldn't
# ship this until those are sorted out.
- name: layout.css.focus-visible.enabled
type: RelaxedAtomicBool
value: @IS_NIGHTLY_BUILD@
mirror: always
rust: true
# Allow <number> and <number>/<number> both for <aspect-ratio>
# https://github.com/w3c/csswg-drafts/issues/3757
- name: layout.css.aspect-ratio-number.enabled

Просмотреть файл

@ -137,10 +137,6 @@ bitflags! {
const IN_AUTOFILL_STATE = 1 << 50;
/// Non-standard & undocumented.
const IN_AUTOFILL_PREVIEW_STATE = 1 << 51;
/// :focus-visible
///
/// https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo
const IN_FOCUS_VISIBLE_STATE = 1 << 52;
}
}

Просмотреть файл

@ -30,78 +30,77 @@ macro_rules! apply_non_ts_list {
($apply_macro:ident) => {
$apply_macro! {
[
("-moz-table-border-nonzero", MozTableBorderNonzero, _, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("-moz-browser-frame", MozBrowserFrame, _, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("link", Link, IN_UNVISITED_STATE, _),
("any-link", AnyLink, IN_VISITED_OR_UNVISITED_STATE, _),
("visited", Visited, IN_VISITED_STATE, _),
("active", Active, IN_ACTIVE_STATE, _),
("checked", Checked, IN_CHECKED_STATE, _),
("defined", Defined, IN_DEFINED_STATE, _),
("disabled", Disabled, IN_DISABLED_STATE, _),
("enabled", Enabled, IN_ENABLED_STATE, _),
("focus", Focus, IN_FOCUS_STATE, _),
("focus-within", FocusWithin, IN_FOCUS_WITHIN_STATE, _),
("focus-visible", FocusVisible, IN_FOCUS_VISIBLE_STATE, _),
("hover", Hover, IN_HOVER_STATE, _),
("-moz-drag-over", MozDragOver, IN_DRAGOVER_STATE, _),
("target", Target, IN_TARGET_STATE, _),
("indeterminate", Indeterminate, IN_INDETERMINATE_STATE, _),
("-moz-devtools-highlighted", MozDevtoolsHighlighted, IN_DEVTOOLS_HIGHLIGHTED_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("-moz-styleeditor-transitioning", MozStyleeditorTransitioning, IN_STYLEEDITOR_TRANSITIONING_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("fullscreen", Fullscreen, IN_FULLSCREEN_STATE, _),
("-moz-table-border-nonzero", MozTableBorderNonzero, mozTableBorderNonzero, _, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("-moz-browser-frame", MozBrowserFrame, mozBrowserFrame, _, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("link", Link, link, IN_UNVISITED_STATE, _),
("any-link", AnyLink, anyLink, IN_VISITED_OR_UNVISITED_STATE, _),
("visited", Visited, visited, IN_VISITED_STATE, _),
("active", Active, active, IN_ACTIVE_STATE, _),
("checked", Checked, checked, IN_CHECKED_STATE, _),
("defined", Defined, defined, IN_DEFINED_STATE, _),
("disabled", Disabled, disabled, IN_DISABLED_STATE, _),
("enabled", Enabled, enabled, IN_ENABLED_STATE, _),
("focus", Focus, focus, IN_FOCUS_STATE, _),
("focus-within", FocusWithin, focusWithin, IN_FOCUS_WITHIN_STATE, _),
("hover", Hover, hover, IN_HOVER_STATE, _),
("-moz-drag-over", MozDragOver, mozDragOver, IN_DRAGOVER_STATE, _),
("target", Target, target, IN_TARGET_STATE, _),
("indeterminate", Indeterminate, indeterminate, IN_INDETERMINATE_STATE, _),
("-moz-devtools-highlighted", MozDevtoolsHighlighted, mozDevtoolsHighlighted, IN_DEVTOOLS_HIGHLIGHTED_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("-moz-styleeditor-transitioning", MozStyleeditorTransitioning, mozStyleeditorTransitioning, IN_STYLEEDITOR_TRANSITIONING_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("fullscreen", Fullscreen, fullscreen, IN_FULLSCREEN_STATE, _),
// TODO(emilio): This is inconsistently named (the capital R).
("-moz-focusring", MozFocusRing, IN_FOCUSRING_STATE, _),
("-moz-broken", MozBroken, IN_BROKEN_STATE, _),
("-moz-loading", MozLoading, IN_LOADING_STATE, _),
("-moz-suppressed", MozSuppressed, IN_SUPPRESSED_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-has-dir-attr", MozHasDirAttr, IN_HAS_DIR_ATTR_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("-moz-dir-attr-ltr", MozDirAttrLTR, IN_HAS_DIR_ATTR_LTR_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("-moz-dir-attr-rtl", MozDirAttrRTL, IN_HAS_DIR_ATTR_RTL_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("-moz-dir-attr-like-auto", MozDirAttrLikeAuto, IN_HAS_DIR_ATTR_LIKE_AUTO_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("-moz-autofill", MozAutofill, IN_AUTOFILL_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-autofill-preview", MozAutofillPreview, IN_AUTOFILL_PREVIEW_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-focusring", MozFocusRing, mozFocusRing, IN_FOCUSRING_STATE, _),
("-moz-broken", MozBroken, mozBroken, IN_BROKEN_STATE, _),
("-moz-loading", MozLoading, mozLoading, IN_LOADING_STATE, _),
("-moz-suppressed", MozSuppressed, mozSuppressed, IN_SUPPRESSED_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-has-dir-attr", MozHasDirAttr, mozHasDirAttr, IN_HAS_DIR_ATTR_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("-moz-dir-attr-ltr", MozDirAttrLTR, mozDirAttrLTR, IN_HAS_DIR_ATTR_LTR_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("-moz-dir-attr-rtl", MozDirAttrRTL, mozDirAttrRTL, IN_HAS_DIR_ATTR_RTL_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("-moz-dir-attr-like-auto", MozDirAttrLikeAuto, mozDirAttrLikeAuto, IN_HAS_DIR_ATTR_LIKE_AUTO_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("-moz-autofill", MozAutofill, mozAutofill, IN_AUTOFILL_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-autofill-preview", MozAutofillPreview, mozAutofillPreview, IN_AUTOFILL_PREVIEW_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-handler-clicktoplay", MozHandlerClickToPlay, IN_HANDLER_CLICK_TO_PLAY_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-handler-vulnerable-updatable", MozHandlerVulnerableUpdatable, IN_HANDLER_VULNERABLE_UPDATABLE_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-handler-vulnerable-no-update", MozHandlerVulnerableNoUpdate, IN_HANDLER_VULNERABLE_NO_UPDATE_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-handler-clicktoplay", MozHandlerClickToPlay, mozHandlerClickToPlay, IN_HANDLER_CLICK_TO_PLAY_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-handler-vulnerable-updatable", MozHandlerVulnerableUpdatable, mozHandlerVulnerableUpdatable, IN_HANDLER_VULNERABLE_UPDATABLE_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-handler-vulnerable-no-update", MozHandlerVulnerableNoUpdate, mozHandlerVulnerableNoUpdate, IN_HANDLER_VULNERABLE_NO_UPDATE_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-handler-disabled", MozHandlerDisabled, IN_HANDLER_DISABLED_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-handler-blocked", MozHandlerBlocked, IN_HANDLER_BLOCKED_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-handler-crashed", MozHandlerCrashed, IN_HANDLER_CRASHED_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-math-increment-script-level", MozMathIncrementScriptLevel, IN_INCREMENT_SCRIPT_LEVEL_STATE, _),
("-moz-handler-disabled", MozHandlerDisabled, mozHandlerDisabled, IN_HANDLER_DISABLED_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-handler-blocked", MozHandlerBlocked, mozHandlerBlocked, IN_HANDLER_BLOCKED_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-handler-crashed", MozHandlerCrashed, mozHandlerCrashed, IN_HANDLER_CRASHED_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-math-increment-script-level", MozMathIncrementScriptLevel, mozMathIncrementScriptLevel, IN_INCREMENT_SCRIPT_LEVEL_STATE, _),
("required", Required, IN_REQUIRED_STATE, _),
("optional", Optional, IN_OPTIONAL_STATE, _),
("valid", Valid, IN_VALID_STATE, _),
("invalid", Invalid, IN_INVALID_STATE, _),
("in-range", InRange, IN_INRANGE_STATE, _),
("out-of-range", OutOfRange, IN_OUTOFRANGE_STATE, _),
("default", Default, IN_DEFAULT_STATE, _),
("placeholder-shown", PlaceholderShown, IN_PLACEHOLDER_SHOWN_STATE, _),
("-moz-read-only", MozReadOnly, IN_MOZ_READONLY_STATE, _),
("-moz-read-write", MozReadWrite, IN_MOZ_READWRITE_STATE, _),
("-moz-submit-invalid", MozSubmitInvalid, IN_MOZ_SUBMITINVALID_STATE, _),
("-moz-ui-valid", MozUIValid, IN_MOZ_UI_VALID_STATE, _),
("-moz-ui-invalid", MozUIInvalid, IN_MOZ_UI_INVALID_STATE, _),
("-moz-meter-optimum", MozMeterOptimum, IN_OPTIMUM_STATE, _),
("-moz-meter-sub-optimum", MozMeterSubOptimum, IN_SUB_OPTIMUM_STATE, _),
("-moz-meter-sub-sub-optimum", MozMeterSubSubOptimum, IN_SUB_SUB_OPTIMUM_STATE, _),
("required", Required, required, IN_REQUIRED_STATE, _),
("optional", Optional, optional, IN_OPTIONAL_STATE, _),
("valid", Valid, valid, IN_VALID_STATE, _),
("invalid", Invalid, invalid, IN_INVALID_STATE, _),
("in-range", InRange, inRange, IN_INRANGE_STATE, _),
("out-of-range", OutOfRange, outOfRange, IN_OUTOFRANGE_STATE, _),
("default", Default, defaultPseudo, IN_DEFAULT_STATE, _),
("placeholder-shown", PlaceholderShown, placeholderShown, IN_PLACEHOLDER_SHOWN_STATE, _),
("-moz-read-only", MozReadOnly, mozReadOnly, IN_MOZ_READONLY_STATE, _),
("-moz-read-write", MozReadWrite, mozReadWrite, IN_MOZ_READWRITE_STATE, _),
("-moz-submit-invalid", MozSubmitInvalid, mozSubmitInvalid, IN_MOZ_SUBMITINVALID_STATE, _),
("-moz-ui-valid", MozUIValid, mozUIValid, IN_MOZ_UI_VALID_STATE, _),
("-moz-ui-invalid", MozUIInvalid, mozUIInvalid, IN_MOZ_UI_INVALID_STATE, _),
("-moz-meter-optimum", MozMeterOptimum, mozMeterOptimum, IN_OPTIMUM_STATE, _),
("-moz-meter-sub-optimum", MozMeterSubOptimum, mozMeterSubOptimum, IN_SUB_OPTIMUM_STATE, _),
("-moz-meter-sub-sub-optimum", MozMeterSubSubOptimum, mozMeterSubSubOptimum, IN_SUB_SUB_OPTIMUM_STATE, _),
("-moz-user-disabled", MozUserDisabled, IN_USER_DISABLED_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-user-disabled", MozUserDisabled, mozUserDisabled, IN_USER_DISABLED_STATE, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME),
("-moz-first-node", MozFirstNode, _, _),
("-moz-last-node", MozLastNode, _, _),
("-moz-only-whitespace", MozOnlyWhitespace, _, _),
("-moz-native-anonymous", MozNativeAnonymous, _, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("-moz-native-anonymous-no-specificity", MozNativeAnonymousNoSpecificity, _, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("-moz-use-shadow-tree-root", MozUseShadowTreeRoot, _, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("-moz-is-html", MozIsHTML, _, _),
("-moz-placeholder", MozPlaceholder, _, _),
("-moz-lwtheme", MozLWTheme, _, _),
("-moz-lwtheme-brighttext", MozLWThemeBrightText, _, _),
("-moz-lwtheme-darktext", MozLWThemeDarkText, _, _),
("-moz-window-inactive", MozWindowInactive, _, _),
("-moz-first-node", MozFirstNode, firstNode, _, _),
("-moz-last-node", MozLastNode, lastNode, _, _),
("-moz-only-whitespace", MozOnlyWhitespace, mozOnlyWhitespace, _, _),
("-moz-native-anonymous", MozNativeAnonymous, mozNativeAnonymous, _, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("-moz-native-anonymous-no-specificity", MozNativeAnonymousNoSpecificity, mozNativeAnonymousNoSpecificity, _, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("-moz-use-shadow-tree-root", MozUseShadowTreeRoot, mozUseShadowTreeRoot, _, PSEUDO_CLASS_ENABLED_IN_UA_SHEETS),
("-moz-is-html", MozIsHTML, mozIsHTML, _, _),
("-moz-placeholder", MozPlaceholder, mozPlaceholder, _, _),
("-moz-lwtheme", MozLWTheme, mozLWTheme, _, _),
("-moz-lwtheme-brighttext", MozLWThemeBrightText, mozLWThemeBrightText, _, _),
("-moz-lwtheme-darktext", MozLWThemeDarkText, mozLWThemeDarkText, _, _),
("-moz-window-inactive", MozWindowInactive, mozWindowInactive, _, _),
]
}
}

Просмотреть файл

@ -42,7 +42,7 @@ bitflags! {
pub type Lang = Atom;
macro_rules! pseudo_class_name {
([$(($css:expr, $name:ident, $state:tt, $flags:tt),)*]) => {
([$(($css:expr, $name:ident, $gecko_type:tt, $state:tt, $flags:tt),)*]) => {
/// Our representation of a non tree-structural pseudo-class.
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToShmem)]
pub enum NonTSPseudoClass {
@ -72,7 +72,7 @@ impl ToCss for NonTSPseudoClass {
W: fmt::Write,
{
macro_rules! pseudo_class_serialize {
([$(($css:expr, $name:ident, $state:tt, $flags:tt),)*]) => {
([$(($css:expr, $name:ident, $gecko_type:tt, $state:tt, $flags:tt),)*]) => {
match *self {
$(NonTSPseudoClass::$name => concat!(":", $css),)*
NonTSPseudoClass::Lang(ref s) => {
@ -134,7 +134,7 @@ impl NonTSPseudoClass {
/// in a particular state.
pub fn parse_non_functional(name: &str) -> Option<Self> {
macro_rules! pseudo_class_parse {
([$(($css:expr, $name:ident, $state:tt, $flags:tt),)*]) => {
([$(($css:expr, $name:ident, $gecko_type:tt, $state:tt, $flags:tt),)*]) => {
match_ignore_ascii_case! { &name,
$($css => Some(NonTSPseudoClass::$name),)*
"-moz-full-screen" => Some(NonTSPseudoClass::Fullscreen),
@ -156,7 +156,7 @@ impl NonTSPseudoClass {
};
}
macro_rules! pseudo_class_check_is_enabled_in {
([$(($css:expr, $name:ident, $state:tt, $flags:tt),)*]) => {
([$(($css:expr, $name:ident, $gecko_type:tt, $state:tt, $flags:tt),)*]) => {
match *self {
$(NonTSPseudoClass::$name => check_flag!($flags),)*
NonTSPseudoClass::MozLocaleDir(_) |
@ -172,9 +172,6 @@ impl NonTSPseudoClass {
/// Returns whether the pseudo-class is enabled in content sheets.
#[inline]
fn is_enabled_in_content(&self) -> bool {
if matches!(*self, NonTSPseudoClass::FocusVisible) {
return static_prefs::pref!("layout.css.focus-visible.enabled")
}
!self.has_any_flag(NonTSPseudoClassFlag::PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME)
}
@ -189,7 +186,7 @@ impl NonTSPseudoClass {
};
}
macro_rules! pseudo_class_state {
([$(($css:expr, $name:ident, $state:tt, $flags:tt),)*]) => {
([$(($css:expr, $name:ident, $gecko_type:tt, $state:tt, $flags:tt),)*]) => {
match *self {
$(NonTSPseudoClass::$name => flag!($state),)*
NonTSPseudoClass::Dir(..) |

Просмотреть файл

@ -2049,7 +2049,6 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
NonTSPseudoClass::MozReadOnly |
NonTSPseudoClass::MozReadWrite |
NonTSPseudoClass::FocusWithin |
NonTSPseudoClass::FocusVisible |
NonTSPseudoClass::MozDragOver |
NonTSPseudoClass::MozDevtoolsHighlighted |
NonTSPseudoClass::MozStyleeditorTransitioning |

Просмотреть файл

@ -1 +0,0 @@
prefs: [layout.css.focus-visible.enabled:true]

Просмотреть файл

@ -1,3 +1,7 @@
[focus-visible-005.html]
[Programmatic focus after click should not match :focus-visible]
expected: FAIL
expected:
if os == "android": FAIL
if os == "mac": FAIL
if os == "linux": FAIL

Просмотреть файл

@ -0,0 +1,4 @@
[focus-visible-009.html]
[Autofocus should match :focus-visible]
expected: FAIL

Просмотреть файл

@ -0,0 +1,4 @@
[focus-visible-010.html]
[Programmatic focus on page load bshould match :focus-visible]
expected: FAIL

Просмотреть файл

@ -0,0 +1,4 @@
[focus-visible-011.html]
[:focus-visible matches even if preventDefault() is called]
expected: FAIL

Просмотреть файл

@ -35,7 +35,7 @@
assert_equals(getComputedStyle(el).outlineColor, "rgb(0, 100, 0)");
t.done();
}));
}, "Programmatic focus on page load should match :focus-visible");
}, "Programmatic focus on page load bshould match :focus-visible");
</script>
</body>
</html>