Title: [203187] trunk
Revision
203187
Author
[email protected]
Date
2016-07-13 13:52:21 -0700 (Wed, 13 Jul 2016)

Log Message

REGRESSION(r202953): Clicking on input[type=file] doesn't open a file picker
https://bugs.webkit.org/show_bug.cgi?id=159686
Source/WebCore:


Reviewed by Chris Dumez.

The bug was caused by DOMActivate event not propagating out of the user-agent shadow tree
of a file input, and FileInputType not receiving the event to open the file picker.

Made DOMActivate "composed" event which cross shadow boundaries to fix the bug. The feedback
was given back to W3C on https://github.com/w3c/webcomponents/issues/513#issuecomment-231851617

Test: fast/forms/file/open-file-panel.html

* dom/Event.cpp:
(WebCore::Event::composed):

Tools:


Reviewed by Chris Dumez.

Added a code to print "OPEN FILE PANEL" in the text when runOpenPanel is called in the UI delegate.

* WebKitTestRunner/TestController.cpp:
(WTR::runOpenPanel):
(WTR::TestController::createOtherPage):
(WTR::TestController::createWebViewWithOptions):

LayoutTests:

<rdar://problem/27263589>

Reviewed by Chris Dumez.

Added a regression test for opening a file picker on a type=file input element.

The test currently only works on WebKit2 since the support for logging "OPEN FILE PANEL"
was only added to WebKitTestRunner.

Also added WebKit2 specific expected results for some tests that tries to open file panel.

* fast/forms/file/open-file-panel-expected.txt: Added.
* fast/forms/file/open-file-panel.html: Added.
* platform/ios-simulator-wk1/TestExpectations:
* platform/mac-wk1/TestExpectations:
* platform/win/TestExpectations:
* platform/wk2/accessibility: Added.
* platform/wk2/accessibility/axpress-on-aria-button-expected.txt: Copied from LayoutTests/accessibility/axpress-on-aria-button-expected.txt.
* platform/wk2/accessibility/file-upload-button-with-axpress-expected.txt: Copied from LayoutTests/accessibility/file-upload-button-with-axpress-expected.txt.
* platform/wk2/fast: Added.
* platform/wk2/fast/events: Added.
* platform/wk2/fast/events/domactivate-sets-underlying-click-event-as-handled-expected.txt: Copied from LayoutTests/fast/events/domactivate-sets-underlying-click-event-as-handled-expected.txt.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (203186 => 203187)


--- trunk/LayoutTests/ChangeLog	2016-07-13 20:51:01 UTC (rev 203186)
+++ trunk/LayoutTests/ChangeLog	2016-07-13 20:52:21 UTC (rev 203187)
@@ -1,3 +1,30 @@
+2016-07-12  Ryosuke Niwa  <[email protected]>
+
+        REGRESSION(r202953): Clicking on input[type=file] doesn't open a file picker
+        https://bugs.webkit.org/show_bug.cgi?id=159686
+        <rdar://problem/27263589>
+
+        Reviewed by Chris Dumez.
+
+        Added a regression test for opening a file picker on a type=file input element.
+
+        The test currently only works on WebKit2 since the support for logging "OPEN FILE PANEL"
+        was only added to WebKitTestRunner.
+
+        Also added WebKit2 specific expected results for some tests that tries to open file panel.
+
+        * fast/forms/file/open-file-panel-expected.txt: Added.
+        * fast/forms/file/open-file-panel.html: Added.
+        * platform/ios-simulator-wk1/TestExpectations:
+        * platform/mac-wk1/TestExpectations:
+        * platform/win/TestExpectations:
+        * platform/wk2/accessibility: Added.
+        * platform/wk2/accessibility/axpress-on-aria-button-expected.txt: Copied from LayoutTests/accessibility/axpress-on-aria-button-expected.txt.
+        * platform/wk2/accessibility/file-upload-button-with-axpress-expected.txt: Copied from LayoutTests/accessibility/file-upload-button-with-axpress-expected.txt.
+        * platform/wk2/fast: Added.
+        * platform/wk2/fast/events: Added.
+        * platform/wk2/fast/events/domactivate-sets-underlying-click-event-as-handled-expected.txt: Copied from LayoutTests/fast/events/domactivate-sets-underlying-click-event-as-handled-expected.txt.
+
 2016-07-13  Frederic Wang  <[email protected]>
 
         Remove padding and margin around the <math> element

