FormAssociatedElement.h [plain text]
#ifndef FormAssociatedElement_h
#define FormAssociatedElement_h
#include "FormNamedItem.h"
#include <wtf/text/WTFString.h>
namespace WebCore {
class ContainerNode;
class Document;
class FormAttributeTargetObserver;
class FormDataList;
class HTMLElement;
class HTMLFormElement;
class Node;
class ValidityState;
class FormAssociatedElement : public FormNamedItem {
public:
virtual ~FormAssociatedElement();
void ref() { refFormAssociatedElement(); }
void deref() { derefFormAssociatedElement(); }
static HTMLFormElement* findAssociatedForm(const HTMLElement*, HTMLFormElement*);
HTMLFormElement* form() const { return m_form; }
ValidityState* validity();
virtual bool isFormControlElement() const = 0;
virtual bool isFormControlElementWithState() const;
virtual bool isEnumeratable() const = 0;
virtual const AtomicString& name() const;
virtual bool appendFormData(FormDataList&, bool) { return false; }
void formWillBeDestroyed();
void resetFormOwner();
void formRemovedFromTree(const Node* formRoot);
bool badInput() const { return hasBadInput(); }
bool customError() const;
virtual bool hasBadInput() const;
virtual bool patternMismatch() const;
virtual bool rangeOverflow() const;
virtual bool rangeUnderflow() const;
virtual bool stepMismatch() const;
virtual bool tooLong() const;
virtual bool typeMismatch() const;
virtual bool valueMissing() const;
virtual String validationMessage() const;
bool valid() const;
virtual void setCustomValidity(const String&);
void formAttributeTargetChanged();
protected:
FormAssociatedElement();
void insertedInto(ContainerNode&);
void removedFrom(ContainerNode&);
void didMoveToNewDocument(Document* oldDocument);
void setForm(HTMLFormElement*);
void formAttributeChanged();
virtual void willChangeForm();
virtual void didChangeForm();
String customValidationMessage() const;
private:
virtual void refFormAssociatedElement() = 0;
virtual void derefFormAssociatedElement() = 0;
void resetFormAttributeTargetObserver();
virtual bool isFormAssociatedElement() const override final { return true; }
std::unique_ptr<FormAttributeTargetObserver> m_formAttributeTargetObserver;
HTMLFormElement* m_form;
String m_customValidationMessage;
};
#define FORM_ASSOCIATED_ELEMENT_TYPE_CASTS(ToClassName, predicate) \
TYPE_CASTS_BASE(ToClassName, FormAssociatedElement, element, element->predicate, element.predicate)
}
#endif // FormAssociatedElement_h