Diff
Modified: trunk/LayoutTests/ChangeLog (90100 => 90101)
--- trunk/LayoutTests/ChangeLog 2011-06-30 09:31:01 UTC (rev 90100)
+++ trunk/LayoutTests/ChangeLog 2011-06-30 10:40:32 UTC (rev 90101)
@@ -1,3 +1,23 @@
+2011-06-30 Kentaro Hara <[email protected]>
+
+ Reviewed by Kent Tamura.
+
+ Change the label of an HTML5 file chooser button to "Choose Files"
+ https://bugs.webkit.org/show_bug.cgi?id=49245
+
+ We should notify capability of multiple files to users.
+ input-file-label.html is a test that checks a label of the file chooser
+ with/without 'multiple' attribute. input-file-label.html will fail in Chromium
+ until a planned Chromium patch is landed. input-file-re-render.html will
+ also fail in Chromium, gtk and MacLeopard until we update the expected images
+ for the test.
+
+ * fast/forms/input-file-label-expected.txt: Added.
+ * fast/forms/input-file-label.html: Added.
+ * platform/chromium/test_expectations.txt:
+ * platform/mac/fast/forms/input-file-re-render-expected.png:
+ * platform/mac/fast/forms/input-file-re-render-expected.txt:
+
2011-06-30 Yuta Kitamura <[email protected]>
Reviewed by Kent Tamura.
Added: trunk/LayoutTests/fast/forms/input-file-label-expected.txt (0 => 90101)
--- trunk/LayoutTests/fast/forms/input-file-label-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/forms/input-file-label-expected.txt 2011-06-30 10:40:32 UTC (rev 90101)
@@ -0,0 +1,12 @@
+
+This tests the label of a file chooser button.
+
+PASS The label of a single file chooser button is "Choose File".
+PASS The label of a multiple file chooser button is "Choose Files".
+PASS Initially, the label of a file chooser button is "Choose File".
+PASS Set "multiple" attribute, then the label of the file chooser button becomes "Choose Files".
+PASS Unset "multiple" attribute, then the label of the file chooser button becomes "Choose File".
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/forms/input-file-label.html (0 => 90101)
--- trunk/LayoutTests/fast/forms/input-file-label.html (rev 0)
+++ trunk/LayoutTests/fast/forms/input-file-label.html 2011-06-30 10:40:32 UTC (rev 90101)
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<input id="single_file" name="upfile" type="file" />
+<input id="multiple_files" name="upfile[]" multiple="multiple" type="file" />
+<input id="single_or_multiple_file" name="upfile[]" type="file" />
+<p>This tests the label of a file chooser button.</p>
+<div id="console"></div>
+<script>
+if (window.layoutTestController) {
+ var file = document.getElementById('single_file');
+ var button = internals.shadowRoot(file).firstChild;
+ var label = button.getAttribute('value');
+ var result = 'The label of a single file chooser button is "' + label + '".';
+ label == 'Choose File' ? testPassed(result) : testFailed(result);
+
+ file = document.getElementById('multiple_files');
+ button = internals.shadowRoot(file).firstChild;
+ label = button.getAttribute('value');
+ result = 'The label of a multiple file chooser button is "' + label + '".';
+ label == 'Choose Files' ? testPassed(result) : testFailed(result);
+
+ file = document.getElementById('single_or_multiple_file');
+ button = internals.shadowRoot(file).firstChild;
+ label = button.getAttribute('value');
+ result = 'Initially, the label of a file chooser button is "' + label + '".';
+ label == 'Choose File' ? testPassed(result) : testFailed(result);
+
+ file.setAttribute("multiple", "multiple");
+ button = internals.shadowRoot(file).firstChild;
+ label = button.getAttribute('value');
+ result = 'Set "multiple" attribute, then the label of the file chooser button becomes "' + label + '".';
+ label == 'Choose Files' ? testPassed(result) : testFailed(result);
+
+ file.removeAttribute("multiple");
+ button = internals.shadowRoot(file).firstChild;
+ label = button.getAttribute('value');
+ result = 'Unset "multiple" attribute, then the label of the file chooser button becomes "' + label + '".';
+ label == 'Choose File' ? testPassed(result) : testFailed(result);
+}
+
+var successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (90100 => 90101)
--- trunk/LayoutTests/platform/chromium/test_expectations.txt 2011-06-30 09:31:01 UTC (rev 90100)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt 2011-06-30 10:40:32 UTC (rev 90101)
@@ -216,6 +216,16 @@
// Unskip after implementing LayoutTestController::setDefersLoading and ::goBack.
BUGWK60877 SKIP : loader/navigation-while-deferring-loads.html = FAIL
+// This test fails because WebLocalizedString::FileButtonChooseMultipleFilesLabel
+// is not described in switch cases in ToMessageID(), in order to avoid compiler warnings
+// in the Chromium patch. See here: http://codereview.chromium.org/7273024/.
+// This failure is going to be removed when a planned Chromium patch is merged.
+BUGWK49245 : fast/forms/input-file-label.html = FAIL
+
+// This test fails because the label of a multiple file chooser button is updated.
+// We need to update expected.txt and expected.png.
+BUGWK49245 : fast/forms/input-file-re-render.html = FAIL
+
// -----------------------------------------------------------------
// WONTFIX TESTS
// -----------------------------------------------------------------
Modified: trunk/LayoutTests/platform/mac/fast/forms/input-file-re-render-expected.png
(Binary files differ)
Modified: trunk/LayoutTests/platform/mac/fast/forms/input-file-re-render-expected.txt (90100 => 90101)
--- trunk/LayoutTests/platform/mac/fast/forms/input-file-re-render-expected.txt 2011-06-30 09:31:01 UTC (rev 90100)
+++ trunk/LayoutTests/platform/mac/fast/forms/input-file-re-render-expected.txt 2011-06-30 10:40:32 UTC (rev 90101)
@@ -5,10 +5,10 @@
RenderBody {BODY} at (8,8) size 784x56
RenderBlock {FORM} at (0,0) size 784x22
RenderFileUploadControl {INPUT} at (2,2) size 237x18 "2 files"
- RenderButton {INPUT} at (0,0) size 78x18 [bgcolor=#C0C0C0]
- RenderBlock (anonymous) at (8,2) size 62x13
- RenderText at (0,0) size 62x13
- text run at (0,0) width 62: "Choose File"
+ RenderButton {INPUT} at (0,0) size 84x18 [bgcolor=#C0C0C0]
+ RenderBlock (anonymous) at (8,2) size 68x13
+ RenderText at (0,0) size 68x13
+ text run at (0,0) width 68: "Choose Files"
RenderText {#text} at (0,0) size 0x0
RenderBlock {P} at (0,38) size 784x18
RenderText {#text} at (0,0) size 442x18
Modified: trunk/Source/WebCore/ChangeLog (90100 => 90101)
--- trunk/Source/WebCore/ChangeLog 2011-06-30 09:31:01 UTC (rev 90100)
+++ trunk/Source/WebCore/ChangeLog 2011-06-30 10:40:32 UTC (rev 90101)
@@ -1,3 +1,44 @@
+2011-06-30 Kentaro Hara <[email protected]>
+
+ Reviewed by Kent Tamura.
+
+ Change the label of an HTML5 file chooser button to "Choose Files"
+ https://bugs.webkit.org/show_bug.cgi?id=49245
+
+ We should notify capability of multiple files to users.
+
+ Test: fast/forms/input-file-label.html
+
+ * English.lproj/Localizable.strings:
+ * html/FileInputType.cpp:
+ (WebCore::UploadButtonElement::createForMultiple): Constructs a multiple file chooser button.
+ (WebCore::FileInputType::createShadowSubtree): Constructs a single/multiple file chooser button depending on 'multiple' attribute.
+ (WebCore::FileInputType::multipleAttributeChanged): Updates the label of the file chooser button.
+ * html/FileInputType.h:
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::parseMappedAttribute): Updates the shadow tree of the file chooser button when 'multiple' attribute is set or unset.
+ * html/InputType.cpp:
+ (WebCore::InputType::multipleAttributeChanged): Virtual method to be overridden by FileInputType.
+ * html/InputType.h:
+ * platform/DefaultLocalizationStrategy.cpp:
+ (WebCore::DefaultLocalizationStrategy::fileButtonChooseFileLabel): Updated the description for "Choose File".
+ (WebCore::DefaultLocalizationStrategy::fileButtonChooseMultipleFilesLabel): Returns a string "Choose Files".
+ * platform/DefaultLocalizationStrategy.h:
+ * platform/LocalizationStrategy.h:
+ * platform/LocalizedStrings.cpp:
+ (WebCore::fileButtonChooseMultipleFilesLabel): Wrapper method for getting the "Choose Files" label.
+ * platform/LocalizedStrings.h:
+ * platform/brew/LocalizedStringsBrew.cpp:
+ (WebCore::fileButtonChooseMultipleFilesLabel): Returns a "Choose Files" label.
+ * platform/efl/LocalizedStringsEfl.cpp:
+ (WebCore::fileButtonChooseMultipleFilesLabel): Returns a "Choose Files" label.
+ * platform/gtk/LocalizedStringsGtk.cpp:
+ (WebCore::fileButtonChooseMultipleFilesLabel): Returns a "Choose Files" label.
+ * platform/haiku/LocalizedStringsHaiku.cpp:
+ (WebCore::fileButtonChooseMultipleFilesLabel): Returns a "Choose Files" label.
+ * platform/wx/LocalizedStringsWx.cpp:
+ (WebCore::fileButtonChooseMultipleFilesLabel): Returns a "Choose Files" label.
+
2011-06-30 Ryosuke Niwa <[email protected]>
Reviewed by Kent Tamura.
Modified: trunk/Source/WebCore/English.lproj/Localizable.strings (90100 => 90101)
--- trunk/Source/WebCore/English.lproj/Localizable.strings 2011-06-30 09:31:01 UTC (rev 90100)
+++ trunk/Source/WebCore/English.lproj/Localizable.strings 2011-06-30 10:40:32 UTC (rev 90101)
@@ -70,6 +70,9 @@
/ * t i t l e f o r f i l e b u t t o n u s e d i n H T M L f o r m s * /
"