Added: trunk/LayoutTests/fast/forms/file/open-file-panel-expected.txt (0 => 203187)


--- trunk/LayoutTests/fast/forms/file/open-file-panel-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/file/open-file-panel-expected.txt	2016-07-13 20:52:21 UTC (rev 203187)
@@ -0,0 +1,5 @@
+OPEN FILE PANEL
+This test checks that clicking on an file input field opens up a file picker.
+To manually test, click on the button below. WebKit should open a file picker.
+
+ Test passes if "OPEN FILE PANEL" is logged above.

Added: trunk/LayoutTests/fast/forms/file/open-file-panel.html (0 => 203187)


--- trunk/LayoutTests/fast/forms/file/open-file-panel.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/file/open-file-panel.html	2016-07-13 20:52:21 UTC (rev 203187)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This test checks that clicking on an file input field opens up a file picker.<br>
+To manually test, click on the button below. WebKit should open a file picker.</p>
+<input type=file>
+<script>
+
+if (window.internals && window.eventSender) {
+    testRunner.dumpAsText();
+
+    document.write('Test passes if "OPEN FILE PANEL" is logged above.');
+
+    var input = document.querySelector('input');
+    var shadow = internals.shadowRoot(input);
+    var button = shadow.querySelector('input');
+
+    eventSender.mouseMoveTo(button.offsetLeft + 10, button.offsetTop + 10);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+}
+
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (203186 => 203187)


--- trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-07-13 20:51:01 UTC (rev 203186)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-07-13 20:52:21 UTC (rev 203187)
@@ -2984,6 +2984,9 @@
 # iOS does not allow you to scroll by dragging the scrollbar thumb.
 webkit.org/b/157201 fast/scrolling/rtl-drag-vertical-scroller.html [ Failure ]
 
+# DumpRenderTree doesn't support logging calls to runOpenPanel and iOS's WebKitTestRunner doesn't support eventSender.mouseDown.
+fast/forms/file/open-file-panel.html [ Skip ]
+
 # Tests that are failing after bug 157170 (WPT test sync). These tests may just need rebasing.
 imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/readwrite-readonly.html [ Failure ]
 [ Release ] imported/w3c/web-platform-tests/html/dom/interfaces.html [ Failure ]

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (203186 => 203187)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2016-07-13 20:51:01 UTC (rev 203186)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2016-07-13 20:52:21 UTC (rev 203187)
@@ -80,6 +80,9 @@
 webkit.org/b/119094 fast/forms/color/input-color-onchange-event.html [ Skip ]
 webkit.org/b/119094 fast/forms/color/color-suggestion-picker-crash-on-set-value.html [ Skip ]
 
+# DumpRenderTree doesn't support logging calls to runOpenPanel.
+fast/forms/file/open-file-panel.html [ Skip ]
+
 # WK1 and WK2 mousemove events are subtly different in ways that break this test on WK1.
 fast/events/ghostly-mousemoves-in-subframe.html [ Skip ]
 

Modified: trunk/LayoutTests/platform/win/TestExpectations (203186 => 203187)


--- trunk/LayoutTests/platform/win/TestExpectations	2016-07-13 20:51:01 UTC (rev 203186)
+++ trunk/LayoutTests/platform/win/TestExpectations	2016-07-13 20:52:21 UTC (rev 203187)
@@ -317,6 +317,9 @@
 webkit.org/b/29359 fast/forms/time [ Skip ]
 webkit.org/b/29359 fast/forms/week [ Skip ]
 
+# DumpRenderTree doesn't support logging calls to runOpenPanel.
+fast/forms/file/open-file-panel.html [ Skip ]
+
 # ENABLE_GAMEPAD not enabled.
 gamepad/ [ Skip ]
 

