Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1593)

Unified Diff: Source/web/WebPasswordFormUtils.cpp

Issue 200723002: Use new is*Element() helper functions more in web/ code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use same assertion as in operator->() Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/WebPageSerializerImpl.cpp ('k') | Source/web/WebSearchableFormData.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebPasswordFormUtils.cpp
diff --git a/Source/web/WebPasswordFormUtils.cpp b/Source/web/WebPasswordFormUtils.cpp
index 582d75cb34d611b504bb4c64c6acd4694a8da30d..cc3dd6d30832259c711ce4bbbed220dd2432e84e 100644
--- a/Source/web/WebPasswordFormUtils.cpp
+++ b/Source/web/WebPasswordFormUtils.cpp
@@ -69,15 +69,15 @@ void findPasswordFormFields(HTMLFormElement* form, PasswordFormFields* fields)
if (control->isActivatedSubmit())
fields->submit = control;
- if (!control->hasTagName(HTMLNames::inputTag))
+ if (!isHTMLInputElement(*control))
continue;
- HTMLInputElement* inputElement = toHTMLInputElement(control);
- if (inputElement->isDisabledFormControl())
+ HTMLInputElement& inputElement = toHTMLInputElement(*control);
+ if (inputElement.isDisabledFormControl())
continue;
if ((fields->passwords.size() < maxPasswords)
- && inputElement->isPasswordField()) {
+ && inputElement.isPasswordField()) {
// We assume that the username is the input element before the
// first password element.
if (fields->passwords.isEmpty() && latestInputElement) {
@@ -86,17 +86,17 @@ void findPasswordFormFields(HTMLFormElement* form, PasswordFormFields* fields)
if (!fields->alternateUserNames.isEmpty() && !latestInputElement->value().isEmpty())
fields->alternateUserNames.removeLast();
}
- fields->passwords.append(inputElement);
+ fields->passwords.append(&inputElement);
}
// Various input types such as text, url, email can be a username field.
- if (inputElement->isTextField() && !inputElement->isPasswordField()) {
- latestInputElement = inputElement;
+ 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());
+ if (!inputElement.value().isEmpty())
+ fields->alternateUserNames.append(inputElement.value());
}
}
}
« no previous file with comments | « Source/web/WebPageSerializerImpl.cpp ('k') | Source/web/WebSearchableFormData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698