<input=file multiple> default text uses singular instead of plural
authorjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Nov 2011 18:35:42 +0000 (18:35 +0000)
committerjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Nov 2011 18:35:42 +0000 (18:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=71319
<rdar://problem/10379021>

Reviewed by Darin Adler.

Source/WebCore:

Added a new method to return the label text for a file upload control that
allows multiple files. Needed to extend the RenderTheme function to pass down
a boolean representing whether multiple files are allowed in the file list.

* English.lproj/Localizable.strings:
* html/FileInputType.cpp:
(WebCore::FileInputType::defaultToolTip):
* platform/DefaultLocalizationStrategy.cpp:
(WebCore::DefaultLocalizationStrategy::fileButtonNoFilesSelectedLabel):
* platform/DefaultLocalizationStrategy.h:
* platform/LocalizationStrategy.h:
* platform/LocalizedStrings.cpp:
(WebCore::fileButtonNoFilesSelectedLabel):
* platform/LocalizedStrings.h:
* platform/efl/LocalizedStringsEfl.cpp:
(WebCore::fileButtonNoFilesSelectedLabel):
* platform/gtk/LocalizedStringsGtk.cpp:
(WebCore::fileButtonNoFilesSelectedLabel):
* platform/gtk/RenderThemeGtk.cpp:
(WebCore::RenderThemeGtk::fileListNameForWidth):
* platform/gtk/RenderThemeGtk.h:
* platform/qt/RenderThemeQt.cpp:
(WebCore::RenderThemeQt::fileListNameForWidth):
* platform/qt/RenderThemeQt.h:
* platform/wx/LocalizedStringsWx.cpp:
(WebCore::fileButtonNoFilesSelectedLabel):
* rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::fileTextValue):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::fileListNameForWidth):
* rendering/RenderTheme.h:
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::fileListNameForWidth):

Source/WebKit/chromium:

* src/LocalizedStrings.cpp:
(WebCore::fileButtonNoFilesSelectedLabel):

Source/WebKit/qt:

* WebCoreSupport/WebPlatformStrategies.cpp:
(WebPlatformStrategies::fileButtonNoFilesSelectedLabel):
* WebCoreSupport/WebPlatformStrategies.h:

Source/WebKit/wince:

* WebCoreSupport/PlatformStrategiesWinCE.cpp:
(PlatformStrategiesWinCE::fileButtonNoFilesSelectedLabel):
* WebCoreSupport/PlatformStrategiesWinCE.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@99083 268f45cc-cd09-0410-ab3c-d52691b4dbfc

28 files changed:
Source/WebCore/ChangeLog
Source/WebCore/English.lproj/Localizable.strings
Source/WebCore/html/FileInputType.cpp
Source/WebCore/platform/DefaultLocalizationStrategy.cpp
Source/WebCore/platform/DefaultLocalizationStrategy.h
Source/WebCore/platform/LocalizationStrategy.h
Source/WebCore/platform/LocalizedStrings.cpp
Source/WebCore/platform/LocalizedStrings.h
Source/WebCore/platform/efl/LocalizedStringsEfl.cpp
Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp
Source/WebCore/platform/gtk/RenderThemeGtk.cpp
Source/WebCore/platform/gtk/RenderThemeGtk.h
Source/WebCore/platform/qt/RenderThemeQt.cpp
Source/WebCore/platform/qt/RenderThemeQt.h
Source/WebCore/platform/wx/LocalizedStringsWx.cpp
Source/WebCore/rendering/RenderFileUploadControl.cpp
Source/WebCore/rendering/RenderTheme.cpp
Source/WebCore/rendering/RenderTheme.h
Source/WebCore/rendering/RenderThemeMac.h
Source/WebCore/rendering/RenderThemeMac.mm
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/LocalizedStrings.cpp
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp
Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h
Source/WebKit/wince/ChangeLog
Source/WebKit/wince/WebCoreSupport/PlatformStrategiesWinCE.cpp
Source/WebKit/wince/WebCoreSupport/PlatformStrategiesWinCE.h