Copied: trunk/LayoutTests/platform/wk2/accessibility/axpress-on-aria-button-expected.txt (from rev 203076, trunk/LayoutTests/accessibility/axpress-on-aria-button-expected.txt) (0 => 203187)


--- trunk/LayoutTests/platform/wk2/accessibility/axpress-on-aria-button-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/wk2/accessibility/axpress-on-aria-button-expected.txt	2016-07-13 20:52:21 UTC (rev 203187)
@@ -0,0 +1,19 @@
+OPEN FILE PANEL
+Upload
+
+Upload
+
+Upload
+
+This tests that if a non-native action type is exposed as a control, then we will look for descendants to call press() on.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Press performed on fileupload
+Press performed on button
+Press performed on checkbox
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: trunk/LayoutTests/platform/wk2/accessibility/file-upload-button-with-axpress-expected.txt (from rev 203076, trunk/LayoutTests/accessibility/file-upload-button-with-axpress-expected.txt) (0 => 203187)


--- trunk/LayoutTests/platform/wk2/accessibility/file-upload-button-with-axpress-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/wk2/accessibility/file-upload-button-with-axpress-expected.txt	2016-07-13 20:52:21 UTC (rev 203187)
@@ -0,0 +1,11 @@
+OPEN FILE PANEL
+
+This tests that when AXPress is used DOMActivate will be handled by the input file type.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+DOMActivate was called
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: trunk/LayoutTests/platform/wk2/fast/events/domactivate-sets-underlying-click-event-as-handled-expected.txt (from rev 203076, trunk/LayoutTests/fast/events/domactivate-sets-underlying-click-event-as-handled-expected.txt) (0 => 203187)


--- trunk/LayoutTests/platform/wk2/fast/events/domactivate-sets-underlying-click-event-as-handled-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/wk2/fast/events/domactivate-sets-underlying-click-event-as-handled-expected.txt	2016-07-13 20:52:21 UTC (rev 203187)
@@ -0,0 +1,42 @@
+OPEN FILE PANEL
+OPEN FILE PANEL
+To test manually, click on all the form elements (except the textbox) and the details/summary element. The anchor shouldn't be activated (i.e. you shouldn't see any "anchor activated" messages).
+
+Focusing [object HTMLInputElement] type=text and pressing enter
+form submitted
+
+Activated [object HTMLInputElement] type=submit
+form submitted
+
+Focusing [object HTMLInputElement] type=submit and pressing enter
+Activated [object HTMLInputElement] type=submit
+form submitted
+
+Activated [object HTMLInputElement] type=image
+form submitted
+
+Focusing [object HTMLInputElement] type=image and pressing enter
+Activated [object HTMLInputElement] type=image
+form submitted
+
+Activated [object HTMLButtonElement] type=submit
+form submitted
+
+Focusing [object HTMLButtonElement] type=submit and pressing enter
+Activated [object HTMLButtonElement] type=submit
+form submitted
+
+Activated [object HTMLInputElement] type=reset
+Focusing [object HTMLInputElement] type=reset and pressing enter
+Activated [object HTMLInputElement] type=reset
+Activated [object HTMLButtonElement] type=reset
+Focusing [object HTMLButtonElement] type=reset and pressing enter
+Activated [object HTMLButtonElement] type=reset
+Activated [object HTMLInputElement] type=checkbox
+Activated [object HTMLInputElement] type=radio
+Activated [object HTMLInputElement] type=file
+Focusing [object HTMLInputElement] type=file and pressing enter
+Activated [object HTMLInputElement] type=file
+
+The details element was opened
+

Modified: trunk/Source/WebCore/ChangeLog (203186 => 203187)


