Bug 1864291 - Implements HandleInvokeInternal for select and input elements. r=smaug
Implements invoketarget defaults for select and input element, as specified in the open-ui "Invokers explainer". (https://open-ui.org/components/invokers.explainer/) Differential Revision: https://phabricator.services.mozilla.com/D193363
This commit is contained in:
@@ -5755,10 +5755,22 @@ void HTMLInputElement::ShowPicker(ErrorResult& aRv) {
|
||||
//
|
||||
// https://html.spec.whatwg.org/multipage/input.html#show-the-picker,-if-applicable
|
||||
// To show the picker, if applicable for an input element element:
|
||||
ShowThePickerIfApplicable();
|
||||
}
|
||||
|
||||
void HTMLInputElement::ShowThePickerIfApplicable() {
|
||||
// https://html.spec.whatwg.org/multipage/input.html#show-the-picker,-if-applicable
|
||||
// To show the picker, if applicable for an input element element:
|
||||
|
||||
// Step 1. Assert: element's relevant global object has transient activation.
|
||||
if (!OwnerDoc()->HasValidTransientUserGestureActivation()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Step 2. If element is not mutable, then return.
|
||||
// (See above.)
|
||||
if (!IsMutable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Step 3. If element's type attribute is in the File Upload state, then run
|
||||
// these steps in parallel:
|
||||
@@ -7324,6 +7336,23 @@ void HTMLInputElement::MaybeFireInputPasswordRemoved() {
|
||||
ChromeOnlyDispatch::eYes);
|
||||
}
|
||||
|
||||
void HTMLInputElement::HandleInvokeInternal(nsAtom* aAction, ErrorResult& aRv) {
|
||||
// If this's relevant settings object's origin is not same origin with
|
||||
// this's relevant settings object's top-level origin, [...], then return.
|
||||
nsPIDOMWindowInner* window = OwnerDoc()->GetInnerWindow();
|
||||
WindowGlobalChild* windowGlobalChild =
|
||||
window ? window->GetWindowGlobalChild() : nullptr;
|
||||
if (!windowGlobalChild || !windowGlobalChild->SameOriginWithTop()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If action is an ASCII case-insensitive match for "showPicker"
|
||||
// then show the picker, if applicable for this.
|
||||
if (nsContentUtils::EqualsIgnoreASCIICase(aAction, nsGkAtoms::showPicker)) {
|
||||
ShowThePickerIfApplicable();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla::dom
|
||||
|
||||
#undef NS_ORIGINAL_CHECKED_VALUE
|
||||
|
||||
Reference in New Issue
Block a user