index cdb9446..49f28ce 100644 (file)
@@ -1,3 +1,46 @@
+2011-11-02  Jon Lee  <jonlee@apple.com>
+
+        <input=file multiple> default text uses singular instead of plural
+        https://bugs.webkit.org/show_bug.cgi?id=71319
+        <rdar://problem/10379021>
+
+        Reviewed by Darin Adler.
+
+        Added a new method to return the label text for a file upload control that
+        allows multiple files. Needed to extend the RenderTheme function to pass down
+        a boolean representing whether multiple files are allowed in the file list.
+
+        * English.lproj/Localizable.strings:
+        * html/FileInputType.cpp:
+        (WebCore::FileInputType::defaultToolTip):
+        * platform/DefaultLocalizationStrategy.cpp:
+        (WebCore::DefaultLocalizationStrategy::fileButtonNoFilesSelectedLabel):
+        * platform/DefaultLocalizationStrategy.h:
+        * platform/LocalizationStrategy.h:
+        * platform/LocalizedStrings.cpp:
+        (WebCore::fileButtonNoFilesSelectedLabel):
+        * platform/LocalizedStrings.h:
+        * platform/efl/LocalizedStringsEfl.cpp:
+        (WebCore::fileButtonNoFilesSelectedLabel):
+        * platform/gtk/LocalizedStringsGtk.cpp:
+        (WebCore::fileButtonNoFilesSelectedLabel):
+        * platform/gtk/RenderThemeGtk.cpp:
+        (WebCore::RenderThemeGtk::fileListNameForWidth):
+        * platform/gtk/RenderThemeGtk.h:
+        * platform/qt/RenderThemeQt.cpp:
+        (WebCore::RenderThemeQt::fileListNameForWidth):
+        * platform/qt/RenderThemeQt.h:
+        * platform/wx/LocalizedStringsWx.cpp:
+        (WebCore::fileButtonNoFilesSelectedLabel):
+        * rendering/RenderFileUploadControl.cpp:
+        (WebCore::RenderFileUploadControl::fileTextValue):
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::fileListNameForWidth):
+        * rendering/RenderTheme.h:
+        * rendering/RenderThemeMac.h:
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::fileListNameForWidth):
+
 2011-11-02  Andras Becsi  <andras.becsi@nokia.com>
 
         [Qt] Fix the build with NO_LISTBOX_RENDERING
