Make the files attribute of HTMLInputElement writable
Created attachment 143343 [details] Patch
Comment on attachment 143343 [details] Patch still needs tests
Created attachment 143374 [details] Patch
Comment on attachment 143374 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=143374&action=review > Source/WebCore/html/FileInputType.cpp:224 > +void FileInputType::setFiles(PassRefPtr<FileList> files) Did you just move this function, or did you change something about it?
Comment on attachment 143374 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=143374&action=review >> Source/WebCore/html/FileInputType.cpp:224 >> +void FileInputType::setFiles(PassRefPtr<FileList> files) > > Did you just move this function, or did you change something about it? I just moved it. See """ (WebCore::FileInputType::setFiles): Pure code move. """ in the ChangeLog. Is it better to leave comments on the diff too?
Comment on attachment 143374 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=143374&action=review >> Source/WebCore/html/FileInputType.cpp:224 >> +void FileInputType::setFiles(PassRefPtr<FileList> files) > > Did you just move this function, or did you change something about it? Let me make a stronger statement. There is no need to move this function. Please don’t move it. > Source/WebCore/html/HTMLInputElement.cpp:1226 > + if (files) > + m_inputType->setFiles(files); Why a null check here but not in FileInputType's setFiles function?
Comment on attachment 143374 [details] Patch Attachment 143374 [details] did not pass win-ews (win): Output: http://queues.webkit.org/results/12761174
> in the ChangeLog. Is it better to leave comments on the diff too? Nope, the ChangeLog is the right place. I just failed to read it. :)
Created attachment 143382 [details] Patch
Comment on attachment 143374 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=143374&action=review >>>> Source/WebCore/html/FileInputType.cpp:224 >>>> +void FileInputType::setFiles(PassRefPtr<FileList> files) >>> >>> Did you just move this function, or did you change something about it? >> >> I just moved it. See >> >> """ >> (WebCore::FileInputType::setFiles): >> Pure code move. >> """ >> >> in the ChangeLog. Is it better to leave comments on the diff too? > > Let me make a stronger statement. There is no need to move this function. Please don’t move it. Undone. >> Source/WebCore/html/HTMLInputElement.cpp:1226 >> + m_inputType->setFiles(files); > > Why a null check here but not in FileInputType's setFiles function? The if here protects the call to FileInputType's setFiles() function, so if that's called the pointer has to be NULL. If you prefer, I can check in both places.
Created attachment 143383 [details] Patch
Comment on attachment 143374 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=143374&action=review >>> Source/WebCore/html/HTMLInputElement.cpp:1226 >>> + m_inputType->setFiles(files); >> >> Why a null check here but not in FileInputType's setFiles function? > > The if here protects the call to FileInputType's setFiles() function, so if that's called the pointer has to be NULL. If you prefer, I can check in both places. I think Darin's point was to put it in FileInputType's setFiles (and not here) because that's where the pointer is actually used.
Comment on attachment 143374 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=143374&action=review >>>> Source/WebCore/html/HTMLInputElement.cpp:1226 >>>> + m_inputType->setFiles(files); >>> >>> Why a null check here but not in FileInputType's setFiles function? >> >> The if here protects the call to FileInputType's setFiles() function, so if that's called the pointer has to be NULL. If you prefer, I can check in both places. > > I think Darin's point was to put it in FileInputType's setFiles (and not here) because that's where the pointer is actually used. Done. (My reasoning for putting it here: Otherwise, all the InputType subclasses that want to implement setFiles() need to NULL-check (admittedly, at the moment that's only FileInputType). If the if is here, it's only in one place. Also, before this patch, FileInputType::setFiles() could never be called with a NULL pointer and I felt maintaining that would be good.)
Created attachment 143388 [details] Patch
Comment on attachment 143388 [details] Patch Patch looks good. If you don't mind, lets allow the whatwg thread a couple days to give time for other browser vendors to voice concerns. http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-May/036140.html
Comment on attachment 143388 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=143388&action=review > Source/WebCore/html/HTMLInputElement.idl:35 > readonly attribute HTMLFormElement form; > - readonly attribute FileList files; > + attribute FileList files; > attribute [Reflect, URL] DOMString formAction; Why?
(In reply to comment #16) > (From update of attachment 143388 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=143388&action=review > > > Source/WebCore/html/HTMLInputElement.idl:35 > > readonly attribute HTMLFormElement form; > > - readonly attribute FileList files; > > + attribute FileList files; > > attribute [Reflect, URL] DOMString formAction; > > Why? From the linked whatwg thread (http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-May/036140.html): """Making the attribute writable would allow setting the files property of an input element to dataTransfer.files from a drop handler. For example, I would like to use this to create a larger drop-target for a file input. Here's one request for this functionality: http://stackoverflow.com/questions/8006715/drag-drop-files-into-standard-html-file-input"""
(In reply to comment #17) > (In reply to comment #16) > > (From update of attachment 143388 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=143388&action=review > > > > > Source/WebCore/html/HTMLInputElement.idl:35 > > > readonly attribute HTMLFormElement form; > > > - readonly attribute FileList files; > > > + attribute FileList files; > > > attribute [Reflect, URL] DOMString formAction; > > > > Why? > > From the linked whatwg thread (http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-May/036140.html): > > """Making the attribute writable would allow setting the files property > of an input element to dataTransfer.files from a drop handler. For > example, I would like to use this to create a larger drop-target for a > file input. Here's one request for this functionality: > http://stackoverflow.com/questions/8006715/drag-drop-files-into-standard-html-file-input""" I think we don't have consensus of the spec change yet. It's too early to implement it.
Yes, see Ojan's "If you don't mind, lets allow the whatwg thread a couple days to give time for other browser vendors to voice concerns." in comment 15.
Comment on attachment 143388 [details] Patch Attachment 143388 [details] did not pass win-ews (win): Output: http://queues.webkit.org/results/12761192
Comment on attachment 143388 [details] Patch Attachment 143388 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/12768019
Comment on attachment 143388 [details] Patch Lets hold off on landing this till the whatwg discussion settles on what the best thing to expose is.
Sounds like we should move forward here. The response on WhatWG has been basically "yes, let's do this and more." We can start with this and then do more later.
Nico, would you be willing to update the patch so that the mac and win bubbles will be green?
Created attachment 144680 [details] Patch
(In reply to comment #24) > Nico, would you be willing to update the patch so that the mac and win bubbles will be green? I'm giving it a try. If they do become green, someone familiar with the ObjC bindings generator should look at the change to PublicDOMInterfaces.h.
Please wait for approval from timothy@apple.com (or another member of the Apple Safari Team) before submitting because this patch contains changes to the Apple Mac WebKit.framework public API.
Comment on attachment 144680 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=144680&action=review > Source/WebCore/bindings/objc/PublicDOMInterfaces.h:629 > +#if WEBKIT_VERSION_MIN_REQUIRED >= WEBKIT_VERSION_LATEST > +@property(retain) DOMFileList *files; > +#else > @property(readonly, retain) DOMFileList *files AVAILABLE_IN_WEBKIT_VERSION_4_0; > +#endif #ifdefs in this file are not correct. This file is parsed by a build script and not used by a compiler. In this case it is file to just drop the readonly and keep the AVAILABLE_IN_WEBKIT_VERSION_4_0.
"it is file" => "it is fine"
Created attachment 144681 [details] Patch
Comment on attachment 144681 [details] Patch Attachment 144681 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/12840783
(In reply to comment #31) > (From update of attachment 144681 [details]) > Attachment 144681 [details] did not pass mac-ews (mac): > Output: http://queues.webkit.org/results/12840783 The error is: make: *** [JSAudioPannerNode.h] Segmentation fault: 11 I'm not sure if that's related – is there a way to rerun an ews bot?
Comment on attachment 144681 [details] Patch Attachment 144681 [details] did not pass win-ews (win): Output: http://queues.webkit.org/results/12852643
(In reply to comment #33) > (From update of attachment 144681 [details]) > Attachment 144681 [details] did not pass win-ews (win): > Output: http://queues.webkit.org/results/12852643 win ews error: 34>c:\cygwin\home\buildbot\WebKit\Tools\TestWebKitAPI\config.h(47) : fatal error C1083: Cannot open include file: 'WebKit2/WebKit2.h': No such file or directory Looks unrelated as well :-/
Created attachment 144840 [details] Patch
Comment on attachment 144840 [details] Patch Attachment 144840 [details] did not pass win-ews (win): Output: http://queues.webkit.org/results/12840976
Created attachment 144856 [details] Patch
Now with green mac and win bubbles. (The mac bubble went green when I reuploaded the patch without any changes; for the win bubble I needed to add a `#include "FileList.h"` to FileType.cpp -- else cl.exe would complain about PassRefPtr<FileList>.)
Comment on attachment 144856 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=144856&action=review > Source/WebCore/bindings/objc/PublicDOMInterfaces.h:625 > -@property(readonly, retain) DOMFileList *files AVAILABLE_IN_WEBKIT_VERSION_4_0; > +@property(retain) DOMFileList *files AVAILABLE_IN_WEBKIT_VERSION_4_0; I believe this is backwards compatible, so this should be fine.
(In reply to comment #39) > (From update of attachment 144856 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=144856&action=review > > > Source/WebCore/bindings/objc/PublicDOMInterfaces.h:625 > > -@property(readonly, retain) DOMFileList *files AVAILABLE_IN_WEBKIT_VERSION_4_0; > > +@property(retain) DOMFileList *files AVAILABLE_IN_WEBKIT_VERSION_4_0; > > I believe this is backwards compatible, so this should be fine. It's also what TImothy told me to do in comment 28 :-)
Comment on attachment 144856 [details] Patch Looks like Timothy Hatcher has already approved the PublicDOMInterfaces.h part of this change. Thanks!
> It's also what TImothy told me to do in comment 28 :-) Yeah, I'm just a little slow. :)
Comment on attachment 144856 [details] Patch Clearing flags on attachment: 144856 Committed r118993: <http://trac.webkit.org/changeset/118993>
All reviewed patches have been landed. Closing bug.
Is this documented anywhere?
(In reply to comment #45) > Is this documented anywhere? http://www.chromium.org/developers/web-platform-status/forms | files property is writable. [M21] Safari in iOS7 should have this behavior. But I don't know if it's documented.