| OLD | NEW |
| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @extends {WebInspector.View} | 33 * @extends {WebInspector.View} |
| 34 * @param {!WebInspector.PopoverHelper=} popoverHelper | 34 * @param {!WebInspector.PopoverHelper=} popoverHelper |
| 35 */ | 35 */ |
| 36 WebInspector.Popover = function(popoverHelper) | 36 WebInspector.Popover = function(popoverHelper) |
| 37 { | 37 { |
| 38 WebInspector.View.call(this); | 38 WebInspector.View.call(this); |
| 39 this.markAsRoot(); | 39 this.markAsRoot(); |
| 40 this.element.className = "popover custom-popup-vertical-scroll custom-popup-
horizontal-scroll"; // Override | 40 this.element.className = WebInspector.Popover._classNamePrefix; // Override |
| 41 this._containerElement = document.createElementWithClass("div", "fill popove
r-container"); | 41 this._containerElement = document.createElementWithClass("div", "fill popove
r-container"); |
| 42 | 42 |
| 43 this._popupArrowElement = this.element.createChild("div", "arrow"); | 43 this._popupArrowElement = this.element.createChild("div", "arrow"); |
| 44 this._contentDiv = this.element.createChild("div", "content"); | 44 this._contentDiv = this.element.createChild("div", "content"); |
| 45 | 45 |
| 46 this._popoverHelper = popoverHelper; | 46 this._popoverHelper = popoverHelper; |
| 47 this._hideBound = this.hide.bind(this); | 47 this._hideBound = this.hide.bind(this); |
| 48 } | 48 } |
| 49 | 49 |
| 50 WebInspector.Popover._classNamePrefix = "popover component-root custom-popup-ver
tical-scroll custom-popup-horizontal-scroll"; |
| 51 |
| 50 WebInspector.Popover.prototype = { | 52 WebInspector.Popover.prototype = { |
| 51 /** | 53 /** |
| 52 * @param {!Element} element | 54 * @param {!Element} element |
| 53 * @param {!Element|!AnchorBox} anchor | 55 * @param {!Element|!AnchorBox} anchor |
| 54 * @param {?number=} preferredWidth | 56 * @param {?number=} preferredWidth |
| 55 * @param {?number=} preferredHeight | 57 * @param {?number=} preferredHeight |
| 56 * @param {?WebInspector.Popover.Orientation=} arrowDirection | 58 * @param {?WebInspector.Popover.Orientation=} arrowDirection |
| 57 */ | 59 */ |
| 58 show: function(element, anchor, preferredWidth, preferredHeight, arrowDirect
ion) | 60 show: function(element, anchor, preferredWidth, preferredHeight, arrowDirect
ion) |
| 59 { | 61 { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 newElementPosition.width = totalWidth - borderRadius * 2; | 213 newElementPosition.width = totalWidth - borderRadius * 2; |
| 212 newElementPosition.height += scrollerWidth; | 214 newElementPosition.height += scrollerWidth; |
| 213 horizontalAlignment = "left"; | 215 horizontalAlignment = "left"; |
| 214 if (verticalAlignment === WebInspector.Popover.Orientation.Bottom) | 216 if (verticalAlignment === WebInspector.Popover.Orientation.Bottom) |
| 215 newElementPosition.y -= scrollerWidth; | 217 newElementPosition.y -= scrollerWidth; |
| 216 // Position arrow accurately. | 218 // Position arrow accurately. |
| 217 this._popupArrowElement.style.left = Math.max(0, anchorBox.x - borde
rRadius * 2 - arrowOffset) + "px"; | 219 this._popupArrowElement.style.left = Math.max(0, anchorBox.x - borde
rRadius * 2 - arrowOffset) + "px"; |
| 218 this._popupArrowElement.style.left += anchorBox.width / 2; | 220 this._popupArrowElement.style.left += anchorBox.width / 2; |
| 219 } | 221 } |
| 220 | 222 |
| 221 this.element.className = "popover custom-popup-vertical-scroll custom-po
pup-horizontal-scroll " + verticalAlignment + "-" + horizontalAlignment + "-arro
w"; | 223 this.element.className = WebInspector.Popover._classNamePrefix + " " + v
erticalAlignment + "-" + horizontalAlignment + "-arrow"; |
| 222 this.element.positionAt(newElementPosition.x - borderWidth, newElementPo
sition.y - borderWidth, container); | 224 this.element.positionAt(newElementPosition.x - borderWidth, newElementPo
sition.y - borderWidth, container); |
| 223 this.element.style.width = newElementPosition.width + borderWidth * 2 +
"px"; | 225 this.element.style.width = newElementPosition.width + borderWidth * 2 +
"px"; |
| 224 this.element.style.height = newElementPosition.height + borderWidth * 2
+ "px"; | 226 this.element.style.height = newElementPosition.height + borderWidth * 2
+ "px"; |
| 225 }, | 227 }, |
| 226 | 228 |
| 227 __proto__: WebInspector.View.prototype | 229 __proto__: WebInspector.View.prototype |
| 228 } | 230 } |
| 229 | 231 |
| 230 /** | 232 /** |
| 231 * @constructor | 233 * @constructor |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 this._resetHoverTimer(); | 397 this._resetHoverTimer(); |
| 396 } | 398 } |
| 397 } | 399 } |
| 398 } | 400 } |
| 399 | 401 |
| 400 /** @enum {string} */ | 402 /** @enum {string} */ |
| 401 WebInspector.Popover.Orientation = { | 403 WebInspector.Popover.Orientation = { |
| 402 Top: "top", | 404 Top: "top", |
| 403 Bottom: "bottom" | 405 Bottom: "bottom" |
| 404 } | 406 } |
| OLD | NEW |