ApplicationImpl cleanup, part 1:
[chromium-blink-merge.git] / third_party / polymer / v1_0 / components-chromium / iron-overlay-behavior / iron-overlay-backdrop-extracted.js
blobf3fd930bb916b4a6e5f81d9c7042f63d64e6de40
3 (function() {
5 Polymer({
7 is: 'iron-overlay-backdrop',
9 properties: {
11 /**
12 * Returns true if the backdrop is opened.
14 opened: {
15 readOnly: true,
16 reflectToAttribute: true,
17 type: Boolean,
18 value: false
21 _manager: {
22 type: Object,
23 value: Polymer.IronOverlayManager
28 /**
29 * Appends the backdrop to document body and sets its `z-index` to be below the latest overlay.
31 prepare: function() {
32 if (!this.parentNode) {
33 Polymer.dom(document.body).appendChild(this);
34 this.style.zIndex = this._manager.currentOverlayZ() - 1;
38 /**
39 * Shows the backdrop if needed.
41 open: function() {
42 // only need to make the backdrop visible if this is called by the first overlay with a backdrop
43 if (this._manager.getBackdrops().length < 2) {
44 this._setOpened(true);
48 /**
49 * Hides the backdrop if needed.
51 close: function() {
52 // only need to make the backdrop invisible if this is called by the last overlay with a backdrop
53 if (this._manager.getBackdrops().length < 2) {
54 this._setOpened(false);
58 /**
59 * Removes the backdrop from document body if needed.
61 complete: function() {
62 // only remove the backdrop if there are no more overlays with backdrops
63 if (this._manager.getBackdrops().length === 0 && this.parentNode) {
64 Polymer.dom(this.parentNode).removeChild(this);
68 });
70 })();