Chromium Code Reviews| Index: Source/core/html/forms/FileInputType.cpp |
| diff --git a/Source/core/html/forms/FileInputType.cpp b/Source/core/html/forms/FileInputType.cpp |
| index 5c74604d1c3ab71f6f326edf3f8fe3683e0e25ab..7f55b7f70a78b8751a031e508da91512cc86c562 100644 |
| --- a/Source/core/html/forms/FileInputType.cpp |
| +++ b/Source/core/html/forms/FileInputType.cpp |
| @@ -245,8 +245,13 @@ FileList* FileInputType::createFileList(const Vector<FileChooserFileInfo>& files |
| return fileList; |
| } |
| - for (size_t i = 0; i < size; i++) |
| - fileList->append(File::createForUserProvidedFile(files[i].path, files[i].displayName)); |
| + for (size_t i = 0; i < size; i++) { |
|
tkent
2014/10/17 00:20:22
nit: We prefer |++i|.
hirono
2014/10/17 09:30:58
Done.
|
| + if (files[i].fileSystemURL.isNull()) { |
|
tkent
2014/10/17 00:20:22
Why do you use isNull() though WebFileChooserCompl
hirono
2014/10/17 09:30:58
It should be isEmpty(). Done.
|
| + fileList->append(File::createForUserProvidedFile(files[i].path, files[i].displayName)); |
| + } else { |
| + fileList->append(File::createForFileSystemFile(files[i].fileSystemURL, files[i].metadata)); |
| + } |
| + } |
| return fileList; |
|
tkent
2014/10/17 00:20:22
Please add unit test for FileInputType::createFile
hirono
2014/10/17 09:30:58
Done.
|
| } |
| @@ -281,13 +286,15 @@ void FileInputType::setFiles(FileList* files) |
| RefPtrWillBeRawPtr<HTMLInputElement> input(element()); |
| - bool pathsChanged = false; |
| + bool filesChanged = false; |
| if (files->length() != m_fileList->length()) { |
| - pathsChanged = true; |
| + filesChanged = true; |
| } else { |
| for (unsigned i = 0; i < files->length(); ++i) { |
| - if (files->item(i)->path() != m_fileList->item(i)->path()) { |
| - pathsChanged = true; |
| + if (files->item(i)->hasBackingFile() != m_fileList->item(i)->hasBackingFile() |
|
tkent
2014/10/17 00:20:22
We should introduce comparison member function, or
hirono
2014/10/17 09:30:58
Done.
|
| + || files->item(i)->path() != m_fileList->item(i)->path() |
| + || files->item(i)->fileSystemURL() != m_fileList->item(i)->fileSystemURL()) { |
| + filesChanged = true; |
| break; |
| } |
| } |
| @@ -301,7 +308,7 @@ void FileInputType::setFiles(FileList* files) |
| if (input->renderer()) |
| input->renderer()->setShouldDoFullPaintInvalidation(); |
| - if (pathsChanged) { |
| + if (filesChanged) { |
| // This call may cause destruction of this instance. |
| // input instance is safe since it is ref-counted. |
| input->dispatchChangeEvent(); |