Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(752)

Unified Diff: Source/core/html/FormDataList.cpp

Issue 1334513002: Fold FormDataList::getEntry(index) into DOMFormData. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/FormDataList.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/FormDataList.cpp
diff --git a/Source/core/html/FormDataList.cpp b/Source/core/html/FormDataList.cpp
index ca96928cf3c6efa263c78211f179e89e8d9b461b..05165ae2f3f53b4391ccd23920be9a78e87a6756 100644
--- a/Source/core/html/FormDataList.cpp
+++ b/Source/core/html/FormDataList.cpp
@@ -48,14 +48,6 @@ FormDataList::Entry FormDataList::getEntry(const String& key) const
return Entry();
}
-FormDataList::Entry FormDataList::getEntry(size_t index) const
-{
- const FormDataListItems& items = this->items();
- if (index >= items.size())
- return Entry();
- return itemsToEntry(items[index]);
-}
-
HeapVector<FormDataList::Entry> FormDataList::getAll(const String& key) const
{
HeapVector<FormDataList::Entry> matches;
@@ -78,23 +70,28 @@ FormDataList::Entry FormDataList::itemsToEntry(const FormDataList::Item& item) c
const CString valueData = item.data();
return Entry(name, m_encoding.decode(valueData.data(), valueData.length()));
}
+ return Entry(name, item.file());
+}
+File* FormDataList::Item::file() const
+{
+ ASSERT(blob());
// The spec uses the passed filename when inserting entries into the list.
// Here, we apply the filename (if present) as an override when extracting
// items.
// FIXME: Consider applying the name during insertion.
- if (item.blob()->isFile()) {
- File* file = toFile(item.blob());
- if (item.filename().isNull())
- return Entry(name, file);
- return Entry(name, file->clone(item.filename()));
+ if (blob()->isFile()) {
+ File* file = toFile(blob());
+ if (filename().isNull())
+ return file;
+ return file->clone(filename());
}
- String filename = item.filename();
+ String filename = m_filename;
if (filename.isNull())
filename = "blob";
- return Entry(name, File::create(filename, currentTimeMS(), item.blob()->blobDataHandle()));
+ return File::create(filename, currentTimeMS(), blob()->blobDataHandle());
}
PassRefPtr<FormData> FormDataList::createFormData(FormData::EncodingType encodingType)
« no previous file with comments | « Source/core/html/FormDataList.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698