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

Unified Diff: Source/core/html/forms/EmailInputType.cpp

Issue 27746003: Have InputType factories take an HTMLInputElement reference in parameter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 2 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/core/html/forms/EmailInputType.h ('k') | Source/core/html/forms/FileInputType.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/forms/EmailInputType.cpp
diff --git a/Source/core/html/forms/EmailInputType.cpp b/Source/core/html/forms/EmailInputType.cpp
index fc846f831687fb54ea74fa25d130a66b8f7dabe3..7c31462add9c988c5086667d939dd594289875da 100644
--- a/Source/core/html/forms/EmailInputType.cpp
+++ b/Source/core/html/forms/EmailInputType.cpp
@@ -133,7 +133,7 @@ static bool isValidEmailAddress(const String& address)
return !matchOffset && matchLength == addressLength;
}
-PassRefPtr<InputType> EmailInputType::create(HTMLInputElement* element)
+PassRefPtr<InputType> EmailInputType::create(HTMLInputElement& element)
{
return adoptRef(new EmailInputType(element));
}
@@ -156,7 +156,7 @@ String EmailInputType::findInvalidAddress(const String& value) const
{
if (value.isEmpty())
return String();
- if (!element()->multiple())
+ if (!element().multiple())
return isValidEmailAddress(value) ? String() : value;
Vector<String> addresses;
value.split(',', true, addresses);
@@ -175,12 +175,12 @@ bool EmailInputType::typeMismatchFor(const String& value) const
bool EmailInputType::typeMismatch() const
{
- return typeMismatchFor(element()->value());
+ return typeMismatchFor(element().value());
}
String EmailInputType::typeMismatchText() const
{
- String invalidAddress = findInvalidAddress(element()->value());
+ String invalidAddress = findInvalidAddress(element().value());
ASSERT(!invalidAddress.isNull());
if (invalidAddress.isEmpty())
return locale().queryString(WebLocalizedString::ValidationTypeMismatchForEmailEmpty);
@@ -212,7 +212,7 @@ String EmailInputType::typeMismatchText() const
ASSERT(atIndexInUnicode != kNotFound);
return locale().queryString(WebLocalizedString::ValidationTypeMismatchForEmailInvalidDots, String("."), unicodeAddress.substring(atIndexInUnicode + 1));
}
- if (element()->multiple())
+ if (element().multiple())
return locale().queryString(WebLocalizedString::ValidationTypeMismatchForMultipleEmail);
return locale().queryString(WebLocalizedString::ValidationTypeMismatchForEmail);
}
@@ -230,7 +230,7 @@ bool EmailInputType::supportsSelectionAPI() const
String EmailInputType::sanitizeValue(const String& proposedValue) const
{
String noLineBreakValue = proposedValue.removeCharacters(isHTMLLineBreak);
- if (!element()->multiple())
+ if (!element().multiple())
return stripLeadingAndTrailingHTMLSpaces(noLineBreakValue);
Vector<String> addresses;
noLineBreakValue.split(',', true, addresses);
@@ -246,7 +246,7 @@ String EmailInputType::sanitizeValue(const String& proposedValue) const
String EmailInputType::convertFromVisibleValue(const String& visibleValue) const
{
String sanitizedValue = sanitizeValue(visibleValue);
- if (!element()->multiple())
+ if (!element().multiple())
return convertEmailAddressToASCII(sanitizedValue);
Vector<String> addresses;
sanitizedValue.split(',', true, addresses);
@@ -262,8 +262,8 @@ String EmailInputType::convertFromVisibleValue(const String& visibleValue) const
String EmailInputType::visibleValue() const
{
- String value = element()->value();
- if (!element()->multiple())
+ String value = element().value();
+ if (!element().multiple())
return convertEmailAddressToUnicode(value);
Vector<String> addresses;
« no previous file with comments | « Source/core/html/forms/EmailInputType.h ('k') | Source/core/html/forms/FileInputType.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698