Bug 1868552 - Make the initial value of -moz-user-focus normal, and make none actually prevent focusability. r=smaug,jwatt

This is tested via the inert tests, effectively, but I can add more
explicit tests.

Remove rules that would otherwise change behavior (the other rules in
the tree apply to XUL elements and serve a purpose).

Differential Revision: https://phabricator.services.mozilla.com/D195645
This commit is contained in:
Emilio Cobos Álvarez 2023-12-12 13:51:30 +00:00
parent 399c9ee415
commit 88c136af5b
6 changed files with 10 additions and 25 deletions

View File

@ -53,14 +53,12 @@ a:link {
input, button, textarea { input, button, textarea {
user-select: all !important; user-select: all !important;
-moz-user-input: auto !important; -moz-user-input: auto !important;
-moz-user-focus: none !important;
} }
/* XXX Still need a better way of blocking other events to these widgets */ /* XXX Still need a better way of blocking other events to these widgets */
select, input[disabled], input[type="checkbox"], input[type="radio"], input[type="file"] { select, input[disabled], input[type="checkbox"], input[type="radio"], input[type="file"] {
user-select: all !important; user-select: all !important;
-moz-user-input: none !important; -moz-user-input: none !important;
-moz-user-focus: none !important;
} }
input[type="hidden"] { input[type="hidden"] {
@ -200,7 +198,6 @@ a[\_moz_anonclass="mozTableAddColumnBefore"] {
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
user-select: none !important; user-select: none !important;
-moz-user-focus: none !important;
} }
a[\_moz_anonclass="mozTableAddColumnBefore"]:hover { a[\_moz_anonclass="mozTableAddColumnBefore"]:hover {
@ -222,7 +219,6 @@ a[\_moz_anonclass="mozTableAddColumnAfter"] {
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
user-select: none !important; user-select: none !important;
-moz-user-focus: none !important;
} }
a[\_moz_anonclass="mozTableAddColumnAfter"]:hover { a[\_moz_anonclass="mozTableAddColumnAfter"]:hover {
@ -244,7 +240,6 @@ a[\_moz_anonclass="mozTableRemoveColumn"] {
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
user-select: none !important; user-select: none !important;
-moz-user-focus: none !important;
} }
a[\_moz_anonclass="mozTableRemoveColumn"]:hover { a[\_moz_anonclass="mozTableRemoveColumn"]:hover {
@ -266,7 +261,6 @@ a[\_moz_anonclass="mozTableAddRowBefore"] {
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
user-select: none !important; user-select: none !important;
-moz-user-focus: none !important;
} }
a[\_moz_anonclass="mozTableAddRowBefore"]:hover { a[\_moz_anonclass="mozTableAddRowBefore"]:hover {
@ -288,7 +282,6 @@ a[\_moz_anonclass="mozTableAddRowAfter"] {
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
user-select: none !important; user-select: none !important;
-moz-user-focus: none !important;
} }
a[\_moz_anonclass="mozTableAddRowAfter"]:hover { a[\_moz_anonclass="mozTableAddRowAfter"]:hover {
@ -310,7 +303,6 @@ a[\_moz_anonclass="mozTableRemoveRow"] {
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
user-select: none !important; user-select: none !important;
-moz-user-focus: none !important;
} }
a[\_moz_anonclass="mozTableRemoveRow"]:hover { a[\_moz_anonclass="mozTableRemoveRow"]:hover {

View File

@ -10680,12 +10680,13 @@ Focusable nsIFrame::IsFocusable(bool aWithMouse, bool aCheckVisibility) {
return {}; return {};
} }
const nsStyleUI& ui = *StyleUI(); const StyleUserFocus uf = StyleUI()->UserFocus();
if (ui.IsInert()) { if (uf == StyleUserFocus::None) {
return {}; return {};
} }
MOZ_ASSERT(!StyleUI()->IsInert(), "inert implies -moz-user-focus: none");
PseudoStyleType pseudo = Style()->GetPseudoType(); const PseudoStyleType pseudo = Style()->GetPseudoType();
if (pseudo == PseudoStyleType::anonymousItem) { if (pseudo == PseudoStyleType::anonymousItem) {
return {}; return {};
} }
@ -10696,8 +10697,8 @@ Focusable nsIFrame::IsFocusable(bool aWithMouse, bool aCheckVisibility) {
// tabability of XUL elements in some circumstances (which default to // tabability of XUL elements in some circumstances (which default to
// -moz-user-focus: ignore). // -moz-user-focus: ignore).
auto focusability = xul->GetXULFocusability(aWithMouse); auto focusability = xul->GetXULFocusability(aWithMouse);
focusable.mFocusable = focusability.mForcedFocusable.valueOr( focusable.mFocusable =
ui.UserFocus() == StyleUserFocus::Normal); focusability.mForcedFocusable.valueOr(uf == StyleUserFocus::Normal);
if (focusable) { if (focusable) {
focusable.mTabIndex = focusability.mForcedTabIndexIfFocusable.valueOr(0); focusable.mTabIndex = focusability.mForcedTabIndexIfFocusable.valueOr(0);
} }

View File

@ -55,7 +55,6 @@ a:link:read-write {
*|*:read-write > textarea:read-only { *|*:read-write > textarea:read-only {
user-select: all; user-select: all;
-moz-user-input: auto !important; -moz-user-input: auto !important;
-moz-user-focus: none !important;
} }
/* XXX Still need a better way of blocking other events to these widgets */ /* XXX Still need a better way of blocking other events to these widgets */
@ -70,7 +69,6 @@ input[contenteditable="true"][type="radio"],
input[contenteditable="true"][type="file"] { input[contenteditable="true"][type="file"] {
user-select: all; user-select: all;
-moz-user-input: none !important; -moz-user-input: none !important;
-moz-user-focus: none !important;
} }
*|*:read-write > input[type="hidden"], *|*:read-write > input[type="hidden"],
@ -201,7 +199,6 @@ a[\_moz_anonclass="mozTableAddColumnBefore"] {
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
user-select: none; user-select: none;
-moz-user-focus: none !important;
} }
a[\_moz_anonclass="mozTableAddColumnBefore"]:hover { a[\_moz_anonclass="mozTableAddColumnBefore"]:hover {
@ -223,7 +220,6 @@ a[\_moz_anonclass="mozTableAddColumnAfter"] {
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
user-select: none; user-select: none;
-moz-user-focus: none !important;
} }
a[\_moz_anonclass="mozTableAddColumnAfter"]:hover { a[\_moz_anonclass="mozTableAddColumnAfter"]:hover {
@ -245,7 +241,6 @@ a[\_moz_anonclass="mozTableRemoveColumn"] {
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
user-select: none; user-select: none;
-moz-user-focus: none !important;
} }
a[\_moz_anonclass="mozTableRemoveColumn"]:hover { a[\_moz_anonclass="mozTableRemoveColumn"]:hover {
@ -267,7 +262,6 @@ a[\_moz_anonclass="mozTableAddRowBefore"] {
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
user-select: none; user-select: none;
-moz-user-focus: none !important;
} }
a[\_moz_anonclass="mozTableAddRowBefore"]:hover { a[\_moz_anonclass="mozTableAddRowBefore"]:hover {
@ -289,7 +283,6 @@ a[\_moz_anonclass="mozTableAddRowAfter"] {
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
user-select: none; user-select: none;
-moz-user-focus: none !important;
} }
a[\_moz_anonclass="mozTableAddRowAfter"]:hover { a[\_moz_anonclass="mozTableAddRowAfter"]:hover {
@ -311,7 +304,6 @@ a[\_moz_anonclass="mozTableRemoveRow"] {
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
user-select: none; user-select: none;
-moz-user-focus: none !important;
} }
a[\_moz_anonclass="mozTableRemoveRow"]:hover { a[\_moz_anonclass="mozTableRemoveRow"]:hover {

View File

@ -2993,7 +2993,7 @@ nsStyleUI::nsStyleUI()
mMozTheme(StyleMozTheme::Auto), mMozTheme(StyleMozTheme::Auto),
mUserInput(StyleUserInput::Auto), mUserInput(StyleUserInput::Auto),
mUserModify(StyleUserModify::ReadOnly), mUserModify(StyleUserModify::ReadOnly),
mUserFocus(StyleUserFocus::None), mUserFocus(StyleUserFocus::Normal),
mPointerEvents(StylePointerEvents::Auto), mPointerEvents(StylePointerEvents::Auto),
mCursor{{}, StyleCursorKind::Auto}, mCursor{{}, StyleCursorKind::Auto},
mAccentColor(StyleColorOrAuto::Auto()), mAccentColor(StyleColorOrAuto::Auto()),

View File

@ -3909,8 +3909,8 @@ var gCSSProperties = {
domProp: "MozUserFocus", domProp: "MozUserFocus",
inherited: true, inherited: true,
type: CSS_TYPE_LONGHAND, type: CSS_TYPE_LONGHAND,
initial_values: ["none"], initial_values: ["normal"],
other_values: ["normal", "ignore"], other_values: ["none", "ignore"],
invalid_values: [], invalid_values: [],
}, },
"-moz-user-input": { "-moz-user-input": {

View File

@ -68,7 +68,7 @@ ${helpers.single_keyword(
${helpers.single_keyword( ${helpers.single_keyword(
"-moz-user-focus", "-moz-user-focus",
"none ignore normal", "normal none ignore",
engines="gecko", engines="gecko",
gecko_ffi_name="mUserFocus", gecko_ffi_name="mUserFocus",
gecko_enum_prefix="StyleUserFocus", gecko_enum_prefix="StyleUserFocus",