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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 const borderRadius = 10; | 87 const borderRadius = 10; |
88 | 88 |
89 // Skinny tooltips are not pretty, their arrow location is not nice. | 89 // Skinny tooltips are not pretty, their arrow location is not nice. |
90 preferredWidth = Math.max(preferredWidth, 50); | 90 preferredWidth = Math.max(preferredWidth, 50); |
91 const totalWidth = window.innerWidth; | 91 const totalWidth = window.innerWidth; |
92 const totalHeight = window.innerHeight; | 92 const totalHeight = window.innerHeight; |
93 | 93 |
94 var anchorBox = anchorElement.offsetRelativeToWindow(window); | 94 var anchorBox = anchorElement.offsetRelativeToWindow(window); |
95 anchorBox.width = anchorElement.offsetWidth; | 95 anchorBox.width = anchorElement.offsetWidth; |
96 anchorBox.height = anchorElement.offsetHeight; | 96 anchorBox.height = anchorElement.offsetHeight; |
97 while (anchorElement !== anchorElement.ownerDocument.body) { | 97 while (anchorElement && anchorElement !== anchorElement.ownerDocument.bo
dy) { |
98 if (anchorElement.scrollLeft) | 98 if (anchorElement.scrollLeft) |
99 anchorBox.x -= anchorElement.scrollLeft; | 99 anchorBox.x -= anchorElement.scrollLeft; |
100 if (anchorElement.scrollTop) | 100 if (anchorElement.scrollTop) |
101 anchorBox.y -= anchorElement.scrollTop; | 101 anchorBox.y -= anchorElement.scrollTop; |
102 anchorElement = anchorElement.parentElement; | 102 anchorElement = anchorElement.parentElement; |
103 } | 103 } |
104 | 104 |
105 var newElementPosition = { x: 0, y: 0, width: preferredWidth + scrollerW
idth, height: preferredHeight }; | 105 var newElementPosition = { x: 0, y: 0, width: preferredWidth + scrollerW
idth, height: preferredHeight }; |
106 | 106 |
107 var verticalAlignment; | 107 var verticalAlignment; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 if (this._hidePopupTimer) { | 252 if (this._hidePopupTimer) { |
253 clearTimeout(this._hidePopupTimer); | 253 clearTimeout(this._hidePopupTimer); |
254 delete this._hidePopupTimer; | 254 delete this._hidePopupTimer; |
255 | 255 |
256 // We know that we reached the popup, but we might have moved over o
ther elements. | 256 // We know that we reached the popup, but we might have moved over o
ther elements. |
257 // Discard pending command. | 257 // Discard pending command. |
258 this._resetHoverTimer(); | 258 this._resetHoverTimer(); |
259 } | 259 } |
260 } | 260 } |
261 } | 261 } |
OLD | NEW |