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

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

Issue 2658383002: [DevTools] Make UI.GlassPane position contentElement for different overlay controls. (Closed)
Patch Set: rebased Created 3 years, 10 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 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 const arrowHeight = this._hasNoPadding ? 8 : 15; 158 const arrowHeight = this._hasNoPadding ? 8 : 15;
159 const arrowOffset = 10; 159 const arrowOffset = 10;
160 const borderRadius = 4; 160 const borderRadius = 4;
161 const arrowRadius = 6; 161 const arrowRadius = 6;
162 preferredWidth = preferredWidth || this._preferredWidth; 162 preferredWidth = preferredWidth || this._preferredWidth;
163 preferredHeight = preferredHeight || this._preferredHeight; 163 preferredHeight = preferredHeight || this._preferredHeight;
164 164
165 // Skinny tooltips are not pretty, their arrow location is not nice. 165 // Skinny tooltips are not pretty, their arrow location is not nice.
166 preferredWidth = Math.max(preferredWidth, 50); 166 preferredWidth = Math.max(preferredWidth, 50);
167 // Position relative to main DevTools element. 167 // Position relative to main DevTools element.
168 const container = UI.Dialog.modalHostView().element; 168 const container = UI.GlassPane.container(/** @type {!Document} */ (this._con tainerElement.ownerDocument));
169 const totalWidth = container.offsetWidth; 169 const totalWidth = container.offsetWidth;
170 const totalHeight = container.offsetHeight; 170 const totalHeight = container.offsetHeight;
171 171
172 var anchorBox = anchorElement instanceof AnchorBox ? anchorElement : anchorE lement.boxInWindow(window); 172 var anchorBox = anchorElement instanceof AnchorBox ? anchorElement : anchorE lement.boxInWindow(window);
173 anchorBox = anchorBox.relativeToElement(container); 173 anchorBox = anchorBox.relativeToElement(container);
174 var newElementPosition = {x: 0, y: 0, width: preferredWidth + scrollerWidth, height: preferredHeight}; 174 var newElementPosition = {x: 0, y: 0, width: preferredWidth + scrollerWidth, height: preferredHeight};
175 175
176 var verticalAlignment; 176 var verticalAlignment;
177 var roomAbove = anchorBox.y; 177 var roomAbove = anchorBox.y;
178 var roomBelow = totalHeight - anchorBox.y - anchorBox.height; 178 var roomBelow = totalHeight - anchorBox.y - anchorBox.height;
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 this._resetHoverTimer(); 404 this._resetHoverTimer();
405 } 405 }
406 } 406 }
407 }; 407 };
408 408
409 /** @enum {string} */ 409 /** @enum {string} */
410 UI.Popover.Orientation = { 410 UI.Popover.Orientation = {
411 Top: 'top', 411 Top: 'top',
412 Bottom: 'bottom' 412 Bottom: 'bottom'
413 }; 413 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698