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

Side by Side Diff: LayoutTests/fast/forms/select/popup-menu-position.html

Issue 1087743002: Support multiple displays for PagePopup (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixed IntRect inclusion Created 5 years, 8 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 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../../resources/js-test.js"></script> 4 <script src="../../../resources/js-test.js"></script>
5 <script src="../resources/picker-common.js"></script> 5 <script src="../resources/picker-common.js"></script>
6 </head> 6 </head>
7 <body> 7 <body>
8 <style> 8 <style>
9 select { 9 select {
10 position: absolute; 10 position: absolute;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 menu.style.left = (screenWidth - 100) + 'px'; 66 menu.style.left = (screenWidth - 100) + 'px';
67 setItemCount(1); 67 setItemCount(1);
68 openPicker(menu, function () { 68 openPicker(menu, function () {
69 injectFakeScreenSize(); 69 injectFakeScreenSize();
70 injectFakeItemSize(200, 100, test4); 70 injectFakeItemSize(200, 100, test4);
71 }, openPickerErrorCallback); 71 }, openPickerErrorCallback);
72 } 72 }
73 73
74 function test4() { 74 function test4() {
75 popupWindowRect = getPopupWindowRect(); 75 popupWindowRect = getPopupWindowRect();
76 shouldBe('popupWindowRect.x', 'screenWidth - menuWidth'); 76 shouldBe('popupWindowRect.x', 'screenWidth - 100');
77 shouldBe('popupWindowRect.y', 'menuHeight'); 77 shouldBe('popupWindowRect.y', 'menuHeight');
78 78
79 popupWindow.pagePopupController.closePopup(); 79 popupWindow.pagePopupController.closePopup();
80 // Position menu at left edge, clipped. 80 // Position menu at left edge, clipped.
81 menu.style.top = '0'; 81 menu.style.top = '0';
82 menu.style.left = '-100px'; 82 menu.style.left = '-100px';
83 setItemCount(1); 83 setItemCount(1);
84 openPicker(menu, function () { 84 openPicker(menu, function () {
85 injectFakeScreenSize(); 85 injectFakeScreenSize();
86 injectFakeItemSize(200, 100, test5); 86 injectFakeItemSize(200, 100, test5);
87 }, openPickerErrorCallback); 87 }, openPickerErrorCallback);
88 } 88 }
89 89
90 function test5() { 90 function test5() {
91 popupWindowRect = getPopupWindowRect(); 91 popupWindowRect = getPopupWindowRect();
92 shouldBe('popupWindowRect.x', '0'); 92 shouldBe('popupWindowRect.x', '-100');
93 shouldBe('popupWindowRect.y', 'menuHeight'); 93 shouldBe('popupWindowRect.y', 'menuHeight');
94 94
95 popupWindow.pagePopupController.closePopup(); 95 popupWindow.pagePopupController.closePopup();
96 // Position close to right edge. 96 // Position close to right edge.
97 menu.style.top = '0'; 97 menu.style.top = '0';
98 menu.style.left = (screenWidth - menuWidth - 10) + 'px'; 98 menu.style.left = (screenWidth - menuWidth - 10) + 'px';
99 setItemCount(1); 99 setItemCount(1);
100 openPicker(menu, function () { 100 openPicker(menu, function () {
101 injectFakeScreenSize(); 101 injectFakeScreenSize();
102 injectFakeItemSize(250, 100, test6); 102 injectFakeItemSize(250, 100, test6);
103 }, openPickerErrorCallback); 103 }, openPickerErrorCallback);
104 } 104 }
105 105
106 function test6() { 106 function test6() {
107 popupWindowRect = getPopupWindowRect(); 107 popupWindowRect = getPopupWindowRect();
108 // Popup should appear right at the right edge of the screen. 108 shouldBe('popupWindowRect.x', 'screenWidth - menuWidth - 10');
109 shouldBe('popupWindowRect.x', 'screenWidth - 250');
110 shouldBe('popupWindowRect.y', 'menuHeight'); 109 shouldBe('popupWindowRect.y', 'menuHeight');
111 110
112 popupWindow.pagePopupController.closePopup(); 111 popupWindow.pagePopupController.closePopup();
113 // Position close to bottom edge. 112 // Position close to bottom edge.
114 menu.style.top = (screenHeight - 100) + 'px'; 113 menu.style.top = (screenHeight - 100) + 'px';
115 menu.style.left = '0'; 114 menu.style.left = '0';
116 setItemCount(2); 115 setItemCount(2);
117 openPicker(menu, function () { 116 openPicker(menu, function () {
118 injectFakeScreenSize(); 117 injectFakeScreenSize();
119 injectFakeItemSize(200, 100, test7); 118 injectFakeItemSize(200, 100, test7);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 function injectFakeItemSize(width, height, callback) { 174 function injectFakeItemSize(width, height, callback) {
176 var style = popupWindow.document.createElement('style'); 175 var style = popupWindow.document.createElement('style');
177 style.innerHTML = 'select { width: ' + width + 'px !important; } option { he ight: ' + height + 'px; }'; 176 style.innerHTML = 'select { width: ' + width + 'px !important; } option { he ight: ' + height + 'px; }';
178 popupWindow.document.body.appendChild(style); 177 popupWindow.document.body.appendChild(style);
179 popupWindow.global.picker._fixWindowSize(); 178 popupWindow.global.picker._fixWindowSize();
180 popupWindow.addEventListener('resize', callback, false); 179 popupWindow.addEventListener('resize', callback, false);
181 } 180 }
182 </script> 181 </script>
183 </body> 182 </body>
184 </html> 183 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698