Summary: | Allow WebFileChooser to return extra file info (like displayName) in addition to mere file paths | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Kinuko Yasuda <kinuko> | ||||||||||||||||||
Component: | WebCore Misc. | Assignee: | Kinuko Yasuda <kinuko> | ||||||||||||||||||
Status: | RESOLVED FIXED | ||||||||||||||||||||
Severity: | Normal | CC: | abarth, dglazkov, fishd, gustavo.noronha, gustavo, michaeln, satorux, tkent, webkit.review.bot, xan.lopez | ||||||||||||||||||
Priority: | P2 | ||||||||||||||||||||
Version: | 528+ (Nightly build) | ||||||||||||||||||||
Hardware: | Unspecified | ||||||||||||||||||||
OS: | Unspecified | ||||||||||||||||||||
Attachments: |
|
Description
Kinuko Yasuda
2012-03-09 12:41:24 PST
Created attachment 131078 [details]
Patch
This is only for WebKit API changes-- the callsites and WebCore part also need to be changed. Please wait for approval from fishd@chromium.org before submitting because this patch contains changes to the Chromium public API. Comment on attachment 131078 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=131078&action=review > Source/WebKit/chromium/public/WebFileChooserCompletion.h:55 > virtual void didChooseFile(const WebVector<WebString>& fileNames) = 0; is the idea that didChooseFile will be deprecated and removed? assuming that is the case, then you might just want to use the same name for the new method. (although, perhaps it should be "didChooseFiles" instead of "didChooseFile"!) Created attachment 131125 [details]
Patch
Comment on attachment 131078 [details] Patch Thanks. I added corresponding WebCore changes with some FIXME comments. The change may feel a bit noisy as we need to keep the existing methods as well not to break other ports. View in context: https://bugs.webkit.org/attachment.cgi?id=131078&action=review > Source/WebKit/chromium/public/WebFileChooserCompletion.h:55 > virtual void didChooseFile(const WebVector<WebString>& fileNames) = 0; Either one of the method should be deprecated. I think probably we should eventually just rewind what we're doing now... I added FIXME comment about that, renamed it to didChooseFile, and also added another comment that we should consider renaming it to "didChooseFiles". Comment on attachment 131125 [details] Patch Attachment 131125 [details] did not pass qt-wk2-ews (qt): Output: http://queues.webkit.org/results/11901024 Comment on attachment 131125 [details] Patch Attachment 131125 [details] did not pass qt-ews (qt): Output: http://queues.webkit.org/results/11892795 Comment on attachment 131125 [details] Patch Attachment 131125 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/11904828 Comment on attachment 131125 [details] Patch Attachment 131125 [details] did not pass efl-ews (efl): Output: http://queues.webkit.org/results/11911900 Comment on attachment 131125 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=131125&action=review > Source/WebCore/html/FileInputType.cpp:364 > + for (unsigned i = 0; i < paths.size(); ++i) { > + FileChooserFileInfo file; > + file.path = paths[i]; > + files.append(file); > + } Wrong indentation. I recommend to add constructors to FileChooserFileInfo, and make FileChooserFileInfo immutable. Created attachment 131504 [details]
build fix (for EWS)
(In reply to comment #11) > (From update of attachment 131125 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=131125&action=review > > > Source/WebCore/html/FileInputType.cpp:364 > > + for (unsigned i = 0; i < paths.size(); ++i) { > > + FileChooserFileInfo file; > > + file.path = paths[i]; > > + files.append(file); > > + } > > Wrong indentation. > > I recommend to add constructors to FileChooserFileInfo, and make FileChooserFileInfo immutable. Will fix this and re-upload the patch. Created attachment 131507 [details]
Patch
Comment on attachment 131507 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=131507&action=review > Source/WebCore/html/FileInputType.cpp:127 > + Vector<FileChooserFileInfo> files; > + Vector<String> pathAndNames; > + state.split('\0', pathAndNames); > + for (unsigned i = 0; i < pathAndNames.size();) { > + ASSERT(i + 1 < pathAndNames.size()); > + String path = pathAndNames[i++]; > + String name = pathAndNames[i++]; > + files.append(FileChooserFileInfo(path, name)); > + } We can't do this. It's possible that a form control state saved by a browser without this patch, and it is restored by a browser with this patch. > Source/WebKit/chromium/src/WebFileChooserCompletionImpl.cpp:51 > + for (unsigned i = 0; i < fileNames.size(); ++i) { > + SelectedFileInfo file; > + file.path = fileNames[i]; > + files.append(file); Wrong indentation. Created attachment 131546 [details]
Patch
Comment on attachment 131546 [details] Patch Attachment 131546 [details] did not pass gtk-ews (gtk): Output: http://queues.webkit.org/results/11949267 Comment on attachment 131546 [details]
Patch
Oops, sorry this has wrong change...
Created attachment 131549 [details]
Patch
Comment on attachment 131549 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=131549&action=review > Source/WebCore/html/FileInputType.cpp:110 > + result.append("\xFF\xFE"); This is interpreted as ISO-8859-1, and U+00FF and U+00FE are valid characters. I recommend to use U+FFFF. String::fromUTF8("\xEF\xBF\xBF") Created attachment 131555 [details]
Patch
Comment on attachment 131549 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=131549&action=review >> Source/WebCore/html/FileInputType.cpp:110 >> + result.append("\xFF\xFE"); > > This is interpreted as ISO-8859-1, and U+00FF and U+00FE are valid characters. > I recommend to use U+FFFF. > > String::fromUTF8("\xEF\xBF\xBF") Great, thanks for the comment!! Updated. Comment on attachment 131555 [details] Patch Attachment 131555 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/11949280 (In reply to comment #22) > (From update of attachment 131549 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=131549&action=review > > >> Source/WebCore/html/FileInputType.cpp:110 > >> + result.append("\xFF\xFE"); > > > > This is interpreted as ISO-8859-1, and U+00FF and U+00FE are valid characters. > > I recommend to use U+FFFF. > > > > String::fromUTF8("\xEF\xBF\xBF") > > Great, thanks for the comment!! Updated. I'm sorry that U+FFFF is also a wrong choice because it is an invalid character according to the standard. Some string conversion code might break this characters. I recommend another control characters such as \1. Comment on attachment 131555 [details] Patch Attachment 131555 [details] did not pass gtk-ews (gtk): Output: http://queues.webkit.org/results/11944405 Created attachment 131562 [details]
Patch
(In reply to comment #24) > (In reply to comment #22) > > (From update of attachment 131549 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=131549&action=review > > > > >> Source/WebCore/html/FileInputType.cpp:110 > > >> + result.append("\xFF\xFE"); > > > > > > This is interpreted as ISO-8859-1, and U+00FF and U+00FE are valid characters. > > > I recommend to use U+FFFF. > > > > > > String::fromUTF8("\xEF\xBF\xBF") > > > > Great, thanks for the comment!! Updated. > > I'm sorry that U+FFFF is also a wrong choice because it is an invalid character according to the standard. Some string conversion code might break this characters. > I recommend another control characters such as \1. Thanks, character handling is difficult. Updated. Comment on attachment 131562 [details]
Patch
Looks ok.
Comment on attachment 131562 [details] Patch Clearing flags on attachment: 131562 Committed r110557: <http://trac.webkit.org/changeset/110557> All reviewed patches have been landed. Closing bug. |