2011-06-26 Dimitri Glazkov <dglazkov@chromium.org>
authordglazkov@chromium.org <dglazkov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Jun 2011 01:47:50 +0000 (01:47 +0000)
committerdglazkov@chromium.org <dglazkov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Jun 2011 01:47:50 +0000 (01:47 +0000)
        Reviewed by Adam Barth.

        FileList::filenames should be FileList::paths, because it's more accurate.
        https://bugs.webkit.org/show_bug.cgi?id=63414

        Refactoring, no change in behavior.

        * fileapi/FileList.cpp:
        (WebCore::FileList::paths): Renamed from filenames.
        * fileapi/FileList.h:
        * html/FileInputType.cpp:
        (WebCore::FileInputType::handleDOMActivateEvent): Changed to use filenames, also fixed a reach-unto-thyself whoopsie.
        (WebCore::FileInputType::requestIcon): Ditto.
        (WebCore::FileInputType::filesChosen): Ditto.
        * rendering/RenderFileUploadControl.cpp:
        (WebCore::RenderFileUploadControl::fileTextValue): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@89777 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/fileapi/FileList.cpp
Source/WebCore/fileapi/FileList.h
Source/WebCore/html/FileInputType.cpp
Source/WebCore/rendering/RenderFileUploadControl.cpp

index 7bfdfea..67f944a 100644 (file)
@@ -1,3 +1,22 @@
+2011-06-26  Dimitri Glazkov  <dglazkov@chromium.org>
+
+        Reviewed by Adam Barth.
+
+        FileList::filenames should be FileList::paths, because it's more accurate.
+        https://bugs.webkit.org/show_bug.cgi?id=63414
+
+        Refactoring, no change in behavior.
+
+        * fileapi/FileList.cpp:
+        (WebCore::FileList::paths): Renamed from filenames.
+        * fileapi/FileList.h:
+        * html/FileInputType.cpp:
+        (WebCore::FileInputType::handleDOMActivateEvent): Changed to use filenames, also fixed a reach-unto-thyself whoopsie.
+        (WebCore::FileInputType::requestIcon): Ditto.
+        (WebCore::FileInputType::filesChosen): Ditto.
+        * rendering/RenderFileUploadControl.cpp:
+        (WebCore::RenderFileUploadControl::fileTextValue): Ditto.
+
 2011-06-26  Young Han Lee  <joybro@company100.net>
 
         Reviewed by Dirk Schulze.
index 14e1727..809e253 100644 (file)
@@ -41,13 +41,13 @@ File* FileList::item(unsigned index) const
     return m_files[index].get();
 }
 
-Vector<String> FileList::filenames() const
+Vector<String> FileList::paths() const
 {
-    Vector<String> filenames;
+    Vector<String> paths;
     for (unsigned i = 0; i < m_files.size(); ++i)
-        filenames.append(m_files[i]->path());
+        paths.append(m_files[i]->path());
 
-    return filenames;
+    return paths;
 }
 
 } // namespace WebCore
index 7723682..928981f 100644 (file)
@@ -47,7 +47,7 @@ namespace WebCore {
         bool isEmpty() const { return m_files.isEmpty(); }
         void clear() { m_files.clear(); }
         void append(PassRefPtr<File> file) { m_files.append(file); }
-        Vector<String> filenames() const;
+        Vector<String> paths() const;
 
     private:
         FileList();
index 0a8741f..6daac39 100644 (file)
@@ -147,8 +147,7 @@ void FileInputType::handleDOMActivateEvent(Event* event)
         settings.allowsMultipleFiles = input->fastHasAttribute(multipleAttr);
 #endif
         settings.acceptTypes = input->accept();
-        ASSERT(input->files());
-        settings.selectedFiles = input->files()->filenames();
+        settings.selectedFiles = m_fileList->paths();
         chrome->runOpenPanel(input->document()->frame(), newFileChooser(settings));
     }
     event->setDefaultHandled();
@@ -252,25 +251,25 @@ void FileInputType::createShadowSubtree()
     element()->ensureShadowRoot()->appendChild(UploadButtonElement::create(element()->document()), ec);
 }
 
-void FileInputType::requestIcon(const Vector<String>& filenames)
+void FileInputType::requestIcon(const Vector<String>& paths)
 {
-    if (!filenames.size())
+    if (!paths.size())
         return;
 
     if (Chrome* chrome = this->chrome())
-        chrome->loadIconForFiles(filenames, newFileIconLoader());
+        chrome->loadIconForFiles(paths, newFileIconLoader());
 }
 
-void FileInputType::filesChosen(const Vector<String>& filenames)
+void FileInputType::filesChosen(const Vector<String>& paths)
 {
     HTMLInputElement* input = element();
-    setFileList(filenames);
+    setFileList(paths);
 
     input->setFormControlValueMatchesRenderer(true);
     input->notifyFormStateChanged();
     input->setNeedsValidityCheck();
 
-    requestIcon(filenames);
+    requestIcon(paths);
 
     if (input->renderer())
         input->renderer()->repaint();
index ebc3334..6bef50f 100644 (file)
@@ -210,7 +210,7 @@ String RenderFileUploadControl::fileTextValue() const
 {
     HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
     ASSERT(input->files());
-    return theme()->fileListNameForWidth(input->files()->filenames(), style()->font(), maxFilenameWidth());
+    return theme()->fileListNameForWidth(input->files()->paths(), style()->font(), maxFilenameWidth());
 }
     
 } // namespace WebCore