This source file includes following definitions.
- create
- formControlType
- appendFormData
- supportsRequired
- handleDOMActivateEvent
- canBeSuccessfulSubmitButton
- defaultValue
- isTextButton
#include "config.h"
#include "core/html/forms/SubmitInputType.h"
#include "InputTypeNames.h"
#include "core/events/Event.h"
#include "core/html/FormDataList.h"
#include "core/html/HTMLFormElement.h"
#include "core/html/HTMLInputElement.h"
#include "platform/text/PlatformLocale.h"
#include "wtf/PassOwnPtr.h"
namespace WebCore {
PassRefPtr<InputType> SubmitInputType::create(HTMLInputElement& element)
{
return adoptRef(new SubmitInputType(element));
}
const AtomicString& SubmitInputType::formControlType() const
{
return InputTypeNames::submit;
}
bool SubmitInputType::appendFormData(FormDataList& encoding, bool) const
{
if (!element().isActivatedSubmit())
return false;
encoding.appendData(element().name(), element().valueWithDefault());
return true;
}
bool SubmitInputType::supportsRequired() const
{
return false;
}
void SubmitInputType::handleDOMActivateEvent(Event* event)
{
RefPtr<HTMLInputElement> element(this->element());
if (element->isDisabledFormControl() || !element->form())
return;
element->setActivatedSubmit(true);
element->form()->prepareForSubmission(event);
element->setActivatedSubmit(false);
event->setDefaultHandled();
}
bool SubmitInputType::canBeSuccessfulSubmitButton()
{
return true;
}
String SubmitInputType::defaultValue() const
{
return locale().queryString(blink::WebLocalizedString::SubmitButtonDefaultLabel);
}
bool SubmitInputType::isTextButton() const
{
return true;
}
}