This source file includes following definitions.
- create
- formControlType
- saveFormControlState
- restoreFormControlState
- supportsValidation
- createRenderer
- accessKeyAction
- rendererIsNeeded
- storesValueSeparateFromAttribute
- setValue
- isHiddenType
- appendFormData
- shouldRespectHeightAndWidthAttributes
#include "config.h"
#include "core/html/forms/HiddenInputType.h"
#include "HTMLNames.h"
#include "InputTypeNames.h"
#include "core/html/FormDataList.h"
#include "core/html/HTMLInputElement.h"
#include "core/html/forms/FormController.h"
#include "wtf/PassOwnPtr.h"
namespace WebCore {
using namespace HTMLNames;
PassRefPtr<InputType> HiddenInputType::create(HTMLInputElement& element)
{
return adoptRef(new HiddenInputType(element));
}
const AtomicString& HiddenInputType::formControlType() const
{
return InputTypeNames::hidden;
}
FormControlState HiddenInputType::saveFormControlState() const
{
return element().valueAttributeWasUpdatedAfterParsing() ? FormControlState(element().value()) : FormControlState();
}
void HiddenInputType::restoreFormControlState(const FormControlState& state)
{
element().setAttribute(valueAttr, AtomicString(state[0]));
}
bool HiddenInputType::supportsValidation() const
{
return false;
}
RenderObject* HiddenInputType::createRenderer(RenderStyle*) const
{
ASSERT_NOT_REACHED();
return 0;
}
void HiddenInputType::accessKeyAction(bool)
{
}
bool HiddenInputType::rendererIsNeeded()
{
return false;
}
bool HiddenInputType::storesValueSeparateFromAttribute()
{
return false;
}
void HiddenInputType::setValue(const String& sanitizedValue, bool, TextFieldEventBehavior)
{
element().setAttribute(valueAttr, AtomicString(sanitizedValue));
}
bool HiddenInputType::isHiddenType() const
{
return true;
}
bool HiddenInputType::appendFormData(FormDataList& encoding, bool isMultipartForm) const
{
if (equalIgnoringCase(element().name(), "_charset_")) {
encoding.appendData(element().name(), String(encoding.encoding().name()));
return true;
}
return InputType::appendFormData(encoding, isMultipartForm);
}
bool HiddenInputType::shouldRespectHeightAndWidthAttributes()
{
return true;
}
}