Changeset 118993 in webkit


Ignore:
Timestamp:
May 30, 2012 4:10:40 PM (12 years ago)
Author:
thakis@chromium.org
Message:

Make the files attribute of HTMLInputElement writable
https://bugs.webkit.org/show_bug.cgi?id=87154

Reviewed by Adam Barth.

whatwg thread:
http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-May/036140.html

  • bindings/objc/PublicDOMInterfaces.h:

Remove readonly on files property.

  • html/FileInputType.cpp:

(FileInputType):

Add a NULL check to setFiles().

  • html/FileInputType.h:

(FileInputType):

Let setFiles() overwrite the base class's method.

  • html/HTMLInputElement.cpp:

(WebCore::HTMLInputElement::setFiles):

Add setFiles() implementation, delegate to input type.

  • html/HTMLInputElement.h:

(HTMLInputElement):

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

(WebCore::InputType::setFiles):

setFiles() does nothing by default.

  • html/InputType.h:

(InputType):

Add a virtual setFiles() method.

Location:
trunk
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r118991 r118993  
     12012-05-30  Nico Weber  <thakis@chromium.org>
     2
     3        Make the files attribute of HTMLInputElement writable
     4        https://bugs.webkit.org/show_bug.cgi?id=87154
     5
     6        Reviewed by Adam Barth.
     7
     8        whatwg thread:
     9        http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2012-May/036140.html
     10
     11        * bindings/objc/PublicDOMInterfaces.h:
     12            Remove readonly on files property.
     13        * html/FileInputType.cpp:
     14        (FileInputType):
     15            Add a NULL check to setFiles().
     16        * html/FileInputType.h:
     17        (FileInputType):
     18            Let setFiles() overwrite the base  class's method.
     19        * html/HTMLInputElement.cpp:
     20        (WebCore::HTMLInputElement::setFiles):
     21            Add setFiles() implementation, delegate to input type.
     22        * html/HTMLInputElement.h:
     23        (HTMLInputElement):
     24        * html/HTMLInputElement.idl:
     25        * html/InputType.cpp:
     26        (WebCore::InputType::setFiles):
     27            setFiles() does nothing by default.
     28        * html/InputType.h:
     29        (InputType):
     30            Add a virtual setFiles() method.
     31
    1322012-05-30  Joe Mason  <jmason@rim.com>
    233
  • trunk/Source/WebCore/bindings/objc/PublicDOMInterfaces.h

    r111569 r118993  
    623623@property BOOL multiple AVAILABLE_IN_WEBKIT_VERSION_4_0;
    624624@property(readonly) BOOL willValidate AVAILABLE_IN_WEBKIT_VERSION_4_0;
    625 @property(readonly, retain) DOMFileList *files AVAILABLE_IN_WEBKIT_VERSION_4_0;
     625@property(retain) DOMFileList *files AVAILABLE_IN_WEBKIT_VERSION_4_0;
    626626- (void)select;
    627627- (void)click;
  • trunk/Source/WebCore/html/FileInputType.cpp

    r117995 r118993  
    321321void FileInputType::setFiles(PassRefPtr<FileList> files)
    322322{
     323    if (!files)
     324        return;
     325
    323326    RefPtr<HTMLInputElement> input = element();
    324327
  • trunk/Source/WebCore/html/FileInputType.h

    r117995 r118993  
    5959    virtual bool canChangeFromAnotherType() const OVERRIDE;
    6060    virtual FileList* files() OVERRIDE;
     61    virtual void setFiles(PassRefPtr<FileList>) OVERRIDE;
    6162    virtual bool canSetValue(const String&) OVERRIDE;
    6263    virtual bool getTypeSpecificValue(String&) OVERRIDE; // Checked first, before internal storage or the value attribute.
     
    7576    virtual void updateRendering(PassRefPtr<Icon>) OVERRIDE;
    7677
    77     void setFiles(PassRefPtr<FileList>);
    7878    PassRefPtr<FileList> createFileList(const Vector<FileChooserFileInfo>& files) const;
    7979#if ENABLE(DIRECTORY_UPLOAD)
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r118963 r118993  
    12211221}
    12221222
     1223void HTMLInputElement::setFiles(PassRefPtr<FileList> files)
     1224{
     1225    m_inputType->setFiles(files);
     1226}
     1227
    12231228void HTMLInputElement::receiveDroppedFiles(const Vector<String>& filenames)
    12241229{
  • trunk/Source/WebCore/html/HTMLInputElement.h

    r118963 r118993  
    212212
    213213    FileList* files();
     214    void setFiles(PassRefPtr<FileList>);
    214215    void receiveDroppedFiles(const Vector<String>&);
    215216    Icon* icon() const;
  • trunk/Source/WebCore/html/HTMLInputElement.idl

    r116592 r118993  
    3232        attribute [Reflect] boolean disabled;
    3333        readonly attribute HTMLFormElement form;
    34         readonly attribute FileList files;
     34        attribute FileList files;
    3535        attribute [Reflect, URL] DOMString formAction;
    3636        attribute [TreatNullAs=NullString] DOMString formEnctype;
  • trunk/Source/WebCore/html/InputType.cpp

    r118677 r118993  
    4242#include "ExceptionCode.h"
    4343#include "FileInputType.h"
     44#include "FileList.h"
    4445#include "FormDataList.h"
    4546#include "HTMLFormElement.h"
     
    578579}
    579580
     581void InputType::setFiles(PassRefPtr<FileList>)
     582{
     583}
     584
    580585bool InputType::getTypeSpecificValue(String&)
    581586{
  • trunk/Source/WebCore/html/InputType.h

    r118677 r118993  
    230230    virtual bool shouldRespectAlignAttribute();
    231231    virtual FileList* files();
     232    virtual void setFiles(PassRefPtr<FileList>);
    232233    virtual void receiveDroppedFiles(const Vector<String>&);
    233234    virtual Icon* icon() const;
Note: See TracChangeset for help on using the changeset viewer.