Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 cr.define('settings', function() { | |
|
stevenjb
2016/09/26 22:52:00
Optional: It seems like this might be generally us
dpapad
2016/09/26 23:04:32
Prefer to wait until the 2nd client of this class
| |
| 6 /** | |
| 7 * The max z index assigned to an <iron-list> item so far. Used to | |
| 8 * ensure that the per-item popup menu is displayed correctly. | |
| 9 * @type {number} | |
| 10 */ | |
| 11 var maxZIndex = 0; | |
|
stevenjb
2016/09/26 22:52:00
nit: maxZIndex_ since it's private
dpapad
2016/09/26 23:04:32
Done.
| |
| 12 | |
| 13 var ListItemBehavior = { | |
| 14 showActionMenu: function() { | |
| 15 // <iron-list> applies translate3d() transform on every element, which | |
| 16 // means that in the natural order the (n-1)-th element is at a lower z | |
| 17 // index than the n-th element. This prevents the popup menu from being | |
| 18 // painted on top of other elements, and therefore a zIndex adjustment is | |
| 19 // necessary. | |
| 20 this.style.zIndex = ++maxZIndex; | |
| 21 }, | |
| 22 }; | |
| 23 | |
| 24 return { | |
| 25 ListItemBehavior: ListItemBehavior, | |
| 26 }; | |
| 27 }); | |
| OLD | NEW |