Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/forms/resources/picker-common.js

Issue 1935993003: SELECT element: Ignore synthetic events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix openPicker() Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 window.jsTestIsAsync = true; 1 window.jsTestIsAsync = true;
2 2
3 var popupWindow = null; 3 var popupWindow = null;
4 4
5 var popupOpenCallback = null; 5 var popupOpenCallback = null;
6 6
7 function popupOpenCallbackWrapper() { 7 function popupOpenCallbackWrapper() {
8 popupWindow.removeEventListener("didOpenPicker", popupOpenCallbackWrapper); 8 popupWindow.removeEventListener("didOpenPicker", popupOpenCallbackWrapper);
9 // We need some delay. Without it, testRunner.notifyDone() freezes. 9 // We need some delay. Without it, testRunner.notifyDone() freezes.
10 // See crbug.com/562311. 10 // See crbug.com/562311.
(...skipping 26 matching lines...) Expand all
37 // |callback| is called if we successfully open the picker UI. However it is 37 // |callback| is called if we successfully open the picker UI. However it is
38 // called only for the following types: 38 // called only for the following types:
39 // - menulist SELECT on Windows, Linux, and CrOS 39 // - menulist SELECT on Windows, Linux, and CrOS
40 // - INPUT color with DATALIST 40 // - INPUT color with DATALIST
41 // - INPUT date/datetime-local/month/week 41 // - INPUT date/datetime-local/month/week
42 function openPicker(element, callback, errorCallback) { 42 function openPicker(element, callback, errorCallback) {
43 rootWindow().moveTo(window.screenX, window.screenY); 43 rootWindow().moveTo(window.screenX, window.screenY);
44 element.offsetTop; // Force to lay out 44 element.offsetTop; // Force to lay out
45 element.focus(); 45 element.focus();
46 if (element.tagName === "SELECT") { 46 if (element.tagName === "SELECT") {
47 sendKey(element, "Down", false, true); 47 eventSender.keyDown("downArrow", ["altKey"]);
48 } else if (element.tagName === "INPUT") { 48 } else if (element.tagName === "INPUT") {
49 if (element.type === "color") { 49 if (element.type === "color") {
50 element.focus(); 50 element.focus();
51 eventSender.keyDown(" "); 51 eventSender.keyDown(" ");
52 } else { 52 } else {
53 sendKey(element, "Down", false, true); 53 sendKey(element, "Down", false, true);
54 } 54 }
55 } 55 }
56 popupWindow = window.internals.pagePopupWindow; 56 popupWindow = window.internals.pagePopupWindow;
57 if (typeof callback === "function" && popupWindow) 57 if (typeof callback === "function" && popupWindow)
(...skipping 22 matching lines...) Expand all
80 // ShellViewMsg_SetTestConfiguration IPC arrives. 80 // ShellViewMsg_SetTestConfiguration IPC arrives.
81 rootWindow().moveTo(window.screenX, window.screenY); 81 rootWindow().moveTo(window.screenX, window.screenY);
82 callback(); 82 callback();
83 }).bind(this, callback); 83 }).bind(this, callback);
84 try { 84 try {
85 popupWindow.addEventListener("didOpenPicker", popupOpenCallbackWrapper, false); 85 popupWindow.addEventListener("didOpenPicker", popupOpenCallbackWrapper, false);
86 } catch(e) { 86 } catch(e) {
87 debug(e.name); 87 debug(e.name);
88 } 88 }
89 } 89 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698