本文整理汇总了C++中HTMLFormControlElement::toInputElement方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLFormControlElement::toInputElement方法的具体用法?C++ HTMLFormControlElement::toInputElement怎么用?C++ HTMLFormControlElement::toInputElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLFormControlElement
的用法示例。
在下文中一共展示了HTMLFormControlElement::toInputElement方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findPasswordFormFields
bool CredentialTransformData::findPasswordFormFields(HTMLFormElement* form)
{
ASSERT(form);
int firstPasswordIndex = 0;
// First, find the password fields and activated submit button.
const Vector<FormAssociatedElement*>& formElements = form->associatedElements();
Vector<HTMLInputElement*> passwords;
for (size_t i = 0; i < formElements.size(); i++) {
if (!formElements[i]->isFormControlElement())
continue;
HTMLFormControlElement* formElement = static_cast<HTMLFormControlElement*>(formElements[i]);
if (!formElement->hasLocalName(HTMLNames::inputTag))
continue;
HTMLInputElement* inputElement = formElement->toInputElement();
if (!inputElement->isEnabledFormControl())
continue;
if ((passwords.size() < maxPasswords)
&& inputElement->isPasswordField()
&& inputElement->shouldAutocomplete()) {
if (passwords.isEmpty())
firstPasswordIndex = i;
passwords.append(inputElement);
}
}
if (!passwords.isEmpty()) {
// Then, search backwards for the username field.
for (int i = firstPasswordIndex - 1; i >= 0; i--) {
if (!formElements[i]->isFormControlElement())
continue;
HTMLFormControlElement* formElement = static_cast<HTMLFormControlElement*>(formElements[i]);
if (!formElement->hasLocalName(HTMLNames::inputTag))
continue;
HTMLInputElement* inputElement = formElement->toInputElement();
if (!inputElement->isEnabledFormControl())
continue;
// Various input types such as text, url, email can be a username field.
if ((inputElement->isTextField() && !inputElement->isPasswordField())
&& (inputElement->shouldAutocomplete())) {
m_userNameElement = inputElement;
break;
}
}
}
if (!m_userNameElement)
return false;
if (!locateSpecificPasswords(passwords, &(m_passwordElement)))
return false;
return true;
}