Bug 675943 - Part 1: Implement dirname attr for input elements within forms. r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D175626
This commit is contained in:
@@ -5862,7 +5862,28 @@ HTMLInputElement::SubmitNamesValues(FormData* aFormData) {
|
||||
value = defaultValue;
|
||||
}
|
||||
|
||||
return aFormData->AddNameValuePair(name, value);
|
||||
const nsresult rv = aFormData->AddNameValuePair(name, value);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Submit dirname=dir if element has non-empty dirname attribute and is text
|
||||
// or search type
|
||||
const bool dirnameApplicable = mType == FormControlType::InputText ||
|
||||
mType == FormControlType::InputSearch;
|
||||
if (dirnameApplicable && HasAttr(kNameSpaceID_None, nsGkAtoms::dirname)) {
|
||||
nsAutoString dirname;
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::dirname, dirname);
|
||||
if (!dirname.IsEmpty()) {
|
||||
const Directionality eDir = GetDirectionality();
|
||||
MOZ_ASSERT(eDir == eDir_RTL || eDir == eDir_LTR,
|
||||
"The directionality of an element is either ltr or rtl");
|
||||
const nsString dir = eDir == eDir_LTR ? u"ltr"_ns : u"rtl"_ns;
|
||||
return aFormData->AddNameValuePair(dirname, dir);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsTArray<FileContentData> SaveFileContentData(
|
||||
|
||||
Reference in New Issue
Block a user