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

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

Issue 1311013012: date/time inputs should not handle keyboard events if they aren't focused. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: update *-open-picker-with-f4-key.html Created 5 years, 3 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 | Annotate | Revision Log
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 setTimeout(popupOpenCallback, 0); 9 setTimeout(popupOpenCallback, 0);
10 } 10 }
(...skipping 22 matching lines...) Expand all
33 // - INPUT date/datetime-local/month/week 33 // - INPUT date/datetime-local/month/week
34 // 34 //
35 // |callback| is called if we successfully open the picker UI. However it is 35 // |callback| is called if we successfully open the picker UI. However it is
36 // called only for the following types: 36 // called only for the following types:
37 // - menulist SELECT on Windows, Linux, and CrOS 37 // - menulist SELECT on Windows, Linux, and CrOS
38 // - INPUT color with DATALIST 38 // - INPUT color with DATALIST
39 // - INPUT date/datetime-local/month/week 39 // - INPUT date/datetime-local/month/week
40 function openPicker(element, callback, errorCallback) { 40 function openPicker(element, callback, errorCallback) {
41 rootWindow().moveTo(window.screenX, window.screenY); 41 rootWindow().moveTo(window.screenX, window.screenY);
42 element.offsetTop; // Force to lay out 42 element.offsetTop; // Force to lay out
43 element.focus();
43 if (element.tagName === "SELECT") { 44 if (element.tagName === "SELECT") {
44 sendKey(element, "Down", false, true); 45 sendKey(element, "Down", false, true);
45 } else if (element.tagName === "INPUT") { 46 } else if (element.tagName === "INPUT") {
46 if (element.type === "color") { 47 if (element.type === "color") {
47 element.focus(); 48 element.focus();
48 eventSender.keyDown(" "); 49 eventSender.keyDown(" ");
49 } else { 50 } else {
50 sendKey(element, "Down", false, true); 51 sendKey(element, "Down", false, true);
51 } 52 }
52 } 53 }
(...skipping 24 matching lines...) Expand all
77 // ShellViewMsg_SetTestConfiguration IPC arrives. 78 // ShellViewMsg_SetTestConfiguration IPC arrives.
78 rootWindow().moveTo(window.screenX, window.screenY); 79 rootWindow().moveTo(window.screenX, window.screenY);
79 callback(); 80 callback();
80 }).bind(this, callback); 81 }).bind(this, callback);
81 try { 82 try {
82 popupWindow.addEventListener("didOpenPicker", popupOpenCallbackWrapper, false); 83 popupWindow.addEventListener("didOpenPicker", popupOpenCallbackWrapper, false);
83 } catch(e) { 84 } catch(e) {
84 debug(e.name); 85 debug(e.name);
85 } 86 }
86 } 87 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698