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

Unified Diff: third_party/polymer/v1_0/components-chromium/iron-overlay-behavior/iron-overlay-manager-extracted.js

Issue 1901343004: [Polymer] update third_party polymer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: new pull Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/polymer/v1_0/components-chromium/iron-overlay-behavior/iron-overlay-manager-extracted.js
diff --git a/third_party/polymer/v1_0/components-chromium/iron-overlay-behavior/iron-overlay-manager-extracted.js b/third_party/polymer/v1_0/components-chromium/iron-overlay-behavior/iron-overlay-manager-extracted.js
index 0b4df854eca328c15dd1681d32136b450989efa0..ac24e62a13506dd2c486b84ac1f5c4743e55d93f 100644
--- a/third_party/polymer/v1_0/components-chromium/iron-overlay-behavior/iron-overlay-manager-extracted.js
+++ b/third_party/polymer/v1_0/components-chromium/iron-overlay-behavior/iron-overlay-manager-extracted.js
@@ -37,7 +37,7 @@
/**
* The shared backdrop element.
- * @type {Element} backdropElement
+ * @type {!Element} backdropElement
*/
get backdropElement() {
if (!this._backdropElement) {
@@ -48,7 +48,7 @@
/**
* The deepest active element.
- * @type {Element} activeElement the active element
+ * @type {!Element} activeElement the active element
*/
get deepActiveElement() {
// document.activeElement can be null
@@ -68,13 +68,17 @@
*/
_bringOverlayAtIndexToFront: function(i) {
var overlay = this._overlays[i];
+ if (!overlay) {
+ return;
+ }
var lastI = this._overlays.length - 1;
+ var currentOverlay = this._overlays[lastI];
// Ensure always-on-top overlay stays on top.
- if (!overlay.alwaysOnTop && this._overlays[lastI].alwaysOnTop) {
+ if (currentOverlay && this._shouldBeBehindOverlay(overlay, currentOverlay)) {
lastI--;
}
// If already the top element, return.
- if (!overlay || i >= lastI) {
+ if (i >= lastI) {
return;
}
// Update z-index to be on top.
@@ -94,7 +98,7 @@
/**
* Adds the overlay and updates its z-index if it's opened, or removes it if it's closed.
* Also updates the backdrop z-index.
- * @param {Element} overlay
+ * @param {!Element} overlay
*/
addOrRemoveOverlay: function(overlay) {
if (overlay.opened) {
@@ -108,7 +112,7 @@
/**
* Tracks overlays for z-index and focus management.
* Ensures the last added overlay with always-on-top remains on top.
- * @param {Element} overlay
+ * @param {!Element} overlay
*/
addOverlay: function(overlay) {
var i = this._overlays.indexOf(overlay);
@@ -122,7 +126,7 @@
var newZ = this._getZ(overlay);
// Ensure always-on-top overlay stays on top.
- if (currentOverlay && currentOverlay.alwaysOnTop && !overlay.alwaysOnTop) {
+ if (currentOverlay && this._shouldBeBehindOverlay(overlay, currentOverlay)) {
// This bumps the z-index of +2.
this._applyOverlayZ(currentOverlay, minimumZ);
insertionIndex--;
@@ -143,7 +147,7 @@
},
/**
- * @param {Element} overlay
+ * @param {!Element} overlay
*/
removeOverlay: function(overlay) {
var i = this._overlays.indexOf(overlay);
@@ -261,7 +265,7 @@
},
/**
- * @param {Element} element
+ * @param {!Element} element
* @param {number|string} z
* @private
*/
@@ -270,7 +274,7 @@
},
/**
- * @param {Element} overlay
+ * @param {!Element} overlay
* @param {number} aboveZ
* @private
*/
@@ -350,6 +354,19 @@
overlay._onCaptureTab(event);
}
}
+ },
+
+ /**
+ * Returns if the overlay1 should be behind overlay2.
+ * @param {!Element} overlay1
+ * @param {!Element} overlay2
+ * @return {boolean}
+ * @private
+ */
+ _shouldBeBehindOverlay: function(overlay1, overlay2) {
+ var o1 = /** @type {?} */ (overlay1);
+ var o2 = /** @type {?} */ (overlay2);
+ return !o1.alwaysOnTop && o2.alwaysOnTop;
}
};

Powered by Google App Engine
This is Rietveld 408576698