summaryrefslogtreecommitdiffstats
path: root/webkit/support
diff options
context:
space:
mode:
authortkent@chromium.org <tkent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-25 05:37:37 +0000
committertkent@chromium.org <tkent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-25 05:37:37 +0000
commit8ef5716c097776a9ae5c93e895c0effe7695a985 (patch)
tree197a96d2fdcf0ffcd0e90f205222b877b14506e5 /webkit/support
parent7fb865207d11400bc69b15fef20c5e4826c221c2 (diff)
downloadchromium_src-8ef5716c097776a9ae5c93e895c0effe7695a985.zip
chromium_src-8ef5716c097776a9ae5c93e895c0effe7695a985.tar.gz
chromium_src-8ef5716c097776a9ae5c93e895c0effe7695a985.tar.bz2
Add form validation message strings.
* webkit/glue/ - Add overloads of queryLocalizedString() functions They will be added to WebKit::WebKitClient later. - Add implementations for WebLocalizedString::Validation* - Add message strings The English strings are different from WebKit's to avoid the brusque WebKit's strings. Port some messages from Mozilla. * webkit/tools/test_shell/ and webkit/support/ Hook queryLocalizedString() functions in order to return messages same as WebKit in layout test. BUG=28264 TEST=LayoutTests/fast/forms/validationMessage.html Review URL: http://codereview.chromium.org/4678006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67382 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/support')
-rw-r--r--webkit/support/test_webkit_client.cc52
-rw-r--r--webkit/support/test_webkit_client.h7
2 files changed, 59 insertions, 0 deletions
diff --git a/webkit/support/test_webkit_client.cc b/webkit/support/test_webkit_client.cc
index 5c46cf8..e45c263 100644
--- a/webkit/support/test_webkit_client.cc
+++ b/webkit/support/test_webkit_client.cc
@@ -247,6 +247,58 @@ WebKit::WebData TestWebKitClient::loadResource(const char* name) {
return webkit_glue::WebKitClientImpl::loadResource(name);
}
+WebKit::WebString TestWebKitClient::queryLocalizedString(
+ WebKit::WebLocalizedString::Name name) {
+ // Returns messages same as WebKit's in DRT.
+ // We use different strings for form validation messages.
+ switch (name) {
+ case WebKit::WebLocalizedString::ValidationValueMissing:
+ case WebKit::WebLocalizedString::ValidationValueMissingForCheckbox:
+ case WebKit::WebLocalizedString::ValidationValueMissingForFile:
+ case WebKit::WebLocalizedString::ValidationValueMissingForMultipleFile:
+ case WebKit::WebLocalizedString::ValidationValueMissingForRadio:
+ case WebKit::WebLocalizedString::ValidationValueMissingForSelect:
+ return ASCIIToUTF16("value missing");
+ case WebKit::WebLocalizedString::ValidationTypeMismatch:
+ case WebKit::WebLocalizedString::ValidationTypeMismatchForEmail:
+ case WebKit::WebLocalizedString::ValidationTypeMismatchForMultipleEmail:
+ case WebKit::WebLocalizedString::ValidationTypeMismatchForURL:
+ return ASCIIToUTF16("type mismatch");
+ case WebKit::WebLocalizedString::ValidationPatternMismatch:
+ return ASCIIToUTF16("pattern mismatch");
+ case WebKit::WebLocalizedString::ValidationTooLong:
+ return ASCIIToUTF16("too long");
+ case WebKit::WebLocalizedString::ValidationRangeUnderflow:
+ return ASCIIToUTF16("range underflow");
+ case WebKit::WebLocalizedString::ValidationRangeOverflow:
+ return ASCIIToUTF16("range overflow");
+ case WebKit::WebLocalizedString::ValidationStepMismatch:
+ return ASCIIToUTF16("step mismatch");
+ default:
+ return WebKitClientImpl::queryLocalizedString(name);
+ }
+}
+
+WebKit::WebString TestWebKitClient::queryLocalizedString(
+ WebKit::WebLocalizedString::Name name, const WebKit::WebString& value) {
+ if (name == WebKit::WebLocalizedString::ValidationRangeUnderflow)
+ return ASCIIToUTF16("range underflow");
+ if (name == WebKit::WebLocalizedString::ValidationRangeOverflow)
+ return ASCIIToUTF16("range overflow");
+ return WebKitClientImpl::queryLocalizedString(name, value);
+}
+
+WebKit::WebString TestWebKitClient::queryLocalizedString(
+ WebKit::WebLocalizedString::Name name,
+ const WebKit::WebString& value1,
+ const WebKit::WebString& value2) {
+ if (name == WebKit::WebLocalizedString::ValidationTooLong)
+ return ASCIIToUTF16("too long");
+ if (name == WebKit::WebLocalizedString::ValidationStepMismatch)
+ return ASCIIToUTF16("step mismatch");
+ return WebKitClientImpl::queryLocalizedString(name, value1, value2);
+}
+
WebKit::WebString TestWebKitClient::defaultLocale() {
return ASCIIToUTF16("en-US");
}
diff --git a/webkit/support/test_webkit_client.h b/webkit/support/test_webkit_client.h
index 6f1d28d..07beae7 100644
--- a/webkit/support/test_webkit_client.h
+++ b/webkit/support/test_webkit_client.h
@@ -47,6 +47,13 @@ class TestWebKitClient : public webkit_glue::WebKitClientImpl {
virtual void prefetchHostName(const WebKit::WebString&);
virtual WebKit::WebURLLoader* createURLLoader();
virtual WebKit::WebData loadResource(const char* name);
+ virtual WebKit::WebString queryLocalizedString(
+ WebKit::WebLocalizedString::Name name);
+ virtual WebKit::WebString queryLocalizedString(
+ WebKit::WebLocalizedString::Name name, const WebKit::WebString& value);
+ virtual WebKit::WebString queryLocalizedString(
+ WebKit::WebLocalizedString::Name name,
+ const WebKit::WebString& value1, const WebKit::WebString& value2);
virtual WebKit::WebString defaultLocale();
virtual WebKit::WebStorageNamespace* createLocalStorageNamespace(
const WebKit::WebString& path, unsigned quota);