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

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

Issue 886463010: Make arguments to window.{move,resize}{To,By} non-optional (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 5 years, 6 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 setTimeout(popupOpenCallback, 0); 9 setTimeout(popupOpenCallback, 0);
10 } 10 }
(...skipping 10 matching lines...) Expand all
21 21
22 function rootWindow() { 22 function rootWindow() {
23 var currentWindow = window; 23 var currentWindow = window;
24 while (currentWindow !== currentWindow.parent) { 24 while (currentWindow !== currentWindow.parent) {
25 currentWindow = currentWindow.parent; 25 currentWindow = currentWindow.parent;
26 } 26 }
27 return currentWindow; 27 return currentWindow;
28 } 28 }
29 29
30 function openPicker(element, callback, errorCallback) { 30 function openPicker(element, callback, errorCallback) {
31 rootWindow().moveTo(); 31 rootWindow().moveTo(window.screenX, window.screenY);
32 element.offsetTop; // Force to lay out 32 element.offsetTop; // Force to lay out
33 if (element.tagName === "SELECT") { 33 if (element.tagName === "SELECT") {
34 sendKey(element, "Down", false, true); 34 sendKey(element, "Down", false, true);
35 } else if (element.tagName === "INPUT") { 35 } else if (element.tagName === "INPUT") {
36 if (element.type === "color") { 36 if (element.type === "color") {
37 element.focus(); 37 element.focus();
38 eventSender.keyDown(" "); 38 eventSender.keyDown(" ");
39 } else { 39 } else {
40 sendKey(element, "Down", false, true); 40 sendKey(element, "Down", false, true);
41 } 41 }
42 } 42 }
43 popupWindow = window.internals.pagePopupWindow; 43 popupWindow = window.internals.pagePopupWindow;
44 if (typeof callback === "function" && popupWindow) 44 if (typeof callback === "function" && popupWindow)
45 setPopupOpenCallback(callback); 45 setPopupOpenCallback(callback);
46 else if (typeof errorCallback === "function" && !popupWindow) 46 else if (typeof errorCallback === "function" && !popupWindow)
47 errorCallback(); 47 errorCallback();
48 } 48 }
49 49
50 function clickToOpenPicker(x, y, callback, errorCallback) { 50 function clickToOpenPicker(x, y, callback, errorCallback) {
51 rootWindow().moveTo(); 51 rootWindow().moveTo(window.screenX, window.screenY);
52 eventSender.mouseMoveTo(x, y); 52 eventSender.mouseMoveTo(x, y);
53 eventSender.mouseDown(); 53 eventSender.mouseDown();
54 eventSender.mouseUp(); 54 eventSender.mouseUp();
55 popupWindow = window.internals.pagePopupWindow; 55 popupWindow = window.internals.pagePopupWindow;
56 if (typeof callback === "function" && popupWindow) 56 if (typeof callback === "function" && popupWindow)
57 setPopupOpenCallback(callback); 57 setPopupOpenCallback(callback);
58 else if (typeof errorCallback === "function" && !popupWindow) 58 else if (typeof errorCallback === "function" && !popupWindow)
59 errorCallback(); 59 errorCallback();
60 } 60 }
61 61
62 function setPopupOpenCallback(callback) { 62 function setPopupOpenCallback(callback) {
63 console.assert(popupWindow); 63 console.assert(popupWindow);
64 popupOpenCallback = (function(callback) { 64 popupOpenCallback = (function(callback) {
65 // We need to move the window to the top left of available space 65 // We need to move the window to the top left of available space
66 // because the window will move back to (0, 0) when the 66 // because the window will move back to (0, 0) when the
67 // ShellViewMsg_SetTestConfiguration IPC arrives. 67 // ShellViewMsg_SetTestConfiguration IPC arrives.
68 rootWindow().moveTo(); 68 rootWindow().moveTo(window.screenX, window.screenY);
69 callback(); 69 callback();
70 }).bind(this, callback); 70 }).bind(this, callback);
71 popupWindow.addEventListener("didOpenPicker", popupOpenCallbackWrapper, fals e); 71 popupWindow.addEventListener("didOpenPicker", popupOpenCallbackWrapper, fals e);
72 } 72 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698