hidden attribute on <input type=file /> suppresses the file selection dialog
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Feb 2012 08:09:07 +0000 (08:09 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Feb 2012 08:09:07 +0000 (08:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=58208

Patch by Rakesh KN <rakesh.kn@motorola.com> on 2012-02-02
Reviewed by Ryosuke Niwa.

.:

* ManualTests/input-file-hidden-open-dialog-on-click.html: Added.
Adding manual test as the file dialog opens only in User gesture.

Source/WebCore:

We want to allow opening file dialog on hidden element when click() is called
on the element. The behaviour is similar to Firefox and IE.

Added manual test as the file dialog opens only on user gesture.

* html/FileInputType.cpp:
(WebCore::FileInputType::handleDOMActivateEvent):
Removed renderer check as input can be hidden.

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

ChangeLog
ManualTests/input-file-hidden-open-dialog-on-click.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/FileInputType.cpp

index dae9ee0..10c20ea 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-02-02  Rakesh KN  <rakesh.kn@motorola.com>
+
+        hidden attribute on <input type=file /> suppresses the file selection dialog
+        https://bugs.webkit.org/show_bug.cgi?id=58208
+
+        Reviewed by Ryosuke Niwa.
+
+        * ManualTests/input-file-hidden-open-dialog-on-click.html: Added.
+        Adding manual test as the file dialog opens only in User gesture.
+
 2012-02-01  Philippe Normand  <pnormand@igalia.com>
 
         [GStreamer] FFTFrame implementation
diff --git a/ManualTests/input-file-hidden-open-dialog-on-click.html b/ManualTests/input-file-hidden-open-dialog-on-click.html
new file mode 100644 (file)
index 0000000..e8042db
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset='utf-8' />
+    <title>Test that file dialog opens when click() is called </title>
+</head>
+<body>
+Test manually that when you click on "Click me" button, an file open dialog appears.
+<input id=fileinput type="file" hidden />
+<button onclick="document.getElementById('fileinput').click();">Click me</button>
+</body>
+</html>
index b14313d..5093ee8 100644 (file)
@@ -1,3 +1,19 @@
+2012-02-02  Rakesh KN  <rakesh.kn@motorola.com>
+
+        hidden attribute on <input type=file /> suppresses the file selection dialog
+        https://bugs.webkit.org/show_bug.cgi?id=58208
+
+        Reviewed by Ryosuke Niwa.
+
+        We want to allow opening file dialog on hidden element when click() is called
+        on the element. The behaviour is similar to Firefox and IE.
+
+        Added manual test as the file dialog opens only on user gesture.
+
+        * html/FileInputType.cpp:
+        (WebCore::FileInputType::handleDOMActivateEvent):
+        Removed renderer check as input can be hidden.
+
 2012-02-01  Philippe Normand  <pnormand@igalia.com>
 
         [GStreamer] FFTFrame implementation
index 76efa41..ea9a2ee 100644 (file)
@@ -139,7 +139,7 @@ String FileInputType::valueMissingText() const
 
 void FileInputType::handleDOMActivateEvent(Event* event)
 {
-    if (element()->disabled() || !element()->renderer())
+    if (element()->disabled())
         return;
 
     if (!ScriptController::processingUserGesture())