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

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

Issue 2422413002: DevTools: popovers use padding instead of margin (Closed)
Patch Set: Created 4 years, 2 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 /** 140 /**
141 * @param {boolean} canShrink 141 * @param {boolean} canShrink
142 */ 142 */
143 setCanShrink: function(canShrink) 143 setCanShrink: function(canShrink)
144 { 144 {
145 this._hasFixedHeight = !canShrink; 145 this._hasFixedHeight = !canShrink;
146 this._contentDiv.classList.toggle("fixed-height", this._hasFixedHeight); 146 this._contentDiv.classList.toggle("fixed-height", this._hasFixedHeight);
147 }, 147 },
148 148
149 /** 149 /**
150 * @param {boolean} noMargins 150 * @param {boolean} noPadding
151 */ 151 */
152 setNoMargins: function(noMargins) 152 setNoPadding: function(noPadding)
153 { 153 {
154 this._hasNoMargins = noMargins; 154 this._hasNoPadding = noPadding;
155 this._contentDiv.classList.toggle("no-margin", this._hasNoMargins); 155 this._contentDiv.classList.toggle("no-padding", this._hasNoPadding);
156 }, 156 },
157 157
158 /** 158 /**
159 * @param {!Element|!AnchorBox} anchorElement 159 * @param {!Element|!AnchorBox} anchorElement
160 * @param {number=} preferredWidth 160 * @param {number=} preferredWidth
161 * @param {number=} preferredHeight 161 * @param {number=} preferredHeight
162 * @param {?WebInspector.Popover.Orientation=} arrowDirection 162 * @param {?WebInspector.Popover.Orientation=} arrowDirection
163 */ 163 */
164 positionElement: function(anchorElement, preferredWidth, preferredHeight, ar rowDirection) 164 positionElement: function(anchorElement, preferredWidth, preferredHeight, ar rowDirection)
165 { 165 {
166 const borderWidth = this._hasNoMargins ? 0 : 8; 166 const borderWidth = this._hasNoPadding ? 0 : 8;
167 const scrollerWidth = this._hasFixedHeight ? 0 : 14; 167 const scrollerWidth = this._hasFixedHeight ? 0 : 14;
168 const arrowHeight = this._hasNoMargins ? 8 : 15; 168 const arrowHeight = this._hasNoPadding ? 8 : 15;
169 const arrowOffset = 10; 169 const arrowOffset = 10;
170 const borderRadius = 4; 170 const borderRadius = 4;
171 const arrowRadius = 6; 171 const arrowRadius = 6;
172 preferredWidth = preferredWidth || this._preferredWidth; 172 preferredWidth = preferredWidth || this._preferredWidth;
173 preferredHeight = preferredHeight || this._preferredHeight; 173 preferredHeight = preferredHeight || this._preferredHeight;
174 174
175 // Skinny tooltips are not pretty, their arrow location is not nice. 175 // Skinny tooltips are not pretty, their arrow location is not nice.
176 preferredWidth = Math.max(preferredWidth, 50); 176 preferredWidth = Math.max(preferredWidth, 50);
177 // Position relative to main DevTools element. 177 // Position relative to main DevTools element.
178 const container = WebInspector.Dialog.modalHostView().element; 178 const container = WebInspector.Dialog.modalHostView().element;
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 this._resetHoverTimer(); 418 this._resetHoverTimer();
419 } 419 }
420 } 420 }
421 } 421 }
422 422
423 /** @enum {string} */ 423 /** @enum {string} */
424 WebInspector.Popover.Orientation = { 424 WebInspector.Popover.Orientation = {
425 Top: "top", 425 Top: "top",
426 Bottom: "bottom" 426 Bottom: "bottom"
427 } 427 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698