summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-05-18 16:16:01 +0100
committerBen Murdoch <benm@google.com>2010-05-21 10:18:19 +0100
commitb28fa785df693bd46895ae9900810daf38c24bfa (patch)
tree4d91d4376f43db186a0b0c9f6b5b7b3198583e51
parentbdd6b8c62ee90e4130018ec1c58f350fe4021999 (diff)
downloadexternal_webkit-b28fa785df693bd46895ae9900810daf38c24bfa.zip
external_webkit-b28fa785df693bd46895ae9900810daf38c24bfa.tar.gz
external_webkit-b28fa785df693bd46895ae9900810daf38c24bfa.tar.bz2
Provide a string for the case where a file upload control has not had a file attached to it.
Requires a frameworks/base change. Change-Id: Ia50d4b8cceb943166198888dad364b09a2dc06a1
-rw-r--r--WebCore/platform/android/FileChooserAndroid.cpp6
-rw-r--r--WebCore/platform/android/LocalizedStringsAndroid.cpp4
-rw-r--r--WebCore/platform/android/PlatformBridge.h3
-rw-r--r--WebKit/android/jni/WebCoreFrameBridge.cpp9
4 files changed, 16 insertions, 6 deletions
diff --git a/WebCore/platform/android/FileChooserAndroid.cpp b/WebCore/platform/android/FileChooserAndroid.cpp
index 9e50e67..f2ad3b9 100644
--- a/WebCore/platform/android/FileChooserAndroid.cpp
+++ b/WebCore/platform/android/FileChooserAndroid.cpp
@@ -27,6 +27,7 @@
#include "FileChooser.h"
#include "FileSystem.h"
#include "Font.h"
+#include "LocalizedStrings.h"
#include "StringTruncator.h"
namespace WebCore {
@@ -34,9 +35,10 @@ namespace WebCore {
String FileChooser::basenameForWidth(const Font& font, int width) const
{
if (!m_filenames.size())
- return String();
+ return fileButtonNoFileSelectedLabel();
+
String output = pathGetFileName(m_filenames[0]);
- return StringTruncator::rightTruncate(output, static_cast<float>(width), font, false);
+ return StringTruncator::centerTruncate(output, static_cast<float>(width), font, false);
}
} // namespace WebCore
diff --git a/WebCore/platform/android/LocalizedStringsAndroid.cpp b/WebCore/platform/android/LocalizedStringsAndroid.cpp
index e0db88d..5ca7fa2 100644
--- a/WebCore/platform/android/LocalizedStringsAndroid.cpp
+++ b/WebCore/platform/android/LocalizedStringsAndroid.cpp
@@ -48,8 +48,8 @@ String fileButtonChooseFileLabel()
String fileButtonNoFileSelectedLabel()
{
- notImplemented();
- return String();
+ return *(PlatformBridge::globalLocalizedName(
+ PlatformBridge::FileUploadNoFileChosenLabel));
}
String contextMenuItemTagInspectElement()
diff --git a/WebCore/platform/android/PlatformBridge.h b/WebCore/platform/android/PlatformBridge.h
index cdd22f3..33f8697 100644
--- a/WebCore/platform/android/PlatformBridge.h
+++ b/WebCore/platform/android/PlatformBridge.h
@@ -119,7 +119,8 @@ public:
DrawableDir,
FileUploadLabel,
ResetLabel,
- SubmitLabel
+ SubmitLabel,
+ FileUploadNoFileChosenLabel
};
static String* globalLocalizedName(rawResId resId);
diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp
index d1efe07..de172cd 100644
--- a/WebKit/android/jni/WebCoreFrameBridge.cpp
+++ b/WebKit/android/jni/WebCoreFrameBridge.cpp
@@ -116,6 +116,7 @@ using namespace JSC::Bindings;
static String* gUploadFileLabel;
static String* gResetLabel;
static String* gSubmitLabel;
+static String* gNoFileChosenLabel;
String* WebCore::PlatformBridge::globalLocalizedName(
WebCore::PlatformBridge::rawResId resId)
@@ -127,6 +128,9 @@ String* WebCore::PlatformBridge::globalLocalizedName(
return gResetLabel;
case WebCore::PlatformBridge::SubmitLabel:
return gSubmitLabel;
+ case WebCore::PlatformBridge::FileUploadNoFileChosenLabel:
+ return gNoFileChosenLabel;
+
default:
return 0;
}
@@ -148,6 +152,9 @@ void initGlobalLocalizedName(WebCore::PlatformBridge::rawResId resId,
case WebCore::PlatformBridge::SubmitLabel:
pointer = &gSubmitLabel;
break;
+ case WebCore::PlatformBridge::FileUploadNoFileChosenLabel:
+ pointer = &gNoFileChosenLabel;
+ break;
default:
return;
}
@@ -927,7 +934,7 @@ static void CreateFrame(JNIEnv* env, jobject obj, jobject javaview, jobject jAss
WebCore::RenderSkinAndroid::Init(am, directory);
}
for (int i = WebCore::PlatformBridge::FileUploadLabel;
- i <= WebCore::PlatformBridge::SubmitLabel; i++)
+ i <= WebCore::PlatformBridge::FileUploadNoFileChosenLabel; i++)
initGlobalLocalizedName(
static_cast<WebCore::PlatformBridge::rawResId>(i), webFrame);
}