Fix OOP <webview> resize and autosize.
[chromium-blink-merge.git] / third_party / polymer / v1_0 / components-chromium / iron-overlay-behavior / iron-overlay-backdrop-extracted.js
blobfe361638065910b1b1eddd3dfc66838211648514
1 (function() {
3 Polymer({
5 is: 'iron-overlay-backdrop',
7 properties: {
9 /**
10 * Returns true if the backdrop is opened.
12 opened: {
13 readOnly: true,
14 reflectToAttribute: true,
15 type: Boolean,
16 value: false
19 _manager: {
20 type: Object,
21 value: Polymer.IronOverlayManager
26 /**
27 * Appends the backdrop to document body and sets its `z-index` to be below the latest overlay.
29 prepare: function() {
30 if (!this.parentNode) {
31 Polymer.dom(document.body).appendChild(this);
32 this.style.zIndex = this._manager.currentOverlayZ() - 1;
36 /**
37 * Shows the backdrop if needed.
39 open: function() {
40 // only need to make the backdrop visible if this is called by the first overlay with a backdrop
41 if (this._manager.getBackdrops().length < 2) {
42 this._setOpened(true);
46 /**
47 * Hides the backdrop if needed.
49 close: function() {
50 // only need to make the backdrop invisible if this is called by the last overlay with a backdrop
51 if (this._manager.getBackdrops().length < 2) {
52 this._setOpened(false);
56 /**
57 * Removes the backdrop from document body if needed.
59 complete: function() {
60 // only remove the backdrop if there are no more overlays with backdrops
61 if (this._manager.getBackdrops().length === 0 && this.parentNode) {
62 Polymer.dom(this.parentNode).removeChild(this);
66 });
68 })();