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

Side by Side Diff: Source/web/resources/pickerCommon.js

Issue 1087743002: Support multiple displays for PagePopup (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 "use strict"; 1 "use strict";
2 /* 2 /*
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 122
123 return windowRect; 123 return windowRect;
124 } 124 }
125 125
126 function _adjustWindowRectVertically(windowRect, availRect, anchorRect, minHeigh t) { 126 function _adjustWindowRectVertically(windowRect, availRect, anchorRect, minHeigh t) {
127 var availableSpaceAbove = anchorRect.y - availRect.y; 127 var availableSpaceAbove = anchorRect.y - availRect.y;
128 availableSpaceAbove = Math.max(0, Math.min(availRect.height, availableSpaceA bove)); 128 availableSpaceAbove = Math.max(0, Math.min(availRect.height, availableSpaceA bove));
129 129
130 var availableSpaceBelow = availRect.maxY - anchorRect.maxY; 130 var availableSpaceBelow = availRect.maxY - anchorRect.maxY;
131 availableSpaceBelow = Math.max(0, Math.min(availRect.height, availableSpaceB elow)); 131 availableSpaceBelow = Math.max(0, Math.min(availRect.height, availableSpaceB elow));
132
133 if (windowRect.height > availableSpaceBelow && availableSpaceBelow < availab leSpaceAbove) { 132 if (windowRect.height > availableSpaceBelow && availableSpaceBelow < availab leSpaceAbove) {
134 windowRect.height = Math.min(windowRect.height, availableSpaceAbove); 133 windowRect.height = Math.min(windowRect.height, availableSpaceAbove);
135 windowRect.height = Math.max(windowRect.height, minHeight); 134 windowRect.height = Math.max(windowRect.height, minHeight);
136 windowRect.y = anchorRect.y - windowRect.height; 135 windowRect.y = anchorRect.y - windowRect.height;
137 } else { 136 } else {console.log("awrv2");
tkent 2015/04/14 11:09:33 remove this change
keishi 2015/04/14 11:17:45 Done.
138 windowRect.height = Math.min(windowRect.height, availableSpaceBelow); 137 windowRect.height = Math.min(windowRect.height, availableSpaceBelow);
139 windowRect.height = Math.max(windowRect.height, minHeight); 138 windowRect.height = Math.max(windowRect.height, minHeight);
140 windowRect.y = anchorRect.maxY; 139 windowRect.y = anchorRect.maxY;
141 } 140 }
142 windowRect.y = Math.min(windowRect.y, availRect.maxY - windowRect.height);
143 windowRect.y = Math.max(windowRect.y, availRect.y);
144 } 141 }
145 142
146 function _adjustWindowRectHorizontally(windowRect, availRect, anchorRect, minWid th) { 143 function _adjustWindowRectHorizontally(windowRect, availRect, anchorRect, minWid th) {
147 windowRect.width = Math.min(windowRect.width, availRect.width); 144 windowRect.width = Math.min(windowRect.width, availRect.width);
148 windowRect.width = Math.max(windowRect.width, minWidth); 145 windowRect.width = Math.max(windowRect.width, minWidth);
149 windowRect.x = anchorRect.x; 146 windowRect.x = anchorRect.x;
150 if (global.params.isRTL) 147 if (global.params.isRTL)
151 windowRect.x += anchorRect.width - windowRect.width; 148 windowRect.x += anchorRect.width - windowRect.width;
152 windowRect.x = Math.min(windowRect.x, availRect.maxX - windowRect.width);
153 windowRect.x = Math.max(windowRect.x, availRect.x);
154 } 149 }
155 150
156 /** 151 /**
157 * @param {!Rectangle} rect 152 * @param {!Rectangle} rect
158 */ 153 */
159 function setWindowRect(rect) { 154 function setWindowRect(rect) {
160 if (window.frameElement) { 155 if (window.frameElement) {
161 window.frameElement.style.width = rect.width + "px"; 156 window.frameElement.style.width = rect.width + "px";
162 window.frameElement.style.height = rect.height + "px"; 157 window.frameElement.style.height = rect.height + "px";
163 } else { 158 } else {
164 if (isWindowHidden()) { 159 window.pagePopupController.setWindowRect(rect.x, rect.y, rect.width, rec t.height);
165 window.moveTo(rect.x, rect.y);
166 window.resizeTo(rect.width, rect.height);
167 } else {
168 window.resizeTo(rect.width, rect.height);
169 window.moveTo(rect.x, rect.y);
170 }
171 } 160 }
172 } 161 }
173 162
174 function hideWindow() { 163 function hideWindow() {
175 resizeWindow(1, 1); 164 resizeWindow(1, 1);
176 } 165 }
177 166
178 /** 167 /**
179 * @return {!boolean} 168 * @return {!boolean}
180 */ 169 */
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 299
311 Picker.prototype.handleCancel = function() { 300 Picker.prototype.handleCancel = function() {
312 window.pagePopupController.closePopup(); 301 window.pagePopupController.closePopup();
313 }; 302 };
314 303
315 Picker.prototype.chooseOtherColor = function() { 304 Picker.prototype.chooseOtherColor = function() {
316 window.pagePopupController.setValueAndClosePopup(Picker.Actions.ChooseOtherC olor, ""); 305 window.pagePopupController.setValueAndClosePopup(Picker.Actions.ChooseOtherC olor, "");
317 }; 306 };
318 307
319 Picker.prototype.cleanup = function() {}; 308 Picker.prototype.cleanup = function() {};
OLDNEW
« Source/core/page/PagePopupController.idl ('K') | « Source/web/WebPagePopupImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698