RESOLVED FIXED 80970
File upload control should use File.name() rather than File.path() to show chosen filenames
https://bugs.webkit.org/show_bug.cgi?id=80970
Summary File upload control should use File.name() rather than File.path() to show ch...
Kinuko Yasuda
Reported 2012-03-12 22:35:33 PDT
File upload control should use File.name() rather than File.path() to show chosen filenames. In some rare cases (e.g. files from FileSystem API or files created using the newly added WebKit API) File.name has different displayName from the basename of file.path, and in the file uploader controller we should use File.name rather than File.path.
Attachments
Patch (5.28 KB, patch)
2012-03-12 22:52 PDT, Kinuko Yasuda
no flags
Patch (12.05 KB, patch)
2012-03-13 00:03 PDT, Kinuko Yasuda
no flags
Patch (11.97 KB, patch)
2012-03-13 00:29 PDT, Kinuko Yasuda
tkent: review+
buildbot: commit-queue-
Addressed comments; for EWS (11.50 KB, patch)
2012-03-13 00:58 PDT, Kinuko Yasuda
buildbot: commit-queue-
Build fix (for EWS) (11.87 KB, patch)
2012-03-13 03:50 PDT, Kinuko Yasuda
webkit-ews: commit-queue-
Kinuko Yasuda
Comment 1 2012-03-12 22:52:27 PDT
Kent Tamura
Comment 2 2012-03-12 23:31:30 PDT
Comment on attachment 131550 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=131550&action=review > Source/WebCore/rendering/RenderFileUploadControl.cpp:239 > - return theme()->fileListNameForWidth(input->files()->paths(), style()->font(), maxFilenameWidth(), input->multiple()); > + return theme()->fileListNameForWidth(input->files()->names(), style()->font(), maxFilenameWidth(), input->multiple()); I think this is not a compatible change. RenderThemeMac.mm uses NSFileMaanger::displayNameAtPath to make a user-visible string. It requires a full path name. How about passing a FileList to fileListNameForWidth() instead of a Vector of paths?
Kinuko Yasuda
Comment 3 2012-03-13 00:03:33 PDT
Kinuko Yasuda
Comment 4 2012-03-13 00:10:58 PDT
Comment on attachment 131550 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=131550&action=review >> Source/WebCore/rendering/RenderFileUploadControl.cpp:239 >> + return theme()->fileListNameForWidth(input->files()->names(), style()->font(), maxFilenameWidth(), input->multiple()); > > I think this is not a compatible change. > RenderThemeMac.mm uses NSFileMaanger::displayNameAtPath to make a user-visible string. It requires a full path name. > > How about passing a FileList to fileListNameForWidth() instead of a Vector of paths? (google'd how NSFileManager::displayNameAtPath works...) I see, passing a FileList sounds like a better idea (then each platform can do what they want). Updated.
Kent Tamura
Comment 5 2012-03-13 00:22:45 PDT
Comment on attachment 131561 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=131561&action=review > Source/WebCore/rendering/RenderTheme.h:219 > - virtual String fileListNameForWidth(const Vector<String>& filenames, const Font&, int width, bool multipleFilesAllowed) const; > + virtual String fileListNameForWidth(PassRefPtr<FileList>, const Font&, int width, bool multipleFilesAllowed) const; Using PassRefPtr<> is not appropriate because we don't need to move reference count ownership from the caller to fileListNameForWidth. FileList* is enough.
Kinuko Yasuda
Comment 6 2012-03-13 00:29:30 PDT
Kinuko Yasuda
Comment 7 2012-03-13 00:32:07 PDT
Comment on attachment 131561 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=131561&action=review >> Source/WebCore/rendering/RenderTheme.h:219 >> + virtual String fileListNameForWidth(PassRefPtr<FileList>, const Font&, int width, bool multipleFilesAllowed) const; > > Using PassRefPtr<> is not appropriate because we don't need to move reference count ownership from the caller to fileListNameForWidth. > FileList* is enough. Good point, I should have thought about that. Fixed.
Kent Tamura
Comment 8 2012-03-13 00:37:27 PDT
Comment on attachment 131564 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=131564&action=review > Source/WebCore/ChangeLog:3 > + [chromium] File upload control should use File.name() rather than File.path() to show chosen filenames Please do not prepend [Chrmoum] for a patch updating non-Chromium part. > Source/WebCore/rendering/RenderTheme.h:219 > - virtual String fileListNameForWidth(const Vector<String>& filenames, const Font&, int width, bool multipleFilesAllowed) const; > + virtual String fileListNameForWidth(FileList*, const Font&, int width, bool multipleFilesAllowed) const; nit: FileList* can be const?
Kent Tamura
Comment 9 2012-03-13 00:38:22 PDT
Comment on attachment 131564 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=131564&action=review > Source/WebCore/platform/gtk/RenderThemeGtk.h:184 > - virtual String fileListNameForWidth(const Vector<String>& filenames, const Font&, int width, bool multipleFilesAllowed) const; > + virtual String fileListNameForWidth(FileList*, const Font&, int width, bool multipleFilesAllowed) const; nit: We had better append OVERRIDE. > Source/WebCore/platform/qt/RenderThemeQt.h:158 > - virtual String fileListNameForWidth(const Vector<String>& filenames, const Font&, int width) const; > + virtual String fileListNameForWidth(FileList*, const Font&, int width) const; ditto. > Source/WebCore/rendering/RenderThemeMac.h:180 > - virtual String fileListNameForWidth(const Vector<String>& filenames, const Font&, int width, bool multipleFilesAllowed) const; > + virtual String fileListNameForWidth(FileList*, const Font&, int width, bool multipleFilesAllowed) const; nit: We had better append OVERRIDE.
Kinuko Yasuda
Comment 10 2012-03-13 00:58:02 PDT
Created attachment 131569 [details] Addressed comments; for EWS
Build Bot
Comment 11 2012-03-13 02:31:51 PDT
Comment on attachment 131569 [details] Addressed comments; for EWS Attachment 131569 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/11942424
Build Bot
Comment 12 2012-03-13 02:39:29 PDT
Gustavo Noronha (kov)
Comment 13 2012-03-13 02:43:36 PDT
Gustavo Noronha (kov)
Comment 14 2012-03-13 02:48:59 PDT
Comment on attachment 131569 [details] Addressed comments; for EWS Attachment 131569 [details] did not pass gtk-ews (gtk): Output: http://queues.webkit.org/results/11949351
Kinuko Yasuda
Comment 15 2012-03-13 03:50:38 PDT
Created attachment 131586 [details] Build fix (for EWS)
Early Warning System Bot
Comment 16 2012-03-13 06:00:52 PDT
Early Warning System Bot
Comment 17 2012-03-13 06:39:09 PDT
Early Warning System Bot
Comment 18 2012-03-13 06:43:54 PDT
Comment on attachment 131586 [details] Build fix (for EWS) Attachment 131586 [details] did not pass qt-wk2-ews (qt): Output: http://queues.webkit.org/results/11941552
Early Warning System Bot
Comment 19 2012-03-13 07:30:01 PDT
Comment on attachment 131586 [details] Build fix (for EWS) Attachment 131586 [details] did not pass qt-ews (qt): Output: http://queues.webkit.org/results/11947536
Kinuko Yasuda
Comment 20 2012-03-13 07:39:11 PDT
Note You need to log in before you can comment on or make changes to this bug.