--- trunk/Source/WebCore/ChangeLog	2016-07-13 20:51:01 UTC (rev 203186)
+++ trunk/Source/WebCore/ChangeLog	2016-07-13 20:52:21 UTC (rev 203187)
@@ -1,3 +1,21 @@
+2016-07-12  Ryosuke Niwa  <[email protected]>
+
+        REGRESSION(r202953): Clicking on input[type=file] doesn't open a file picker
+        https://bugs.webkit.org/show_bug.cgi?id=159686
+
+        Reviewed by Chris Dumez.
+
+        The bug was caused by DOMActivate event not propagating out of the user-agent shadow tree
+        of a file input, and FileInputType not receiving the event to open the file picker.
+
+        Made DOMActivate "composed" event which cross shadow boundaries to fix the bug. The feedback
+        was given back to W3C on https://github.com/w3c/webcomponents/issues/513#issuecomment-231851617
+
+        Test: fast/forms/file/open-file-panel.html
+
+        * dom/Event.cpp:
+        (WebCore::Event::composed):
+
 2016-07-13  Antti Koivisto  <[email protected]>
 
         v2: WebContent crash due to RELEASE_ASSERT(!m_inLoadPendingImages) in StyleResolver::~StyleResolver()

Modified: trunk/Source/WebCore/dom/Event.cpp (203186 => 203187)


--- trunk/Source/WebCore/dom/Event.cpp	2016-07-13 20:51:01 UTC (rev 203186)
+++ trunk/Source/WebCore/dom/Event.cpp	2016-07-13 20:52:21 UTC (rev 203187)
@@ -97,6 +97,7 @@
 
     return m_type == eventNames().inputEvent
         || m_type == eventNames().textInputEvent
+        || m_type == eventNames().DOMActivateEvent
         || isCompositionEvent()
         || isClipboardEvent()
         || isFocusEvent()

Modified: trunk/Tools/ChangeLog (203186 => 203187)


--- trunk/Tools/ChangeLog	2016-07-13 20:51:01 UTC (rev 203186)
+++ trunk/Tools/ChangeLog	2016-07-13 20:52:21 UTC (rev 203187)
@@ -1,3 +1,17 @@
+2016-07-12  Ryosuke Niwa  <[email protected]>
+
+        REGRESSION(r202953): Clicking on input[type=file] doesn't open a file picker
+        https://bugs.webkit.org/show_bug.cgi?id=159686
+
+        Reviewed by Chris Dumez.
+
+        Added a code to print "OPEN FILE PANEL" in the text when runOpenPanel is called in the UI delegate.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::runOpenPanel):
+        (WTR::TestController::createOtherPage):
+        (WTR::TestController::createWebViewWithOptions):
+
 2016-07-13  Beth Dakin  <[email protected]>
 
         Add more candidate tests

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (203186 => 203187)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2016-07-13 20:51:01 UTC (rev 203186)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2016-07-13 20:52:21 UTC (rev 203187)
@@ -47,6 +47,7 @@
 #include <WebKit/WKNotificationManager.h>
 #include <WebKit/WKNotificationPermissionRequest.h>
 #include <WebKit/WKNumber.h>
+#include <WebKit/WKOpenPanelResultListener.h>
 #include <WebKit/WKPageGroup.h>
 #include <WebKit/WKPageInjectedBundleClient.h>
 #include <WebKit/WKPagePrivate.h>
@@ -153,6 +154,12 @@
     return TestController::singleton().beforeUnloadReturnValue();
 }
 
+static void runOpenPanel(WKPageRef page, WKFrameRef frame, WKOpenPanelParametersRef parameters, WKOpenPanelResultListenerRef resultListenerRef, const void*)
+{
+    printf("OPEN FILE PANEL\n");
+    WKOpenPanelResultListenerCancel(resultListenerRef);
+}
+
 void TestController::runModal(WKPageRef page, const void* clientInfo)
 {
     PlatformWebView* view = static_cast<PlatformWebView*>(const_cast<void*>(clientInfo));
@@ -235,7 +242,7 @@
         0, // didDraw
         0, // pageDidScroll
         0, // exceededDatabaseQuota
-        0, // runOpenPanel
+        runOpenPanel,
         decidePolicyForGeolocationPermissionRequest,
         0, // headerHeight
         0, // footerHeight
@@ -500,7 +507,7 @@
         0, // didDraw
         0, // pageDidScroll
         0, // exceededDatabaseQuota,
-        0, // runOpenPanel
+        runOpenPanel,
         decidePolicyForGeolocationPermissionRequest,
         0, // headerHeight
         0, // footerHeight
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to