Title: [97338] trunk/Source
- Revision
- 97338
- Author
- [email protected]
- Date
- 2011-10-12 19:51:19 -0700 (Wed, 12 Oct 2011)
Log Message
<http://webkit.org/b/69598> Pass Parsed Accept Attribute MIME Types to WebKit Clients
Part 3 - Add acceptMIMETypes, a parsed list of MIME types, to FileChooserSettings for WebKit ports
Reviewed by David Kilzer.
Source/WebCore:
No new tests. No new functionality in WebCore, just
exposing more information to the WebKit port.
* html/FileInputType.cpp:
(WebCore::FileInputType::handleDOMActivateEvent):
(WebCore::FileInputType::receiveDropForDirectoryUpload):
Set the MIME type list on the FileChooser settings.
* html/HTMLInputElement.h:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::acceptMIMETypes):
Accessor for a parsed list of MIME types from the accept attribute.
* platform/FileChooser.h:
Add a slot for a MIME type list on the chooser settings.
Source/WebKit2:
* Shared/WebCoreArgumentCoders.cpp:
(CoreIPC::::encode):
(CoreIPC::::decode):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (97337 => 97338)
--- trunk/Source/WebCore/ChangeLog 2011-10-13 02:51:06 UTC (rev 97337)
+++ trunk/Source/WebCore/ChangeLog 2011-10-13 02:51:19 UTC (rev 97338)
@@ -3,6 +3,29 @@
Pass Parsed Accept Attribute MIME Types to WebKit Clients
https://bugs.webkit.org/show_bug.cgi?id=69598
+ Reviewed by David Kilzer.
+
+ No new tests. No new functionality in WebCore, just
+ exposing more information to the WebKit port.
+
+ * html/FileInputType.cpp:
+ (WebCore::FileInputType::handleDOMActivateEvent):
+ (WebCore::FileInputType::receiveDropForDirectoryUpload):
+ Set the MIME type list on the FileChooser settings.
+
+ * html/HTMLInputElement.h:
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::acceptMIMETypes):
+ Accessor for a parsed list of MIME types from the accept attribute.
+
+ * platform/FileChooser.h:
+ Add a slot for a MIME type list on the chooser settings.
+
+2011-10-12 Joseph Pecoraro <[email protected]>
+
+ Pass Parsed Accept Attribute MIME Types to WebKit Clients
+ https://bugs.webkit.org/show_bug.cgi?id=69598
+
Reviewed by Kent Tamura.
Deprecate the old String version of getting the "accept"
Modified: trunk/Source/WebCore/html/FileInputType.cpp (97337 => 97338)
--- trunk/Source/WebCore/html/FileInputType.cpp 2011-10-13 02:51:06 UTC (rev 97337)
+++ trunk/Source/WebCore/html/FileInputType.cpp 2011-10-13 02:51:19 UTC (rev 97338)
@@ -154,6 +154,7 @@
settings.allowsMultipleFiles = input->fastHasAttribute(multipleAttr);
#endif
settings.deprecatedAcceptTypes = input->accept();
+ settings.acceptMIMETypes = input->acceptMIMETypes();
settings.selectedFiles = m_fileList->paths();
chrome->runOpenPanel(input->document()->frame(), newFileChooser(settings));
}
@@ -324,10 +325,12 @@
{
if (Chrome* chrome = this->chrome()) {
FileChooserSettings settings;
+ HTMLInputElement* input = element();
settings.allowsDirectoryUpload = true;
settings.allowsMultipleFiles = true;
settings.selectedFiles.append(paths[0]);
- settings.deprecatedAcceptTypes = element()->accept();
+ settings.deprecatedAcceptTypes = input->accept();
+ settings.acceptMIMETypes = input->acceptMIMETypes();
chrome->enumerateChosenDirectory(newFileChooser(settings));
}
}
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (97337 => 97338)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2011-10-13 02:51:06 UTC (rev 97337)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2011-10-13 02:51:19 UTC (rev 97338)
@@ -1307,6 +1307,25 @@
m_name = name;
}
+Vector<String> HTMLInputElement::acceptMIMETypes()
+{
+ Vector<String> mimeTypes;
+
+ String acceptString = accept();
+ if (acceptString.isEmpty())
+ return mimeTypes;
+
+ Vector<String> splitTypes;
+ acceptString.split(',', false, splitTypes);
+ for (size_t i = 0; i < splitTypes.size(); ++i) {
+ String trimmedMimeType = stripLeadingAndTrailingHTMLSpaces(splitTypes[i]);
+ if (!trimmedMimeType.isEmpty())
+ mimeTypes.append(trimmedMimeType);
+ }
+
+ return mimeTypes;
+}
+
String HTMLInputElement::accept() const
{
return fastGetAttribute(acceptAttr);
Modified: trunk/Source/WebCore/html/HTMLInputElement.h (97337 => 97338)
--- trunk/Source/WebCore/html/HTMLInputElement.h 2011-10-13 02:51:06 UTC (rev 97337)
+++ trunk/Source/WebCore/html/HTMLInputElement.h 2011-10-13 02:51:19 UTC (rev 97338)
@@ -190,6 +190,7 @@
void setDefaultName(const AtomicString&);
+ Vector<String> acceptMIMETypes();
String accept() const;
String alt() const;
Modified: trunk/Source/WebCore/platform/FileChooser.h (97337 => 97338)
--- trunk/Source/WebCore/platform/FileChooser.h 2011-10-13 02:51:06 UTC (rev 97337)
+++ trunk/Source/WebCore/platform/FileChooser.h 2011-10-13 02:51:19 UTC (rev 97338)
@@ -43,6 +43,7 @@
bool allowsDirectoryUpload;
#endif
String deprecatedAcceptTypes;
+ Vector<String> acceptMIMETypes;
Vector<String> selectedFiles;
};
Modified: trunk/Source/WebKit2/ChangeLog (97337 => 97338)
--- trunk/Source/WebKit2/ChangeLog 2011-10-13 02:51:06 UTC (rev 97337)
+++ trunk/Source/WebKit2/ChangeLog 2011-10-13 02:51:19 UTC (rev 97338)
@@ -3,6 +3,17 @@
Pass Parsed Accept Attribute MIME Types to WebKit Clients
https://bugs.webkit.org/show_bug.cgi?id=69598
+ Reviewed by David Kilzer.
+
+ * Shared/WebCoreArgumentCoders.cpp:
+ (CoreIPC::::encode):
+ (CoreIPC::::decode):
+
+2011-10-12 Joseph Pecoraro <[email protected]>
+
+ Pass Parsed Accept Attribute MIME Types to WebKit Clients
+ https://bugs.webkit.org/show_bug.cgi?id=69598
+
Reviewed by Anders Carlsson.
The WebOpenPanelParameters::Data struct was a mirror of
Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (97337 => 97338)
--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp 2011-10-13 02:51:06 UTC (rev 97337)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp 2011-10-13 02:51:19 UTC (rev 97338)
@@ -525,6 +525,7 @@
#if ENABLE(DIRECTORY_UPLOAD)
encoder->encode(settings.allowsDirectoryUpload);
#endif
+ encoder->encode(settings.acceptMIMETypes);
encoder->encode(settings.selectedFiles);
}
@@ -536,6 +537,8 @@
if (!decoder->decode(settings.allowsDirectoryUpload))
return false;
#endif
+ if (!decoder->decode(settings.acceptMIMETypes))
+ return false;
if (!decoder->decode(settings.selectedFiles))
return false;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes