Changeset 120667 in webkit


Ignore:
Timestamp:
Jun 18, 2012 9:13:44 PM (12 years ago)
Author:
kinuko@chromium.org
Message:

Support File/DirectoryEntry access for <input type=file> if FileSystem API is enabled
https://bugs.webkit.org/show_bug.cgi?id=88293

Reviewed by Tony Chang.

Source/WebCore:

Proposal email on whatwg: http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-November/033814.html
Proposal draft: http://wiki.whatwg.org/wiki/DragAndDropEntries

Test: fast/forms/file/input-file-entries.html

  • Modules/filesystem/HTMLInputElementFileSystem.cpp: Added.
  • Modules/filesystem/HTMLInputElementFileSystem.h: Added.
  • Modules/filesystem/HTMLInputElementFileSystem.idl: Added.
  • WebCore.gypi:
  • html/FileInputType.cpp:

(WebCore::FileInputType::receiveDroppedFiles): Retrieves dropped file
system Id if the given DragData has it.
(WebCore::FileInputType::droppedFileSystemId): Added. This returns
dropped file system Id retrieved in receiveDroppedFiles, or an empty
string if the platform does not support isolated file system for
dropped files.

  • html/FileInputType.h:
  • html/HTMLInputElement.cpp:

(WebCore::HTMLInputElement::droppedFileSystemId): Added.

  • html/HTMLInputElement.h:
  • html/InputType.cpp:

(WebCore::InputType::droppedFileSystemId): Added.

  • html/InputType.h:
  • platform/DragData.cpp:
  • platform/DragData.h:
  • platform/chromium/DragDataChromium.cpp:

(WebCore::DragData::droppedFileSystemId): Added.

LayoutTests:

  • fast/forms/file/input-file-entries-expected.txt: Added.
  • fast/forms/file/input-file-entries.html: Added.
  • fast/forms/resources/dir1/UTF8-2.txt: Added.
  • fast/forms/resources/dir1/UTF8.txt: Added.
  • fast/forms/resources/dir2/green.jpg: Added.
  • platform/efl/Skipped:
  • platform/efl/TestExpectations:
  • platform/gtk/TestExpectations:
  • platform/mac/Skipped:
  • platform/qt/Skipped:
  • platform/win/Skipped:
  • platform/wincairo/Skipped:
  • platform/wk2/Skipped:
