[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.22-985-g3c00f00
jianli at chromium.org
jianli at chromium.org
Wed Mar 17 17:59:45 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 12268dc3e13d2eb97767030465939101e40e906a
Author: jianli at chromium.org <jianli at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Feb 25 22:30:48 2010 +0000
File.type support.
https://bugs.webkit.org/show_bug.cgi?id=35361
Reviewed by Dmitry Titov.
WebCore:
Test: LayoutTests/editing/pasteboard/file-input-files-access.html
* html/File.cpp:
(WebCore::File::File):
* html/File.h:
(WebCore::File::type):
* html/File.idl:
LayoutTests:
Update the layout test to test File.type.
* editing/pasteboard/file-input-files-access-expected.txt:
* editing/pasteboard/script-tests/file-input-files-access.js:
(fileListShouldBe):
(runTest):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55257 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index ecfbf6a..ca839b9 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-02-25 Jian Li <jianli at chromium.org>
+
+ Reviewed by Dmitry Titov.
+
+ File.type support.
+ https://bugs.webkit.org/show_bug.cgi?id=35361
+
+ Update the layout test to test File.type.
+
+ * editing/pasteboard/file-input-files-access-expected.txt:
+ * editing/pasteboard/script-tests/file-input-files-access.js:
+ (fileListShouldBe):
+ (runTest):
+
2010-02-25 Oliver Hunt <oliver at apple.com>
Reviewed by Maciej Stachowiak.
diff --git a/LayoutTests/editing/pasteboard/file-input-files-access-expected.txt b/LayoutTests/editing/pasteboard/file-input-files-access-expected.txt
index caa7ccc..bbcffc7 100644
--- a/LayoutTests/editing/pasteboard/file-input-files-access-expected.txt
+++ b/LayoutTests/editing/pasteboard/file-input-files-access-expected.txt
@@ -10,6 +10,7 @@ Dragging a single (non-existant) file to a file input control:
PASS fileInput.value is "DRTFakeFile"
PASS fileInput.files.length is 1
PASS fileInput.files[0].name is "DRTFakeFile"
+PASS fileInput.files[0].type is ""
PASS fileInput.files[0].size is 0
PASS fileInput.files[0].fileName is "DRTFakeFile"
PASS fileInput.files[0].fileSize is 0
@@ -17,6 +18,7 @@ Dragging a real file to a file input control:
PASS fileInput.value is "apple.gif"
PASS fileInput.files.length is 1
PASS fileInput.files[0].name is "apple.gif"
+PASS fileInput.files[0].type is "image/gif"
PASS fileInput.files[0].size is 1476
PASS fileInput.files[0].fileName is "apple.gif"
PASS fileInput.files[0].fileSize is 1476
@@ -38,10 +40,12 @@ Dragging two files to a multi-file input control:
PASS fileInput.value is "apple.gif"
PASS fileInput.files.length is 2
PASS fileInput.files[0].name is "apple.gif"
+PASS fileInput.files[0].type is "image/gif"
PASS fileInput.files[0].size is 1476
PASS fileInput.files[0].fileName is "apple.gif"
PASS fileInput.files[0].fileSize is 1476
PASS fileInput.files[1].name is "mozilla.gif"
+PASS fileInput.files[1].type is "image/gif"
PASS fileInput.files[1].size is 2593
PASS fileInput.files[1].fileName is "mozilla.gif"
PASS fileInput.files[1].fileSize is 2593
diff --git a/LayoutTests/editing/pasteboard/script-tests/file-input-files-access.js b/LayoutTests/editing/pasteboard/script-tests/file-input-files-access.js
index a093039..d17f897 100644
--- a/LayoutTests/editing/pasteboard/script-tests/file-input-files-access.js
+++ b/LayoutTests/editing/pasteboard/script-tests/file-input-files-access.js
@@ -27,6 +27,7 @@ function fileListShouldBe(fileListString, filesArray)
for (var x = 0; x < filesArray.length; x++) {
var fileValueString = fileListString + "[" + x + "]";
shouldBeEqualToString(fileValueString + ".name", filesArray[x]['name']);
+ shouldBeEqualToString(fileValueString + ".type", filesArray[x]['type']);
shouldBe(fileValueString + ".size", "" + filesArray[x]['size']);
// FIXME: to be removed after legacy attributes are removed.
@@ -80,12 +81,12 @@ function runTest()
debug("Dragging a single (non-existant) file to a file input control:");
testDraggingFiles([
- { 'path': 'DRTFakeFile', 'name' : 'DRTFakeFile', 'size' : 0 }
+ { 'path': 'DRTFakeFile', 'name' : 'DRTFakeFile', 'size' : 0, 'type' : '' }
]);
debug("Dragging a real file to a file input control:");
testDraggingFiles([
- { 'path': 'resources/apple.gif', 'name' : 'apple.gif', 'size' : 1476 }
+ { 'path': 'resources/apple.gif', 'name' : 'apple.gif', 'size' : 1476, 'type' : 'image/gif' }
]);
// Directory dragging behavior is covered by
@@ -105,8 +106,8 @@ function runTest()
debug("Dragging two files to a multi-file input control:");
testDraggingFiles([
- { 'path': 'resources/apple.gif', 'name' : 'apple.gif', 'size' : 1476 },
- { 'path': 'resources/mozilla.gif', 'name' : 'mozilla.gif', 'size' : 2593 }
+ { 'path': 'resources/apple.gif', 'name' : 'apple.gif', 'size' : 1476, 'type' : 'image/gif' },
+ { 'path': 'resources/mozilla.gif', 'name' : 'mozilla.gif', 'size' : 2593, 'type' : 'image/gif' }
]);
testOrderedDraggingWithDirectory();
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c40867c..ae70755 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-02-25 Jian Li <jianli at chromium.org>
+
+ Reviewed by Dmitry Titov.
+
+ File.type support.
+ https://bugs.webkit.org/show_bug.cgi?id=35361
+
+ Test: LayoutTests/editing/pasteboard/file-input-files-access.html
+
+ * html/File.cpp:
+ (WebCore::File::File):
+ * html/File.h:
+ (WebCore::File::type):
+ * html/File.idl:
+
2010-02-25 Alexander Pavlov <apavlov at chromium.org>
Reviewed by Pavel Feldman.
diff --git a/WebCore/html/File.cpp b/WebCore/html/File.cpp
index 25e28e4..97fdc45 100644
--- a/WebCore/html/File.cpp
+++ b/WebCore/html/File.cpp
@@ -27,6 +27,7 @@
#include "File.h"
#include "FileSystem.h"
+#include "MIMETypeRegistry.h"
namespace WebCore {
@@ -34,6 +35,10 @@ File::File(const String& path)
: Blob(path)
, m_name(pathGetFileName(path))
{
+ // We don't use MIMETypeRegistry::getMIMETypeForPath() because it returns "application/octet-stream" upon failure.
+ int index = m_name.reverseFind('.');
+ if (index != -1)
+ m_type = MIMETypeRegistry::getMIMETypeForExtension(m_name.substring(index + 1));
}
} // namespace WebCore
diff --git a/WebCore/html/File.h b/WebCore/html/File.h
index be53e30..dda482a 100644
--- a/WebCore/html/File.h
+++ b/WebCore/html/File.h
@@ -40,6 +40,7 @@ public:
}
const String& name() const { return m_name; }
+ const String& type() const { return m_type; }
// FIXME: obsolete attributes. To be removed.
const String& fileName() const { return m_name; }
@@ -49,6 +50,7 @@ private:
File(const String& path);
String m_name;
+ String m_type;
};
} // namespace WebCore
diff --git a/WebCore/html/File.idl b/WebCore/html/File.idl
index 2632a4d..94287ff 100644
--- a/WebCore/html/File.idl
+++ b/WebCore/html/File.idl
@@ -30,6 +30,7 @@ module html {
GenerateToJS
] File : Blob {
readonly attribute DOMString name;
+ readonly attribute DOMString type;
// FIXME: obsolete attributes. To be removed.
readonly attribute DOMString fileName;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list