[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da
darin at apple.com
darin at apple.com
Wed Dec 22 18:47:48 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 266c65790ecad975ce99ee268822d4120f3c2b16
Author: darin at apple.com <darin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Dec 18 01:42:54 2010 +0000
2010-12-17 Darin Adler <darin at apple.com>
Reviewed by Dan Bernstein.
Window title for image documents shows corrupted characters instead of multiplication sign when using WebKit2
https://bugs.webkit.org/show_bug.cgi?id=43505
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: Changed UI_STRING macros to return
WebCore::String objects instead of C strings.
(WebKit::formatLocalizedString): Added. Uses the Core Foundation string formatting function for
reasons explained in the comment.
(WebKit::WebPlatformStrategies::multipleFileUploadText): Use formatLocalizedString instead of
String::format.
(WebKit::WebPlatformStrategies::imageTitle): Ditto.
(WebKit::WebPlatformStrategies::localizedMediaTimeDescription): Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74306 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 1ec2bd4..f76b22e 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,19 @@
+2010-12-17 Darin Adler <darin at apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Window title for image documents shows corrupted characters instead of multiplication sign when using WebKit2
+ https://bugs.webkit.org/show_bug.cgi?id=43505
+
+ * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: Changed UI_STRING macros to return
+ WebCore::String objects instead of C strings.
+ (WebKit::formatLocalizedString): Added. Uses the Core Foundation string formatting function for
+ reasons explained in the comment.
+ (WebKit::WebPlatformStrategies::multipleFileUploadText): Use formatLocalizedString instead of
+ String::format.
+ (WebKit::WebPlatformStrategies::imageTitle): Ditto.
+ (WebKit::WebPlatformStrategies::localizedMediaTimeDescription): Ditto.
+
2010-12-17 Anders Carlsson <andersca at apple.com>
Reviewed by Sam Weinig.
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp b/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
index 6c6af37..81069e3 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
@@ -38,13 +38,31 @@
#include <wtf/text/CString.h>
// FIXME: Implement localization.
-#define UI_STRING(string, description) string
-#define UI_STRING_KEY(string, key, description) string
+#define UI_STRING(string, description) String::fromUTF8(string, strlen(string))
+#define UI_STRING_KEY(string, key, description) String::fromUTF8(string, strlen(string))
using namespace WebCore;
namespace WebKit {
+// We can't use String::format for two reasons:
+// 1) It doesn't handle non-ASCII characters in the format string.
+// 2) It doesn't handle the %2$d syntax.
+static String formatLocalizedString(const String& format, ...)
+{
+#if PLATFORM(CF)
+ va_list arguments;
+ va_start(arguments, format);
+ RetainPtr<CFStringRef> formatCFString(AdoptCF, format.createCFString());
+ RetainPtr<CFStringRef> result(AdoptCF, CFStringCreateWithFormatAndArguments(0, 0, formatCFString.get(), arguments));
+ va_end(arguments);
+ return result.get();
+#else
+ notImplemented();
+ return format;
+#endif
+}
+
void WebPlatformStrategies::initialize()
{
DEFINE_STATIC_LOCAL(WebPlatformStrategies, platformStrategies, ());
@@ -679,7 +697,7 @@ String WebPlatformStrategies::crashedPluginText()
String WebPlatformStrategies::multipleFileUploadText(unsigned numberOfFiles)
{
- return String::format(UI_STRING("%d files", "Label to describe the number of files selected in a file upload control that allows multiple files"), numberOfFiles);
+ return formatLocalizedString(UI_STRING("%d files", "Label to describe the number of files selected in a file upload control that allows multiple files"), numberOfFiles);
}
String WebPlatformStrategies::unknownFileSizeText()
@@ -705,7 +723,8 @@ String WebPlatformStrategies::allFilesText()
String WebPlatformStrategies::imageTitle(const String& filename, const IntSize& size)
{
- return String::format(UI_STRING("%s %d×%d pixels", "window title for a standalone image (uses multiplication symbol, not x)"), filename.utf8().data(), size.width(), size.height());
+ // FIXME: It would be nice to have the filename inside the format string, but it's not easy to do that in a way that works with non-ASCII characters in the filename.
+ return filename + formatLocalizedString(UI_STRING(" %d×%d pixels", "window title suffix for a standalone image (uses multiplication symbol, not x)"), size.width(), size.height());
}
String WebPlatformStrategies::mediaElementLoadingStateText()
@@ -820,12 +839,12 @@ String WebPlatformStrategies::localizedMediaTimeDescription(float time)
seconds %= 60;
if (days)
- return String::format(UI_STRING("%1$d days %2$d hours %3$d minutes %4$d seconds", "accessibility help text for media controller time value >= 1 day"), days, hours, minutes, seconds);
+ return formatLocalizedString(UI_STRING("%1$d days %2$d hours %3$d minutes %4$d seconds", "accessibility help text for media controller time value >= 1 day"), days, hours, minutes, seconds);
if (hours)
- return String::format(UI_STRING("%1$d hours %2$d minutes %3$d seconds", "accessibility help text for media controller time value >= 60 minutes"), hours, minutes, seconds);
+ return formatLocalizedString(UI_STRING("%1$d hours %2$d minutes %3$d seconds", "accessibility help text for media controller time value >= 60 minutes"), hours, minutes, seconds);
if (minutes)
- return String::format(UI_STRING("%1$d minutes %2$d seconds", "accessibility help text for media controller time value >= 60 seconds"), minutes, seconds);
- return String::format(UI_STRING("%1$d seconds", "accessibility help text for media controller time value < 60 seconds"), seconds);
+ return formatLocalizedString(UI_STRING("%1$d minutes %2$d seconds", "accessibility help text for media controller time value >= 60 seconds"), minutes, seconds);
+ return formatLocalizedString(UI_STRING("%1$d seconds", "accessibility help text for media controller time value < 60 seconds"), seconds);
}
String WebPlatformStrategies::validationMessageValueMissingText()
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list