Location:
trunk
Files:
8 added
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r120666 r120667  
     12012-06-12  Kinuko Yasuda  <kinuko@chromium.org>
     2
     3        Support File/DirectoryEntry access for <input type=file> if FileSystem API is enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=88293
     5
     6        Reviewed by Tony Chang.
     7
     8        * fast/forms/file/input-file-entries-expected.txt: Added.
     9        * fast/forms/file/input-file-entries.html: Added.
     10        * fast/forms/resources/dir1/UTF8-2.txt: Added.
     11        * fast/forms/resources/dir1/UTF8.txt: Added.
     12        * fast/forms/resources/dir2/green.jpg: Added.
     13        * platform/efl/Skipped:
     14        * platform/efl/TestExpectations:
     15        * platform/gtk/TestExpectations:
     16        * platform/mac/Skipped:
     17        * platform/qt/Skipped:
     18        * platform/win/Skipped:
     19        * platform/wincairo/Skipped:
     20        * platform/wk2/Skipped:
     21
    1222012-06-18  Shinya Kawanaka  <shinyak@chromium.org>
    223
  • trunk/LayoutTests/platform/efl/Skipped

    r120645 r120667  
    11331133fast/forms/file/file-input-capture.html
    11341134
     1135# Requires ENABLE(FILE_SYSTEM)
     1136fast/forms/file/input-file-entries.html
     1137
    11351138# Transparent image being produced
    11361139fast/frames/transparent-scrollbar.html
  • trunk/LayoutTests/platform/efl/TestExpectations

    r120654 r120667  
    219219BUGWK84333 : fast/forms/file/get-file-upload.html = TEXT
    220220BUGWK84333 : fast/forms/file/input-file-directory-upload.html = TEXT
     221BUGWK84333 : fast/forms/file/input-file-entries.html = TEXT
    221222BUGWK84333 : fast/forms/file/input-file-re-render.html = MISSING
    222223BUGWK84333 : fast/forms/file/input-file-write-files.html = TEXT
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r120645 r120667  
    160160BUGWKGTK SKIP : http/tests/workers/terminate-during-sync-operation.html = TEXT
    161161BUGWKGTK SKIP : fast/mutation/filesystem-callback-delivery.html = TEXT
     162BUGWKGTK SKIP : fast/forms/file/input-file-entries.html = TEXT
    162163
    163164// Requires WebP support.
  • trunk/LayoutTests/platform/mac/Skipped

    r120645 r120667  
    244244fast/forms/file/input-file-directory-upload.html
    245245
     246# Requires ENABLE(FILE_SYSTEM)
     247fast/forms/file/input-file-entries.html
     248
    246249# Web Timing is not enabled.
    247250# https://bugs.webkit.org/show_bug.cgi?id=42434
  • trunk/LayoutTests/platform/qt/Skipped

    r120645 r120667  
    100100# ENABLE(DIRECTORY_UPLOAD) is disabled.
    101101fast/forms/file/input-file-directory-upload.html
     102
     103# ENABLE(FILE_SYSTEM) is disabled.
     104fast/forms/file/input-file-entries.html
    102105
    103106# ENABLE(INDEXED_DATABASE) is disabled.
  • trunk/LayoutTests/platform/win/Skipped

    r120645 r120667  
    260260fast/forms/file/file-reset-in-change.html
    261261fast/forms/file/input-file-directory-upload.html
     262fast/forms/file/input-file-entries.html
    262263fast/forms/file/input-file-re-render.html
    263264fast/forms/file/recover-file-input-in-unposted-form.html
  • trunk/LayoutTests/platform/wincairo/Skipped

    r120645 r120667  
    18091809http/tests/websocket/tests/hybi/send-file-blob-fail.html
    18101810fast/mutation/filesystem-callback-delivery.html
     1811fast/forms/file/input-file-entries.html
    18111812
    18121813# LayoutTestController::nodesFromRect is not supported.
  • trunk/LayoutTests/platform/wk2/Skipped

    r120645 r120667  
    13981398fast/forms/file/get-file-upload.html
    13991399fast/forms/file/input-file-re-render.html
     1400fast/forms/file/input-file-entries.html
    14001401fast/forms/file/recover-file-input-in-unposted-form.html
    14011402http/tests/local/fileapi/file-last-modified-after-delete.html
  • trunk/Source/WebCore/ChangeLog

    r120666 r120667  
     12012-06-12  Kinuko Yasuda  <kinuko@chromium.org>
     2
     3        Support File/DirectoryEntry access for <input type=file> if FileSystem API is enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=88293
     5
     6        Reviewed by Tony Chang.
     7
     8        Proposal email on whatwg: http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2011-November/033814.html
     9        Proposal draft: http://wiki.whatwg.org/wiki/DragAndDropEntries
     10
     11        Test: fast/forms/file/input-file-entries.html
     12
     13        * Modules/filesystem/HTMLInputElementFileSystem.cpp: Added.
     14        * Modules/filesystem/HTMLInputElementFileSystem.h: Added.
     15        * Modules/filesystem/HTMLInputElementFileSystem.idl: Added.
     16        * WebCore.gypi:
     17        * html/FileInputType.cpp:
     18        (WebCore::FileInputType::receiveDroppedFiles): Retrieves dropped file
     19        system Id if the given DragData has it.
     20        (WebCore::FileInputType::droppedFileSystemId): Added. This returns
     21        dropped file system Id retrieved in receiveDroppedFiles, or an empty
     22        string if the platform does not support isolated file system for
     23        dropped files.
     24        * html/FileInputType.h:
     25        * html/HTMLInputElement.cpp:
     26        (WebCore::HTMLInputElement::droppedFileSystemId): Added.
     27        * html/HTMLInputElement.h:
     28        * html/InputType.cpp:
     29        (WebCore::InputType::droppedFileSystemId): Added.
     30        * html/InputType.h:
     31        * platform/DragData.cpp:
     32        * platform/DragData.h:
     33        * platform/chromium/DragDataChromium.cpp:
     34        (WebCore::DragData::droppedFileSystemId): Added.
     35
    1362012-06-18  Shinya Kawanaka  <shinyak@chromium.org>
    237
  • trunk/Source/WebCore/Modules/filesystem/DOMFileSystem.cpp

    r120645 r120667  
    6565PassRefPtr<DOMFileSystem> DOMFileSystem::createIsolatedFileSystem(ScriptExecutionContext* context, const String& filesystemId)
    6666{
     67    if (filesystemId.isEmpty())
     68        return 0;
     69
    6770    StringBuilder filesystemName;
    6871    filesystemName.append(context->securityOrigin()->databaseIdentifier());
    69     filesystemName.append(":");
    70     filesystemName.append(isolatedPathPrefix);
    71     filesystemName.append("_");
     72    filesystemName.append(":Isolated_");
    7273    filesystemName.append(filesystemId);
    7374
  • trunk/Source/WebCore/WebCore.gypi

    r120645 r120667  
    786786            'Modules/filesystem/FileWriterCallback.idl',
    787787            'Modules/filesystem/FileWriterSync.idl',
     788            'Modules/filesystem/HTMLInputElementFileSystem.idl',
    788789            'Modules/filesystem/Metadata.idl',
    789790            'Modules/filesystem/MetadataCallback.idl',
     
    14131414            'Modules/filesystem/FileWriterSync.cpp',
    14141415            'Modules/filesystem/FileWriterSync.h',
     1416            'Modules/filesystem/HTMLInputElementFileSystem.cpp',
     1417            'Modules/filesystem/HTMLInputElementFileSystem.h',
    14151418            'Modules/filesystem/LocalFileSystem.cpp',
    14161419            'Modules/filesystem/LocalFileSystem.h',
  • trunk/Source/WebCore/html/FileInputType.cpp

    r120645 r120667  
    408408#endif
    409409
     410#if ENABLE(FILE_SYSTEM)
     411    m_droppedFileSystemId = dragData->droppedFileSystemId();
     412#endif
     413
    410414    Vector<FileChooserFileInfo> files;
    411415    for (unsigned i = 0; i < paths.size(); ++i)
     
    422426}
    423427
     428#if ENABLE(FILE_SYSTEM)
     429String FileInputType::droppedFileSystemId()
     430{
     431    return m_droppedFileSystemId;
     432}
     433#endif
     434
    424435Icon* FileInputType::icon() const
    425436{
  • trunk/Source/WebCore/html/FileInputType.h

    r120645 r120667  
    6565    virtual void setValue(const String&, bool valueChanged, TextFieldEventBehavior) OVERRIDE;
    6666    virtual bool receiveDroppedFiles(const DragData*) OVERRIDE;
     67#if ENABLE(FILE_SYSTEM)
     68    virtual String droppedFileSystemId() OVERRIDE;
     69#endif
    6770    virtual Icon* icon() const OVERRIDE;
    6871    virtual bool isFileUpload() const OVERRIDE;
     
    8588    RefPtr<FileList> m_fileList;
    8689    RefPtr<Icon> m_icon;
     90
     91#if ENABLE(FILE_SYSTEM)
     92    String m_droppedFileSystemId;
     93#endif
    8794};
    8895
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r120645 r120667  
    12361236}
    12371237
     1238#if ENABLE(FILE_SYSTEM)
     1239String HTMLInputElement::droppedFileSystemId()
     1240{
     1241    return m_inputType->droppedFileSystemId();
     1242}
     1243#endif
     1244
    12381245Icon* HTMLInputElement::icon() const
    12391246{
  • trunk/Source/WebCore/html/HTMLInputElement.h

    r120645 r120667  
    220220    bool receiveDroppedFiles(const DragData*);
    221221
     222#if ENABLE(FILE_SYSTEM)
     223    String droppedFileSystemId();
     224#endif
     225
    222226    Icon* icon() const;
    223227    // These functions are used for rendering the input active during a
  • trunk/Source/WebCore/html/InputType.cpp

    r120645 r120667  
    678678}
    679679
     680#if ENABLE(FILE_SYSTEM)
     681String InputType::droppedFileSystemId()
     682{
     683    ASSERT_NOT_REACHED();
     684    return String();
     685}
     686#endif
     687
    680688Icon* InputType::icon() const
    681689{
  • trunk/Source/WebCore/html/InputType.h

    r120645 r120667  
    236236    // Should return true if the given DragData has more than one dropped files.
    237237    virtual bool receiveDroppedFiles(const DragData*);
     238#if ENABLE(FILE_SYSTEM)
     239    virtual String droppedFileSystemId();
     240#endif
    238241    virtual Icon* icon() const;
    239242    // Should return true if the corresponding renderer for a type can display a suggested value.
  • trunk/Source/WebCore/platform/DragData.cpp

    r120645 r120667  
    7171    return keyState;
    7272}
     73
     74#if ENABLE(FILE_SYSTEM)
     75String DragData::droppedFileSystemId() const
     76{
     77    return String();
     78}
    7379#endif
    74 
     80#endif
    7581
    7682} // namespace WebCore
    7783
     84
    7885#endif // ENABLE(DRAG_SUPPORT)
  • trunk/Source/WebCore/platform/DragData.h

    r120645 r120667  
    124124#endif
    125125
     126#if ENABLE(FILE_SYSTEM)
     127    String droppedFileSystemId() const;
     128#endif
     129
    126130#if PLATFORM(QT) || PLATFORM(GTK)
    127131    // This constructor should used only by WebKit2 IPC because DragData
     
    157161
    158162#endif // !DragData_h
    159 
  • trunk/Source/WebCore/platform/chromium/DragDataChromium.cpp

    r120645 r120667  
    4343#include <public/Platform.h>
    4444#include <public/WebFileUtilities.h>
     45
     46#if ENABLE(FILE_SYSTEM)
     47#include "DraggedIsolatedFileSystem.h"
     48#endif
    4549
    4650namespace WebCore {
     
    163167}
    164168
     169#if ENABLE(FILE_SYSTEM)
     170String DragData::droppedFileSystemId() const
     171{
     172    DraggedIsolatedFileSystem* filesystem = DraggedIsolatedFileSystem::from(m_platformDragData);
     173    if (!filesystem)
     174        return String();
     175    return filesystem->filesystemId();
     176}
     177#endif
     178
     179
    165180} // namespace WebCore
Note: See TracChangeset for help on using the changeset viewer.