mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 11:57:32 +09:00
Issue #2790 - Part 4: Working non persistent autofill highlight
This commit is contained in:
parent
4cdfb9e16b
commit
bf8cfcc980
12 changed files with 207 additions and 68 deletions
|
|
@ -1270,6 +1270,14 @@ ComputeSelectorStateDependence(nsCSSSelector& aSelector)
|
|||
continue;
|
||||
}
|
||||
|
||||
// --- BEGIN PATCH: Explicit autofill state dependence ---
|
||||
if (pseudoClass->mType == CSSPseudoClassType::autofill ||
|
||||
pseudoClass->mType == CSSPseudoClassType::mozAutofillHighlight) {
|
||||
states |= NS_EVENT_STATE_AUTOFILL;
|
||||
continue;
|
||||
}
|
||||
// --- END PATCH ---
|
||||
|
||||
auto idx = static_cast<CSSPseudoClassTypeBase>(pseudoClass->mType);
|
||||
states |= nsCSSPseudoClasses::sPseudoClassStateDependences[idx];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -576,6 +576,16 @@ nsCSSRuleUtils::StateSelectorMatches(Element* aElement,
|
|||
for (nsPseudoClassList* pseudoClass = aSelector->mPseudoClassList;
|
||||
pseudoClass;
|
||||
pseudoClass = pseudoClass->mNext) {
|
||||
// --- Autofill explicit matching ---
|
||||
if (pseudoClass->mType == CSSPseudoClassType::autofill ||
|
||||
pseudoClass->mType == CSSPseudoClassType::mozAutofillHighlight) {
|
||||
// Match if the element has the autofill state, regardless of focus
|
||||
if (!aElement->State().HasState(NS_EVENT_STATE_AUTOFILL)) {
|
||||
return false;
|
||||
}
|
||||
continue; // This pseudo-class matches
|
||||
}
|
||||
// --- End autofill explicit matching ---
|
||||
auto idx = static_cast<CSSPseudoClassTypeBase>(pseudoClass->mType);
|
||||
EventStates statesToCheck = nsCSSPseudoClasses::sPseudoClassStates[idx];
|
||||
if (!statesToCheck.IsEmpty() && !StateSelectorMatches(aElement,
|
||||
|
|
|
|||
|
|
@ -1152,6 +1152,11 @@ input[type="time"] {
|
|||
|
||||
/* Autofill highlight for internal-only pseudo-class */
|
||||
input:-moz-autofill-highlight,
|
||||
select:-moz-autofill-highlight,
|
||||
textarea:-moz-autofill-highlight {
|
||||
background-color: #ffff99 !important;
|
||||
}
|
||||
|
||||
.custom-autofill-highlight {
|
||||
background: yellow !important;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue