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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js

Issue 2742503002: [DevTools] Adjust popover position so accomodate for arrow. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 UI.GlassPane = class { 5 UI.GlassPane = class {
6 constructor() { 6 constructor() {
7 this._widget = new UI.Widget(true); 7 this._widget = new UI.Widget(true);
8 this._widget.markAsRoot(); 8 this._widget.markAsRoot();
9 this.element = this._widget.element; 9 this.element = this._widget.element;
10 this.contentElement = this._widget.contentElement; 10 this.contentElement = this._widget.contentElement;
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 } 227 }
228 } else { 228 } else {
229 height = Math.min(height, spaceBottom); 229 height = Math.min(height, spaceBottom);
230 } 230 }
231 this._arrowElement.setIconType('mediumicon-arrow-top'); 231 this._arrowElement.setIconType('mediumicon-arrow-top');
232 this._arrowElement.classList.add('arrow-top'); 232 this._arrowElement.classList.add('arrow-top');
233 arrowY = anchorBox.y + anchorBox.height + gutterSize; 233 arrowY = anchorBox.y + anchorBox.height + gutterSize;
234 } 234 }
235 235
236 positionX = Math.max(gutterSize, Math.min(anchorBox.x, containerWidth - width - gutterSize)); 236 positionX = Math.max(gutterSize, Math.min(anchorBox.x, containerWidth - width - gutterSize));
237 if (this._showArrow && positionX - arrowSize >= gutterSize)
238 positionX -= arrowSize;
237 width = Math.min(width, containerWidth - positionX - gutterSize); 239 width = Math.min(width, containerWidth - positionX - gutterSize);
238 if (2 * arrowSize >= width) { 240 if (2 * arrowSize >= width) {
239 this._arrowElement.classList.add('arrow-none'); 241 this._arrowElement.classList.add('arrow-none');
240 } else { 242 } else {
241 var arrowX = anchorBox.x + Math.min(50, Math.floor(anchorBox.width / 2 )); 243 var arrowX = anchorBox.x + Math.min(50, Math.floor(anchorBox.width / 2 ));
242 arrowX = Number.constrain(arrowX, positionX + arrowSize, positionX + w idth - arrowSize); 244 arrowX = Number.constrain(arrowX, positionX + arrowSize, positionX + w idth - arrowSize);
243 this._arrowElement.positionAt(arrowX, arrowY, container); 245 this._arrowElement.positionAt(arrowX, arrowY, container);
244 } 246 }
245 } else { 247 } else {
246 var left = anchorBox.x - 2 * gutterSize; 248 var left = anchorBox.x - 2 * gutterSize;
(...skipping 30 matching lines...) Expand all
277 } 279 }
278 } else { 280 } else {
279 width = Math.min(width, spaceRight); 281 width = Math.min(width, spaceRight);
280 } 282 }
281 this._arrowElement.setIconType('mediumicon-arrow-left'); 283 this._arrowElement.setIconType('mediumicon-arrow-left');
282 this._arrowElement.classList.add('arrow-left'); 284 this._arrowElement.classList.add('arrow-left');
283 arrowX = anchorBox.x + anchorBox.width + gutterSize; 285 arrowX = anchorBox.x + anchorBox.width + gutterSize;
284 } 286 }
285 287
286 positionY = Math.max(gutterSize, Math.min(anchorBox.y, containerHeight - height - gutterSize)); 288 positionY = Math.max(gutterSize, Math.min(anchorBox.y, containerHeight - height - gutterSize));
289 if (this._showArrow && positionY - arrowSize >= gutterSize)
290 positionY -= arrowSize;
287 height = Math.min(height, containerHeight - positionY - gutterSize); 291 height = Math.min(height, containerHeight - positionY - gutterSize);
288 if (2 * arrowSize >= height) { 292 if (2 * arrowSize >= height) {
289 this._arrowElement.classList.add('arrow-none'); 293 this._arrowElement.classList.add('arrow-none');
290 } else { 294 } else {
291 var arrowY = anchorBox.y + Math.min(50, Math.floor(anchorBox.height / 2)); 295 var arrowY = anchorBox.y + Math.min(50, Math.floor(anchorBox.height / 2));
292 arrowY = Number.constrain(arrowY, positionY + arrowSize, positionY + h eight - arrowSize); 296 arrowY = Number.constrain(arrowY, positionY + arrowSize, positionY + h eight - arrowSize);
293 this._arrowElement.positionAt(arrowX, arrowY, container); 297 this._arrowElement.positionAt(arrowX, arrowY, container);
294 } 298 }
295 } 299 }
296 } else { 300 } else {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 SetExactSize: Symbol('SetExactSize'), 373 SetExactSize: Symbol('SetExactSize'),
370 SetMaxSize: Symbol('SetMaxSize'), 374 SetMaxSize: Symbol('SetMaxSize'),
371 SetExactWidthMaxHeight: Symbol('SetExactWidthMaxHeight'), 375 SetExactWidthMaxHeight: Symbol('SetExactWidthMaxHeight'),
372 MeasureContent: Symbol('MeasureContent') 376 MeasureContent: Symbol('MeasureContent')
373 }; 377 };
374 378
375 /** @type {!Map<!Document, !Element>} */ 379 /** @type {!Map<!Document, !Element>} */
376 UI.GlassPane._containers = new Map(); 380 UI.GlassPane._containers = new Map();
377 /** @type {!Set<!UI.GlassPane>} */ 381 /** @type {!Set<!UI.GlassPane>} */
378 UI.GlassPane._panes = new Set(); 382 UI.GlassPane._panes = new Set();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698