本文整理汇总了C++中HTMLFormControlElement::isActivatedSubmit方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLFormControlElement::isActivatedSubmit方法的具体用法?C++ HTMLFormControlElement::isActivatedSubmit怎么用?C++ HTMLFormControlElement::isActivatedSubmit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLFormControlElement
的用法示例。
在下文中一共展示了HTMLFormControlElement::isActivatedSubmit方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: submit
void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool lockHistory, FormSubmissionTrigger formSubmissionTrigger)
{
FrameView* view = document()->view();
Frame* frame = document()->frame();
if (!view || !frame)
return;
if (m_insubmit) {
m_doingsubmit = true;
return;
}
m_insubmit = true;
HTMLFormControlElement* firstSuccessfulSubmitButton = 0;
bool needButtonActivation = activateSubmitButton; // do we need to activate a submit button?
Vector<pair<String, String> > formValues;
for (unsigned i = 0; i < m_associatedElements.size(); ++i) {
HTMLFormControlElement* control = m_associatedElements[i];
if (control->hasLocalName(inputTag)) {
HTMLInputElement* input = static_cast<HTMLInputElement*>(control);
if (input->isTextField()) {
formValues.append(pair<String, String>(input->name(), input->value()));
if (input->isSearchField())
input->addSearchResult();
}
}
if (needButtonActivation) {
if (control->isActivatedSubmit())
needButtonActivation = false;
else if (firstSuccessfulSubmitButton == 0 && control->isSuccessfulSubmitButton())
firstSuccessfulSubmitButton = control;
}
}
RefPtr<FormState> formState = FormState::create(this, formValues, frame, formSubmissionTrigger);
if (needButtonActivation && firstSuccessfulSubmitButton)
firstSuccessfulSubmitButton->setActivatedSubmit(true);
if (m_url.isEmpty())
m_url = document()->url().string();
RefPtr<FormData> data = prepareFormData();
String boundary = m_formDataBuilder.isMultiPartForm() ? data->boundary().data() : String();
const char* method = m_formDataBuilder.isPostMethod() ? "POST" : "GET";
frame->loader()->submitForm(method, m_url, data.release(), m_target, m_formDataBuilder.encodingType(), boundary, lockHistory, event, formState.release());
if (needButtonActivation && firstSuccessfulSubmitButton)
firstSuccessfulSubmitButton->setActivatedSubmit(false);
m_doingsubmit = m_insubmit = false;
}
示例2: findPasswordFormFields
void findPasswordFormFields(HTMLFormElement* form, PasswordFormFields* fields)
{
ASSERT(form);
ASSERT(fields);
int firstPasswordIndex = 0;
// First, find the password fields and activated submit button
const Vector<HTMLFormControlElement*>& formElements = form->associatedElements();
for (size_t i = 0; i < formElements.size(); i++) {
HTMLFormControlElement* formElement = formElements[i];
if (formElement->isActivatedSubmit())
fields->submit = formElement;
if (!formElement->hasLocalName(HTMLNames::inputTag))
continue;
HTMLInputElement* inputElement = toHTMLInputElement(formElement);
if (!inputElement->isEnabledFormControl())
continue;
if ((fields->passwords.size() < maxPasswords)
&& inputElement->isPasswordField()
&& inputElement->autoComplete()) {
if (fields->passwords.isEmpty())
firstPasswordIndex = i;
fields->passwords.append(inputElement);
}
}
if (!fields->passwords.isEmpty()) {
// Then, search backwards for the username field
for (int i = firstPasswordIndex - 1; i >= 0; i--) {
HTMLFormControlElement* formElement = formElements[i];
if (!formElement->hasLocalName(HTMLNames::inputTag))
continue;
HTMLInputElement* inputElement = toHTMLInputElement(formElement);
if (!inputElement->isEnabledFormControl())
continue;
// Various input types such as text, url, email can be a username field.
if ((inputElement->isTextField() && !inputElement->isPasswordField())
&& (inputElement->autoComplete())) {
fields->userName = inputElement;
break;
}
}
}
}
示例3: submit
void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool processingUserGesture)
{
FrameView* view = document().view();
LocalFrame* frame = document().frame();
if (!view || !frame || !frame->page())
return;
if (m_isSubmittingOrInUserJSSubmitEvent) {
m_shouldSubmit = true;
return;
}
m_isSubmittingOrInUserJSSubmitEvent = true;
m_wasUserSubmitted = processingUserGesture;
RefPtrWillBeRawPtr<HTMLFormControlElement> firstSuccessfulSubmitButton = nullptr;
bool needButtonActivation = activateSubmitButton; // do we need to activate a submit button?
const FormAssociatedElement::List& elements = associatedElements();
for (unsigned i = 0; i < elements.size(); ++i) {
FormAssociatedElement* associatedElement = elements[i];
if (!associatedElement->isFormControlElement())
continue;
if (needButtonActivation) {
HTMLFormControlElement* control = toHTMLFormControlElement(associatedElement);
if (control->isActivatedSubmit())
needButtonActivation = false;
else if (firstSuccessfulSubmitButton == 0 && control->isSuccessfulSubmitButton())
firstSuccessfulSubmitButton = control;
}
}
if (needButtonActivation && firstSuccessfulSubmitButton)
firstSuccessfulSubmitButton->setActivatedSubmit(true);
RefPtrWillBeRawPtr<FormSubmission> formSubmission = FormSubmission::create(this, m_attributes, event);
EventQueueScope scopeForDialogClose; // Delay dispatching 'close' to dialog until done submitting.
if (formSubmission->method() == FormSubmission::DialogMethod)
submitDialog(formSubmission.release());
else
scheduleFormSubmission(formSubmission.release());
if (needButtonActivation && firstSuccessfulSubmitButton)
firstSuccessfulSubmitButton->setActivatedSubmit(false);
m_shouldSubmit = false;
m_isSubmittingOrInUserJSSubmitEvent = false;
}
示例4: findPasswordFormFields
void findPasswordFormFields(HTMLFormElement* form, PasswordFormFields* fields)
{
ASSERT(form);
ASSERT(fields);
HTMLInputElement* latestInputElement = 0;
const Vector<FormAssociatedElement*>& formElements = form->associatedElements();
for (size_t i = 0; i < formElements.size(); i++) {
if (!formElements[i]->isFormControlElement())
continue;
HTMLFormControlElement* control = toHTMLFormControlElement(formElements[i]);
if (control->isActivatedSubmit())
fields->submit = control;
if (!control->hasTagName(HTMLNames::inputTag))
continue;
HTMLInputElement* inputElement = toHTMLInputElement(control);
if (inputElement->isDisabledFormControl())
continue;
if ((fields->passwords.size() < maxPasswords)
&& inputElement->isPasswordField()) {
// We assume that the username is the input element before the
// first password element.
if (fields->passwords.isEmpty() && latestInputElement) {
fields->userName = latestInputElement;
// Remove the selected username from alternateUserNames.
if (!fields->alternateUserNames.isEmpty() && !latestInputElement->value().isEmpty())
fields->alternateUserNames.removeLast();
}
fields->passwords.append(inputElement);
}
// Various input types such as text, url, email can be a username field.
if (inputElement->isTextField() && !inputElement->isPasswordField()) {
latestInputElement = inputElement;
// We ignore elements that have no value. Unlike userName, alternateUserNames
// is used only for autofill, not for form identification, and blank autofill
// entries are not useful.
if (!inputElement->value().isEmpty())
fields->alternateUserNames.append(inputElement->value());
}
}
}
示例5: submit
void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool processingUserGesture, FormSubmissionTrigger formSubmissionTrigger)
{
FrameView* view = document()->view();
Frame* frame = document()->frame();
if (!view || !frame)
return;
if (m_isSubmittingOrPreparingForSubmission) {
m_shouldSubmit = true;
return;
}
m_isSubmittingOrPreparingForSubmission = true;
m_wasUserSubmitted = processingUserGesture;
HTMLFormControlElement* firstSuccessfulSubmitButton = 0;
bool needButtonActivation = activateSubmitButton; // do we need to activate a submit button?
for (unsigned i = 0; i < m_associatedElements.size(); ++i) {
FormAssociatedElement* associatedElement = m_associatedElements[i];
if (!associatedElement->isFormControlElement())
continue;
if (needButtonActivation) {
HTMLFormControlElement* control = static_cast<HTMLFormControlElement*>(associatedElement);
if (control->isActivatedSubmit())
needButtonActivation = false;
else if (firstSuccessfulSubmitButton == 0 && control->isSuccessfulSubmitButton())
firstSuccessfulSubmitButton = control;
}
}
if (needButtonActivation && firstSuccessfulSubmitButton)
firstSuccessfulSubmitButton->setActivatedSubmit(true);
bool lockHistory = !processingUserGesture;
frame->loader()->submitForm(FormSubmission::create(this, m_attributes, event, lockHistory, formSubmissionTrigger));
if (needButtonActivation && firstSuccessfulSubmitButton)
firstSuccessfulSubmitButton->setActivatedSubmit(false);
m_shouldSubmit = false;
m_isSubmittingOrPreparingForSubmission = false;
}
示例6: submit
void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool lockHistory, bool lockBackForwardList)
{
FrameView* view = document()->view();
Frame* frame = document()->frame();
if (!view || !frame)
return;
if (m_insubmit) {
m_doingsubmit = true;
return;
}
m_insubmit = true;
HTMLFormControlElement* firstSuccessfulSubmitButton = 0;
bool needButtonActivation = activateSubmitButton; // do we need to activate a submit button?
Vector<pair<String, String> > formValues;
for (unsigned i = 0; i < formElements.size(); ++i) {
HTMLFormControlElement* control = formElements[i];
if (control->hasLocalName(inputTag)) {
HTMLInputElement* input = static_cast<HTMLInputElement*>(control);
if (input->isTextField()) {
formValues.append(pair<String, String>(input->name(), input->value()));
if (input->isSearchField())
input->addSearchResult();
}
}
if (needButtonActivation) {
if (control->isActivatedSubmit())
needButtonActivation = false;
else if (firstSuccessfulSubmitButton == 0 && control->isSuccessfulSubmitButton())
firstSuccessfulSubmitButton = control;
}
}
RefPtr<FormState> formState = FormState::create(this, formValues, frame);
if (needButtonActivation && firstSuccessfulSubmitButton)
firstSuccessfulSubmitButton->setActivatedSubmit(true);
if (m_url.isEmpty())
m_url = document()->url().string();
if (m_formDataBuilder.isPostMethod()) {
if (m_formDataBuilder.isMultiPartForm() && isMailtoForm()) {
setEnctype("application/x-www-form-urlencoded");
ASSERT(!m_formDataBuilder.isMultiPartForm());
}
if (!m_formDataBuilder.isMultiPartForm()) {
RefPtr<FormData> data = createFormData(CString());
if (isMailtoForm()) {
// Convert the form data into a string that we put into the URL.
KURL url = document()->completeURL(m_url);
transferMailtoPostFormDataToURL(data, url, m_formDataBuilder.encodingType());
m_url = url.string();
}
frame->loader()->submitForm("POST", m_url, data.release(), m_target, m_formDataBuilder.encodingType(), String(), lockHistory, lockBackForwardList, event, formState.release());
} else {
Vector<char> boundary = m_formDataBuilder.generateUniqueBoundaryString();
frame->loader()->submitForm("POST", m_url, createFormData(boundary.data()), m_target, m_formDataBuilder.encodingType(), boundary.data(), lockHistory, lockBackForwardList, event, formState.release());
}
} else {
m_formDataBuilder.setIsMultiPartForm(false);
frame->loader()->submitForm("GET", m_url, createFormData(CString()), m_target, String(), String(), lockHistory, lockBackForwardList, event, formState.release());
}
if (needButtonActivation && firstSuccessfulSubmitButton)
firstSuccessfulSubmitButton->setActivatedSubmit(false);
m_doingsubmit = m_insubmit = false;
}
示例7: submit
void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool lockHistory, bool lockBackForwardList)
{
FrameView* view = document()->view();
Frame* frame = document()->frame();
if (!view || !frame)
return;
if (m_insubmit) {
m_doingsubmit = true;
return;
}
m_insubmit = true;
HTMLFormControlElement* firstSuccessfulSubmitButton = 0;
bool needButtonActivation = activateSubmitButton; // do we need to activate a submit button?
frame->loader()->clearRecordedFormValues();
frame->loader()->setFormAboutToBeSubmitted(this);
for (unsigned i = 0; i < formElements.size(); ++i) {
HTMLFormControlElement* control = formElements[i];
if (control->hasLocalName(inputTag)) {
HTMLInputElement* input = static_cast<HTMLInputElement*>(control);
if (input->isTextField()) {
frame->loader()->recordFormValue(input->name(), input->value());
if (input->isSearchField())
input->addSearchResult();
}
}
if (needButtonActivation) {
if (control->isActivatedSubmit())
needButtonActivation = false;
else if (firstSuccessfulSubmitButton == 0 && control->isSuccessfulSubmitButton())
firstSuccessfulSubmitButton = control;
}
}
if (needButtonActivation && firstSuccessfulSubmitButton)
firstSuccessfulSubmitButton->setActivatedSubmit(true);
if (m_url.isEmpty())
m_url = document()->url().string();
if (m_formDataBuilder.isPostMethod()) {
if (m_formDataBuilder.isMultiPartForm() && isMailtoForm()) {
setEnctype("application/x-www-form-urlencoded");
ASSERT(!m_formDataBuilder.isMultiPartForm());
}
if (!m_formDataBuilder.isMultiPartForm()) {
RefPtr<FormData> data = createFormData(CString());
if (isMailtoForm()) {
String body = data->flattenToString();
if (equalIgnoringCase(m_formDataBuilder.encodingType(), "text/plain")) {
// Convention seems to be to decode, and s/&/\r\n/. Also, spaces are encoded as %20.
body = decodeURLEscapeSequences(body.replace('&', "\r\n").replace('+', ' ') + "\r\n");
}
Vector<char> bodyData;
bodyData.append("body=", 5);
FormDataBuilder::encodeStringAsFormData(bodyData, body.utf8());
data = FormData::create(String(bodyData.data(), bodyData.size()).replace('+', "%20").latin1());
}
frame->loader()->submitForm("POST", m_url, data, m_target, m_formDataBuilder.encodingType(), String(), event, lockHistory, lockBackForwardList);
} else {
Vector<char> boundary = m_formDataBuilder.generateUniqueBoundaryString();
frame->loader()->submitForm("POST", m_url, createFormData(boundary.data()), m_target, m_formDataBuilder.encodingType(), boundary.data(), event, lockHistory, lockBackForwardList);
}
} else {
m_formDataBuilder.setIsMultiPartForm(false);
frame->loader()->submitForm("GET", m_url, createFormData(CString()), m_target, String(), String(), event, lockHistory, lockBackForwardList);
}
if (needButtonActivation && firstSuccessfulSubmitButton)
firstSuccessfulSubmitButton->setActivatedSubmit(false);
m_doingsubmit = m_insubmit = false;
}