OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 this._overlay.setLeftOffset(anchorBox.x); | 119 this._overlay.setLeftOffset(anchorBox.x); |
120 | 120 |
121 var under = underHeight >= aboveHeight; | 121 var under = underHeight >= aboveHeight; |
122 if (under) | 122 if (under) |
123 this._overlay.setVerticalOffset(anchorBox.y + anchorBox.height, true); | 123 this._overlay.setVerticalOffset(anchorBox.y + anchorBox.height, true); |
124 else | 124 else |
125 this._overlay.setVerticalOffset(totalHeight - anchorBox.y, false); | 125 this._overlay.setVerticalOffset(totalHeight - anchorBox.y, false); |
126 | 126 |
127 var spacer = 6; | 127 var spacer = 6; |
128 var maxHeight = Math.min( | 128 var maxHeight = Math.min( |
129 Math.max(underHeight, aboveHeight) - spacer, this._maxItemsHeight ? this
._maxItemsHeight * this._rowHeight : 0); | 129 Math.max(underHeight, aboveHeight) - spacer, |
| 130 this._maxItemsHeight ? this._maxItemsHeight * this._rowHeight : Infinity
); |
130 var height = this._rowHeight * this._items.length; | 131 var height = this._rowHeight * this._items.length; |
131 this._hasVerticalScroll = height > maxHeight; | 132 this._hasVerticalScroll = height > maxHeight; |
132 this._element.style.height = Math.min(maxHeight, height) + 'px'; | 133 this._element.style.height = Math.min(maxHeight, height) + 'px'; |
133 } | 134 } |
134 | 135 |
135 _updateWidth() { | 136 _updateWidth() { |
136 if (this._hasVerticalScroll) { | 137 if (this._hasVerticalScroll) { |
137 this._element.style.width = '100vw'; | 138 this._element.style.width = '100vw'; |
138 return; | 139 return; |
139 } | 140 } |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 this.element.style.left = containerBox.x + 'px'; | 591 this.element.style.left = containerBox.x + 'px'; |
591 this.element.style.top = containerBox.y + 'px'; | 592 this.element.style.top = containerBox.y + 'px'; |
592 this.element.style.height = containerBox.height + 'px'; | 593 this.element.style.height = containerBox.height + 'px'; |
593 this.element.style.width = containerBox.width + 'px'; | 594 this.element.style.width = containerBox.width + 'px'; |
594 } | 595 } |
595 | 596 |
596 dispose() { | 597 dispose() { |
597 this.element.remove(); | 598 this.element.remove(); |
598 } | 599 } |
599 }; | 600 }; |
OLD | NEW |