зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1729358 - Part 3: Move GetFormAction to nsGenericHTMLFormElementWithState; r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D124695
This commit is contained in:
Родитель
9bc7d719fe
Коммит
bc58abc210
|
@ -2314,30 +2314,6 @@ bool nsGenericHTMLFormElement::IsLabelable() const {
|
|||
type == FormControlType::Select || type == FormControlType::Textarea;
|
||||
}
|
||||
|
||||
void nsGenericHTMLFormElement::GetFormAction(nsString& aValue) {
|
||||
auto type = ControlType();
|
||||
if (!IsInputElement(type) && !IsButtonElement(type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::formaction, aValue) ||
|
||||
aValue.IsEmpty()) {
|
||||
Document* document = OwnerDoc();
|
||||
nsIURI* docURI = document->GetDocumentURI();
|
||||
if (docURI) {
|
||||
nsAutoCString spec;
|
||||
nsresult rv = docURI->GetSpec(spec);
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
||||
CopyUTF8toUTF16(spec, aValue);
|
||||
}
|
||||
} else {
|
||||
GetURIAttr(nsGkAtoms::formaction, nullptr, aValue);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
void nsGenericHTMLElement::Click(CallerType aCallerType) {
|
||||
|
@ -2748,6 +2724,30 @@ void nsGenericHTMLFormElementWithState::NodeInfoChanged(Document* aOldDoc) {
|
|||
mStateKey.SetIsVoid(true);
|
||||
}
|
||||
|
||||
void nsGenericHTMLFormElementWithState::GetFormAction(nsString& aValue) {
|
||||
auto type = ControlType();
|
||||
if (!IsInputElement(type) && !IsButtonElement(type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GetAttr(kNameSpaceID_None, nsGkAtoms::formaction, aValue) ||
|
||||
aValue.IsEmpty()) {
|
||||
Document* document = OwnerDoc();
|
||||
nsIURI* docURI = document->GetDocumentURI();
|
||||
if (docURI) {
|
||||
nsAutoCString spec;
|
||||
nsresult rv = docURI->GetSpec(spec);
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
||||
CopyUTF8toUTF16(spec, aValue);
|
||||
}
|
||||
} else {
|
||||
GetURIAttr(nsGkAtoms::formaction, nullptr, aValue);
|
||||
}
|
||||
}
|
||||
|
||||
bool nsGenericHTMLElement::IsEventAttributeNameInternal(nsAtom* aName) {
|
||||
return nsContentUtils::IsEventAttributeName(aName, EventNameType_HTML);
|
||||
}
|
||||
|
|
|
@ -1047,8 +1047,6 @@ class nsGenericHTMLFormElement : public nsGenericHTMLElement,
|
|||
|
||||
virtual bool IsLabelable() const override;
|
||||
|
||||
void GetFormAction(nsString& aValue);
|
||||
|
||||
// autocapitalize attribute support
|
||||
virtual void GetAutocapitalize(nsAString& aValue) override;
|
||||
bool IsAutocapitalizeInheriting() const;
|
||||
|
@ -1149,6 +1147,8 @@ class nsGenericHTMLFormElementWithState : public nsGenericHTMLFormElement {
|
|||
*/
|
||||
virtual void NodeInfoChanged(Document* aOldDoc) override;
|
||||
|
||||
void GetFormAction(nsString& aValue);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Restore from presentation state. You pass in the presentation state for
|
||||
|
|
Загрузка…
Ссылка в новой задаче