Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / html / HTMLFormControlElement.h
index e5d6047..44d3315 100644 (file)
@@ -43,12 +43,10 @@ class HTMLFormControlElement : public LabelableElement, public FormAssociatedEle
 public:
     virtual ~HTMLFormControlElement();
 
-    HTMLFormElement* form() const { return FormAssociatedElement::form(); }
-
     String formEnctype() const;
-    void setFormEnctype(const String&);
+    void setFormEnctype(const AtomicString&);
     String formMethod() const;
-    void setFormMethod(const String&);
+    void setFormMethod(const AtomicString&);
     bool formNoValidate() const;
 
     void ancestorDisabledStateWasChanged();
@@ -58,48 +56,50 @@ public:
     virtual bool formControlValueMatchesRenderer() const { return m_valueMatchesRenderer; }
     virtual void setFormControlValueMatchesRenderer(bool b) { m_valueMatchesRenderer = b; }
 
-    virtual bool wasChangedSinceLastFormControlChangeEvent() const;
-    virtual void setChangedSinceLastFormControlChangeEvent(bool);
+    bool wasChangedSinceLastFormControlChangeEvent() const { return m_wasChangedSinceLastFormControlChangeEvent; }
+    void setChangedSinceLastFormControlChangeEvent(bool);
 
     virtual void dispatchFormControlChangeEvent();
-    virtual void dispatchFormControlInputEvent();
+    void dispatchChangeEvent();
+    void dispatchFormControlInputEvent();
+
+    virtual HTMLFormElement* formOwner() const OVERRIDE FINAL;
 
     virtual bool isDisabledFormControl() const OVERRIDE;
 
-    virtual bool isEnumeratable() const { return false; }
+    virtual bool isEnumeratable() const OVERRIDE { return false; }
 
     bool isRequired() const;
 
     const AtomicString& type() const { return formControlType(); }
 
-    virtual const AtomicString& formControlType() const OVERRIDE = 0;
+    virtual const AtomicString& formControlType() const = 0;
 
     virtual bool canTriggerImplicitSubmission() const { return false; }
 
     // Override in derived classes to get the encoded name=value pair for submitting.
     // Return true for a successful control (see HTML4-17.13.2).
-    virtual bool appendFormData(FormDataList&, bool) { return false; }
+    virtual bool appendFormData(FormDataList&, bool) OVERRIDE { return false; }
     virtual String resultForDialogSubmit();
 
-    virtual bool isSuccessfulSubmitButton() const { return false; }
+    virtual bool canBeSuccessfulSubmitButton() const { return false; }
+    bool isSuccessfulSubmitButton() const;
     virtual bool isActivatedSubmit() const { return false; }
     virtual void setActivatedSubmit(bool) { }
 
     enum CheckValidityDispatchEvents { CheckValidityDispatchEventsAllowed, CheckValidityDispatchEventsNone };
 
-    virtual bool willValidate() const;
+    virtual bool willValidate() const OVERRIDE;
     void updateVisibleValidationMessage();
     void hideVisibleValidationMessage();
     bool checkValidity(Vector<RefPtr<FormAssociatedElement> >* unhandledInvalidControls = 0, CheckValidityDispatchEvents = CheckValidityDispatchEventsAllowed);
     // This must be called when a validation constraint or control value is changed.
     void setNeedsValidityCheck();
-    virtual void setCustomValidity(const String&) OVERRIDE;
+    virtual void setCustomValidity(const String&) OVERRIDE FINAL;
 
     bool isReadOnly() const { return m_isReadOnly; }
     bool isDisabledOrReadOnly() const { return isDisabledFormControl() || m_isReadOnly; }
 
-    bool hasAutofocused() const { return m_hasAutofocused; }
-    void setAutofocused() { m_hasAutofocused = true; }
     bool isAutofocusable() const;
 
     bool isAutofilled() const { return m_isAutofilled; }