index 8155ee9..245dacb 100644 (file)
Binary files a/Source/WebCore/English.lproj/Localizable.strings and b/Source/WebCore/English.lproj/Localizable.strings differ
index 6234206..655e81e 100644 (file)
@@ -373,8 +373,11 @@ String FileInputType::defaultToolTip() const
 {
     FileList* fileList = m_fileList.get();
     unsigned listSize = fileList->length();
-    if (!listSize)
+    if (!listSize) {
+        if (element()->multiple())
+            return fileButtonNoFilesSelectedLabel();
         return fileButtonNoFileSelectedLabel();
+    }
 
     StringBuilder names;
     for (size_t i = 0; i < listSize; ++i) {
index adc809f..e453323 100644 (file)
@@ -136,6 +136,11 @@ String DefaultLocalizationStrategy::fileButtonNoFileSelectedLabel()
     return WEB_UI_STRING("no file selected", "text to display in file button used in HTML forms when no file is selected");
 }
 
+String DefaultLocalizationStrategy::fileButtonNoFilesSelectedLabel()
+{
+    return WEB_UI_STRING("no files selected", "text to display in file button used in HTML forms when no files are selected and the button allows multiple files to be selected");
+}
+
 String DefaultLocalizationStrategy::defaultDetailsSummaryText()
 {
     return WEB_UI_STRING("Details", "text to display in <details> tag when it has no <summary> child");
index f11ce99..0900f46 100644 (file)
@@ -46,6 +46,7 @@ public:
     virtual String fileButtonChooseFileLabel();
     virtual String fileButtonChooseMultipleFilesLabel();
     virtual String fileButtonNoFileSelectedLabel();
+    virtual String fileButtonNoFilesSelectedLabel();
     virtual String defaultDetailsSummaryText();
 #if PLATFORM(MAC)
     virtual String copyImageUnknownFileLabel();
index b2eab17..3d1a2b8 100644 (file)
@@ -44,6 +44,7 @@ public:
     virtual String fileButtonChooseFileLabel() = 0;
     virtual String fileButtonChooseMultipleFilesLabel() = 0;
     virtual String fileButtonNoFileSelectedLabel() = 0;
+    virtual String fileButtonNoFilesSelectedLabel() = 0;
     virtual String defaultDetailsSummaryText() = 0;
 
 #if PLATFORM(MAC)
index a95cfff..a6a41ac 100644 (file)
@@ -79,6 +79,11 @@ String fileButtonNoFileSelectedLabel()
     return localizationStrategy()->fileButtonNoFileSelectedLabel();
 }
 
+String fileButtonNoFilesSelectedLabel()
+{
+    return localizationStrategy()->fileButtonNoFilesSelectedLabel();
+}
+
 String defaultDetailsSummaryText()
 {
     return localizationStrategy()->defaultDetailsSummaryText();
index 3293da4..c49ad91 100644 (file)
@@ -40,6 +40,7 @@ namespace WebCore {
     String fileButtonChooseFileLabel();
     String fileButtonChooseMultipleFilesLabel();
     String fileButtonNoFileSelectedLabel();
+    String fileButtonNoFilesSelectedLabel();
     String defaultDetailsSummaryText();
 
 #if PLATFORM(MAC)
index 3000f02..ae530c1 100644 (file)
@@ -78,6 +78,11 @@ String fileButtonNoFileSelectedLabel()
     return String::fromUTF8("No file selected");
 }
 
+String fileButtonNoFilesSelectedLabel()
+{
+    return String::fromUTF8("No files selected");
+}
+
 String contextMenuItemTagOpenLinkInNewWindow()
 {
     return String::fromUTF8("Open Link in New Window");
index 64697b7..07bed8d 100644 (file)
@@ -91,6 +91,11 @@ String fileButtonNoFileSelectedLabel()
     return String::fromUTF8(_("(None)"));
 }
 
+String fileButtonNoFilesSelectedLabel()
+{
+    return String::fromUTF8(_("(None)"));
+}
+
 String contextMenuItemTagOpenLinkInNewWindow()
 {
     return String::fromUTF8(_("Open Link in New _Window"));
index 5d70b2a..ae7ecdc 100644 (file)
@@ -700,12 +700,14 @@ static bool stringByAdoptingFileSystemRepresentation(gchar* systemFilename, Stri
     return true;
 }
 
-String RenderThemeGtk::fileListNameForWidth(const Vector<String>& filenames, const Font& font, int width)
+String RenderThemeGtk::fileListNameForWidth(const Vector<String>& filenames, const Font& font, int width, bool multipleFilesAllowed)
 {
     if (width <= 0)
         return String();
 
     String string = fileButtonNoFileSelectedLabel();
+    if (multipleFilesAllowed)
+        string = fileButtonNoFilesSelectedLabel();
 
     if (filenames.size() == 1) {
         CString systemFilename = fileSystemRepresentation(filenames[0]);
index dd4e3a3..408b05f 100644 (file)
@@ -179,7 +179,7 @@ protected:
     virtual bool paintInnerSpinButton(RenderObject*, const PaintInfo&, const IntRect&);
 
 private:
-    virtual String fileListNameForWidth(const Vector<String>& filenames, const Font&, int width);
+    virtual String fileListNameForWidth(const Vector<String>& filenames, const Font&, int width, bool multipleFilesAllowed);
 
     void platformInit();
     static void setTextInputBorders(RenderStyle*);
index 88d349b..c0e8ac7 100644 (file)
@@ -1570,14 +1570,18 @@ double RenderThemeQt::caretBlinkInterval() const
     return  QApplication::cursorFlashTime() / 1000.0 / 2.0;
 }
 
-String RenderThemeQt::fileListNameForWidth(const Vector<String>& filenames, const Font& font, int width)
+String RenderThemeQt::fileListNameForWidth(const Vector<String>& filenames, const Font& font, int width, bool multipleFilesAllowed)
 {
     if (width <= 0)
         return String();
 
     String string;
-    if (filenames.isEmpty())
-        string = fileButtonNoFileSelectedLabel();
+    if (filenames.isEmpty()) {
+        if (multipleFilesAllowed)
+            string = fileButtonNoFilesSelectedLabel();
+        else
+            string = fileButtonNoFileSelectedLabel();
+    }
     else if (filenames.size() == 1) {
         String fname = filenames[0];
         QFontMetrics fm(font.font());
index 2bc3184..7c7e66f 100644 (file)
@@ -173,7 +173,7 @@ private:
     void computeSizeBasedOnStyle(RenderStyle* renderStyle) const;
 
 private:
-    virtual String fileListNameForWidth(const Vector<String>& filenames, const Font&, int width);
+    virtual String fileListNameForWidth(const Vector<String>& filenames, const Font&, int width, bool multipleFilesAllowed);
 
     bool supportsFocus(ControlPart) const;
 
index e1ad2dc..4d1e197 100644 (file)
@@ -77,6 +77,11 @@ String fileButtonNoFileSelectedLabel()
     return String("No file selected"); 
 }
 
+String fileButtonNoFilesSelectedLabel() 
+{ 
+    return String("No files selected"); 
+}
+
 String contextMenuItemTagOpenLinkInNewWindow() 
 { 
     return String("Open Link in New Window"); 
index 85b94d6..6f6576d 100644 (file)
@@ -228,7 +228,7 @@ String RenderFileUploadControl::fileTextValue() const
 {
     HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
     ASSERT(input->files());
-    return theme()->fileListNameForWidth(input->files()->paths(), style()->font(), maxFilenameWidth());
+    return theme()->fileListNameForWidth(input->files()->paths(), style()->font(), maxFilenameWidth(), input->multiple());
 }
     
 } // namespace WebCore
index 0a2ff4d..4ef9536 100644 (file)
@@ -1101,14 +1101,18 @@ Color RenderTheme::focusRingColor()
     return customFocusRingColor().isValid() ? customFocusRingColor() : defaultTheme()->platformFocusRingColor();
 }
 
-String RenderTheme::fileListNameForWidth(const Vector<String>& filenames, const Font& font, int width)
+String RenderTheme::fileListNameForWidth(const Vector<String>& filenames, const Font& font, int width, bool multipleFilesAllowed)
 {
     if (width <= 0)
         return String();
 
     String string;
-    if (filenames.isEmpty())
-        string = fileButtonNoFileSelectedLabel();
+    if (filenames.isEmpty()) {
+        if (multipleFilesAllowed)
+            string = fileButtonNoFilesSelectedLabel();
+        else
+            string = fileButtonNoFileSelectedLabel();
+    }
     else if (filenames.size() == 1)
         string = pathGetFileName(filenames[0]);
     else
index 3ce2ab2..43aec23 100644 (file)
@@ -207,7 +207,7 @@ public:
     virtual bool shouldShowPlaceholderWhenFocused() const { return false; }
     virtual bool shouldHaveSpinButton(HTMLInputElement*) const;
 
-    virtual String fileListNameForWidth(const Vector<String>& filenames, const Font&, int width);
+    virtual String fileListNameForWidth(const Vector<String>& filenames, const Font&, int width, bool multipleFilesAllowed);
 
 protected:
     // The platform selection color.
index 2d72b81..c87ddec 100644 (file)
@@ -177,7 +177,7 @@ protected:
     virtual bool shouldShowPlaceholderWhenFocused() const;
 
 private:
-    virtual String fileListNameForWidth(const Vector<String>& filenames, const Font&, int width);
+    virtual String fileListNameForWidth(const Vector<String>& filenames, const Font&, int width, bool multipleFilesAllowed);
 
     IntRect inflateRect(const IntRect&, const IntSize&, const int* margins, float zoomLevel = 1.0f) const;
 
index 1d52b8a..9928e18 100644 (file)
@@ -2085,14 +2085,18 @@ NSSliderCell* RenderThemeMac::sliderThumbVertical() const
     return m_sliderThumbVertical.get();
 }
 
-String RenderThemeMac::fileListNameForWidth(const Vector<String>& filenames, const Font& font, int width)
+String RenderThemeMac::fileListNameForWidth(const Vector<String>& filenames, const Font& font, int width, bool multipleFilesAllowed)
 {
     if (width <= 0)
         return String();
 
     String strToTruncate;
-    if (filenames.isEmpty())
-        strToTruncate = fileButtonNoFileSelectedLabel();
+    if (filenames.isEmpty()) {
+        if (multipleFilesAllowed)
+            strToTruncate = fileButtonNoFilesSelectedLabel();
+        else
+            strToTruncate = fileButtonNoFileSelectedLabel();
+    }
     else if (filenames.size() == 1)
         strToTruncate = [[NSFileManager defaultManager] displayNameAtPath:(filenames[0])];
     else
index f0fbfaf..5670aab 100644 (file)
@@ -1,3 +1,14 @@
+2011-11-02  Jon Lee  <jonlee@apple.com>
+
+        <input=file multiple> default text uses singular instead of plural
+        https://bugs.webkit.org/show_bug.cgi?id=71319
+        <rdar://problem/10379021>
+
+        Reviewed by Darin Adler.
+
+        * src/LocalizedStrings.cpp:
+        (WebCore::fileButtonNoFilesSelectedLabel):
+
 2011-11-02  Andrey Kosyakov  <caseq@chromium.org>
 
         Unreviewed fix for build failure on chromium shared linux caused by r99020.
index 3d547eb..c304efb 100644 (file)
@@ -102,6 +102,11 @@ String fileButtonNoFileSelectedLabel()
     return query(WebLocalizedString::FileButtonNoFileSelectedLabel);
 }
 
+String fileButtonNoFilesSelectedLabel()
+{
+    return query(WebLocalizedString::FileButtonNoFileSelectedLabel);
+}
+
 String searchMenuNoRecentSearchesText()
 {
     return query(WebLocalizedString::SearchMenuNoRecentSearchesText);
index 83570a7..67fff30 100644 (file)
@@ -1,3 +1,15 @@
+2011-11-02  Jon Lee  <jonlee@apple.com>
+
+        <input=file multiple> default text uses singular instead of plural
+        https://bugs.webkit.org/show_bug.cgi?id=71319
+        <rdar://problem/10379021>
+
+        Reviewed by Darin Adler.
+
+        * WebCoreSupport/WebPlatformStrategies.cpp:
+        (WebPlatformStrategies::fileButtonNoFilesSelectedLabel):
+        * WebCoreSupport/WebPlatformStrategies.h:
+
 2011-11-02  Deepak Sherveghar  <bpwv64@motorola.com>
 
         [Qt] Failing test media/video-document-types.html
index a775f31..563bd60 100644 (file)
@@ -183,6 +183,11 @@ String WebPlatformStrategies::fileButtonNoFileSelectedLabel()
     return QCoreApplication::translate("QWebPage", "No file selected", "text to display in file button used in HTML forms when no file is selected");
 }
 
+String WebPlatformStrategies::fileButtonNoFilesSelectedLabel()
+{
+    return QCoreApplication::translate("QWebPage", "No files selected", "text to display in file button used in HTML forms when no files are selected and the button allows multiple files to be selected");
+}
+
 String WebPlatformStrategies::defaultDetailsSummaryText()
 {
     return QCoreApplication::translate("QWebPage", "Details", "text to display in <details> tag when it has no <summary> child");
index 9315291..cd4d518 100644 (file)
@@ -66,6 +66,7 @@ private:
     virtual WTF::String fileButtonChooseFileLabel();
     virtual WTF::String fileButtonChooseMultipleFilesLabel();
     virtual WTF::String fileButtonNoFileSelectedLabel();
+    virtual WTF::String fileButtonNoFilesSelectedLabel();
     virtual WTF::String defaultDetailsSummaryText();
     virtual WTF::String contextMenuItemTagOpenLinkInNewWindow();
     virtual WTF::String contextMenuItemTagDownloadLinkToDisk();
index c805568..d0ad0fe 100644 (file)
@@ -1,3 +1,15 @@
+2011-11-02  Jon Lee  <jonlee@apple.com>
+
+        <input=file multiple> default text uses singular instead of plural
+        https://bugs.webkit.org/show_bug.cgi?id=71319
+        <rdar://problem/10379021>
+
+        Reviewed by Darin Adler.
+
+        * WebCoreSupport/PlatformStrategiesWinCE.cpp:
+        (PlatformStrategiesWinCE::fileButtonNoFilesSelectedLabel):
+        * WebCoreSupport/PlatformStrategiesWinCE.h:
+
 2011-10-28  Jochen Eisinger  <jochen@chromium.org>
 
         Rename a number of methods mentioning JavaScript to just Script instead
index 0390e2f..93adffe 100644 (file)
@@ -149,6 +149,11 @@ String PlatformStrategiesWinCE::fileButtonNoFileSelectedLabel()
     return UI_STRING("no file selected", "text to display in file button used in HTML forms when no file is selected");
 }
 
+String PlatformStrategiesWinCE::fileButtonNoFilesSelectedLabel()
+{
+    return UI_STRING("no files selected", "text to display in file button used in HTML forms when no files are selected and the button allows multiple files to be selected");
+}
+
 String PlatformStrategiesWinCE::defaultDetailsSummaryText()
 {
     return UI_STRING("Details", "text to display in <details> tag when it has no <summary> child");
index 2f05245..bbaf07b 100644 (file)
@@ -59,6 +59,7 @@ private:
     virtual WTF::String fileButtonChooseFileLabel();
     virtual WTF::String fileButtonChooseMultipleFilesLabel();
     virtual WTF::String fileButtonNoFileSelectedLabel();
+    virtual WTF::String fileButtonNoFilesSelectedLabel();
     virtual WTF::String defaultDetailsSummaryText();
 #if ENABLE(CONTEXT_MENUS)
     virtual WTF::String contextMenuItemTagOpenLinkInNewWindow();