This source file includes following definitions.
- insertedInto
- removedFrom
- shouldAutocomplete
- notifyFormStateChanged
- shouldSaveAndRestoreFormControlState
- saveFormControlState
- finishParsingChildren
- isFormControlElementWithState
#include "config.h"
#include "core/html/HTMLFormControlElementWithState.h"
#include "core/frame/FrameHost.h"
#include "core/frame/LocalFrame.h"
#include "core/html/HTMLFormElement.h"
#include "core/html/forms/FormController.h"
#include "core/page/Chrome.h"
#include "core/page/ChromeClient.h"
namespace WebCore {
HTMLFormControlElementWithState::HTMLFormControlElementWithState(const QualifiedName& tagName, Document& doc, HTMLFormElement* f)
: HTMLFormControlElement(tagName, doc, f)
{
}
HTMLFormControlElementWithState::~HTMLFormControlElementWithState()
{
}
Node::InsertionNotificationRequest HTMLFormControlElementWithState::insertedInto(ContainerNode* insertionPoint)
{
if (insertionPoint->inDocument() && !containingShadowRoot())
document().formController().registerStatefulFormControl(*this);
return HTMLFormControlElement::insertedInto(insertionPoint);
}
void HTMLFormControlElementWithState::removedFrom(ContainerNode* insertionPoint)
{
if (insertionPoint->inDocument() && !containingShadowRoot() && !insertionPoint->containingShadowRoot())
document().formController().unregisterStatefulFormControl(*this);
HTMLFormControlElement::removedFrom(insertionPoint);
}
bool HTMLFormControlElementWithState::shouldAutocomplete() const
{
if (!form())
return true;
return form()->shouldAutocomplete();
}
void HTMLFormControlElementWithState::notifyFormStateChanged()
{
if (!document().isActive())
return;
document().frame()->loader().markDocumentStateDirty();
}
bool HTMLFormControlElementWithState::shouldSaveAndRestoreFormControlState() const
{
return inActiveDocument() && shouldAutocomplete();
}
FormControlState HTMLFormControlElementWithState::saveFormControlState() const
{
return FormControlState();
}
void HTMLFormControlElementWithState::finishParsingChildren()
{
HTMLFormControlElement::finishParsingChildren();
document().formController().restoreControlStateFor(*this);
}
bool HTMLFormControlElementWithState::isFormControlElementWithState() const
{
return true;
}
}