@@ -107,6 +107,10 @@ public:
 
     static HTMLFormControlElement* enclosingFormControlElement(Node*);
 
+    String nameForAutofill() const;
+
+    virtual void setFocus(bool flag) OVERRIDE;
+
     using Node::ref;
     using Node::deref;
 
@@ -124,31 +128,31 @@ protected:
     virtual bool supportsFocus() const OVERRIDE;
     virtual bool isKeyboardFocusable() const OVERRIDE;
     virtual bool shouldShowFocusRingOnMouseFocus() const;
-    virtual bool shouldHaveFocusAppearance() const OVERRIDE;
-    virtual void dispatchFocusEvent(Element* oldFocusedElement, FocusDirection) OVERRIDE;
+    virtual bool shouldHaveFocusAppearance() const OVERRIDE FINAL;
+    virtual void dispatchFocusEvent(Element* oldFocusedElement, FocusType) OVERRIDE;
     virtual void dispatchBlurEvent(Element* newFocusedElement) OVERRIDE;
-    virtual void willCallDefaultEventHandler(const Event&) OVERRIDE;
+    virtual void willCallDefaultEventHandler(const Event&) OVERRIDE FINAL;
 
-    virtual void didRecalcStyle(StyleRecalcChange) OVERRIDE;
+    virtual void didRecalcStyle(StyleRecalcChange) OVERRIDE FINAL;
 
     // This must be called any time the result of willValidate() has changed.
     void setNeedsWillValidateCheck();
     virtual bool recalcWillValidate() const;
 
     virtual void resetImpl() { }
+    virtual bool supportsAutofocus() const;
 
 private:
-    virtual void refFormAssociatedElement() { ref(); }
-    virtual void derefFormAssociatedElement() { deref(); }
+    virtual void refFormAssociatedElement() OVERRIDE FINAL { ref(); }
+    virtual void derefFormAssociatedElement() OVERRIDE FINAL { deref(); }
 
-    virtual bool isFormControlElement() const { return true; }
+    virtual bool isFormControlElement() const OVERRIDE FINAL { return true; }
     virtual bool alwaysCreateUserAgentShadowRoot() const OVERRIDE { return true; }
 
-    virtual short tabIndex() const;
+    virtual short tabIndex() const OVERRIDE FINAL;
 
-    virtual HTMLFormElement* virtualForm() const;
-    virtual bool isDefaultButtonForForm() const;
-    virtual bool isValidFormControlElement();
+    virtual bool isDefaultButtonForForm() const OVERRIDE FINAL;
+    virtual bool isValidFormControlElement() OVERRIDE FINAL;
     void updateAncestorDisabledState() const;
 
     OwnPtr<ValidationMessage> m_validationMessage;
@@ -175,7 +179,6 @@ private:
 
     bool m_wasChangedSinceLastFormControlChangeEvent : 1;
     bool m_wasFocusedByMouse : 1;
-    bool m_hasAutofocused : 1;
 };
 
 inline bool isHTMLFormControlElement(const Node& node)
@@ -184,24 +187,7 @@ inline bool isHTMLFormControlElement(const Node& node)
 }
 
 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(HTMLFormControlElement);
-
-inline HTMLFormControlElement* toHTMLFormControlElement(FormAssociatedElement* control)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!control || control->isFormControlElement());
-    return static_cast<HTMLFormControlElement*>(control);
-}
-
-inline HTMLFormControlElement& toHTMLFormControlElement(FormAssociatedElement& control)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(control.isFormControlElement());
-    return static_cast<HTMLFormControlElement&>(control);
-}
-
-inline const HTMLFormControlElement* toHTMLFormControlElement(const FormAssociatedElement* control)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!control || control->isFormControlElement());
-    return static_cast<const HTMLFormControlElement*>(control);
-}
+DEFINE_TYPE_CASTS(HTMLFormControlElement, FormAssociatedElement, control, control->isFormControlElement(), control.isFormControlElement());
 
 } // namespace