Skip to content

Commit

Permalink
REGRESSION(r202953): Clicking on input[type=file] doesn't open a file…
Browse files Browse the repository at this point in the history
… 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 WICG/webcomponents#513 (comment)

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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@203187 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
rniwa@webkit.org authored and matteoceraico committed Jul 5, 2017
1 parent 8834688 commit 63a9d15
Show file tree
Hide file tree
Showing 13 changed files with 177 additions and 2,939 deletions.
27 changes: 27 additions & 0 deletions LayoutTests/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
2016-07-12 Ryosuke Niwa <rniwa@webkit.org>

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-07 Ryosuke Niwa <rniwa@webkit.org>

Replace scoped flag in Event by composed flag
Expand Down
5 changes: 5 additions & 0 deletions LayoutTests/fast/forms/file/open-file-panel-expected.txt
Original file line number Diff line number Diff line change
@@ -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.
25 changes: 25 additions & 0 deletions LayoutTests/fast/forms/file/open-file-panel.html
Original file line number Diff line number Diff line change
@@ -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>
Loading

0 comments on commit 63a9d15

Please sign in to comment.