Commit 2511f775 authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

Replace kValidationTypeFoo with IDS_FOO

As a step to remove all uses of WebLocalizedString::kFooBar,
this CL replaces below ones with matched IDS_FOO.

This CL replaces below ones,

  - kValidationTypeMismatch
  - kValidationTypeMismatchForEmail,
  - kValidationTypeMismatchForEmailEmpty,
  - kValidationTypeMismatchForEmailEmptyDomain,
  - kValidationTypeMismatchForEmailEmptyLocal,
  - kValidationTypeMismatchForEmailInvalidDomain,
  - kValidationTypeMismatchForEmailInvalidDots,
  - kValidationTypeMismatchForEmailInvalidLocal,
  - kValidationTypeMismatchForEmailNoAtSign,
  - kValidationTypeMismatchForMultipleEmail,
  - kValidationTypeMismatchForURL,

Bug: 995644
Change-Id: I27362cd5d6adae09983ff43cf34c637ac40eb9a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1824513Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Cr-Commit-Position: refs/heads/master@{#700128}
parent 077f1da1
......@@ -138,28 +138,6 @@ int ToMessageID(int resource_id) {
return IDS_FORM_VALIDATION_TOO_SHORT;
case WebLocalizedString::kValidationTooShortPlural:
return IDS_FORM_VALIDATION_TOO_SHORT_PLURAL;
case WebLocalizedString::kValidationTypeMismatch:
return IDS_FORM_VALIDATION_TYPE_MISMATCH;
case WebLocalizedString::kValidationTypeMismatchForEmail:
return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL;
case WebLocalizedString::kValidationTypeMismatchForEmailEmpty:
return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_EMPTY;
case WebLocalizedString::kValidationTypeMismatchForEmailEmptyDomain:
return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_EMPTY_DOMAIN;
case WebLocalizedString::kValidationTypeMismatchForEmailEmptyLocal:
return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_EMPTY_LOCAL;
case WebLocalizedString::kValidationTypeMismatchForEmailInvalidDomain:
return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_INVALID_DOMAIN;
case WebLocalizedString::kValidationTypeMismatchForEmailInvalidDots:
return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_INVALID_DOTS;
case WebLocalizedString::kValidationTypeMismatchForEmailInvalidLocal:
return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_INVALID_LOCAL;
case WebLocalizedString::kValidationTypeMismatchForEmailNoAtSign:
return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_NO_AT_SIGN;
case WebLocalizedString::kValidationTypeMismatchForMultipleEmail:
return IDS_FORM_VALIDATION_TYPE_MISMATCH_MULTIPLE_EMAIL;
case WebLocalizedString::kValidationTypeMismatchForURL:
return IDS_FORM_VALIDATION_TYPE_MISMATCH_URL;
case WebLocalizedString::kWeekNumberLabel:
return IDS_FORM_WEEK_NUMBER_LABEL;
case WebLocalizedString::kTextTracksNoLabel:
......
......@@ -76,17 +76,6 @@ struct WebLocalizedString {
kValidationStepMismatchCloseToLimit,
kValidationTooShort,
kValidationTooShortPlural,
kValidationTypeMismatch,
kValidationTypeMismatchForEmail,
kValidationTypeMismatchForEmailEmpty,
kValidationTypeMismatchForEmailEmptyDomain,
kValidationTypeMismatchForEmailEmptyLocal,
kValidationTypeMismatchForEmailInvalidDomain,
kValidationTypeMismatchForEmailInvalidDots,
kValidationTypeMismatchForEmailInvalidLocal,
kValidationTypeMismatchForEmailNoAtSign,
kValidationTypeMismatchForMultipleEmail,
kValidationTypeMismatchForURL,
kWeekNumberLabel,
};
};
......
......@@ -27,6 +27,7 @@
#include <unicode/unistr.h>
#include <unicode/uvernum.h>
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/strings/grit/blink_strings.h"
#include "third_party/blink/renderer/bindings/core/v8/script_regexp.h"
#include "third_party/blink/renderer/core/frame/web_feature.h"
#include "third_party/blink/renderer/core/html/forms/html_input_element.h"
......@@ -212,14 +213,15 @@ bool EmailInputType::TypeMismatch() const {
String EmailInputType::TypeMismatchText() const {
String invalid_address = FindInvalidAddress(GetElement().value());
DCHECK(!invalid_address.IsNull());
if (invalid_address.IsEmpty())
if (invalid_address.IsEmpty()) {
return GetLocale().QueryString(
WebLocalizedString::kValidationTypeMismatchForEmailEmpty);
IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_EMPTY);
}
String at_sign = String("@");
wtf_size_t at_index = invalid_address.find('@');
if (at_index == kNotFound)
return GetLocale().QueryString(
WebLocalizedString::kValidationTypeMismatchForEmailNoAtSign, at_sign,
IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_NO_AT_SIGN, at_sign,
invalid_address);
// We check validity against an ASCII value because of difficulty to check
// invalid characters. However we should show Unicode value.
......@@ -228,38 +230,38 @@ String EmailInputType::TypeMismatchText() const {
String domain = invalid_address.Substring(at_index + 1);
if (local_part.IsEmpty())
return GetLocale().QueryString(
WebLocalizedString::kValidationTypeMismatchForEmailEmptyLocal, at_sign,
IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_EMPTY_LOCAL, at_sign,
unicode_address);
if (domain.IsEmpty())
return GetLocale().QueryString(
WebLocalizedString::kValidationTypeMismatchForEmailEmptyDomain, at_sign,
IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_EMPTY_DOMAIN, at_sign,
unicode_address);
wtf_size_t invalid_char_index = local_part.Find(IsInvalidLocalPartCharacter);
if (invalid_char_index != kNotFound) {
unsigned char_length = U_IS_LEAD(local_part[invalid_char_index]) ? 2 : 1;
return GetLocale().QueryString(
WebLocalizedString::kValidationTypeMismatchForEmailInvalidLocal,
at_sign, local_part.Substring(invalid_char_index, char_length));
IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_INVALID_LOCAL, at_sign,
local_part.Substring(invalid_char_index, char_length));
}
invalid_char_index = domain.Find(IsInvalidDomainCharacter);
if (invalid_char_index != kNotFound) {
unsigned char_length = U_IS_LEAD(domain[invalid_char_index]) ? 2 : 1;
return GetLocale().QueryString(
WebLocalizedString::kValidationTypeMismatchForEmailInvalidDomain,
at_sign, domain.Substring(invalid_char_index, char_length));
IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_INVALID_DOMAIN, at_sign,
domain.Substring(invalid_char_index, char_length));
}
if (!CheckValidDotUsage(domain)) {
wtf_size_t at_index_in_unicode = unicode_address.find('@');
DCHECK_NE(at_index_in_unicode, kNotFound);
return GetLocale().QueryString(
WebLocalizedString::kValidationTypeMismatchForEmailInvalidDots,
String("."), unicode_address.Substring(at_index_in_unicode + 1));
IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL_INVALID_DOTS, String("."),
unicode_address.Substring(at_index_in_unicode + 1));
}
if (GetElement().Multiple())
if (GetElement().Multiple()) {
return GetLocale().QueryString(
WebLocalizedString::kValidationTypeMismatchForMultipleEmail);
return GetLocale().QueryString(
WebLocalizedString::kValidationTypeMismatchForEmail);
IDS_FORM_VALIDATION_TYPE_MISMATCH_MULTIPLE_EMAIL);
}
return GetLocale().QueryString(IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL);
}
bool EmailInputType::SupportsSelectionAPI() const {
......
......@@ -378,7 +378,7 @@ bool InputType::StepMismatch(const String& value) const {
String InputType::BadInputText() const {
NOTREACHED();
return GetLocale().QueryString(WebLocalizedString::kValidationTypeMismatch);
return GetLocale().QueryString(IDS_FORM_VALIDATION_TYPE_MISMATCH);
}
String InputType::RangeOverflowText(const Decimal&) const {
......@@ -392,7 +392,7 @@ String InputType::RangeUnderflowText(const Decimal&) const {
}
String InputType::TypeMismatchText() const {
return GetLocale().QueryString(WebLocalizedString::kValidationTypeMismatch);
return GetLocale().QueryString(IDS_FORM_VALIDATION_TYPE_MISMATCH);
}
String InputType::ValueMissingText() const {
......
......@@ -30,6 +30,7 @@
#include "third_party/blink/renderer/core/html/forms/url_input_type.h"
#include "third_party/blink/public/strings/grit/blink_strings.h"
#include "third_party/blink/renderer/core/frame/web_feature.h"
#include "third_party/blink/renderer/core/html/forms/html_input_element.h"
#include "third_party/blink/renderer/core/html/parser/html_parser_idioms.h"
......@@ -55,8 +56,7 @@ bool URLInputType::TypeMismatch() const {
}
String URLInputType::TypeMismatchText() const {
return GetLocale().QueryString(
WebLocalizedString::kValidationTypeMismatchForURL);
return GetLocale().QueryString(IDS_FORM_VALIDATION_TYPE_MISMATCH_URL);
}
String URLInputType::SanitizeValue(const String& proposed_value) const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment