Bug 1355438 - [Form Autofill] Implement an internal-only pseudo-class for highlighting elements with an autofilled value. r=heycam

MozReview-Commit-ID: BUqAWSekPsh

--HG--
extra : rebase_source : c3c9b7a98ca5895eb56c8b07b4c3845e6ac71de0
This commit is contained in:
Luke Chang 2017-04-20 17:44:14 +08:00
Родитель f1219b63e0
Коммит 03c1939e54
4 изменённых файлов: 12 добавлений и 2 удалений

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

@ -4230,7 +4230,7 @@ struct StateTableEntry
};
static constexpr StateTableEntry kManuallyManagedStates[] = {
// none yet; but for example: { "highlight", NS_EVENT_STATE_HIGHLIGHT },
{ "-moz-autofill", NS_EVENT_STATE_AUTOFILL },
{ nullptr, EventStates() },
};

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

@ -288,6 +288,8 @@ private:
#define NS_EVENT_STATE_LTR NS_DEFINE_EVENT_STATE_MACRO(44)
// Element is rtl (for :dir pseudo-class)
#define NS_EVENT_STATE_RTL NS_DEFINE_EVENT_STATE_MACRO(45)
// Element is filled by Autofill feature.
#define NS_EVENT_STATE_AUTOFILL NS_DEFINE_EVENT_STATE_MACRO(50)
// 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)
@ -306,7 +308,7 @@ private:
// document (e.g. in BindToTree and UnbindFromTree), if that is an
// appropriate thing to do for your state bit.
#define MANUALLY_MANAGED_STATES ( \
mozilla::EventStates() /* none so far */ \
NS_EVENT_STATE_AUTOFILL \
)
// Event states that are managed externally to an element (by the

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

@ -208,6 +208,10 @@ CSS_STATE_PSEUDO_CLASS(mozMathIncrementScriptLevel,
":-moz-math-increment-script-level", 0, "",
NS_EVENT_STATE_INCREMENT_SCRIPT_LEVEL)
CSS_STATE_PSEUDO_CLASS(mozAutofill, ":-moz-autofill",
CSS_PSEUDO_CLASS_ENABLED_IN_UA_SHEETS_AND_CHROME, "",
NS_EVENT_STATE_AUTOFILL)
// CSS 3 UI
// http://www.w3.org/TR/2004/CR-css3-ui-20040511/#pseudo-classes
CSS_STATE_PSEUDO_CLASS(required, ":required", 0, "", NS_EVENT_STATE_REQUIRED)

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

@ -1218,3 +1218,7 @@ input[type="number"] > div > div > div:hover {
/* give some indication of hover state for the up/down buttons */
background-color: lightblue;
}
:-moz-autofill {
filter: grayscale(21%) brightness(88%) contrast(161%) invert(10%) sepia(40%) saturate(206%);
}