Bug 80970 - File upload control should use File.name() rather than File.path() to show chosen filenames
Summary: File upload control should use File.name() rather than File.path() to show ch...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kinuko Yasuda
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-12 22:35 PDT by Kinuko Yasuda
Modified: 2012-03-13 07:39 PDT (History)
5 users (show)

See Also:


Attachments
Patch (5.28 KB, patch)
2012-03-12 22:52 PDT, Kinuko Yasuda
no flags Details | Formatted Diff | Diff
Patch (12.05 KB, patch)
2012-03-13 00:03 PDT, Kinuko Yasuda
no flags Details | Formatted Diff | Diff
Patch (11.97 KB, patch)
2012-03-13 00:29 PDT, Kinuko Yasuda
tkent: review+
buildbot: commit-queue-
Details | Formatted Diff | Diff
Addressed comments; for EWS (11.50 KB, patch)
2012-03-13 00:58 PDT, Kinuko Yasuda
buildbot: commit-queue-
Details | Formatted Diff | Diff
Build fix (for EWS) (11.87 KB, patch)
2012-03-13 03:50 PDT, Kinuko Yasuda
webkit-ews: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kinuko Yasuda 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.
Comment 1 Kinuko Yasuda 2012-03-12 22:52:27 PDT
Created attachment 131550 [details]
Patch
Comment 2 Kent Tamura 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?
Comment 3 Kinuko Yasuda 2012-03-13 00:03:33 PDT
Created attachment 131561 [details]
Patch
Comment 4 Kinuko Yasuda 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.
Comment 5 Kent Tamura 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.
Comment 6 Kinuko Yasuda 2012-03-13 00:29:30 PDT
Created attachment 131564 [details]
Patch
Comment 7 Kinuko Yasuda 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.
Comment 8 Kent Tamura 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?
Comment 9 Kent Tamura 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.
Comment 10 Kinuko Yasuda 2012-03-13 00:58:02 PDT
Created attachment 131569 [details]
Addressed comments; for EWS
Comment 11 Build Bot 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
Comment 12 Build Bot 2012-03-13 02:39:29 PDT
Comment on attachment 131564 [details]
Patch

Attachment 131564 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/11941454
Comment 13 Gustavo Noronha (kov) 2012-03-13 02:43:36 PDT
Comment on attachment 131564 [details]
Patch

Attachment 131564 [details] did not pass gtk-ews (gtk):
Output: http://queues.webkit.org/results/11949344
Comment 14 Gustavo Noronha (kov) 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
Comment 15 Kinuko Yasuda 2012-03-13 03:50:38 PDT
Created attachment 131586 [details]
Build fix (for EWS)
Comment 16 Early Warning System Bot 2012-03-13 06:00:52 PDT
Comment on attachment 131564 [details]
Patch

Attachment 131564 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/11944536
Comment 17 Early Warning System Bot 2012-03-13 06:39:09 PDT
Comment on attachment 131564 [details]
Patch

Attachment 131564 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/11948486
Comment 18 Early Warning System Bot 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
Comment 19 Early Warning System Bot 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
Comment 20 Kinuko Yasuda 2012-03-13 07:39:11 PDT
Committed r110560: <http://trac.webkit.org/changeset/110560>