mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1838219 - Notify of user activation after <input type=file/color> picking. r=edgar
This allows opening popups after this. Differential Revision: https://phabricator.services.mozilla.com/D180827
This commit is contained in:
parent
fb4d44ce9d
commit
574b2cd0ea
@ -454,6 +454,8 @@ HTMLInputElement::nsFilePickerShownCallback::Done(
|
|||||||
u"cancel"_ns, CanBubble::eYes, Cancelable::eNo);
|
u"cancel"_ns, CanBubble::eYes, Cancelable::eNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mInput->OwnerDoc()->NotifyUserGestureActivation();
|
||||||
|
|
||||||
nsIFilePicker::Mode mode;
|
nsIFilePicker::Mode mode;
|
||||||
mFilePicker->GetMode(&mode);
|
mFilePicker->GetMode(&mode);
|
||||||
|
|
||||||
@ -610,9 +612,9 @@ class nsColorPickerShownCallback final : public nsIColorPickerShownCallback {
|
|||||||
nsresult nsColorPickerShownCallback::UpdateInternal(const nsAString& aColor,
|
nsresult nsColorPickerShownCallback::UpdateInternal(const nsAString& aColor,
|
||||||
bool aTrustedUpdate) {
|
bool aTrustedUpdate) {
|
||||||
bool valueChanged = false;
|
bool valueChanged = false;
|
||||||
|
|
||||||
nsAutoString oldValue;
|
nsAutoString oldValue;
|
||||||
if (aTrustedUpdate) {
|
if (aTrustedUpdate) {
|
||||||
|
mInput->OwnerDoc()->NotifyUserGestureActivation();
|
||||||
valueChanged = true;
|
valueChanged = true;
|
||||||
} else {
|
} else {
|
||||||
mInput->GetValue(oldValue, CallerType::System);
|
mInput->GetValue(oldValue, CallerType::System);
|
||||||
@ -807,7 +809,7 @@ nsresult HTMLInputElement::InitFilePicker(FilePickerType aType) {
|
|||||||
|
|
||||||
if (aType == FILE_PICKER_DIRECTORY) {
|
if (aType == FILE_PICKER_DIRECTORY) {
|
||||||
mode = nsIFilePicker::modeGetFolder;
|
mode = nsIFilePicker::modeGetFolder;
|
||||||
} else if (HasAttr(kNameSpaceID_None, nsGkAtoms::multiple)) {
|
} else if (HasAttr(nsGkAtoms::multiple)) {
|
||||||
mode = nsIFilePicker::modeOpenMultiple;
|
mode = nsIFilePicker::modeOpenMultiple;
|
||||||
} else {
|
} else {
|
||||||
mode = nsIFilePicker::modeOpen;
|
mode = nsIFilePicker::modeOpen;
|
||||||
@ -822,14 +824,11 @@ nsresult HTMLInputElement::InitFilePicker(FilePickerType aType) {
|
|||||||
|
|
||||||
// Native directory pickers ignore file type filters, so we don't spend
|
// Native directory pickers ignore file type filters, so we don't spend
|
||||||
// cycles adding them for FILE_PICKER_DIRECTORY.
|
// cycles adding them for FILE_PICKER_DIRECTORY.
|
||||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::accept) &&
|
if (HasAttr(nsGkAtoms::accept) && aType != FILE_PICKER_DIRECTORY) {
|
||||||
aType != FILE_PICKER_DIRECTORY) {
|
|
||||||
SetFilePickerFiltersFromAccept(filePicker);
|
SetFilePickerFiltersFromAccept(filePicker);
|
||||||
|
|
||||||
if (StaticPrefs::dom_capture_enabled()) {
|
if (StaticPrefs::dom_capture_enabled()) {
|
||||||
const nsAttrValue* captureVal =
|
if (const nsAttrValue* captureVal = GetParsedAttr(nsGkAtoms::capture)) {
|
||||||
GetParsedAttr(nsGkAtoms::capture, kNameSpaceID_None);
|
|
||||||
if (captureVal) {
|
|
||||||
filePicker->SetCapture(static_cast<nsIFilePicker::CaptureTarget>(
|
filePicker->SetCapture(static_cast<nsIFilePicker::CaptureTarget>(
|
||||||
captureVal->GetEnumValue()));
|
captureVal->GetEnumValue()));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user