Bug 1553603 - Support "capture" attribute in Gecko and expose in GV. r=geckoview-reviewers,smaug,snorp,agi
Differential Revision: https://phabricator.services.mozilla.com/D38746
This commit is contained in:
@@ -195,6 +195,14 @@ static const nsAttrValue::EnumTable kInputInputmodeTable[] = {
|
||||
static const nsAttrValue::EnumTable* kInputDefaultInputmode =
|
||||
&kInputInputmodeTable[0];
|
||||
|
||||
static const nsAttrValue::EnumTable kCaptureTable[] = {
|
||||
{"user", static_cast<int16_t>(nsIFilePicker::captureUser)},
|
||||
{"environment", static_cast<int16_t>(nsIFilePicker::captureEnv)},
|
||||
{"", static_cast<int16_t>(nsIFilePicker::captureDefault)},
|
||||
{nullptr, static_cast<int16_t>(nsIFilePicker::captureNone)}};
|
||||
|
||||
static const nsAttrValue::EnumTable* kCaptureDefault = &kCaptureTable[2];
|
||||
|
||||
const Decimal HTMLInputElement::kStepScaleFactorDate = Decimal(86400000);
|
||||
const Decimal HTMLInputElement::kStepScaleFactorNumberRange = Decimal(1);
|
||||
const Decimal HTMLInputElement::kStepScaleFactorTime = Decimal(1000);
|
||||
@@ -762,6 +770,14 @@ nsresult HTMLInputElement::InitFilePicker(FilePickerType aType) {
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::accept) &&
|
||||
aType != FILE_PICKER_DIRECTORY) {
|
||||
SetFilePickerFiltersFromAccept(filePicker);
|
||||
|
||||
if (StaticPrefs::dom_capture_enabled()) {
|
||||
const nsAttrValue* captureVal = GetParsedAttr(nsGkAtoms::capture,
|
||||
kNameSpaceID_None);
|
||||
if (captureVal) {
|
||||
filePicker->SetCapture(captureVal->GetEnumValue());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
filePicker->AppendFilters(nsIFilePicker::filterAll);
|
||||
}
|
||||
@@ -1359,6 +1375,10 @@ void HTMLInputElement::GetAutocompleteInfo(Nullable<AutocompleteInfo>& aInfo) {
|
||||
attributeVal, aInfo.SetValue(), mAutocompleteInfoState, true);
|
||||
}
|
||||
|
||||
void HTMLInputElement::GetCapture(nsAString& aValue) {
|
||||
GetEnumAttr(nsGkAtoms::capture, kCaptureDefault->tag, aValue);
|
||||
}
|
||||
|
||||
void HTMLInputElement::GetFormEnctype(nsAString& aValue) {
|
||||
GetEnumAttr(nsGkAtoms::formenctype, "", kFormDefaultEnctype->tag, aValue);
|
||||
}
|
||||
@@ -5212,6 +5232,9 @@ bool HTMLInputElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
|
||||
if (aAttribute == nsGkAtoms::inputmode) {
|
||||
return aResult.ParseEnumValue(aValue, kInputInputmodeTable, false);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::capture) {
|
||||
return aResult.ParseEnumValue(aValue, kCaptureTable, false, kCaptureDefault);
|
||||
}
|
||||
if (ParseImageAttribute(aAttribute, aValue, aResult)) {
|
||||
// We have to call |ParseImageAttribute| unconditionally since we
|
||||
// don't know if we're going to have a type="image" attribute yet,
|
||||
|
||||
Reference in New Issue
Block a user