Bug 1398374 - Part 1 - Add helper method to test for the last non-disabled single line form input. r=bz
We want to treat those specially in IME handling. MozReview-Commit-ID: 8OI2fDQEiGj
This commit is contained in:
@@ -1828,14 +1828,27 @@ HTMLFormElement::ImplicitSubmissionIsDisabled() const
|
||||
uint32_t numDisablingControlsFound = 0;
|
||||
uint32_t length = mControls->mElements.Length();
|
||||
for (uint32_t i = 0; i < length && numDisablingControlsFound < 2; ++i) {
|
||||
if (mControls->mElements[i]->IsSingleLineTextControl(false) ||
|
||||
mControls->mElements[i]->ControlType() == NS_FORM_INPUT_NUMBER) {
|
||||
if (mControls->mElements[i]->IsSingleLineTextOrNumberControl(false)) {
|
||||
numDisablingControlsFound++;
|
||||
}
|
||||
}
|
||||
return numDisablingControlsFound != 1;
|
||||
}
|
||||
|
||||
bool
|
||||
HTMLFormElement::IsLastActiveElement(const nsIFormControl* aControl) const
|
||||
{
|
||||
NS_PRECONDITION(aControl, "Unexpected call");
|
||||
|
||||
for (auto* element : Reversed(mControls->mElements)) {
|
||||
if (element->IsSingleLineTextOrNumberControl(false) &&
|
||||
!element->IsDisabled()) {
|
||||
return element == aControl;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLFormElement::GetEncoding(nsAString& aEncoding)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user