Bug 1726393 - Part 2: Rename nsIFormControl::GetFormElement to GetForm; r=smaug

Depends on D122995

Differential Revision: https://phabricator.services.mozilla.com/D122996
This commit is contained in:
Edgar Chen 2021-08-19 09:20:24 +00:00
parent 68a694f291
commit 3d5334b444
11 changed files with 14 additions and 16 deletions

View File

@ -1340,7 +1340,6 @@ void LocalAccessible::DOMAttributeChanged(int32_t aNameSpaceID,
return;
}
}
GroupPos LocalAccessible::GroupPosition() {
@ -2051,7 +2050,7 @@ Relation LocalAccessible::RelationByType(RelationType aType) const {
// HTML form controls implements nsIFormControl interface.
nsCOMPtr<nsIFormControl> control(do_QueryInterface(mContent));
if (control) {
if (dom::HTMLFormElement* form = control->GetFormElement()) {
if (dom::HTMLFormElement* form = control->GetForm()) {
nsCOMPtr<nsIContent> formContent =
do_QueryInterface(form->GetDefaultSubmitElement());
return Relation(mDoc, formContent);

View File

@ -88,7 +88,7 @@ Relation HTMLRadioButtonAccessible::ComputeGroupAttributes(
RefPtr<nsContentList> inputElms;
nsCOMPtr<nsIFormControl> formControlNode(do_QueryInterface(mContent));
if (dom::Element* formElm = formControlNode->GetFormElement()) {
if (dom::Element* formElm = formControlNode->GetForm()) {
inputElms = NS_GetContentList(formElm, namespaceId, tagName);
} else {
inputElms = NS_GetContentList(mContent->OwnerDoc(), namespaceId, tagName);
@ -392,7 +392,7 @@ uint64_t HTMLTextFieldAccessible::NativeState() const {
autocomplete);
if (!autocomplete.LowerCaseEqualsLiteral("off")) {
Element* formElement = input->GetFormElement();
Element* formElement = input->GetForm();
if (formElement) {
formElement->GetAttr(kNameSpaceID_None, nsGkAtoms::autocomplete,
autocomplete);

View File

@ -3032,7 +3032,7 @@ void nsContentUtils::GenerateStateKey(nsIContent* aContent, Document* aDocument,
KeyAppendInt(int32_t(control->ControlType()), aKey);
// If in a form, add form name / index of form / index in form
HTMLFormElement* formElement = control->GetFormElement();
HTMLFormElement* formElement = control->GetForm();
if (formElement) {
if (IsAutocompleteOff(formElement)) {
aKey.Truncate();

View File

@ -1305,7 +1305,7 @@ static void GetActionHint(const IMEState& aState, const nsIContent& aContent,
bool isLastElement = false;
nsCOMPtr<nsIFormControl> control(do_QueryInterface(inputContent));
if (control) {
HTMLFormElement* formElement = control->GetFormElement();
HTMLFormElement* formElement = control->GetForm();
// is this a form and does it have a default submit element?
if (formElement) {
if (formElement->IsLastActiveElement(control)) {

View File

@ -297,7 +297,7 @@ void HTMLFormElement::RequestSubmit(nsGenericHTMLElement* aSubmitter,
// 1.2. If submitter's form owner is not this form element, then throw a
// "NotFoundError" DOMException.
if (fc->GetFormElement() != this) {
if (fc->GetForm() != this) {
aRv.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
return;
}

View File

@ -47,7 +47,7 @@ HTMLFormElement* HTMLLabelElement::GetForm() const {
return nullptr;
}
return formControl->GetFormElement();
return formControl->GetForm();
}
void HTMLLabelElement::Focus(const FocusOptions& aOptions,

View File

@ -45,7 +45,7 @@ class HTMLLegendElement final : public nsGenericHTMLElement {
HTMLFormElement* GetFormElement() const {
nsCOMPtr<nsIFormControl> fieldsetControl = do_QueryInterface(GetFieldSet());
return fieldsetControl ? fieldsetControl->GetFormElement() : nullptr;
return fieldsetControl ? fieldsetControl->GetForm() : nullptr;
}
enum class LegendAlignValue : uint8_t {

View File

@ -1712,8 +1712,6 @@ void nsGenericHTMLFormElement::ClearForm(bool aRemoveFromForm,
AfterClearForm(aUnbindOrDelete);
}
HTMLFormElement* nsGenericHTMLFormElement::GetFormElement() { return mForm; }
HTMLFieldSetElement* nsGenericHTMLFormElement::GetFieldSet() {
return mFieldSet;
}

View File

@ -968,8 +968,9 @@ class nsGenericHTMLFormElement : public nsGenericHTMLElement,
// nsIFormControl
virtual mozilla::dom::HTMLFieldSetElement* GetFieldSet() override;
virtual mozilla::dom::HTMLFormElement* GetFormElement() override;
mozilla::dom::HTMLFormElement* GetForm() const { return mForm; }
virtual mozilla::dom::HTMLFormElement* GetForm() const override {
return mForm;
}
virtual void SetForm(mozilla::dom::HTMLFormElement* aForm) override;
virtual void ClearForm(bool aRemoveFromForm, bool aUnbindOrDelete) override;

View File

@ -195,7 +195,7 @@ void nsIConstraintValidation::SetValidityState(ValidityStateType aState,
nsCOMPtr<nsIFormControl> formCtrl = do_QueryInterface(this);
NS_ASSERTION(formCtrl, "This interface should be used by form elements!");
if (HTMLFormElement* form = formCtrl->GetFormElement()) {
if (HTMLFormElement* form = formCtrl->GetForm()) {
form->UpdateValidity(IsValid());
}
HTMLFieldSetElement* fieldSet = formCtrl->GetFieldSet();
@ -224,7 +224,7 @@ void nsIConstraintValidation::SetBarredFromConstraintValidation(bool aBarred) {
// If the element is going to be barred from constraint validation, we can
// inform the form and fieldset that we are now valid. Otherwise, we are now
// invalid.
if (HTMLFormElement* form = formCtrl->GetFormElement()) {
if (HTMLFormElement* form = formCtrl->GetForm()) {
form->UpdateValidity(aBarred);
}
HTMLFieldSetElement* fieldSet = formCtrl->GetFieldSet();

View File

@ -102,7 +102,7 @@ class nsIFormControl : public nsISupports {
* Get the form for this form control.
* @return the form
*/
virtual mozilla::dom::HTMLFormElement* GetFormElement() = 0;
virtual mozilla::dom::HTMLFormElement* GetForm() const = 0;
/**
* Set the form for this form control.