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

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

Issue 513723003: Add pixel readback to page popup (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 "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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 minWidth = 0; 108 minWidth = 0;
109 if (typeof minHeight !== "number") 109 if (typeof minHeight !== "number")
110 minHeight = 0; 110 minHeight = 0;
111 111
112 var windowRect = new Rectangle(0, 0, width, height); 112 var windowRect = new Rectangle(0, 0, width, height);
113 113
114 if (!global.params.anchorRectInScreen) 114 if (!global.params.anchorRectInScreen)
115 return windowRect; 115 return windowRect;
116 116
117 var anchorRect = new Rectangle(global.params.anchorRectInScreen); 117 var anchorRect = new Rectangle(global.params.anchorRectInScreen);
118 console.log("anchorRect.x:" + anchorRect.x + " anchorRect.y:" + anchorRect.y + " anchorRect.width:" + anchorRect.width + " anchorRect.height:" + anchorRect. height);
tkent 2014/09/01 05:37:03 Remove console.log()s.
keishi 2014/09/04 13:16:20 Done.
118 var availRect = new Rectangle(window.screen.availLeft, window.screen.availTo p, window.screen.availWidth, window.screen.availHeight); 119 var availRect = new Rectangle(window.screen.availLeft, window.screen.availTo p, window.screen.availWidth, window.screen.availHeight);
119 120
120 _adjustWindowRectVertically(windowRect, availRect, anchorRect, minHeight); 121 _adjustWindowRectVertically(windowRect, availRect, anchorRect, minHeight);
121 _adjustWindowRectHorizontally(windowRect, availRect, anchorRect, minWidth); 122 _adjustWindowRectHorizontally(windowRect, availRect, anchorRect, minWidth);
122 123 console.log("width:" + width + " height:" + height);
124 console.log("minWidth:" + minWidth + " minHeight:" + minHeight);
125 console.log("availRect.x:" + availRect.x + " availRect.y:" + availRect.y);
123 return windowRect; 126 return windowRect;
124 } 127 }
125 128
126 function _adjustWindowRectVertically(windowRect, availRect, anchorRect, minHeigh t) { 129 function _adjustWindowRectVertically(windowRect, availRect, anchorRect, minHeigh t) {
127 var availableSpaceAbove = anchorRect.y - availRect.y; 130 var availableSpaceAbove = anchorRect.y - availRect.y;
128 availableSpaceAbove = Math.max(0, Math.min(availRect.height, availableSpaceA bove)); 131 availableSpaceAbove = Math.max(0, Math.min(availRect.height, availableSpaceA bove));
129 132
130 var availableSpaceBelow = availRect.maxY - anchorRect.maxY; 133 var availableSpaceBelow = availRect.maxY - anchorRect.maxY;
131 availableSpaceBelow = Math.max(0, Math.min(availRect.height, availableSpaceB elow)); 134 availableSpaceBelow = Math.max(0, Math.min(availRect.height, availableSpaceB elow));
132 135
(...skipping 17 matching lines...) Expand all
150 if (global.params.isRTL) 153 if (global.params.isRTL)
151 windowRect.x += anchorRect.width - windowRect.width; 154 windowRect.x += anchorRect.width - windowRect.width;
152 windowRect.x = Math.min(windowRect.x, availRect.maxX - windowRect.width); 155 windowRect.x = Math.min(windowRect.x, availRect.maxX - windowRect.width);
153 windowRect.x = Math.max(windowRect.x, availRect.x); 156 windowRect.x = Math.max(windowRect.x, availRect.x);
154 } 157 }
155 158
156 /** 159 /**
157 * @param {!Rectangle} rect 160 * @param {!Rectangle} rect
158 */ 161 */
159 function setWindowRect(rect) { 162 function setWindowRect(rect) {
163 console.log("rect.x:" + rect.x + " rect.y:" + rect.y);
160 if (window.frameElement) { 164 if (window.frameElement) {
161 window.frameElement.style.width = rect.width + "px"; 165 window.frameElement.style.width = rect.width + "px";
162 window.frameElement.style.height = rect.height + "px"; 166 window.frameElement.style.height = rect.height + "px";
163 } else { 167 } else {
164 if (isWindowHidden()) { 168 if (isWindowHidden()) {
165 window.moveTo(rect.x, rect.y); 169 window.moveTo(rect.x, rect.y);
166 window.resizeTo(rect.width, rect.height); 170 window.resizeTo(rect.width, rect.height);
167 } else { 171 } else {
168 window.resizeTo(rect.width, rect.height); 172 window.resizeTo(rect.width, rect.height);
169 window.moveTo(rect.x, rect.y); 173 window.moveTo(rect.x, rect.y);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 252
249 Picker.prototype.handleCancel = function() { 253 Picker.prototype.handleCancel = function() {
250 window.pagePopupController.closePopup(); 254 window.pagePopupController.closePopup();
251 }; 255 };
252 256
253 Picker.prototype.chooseOtherColor = function() { 257 Picker.prototype.chooseOtherColor = function() {
254 window.pagePopupController.setValueAndClosePopup(Picker.Actions.ChooseOtherC olor, ""); 258 window.pagePopupController.setValueAndClosePopup(Picker.Actions.ChooseOtherC olor, "");
255 }; 259 };
256 260
257 Picker.prototype.cleanup = function() {}; 261 Picker.prototype.cleanup = function() {};
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698