Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / third_party / polymer / v1_0 / components / iron-overlay-behavior / iron-overlay-backdrop.html
blob5682c285057815b2582abf0157f9f3365bc25c6c
1 <!--
2 @license
3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4 This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
7 Code distributed by Google as part of the polymer project is also
8 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9 -->
11 <link rel="import" href="../polymer/polymer.html">
12 <link rel="import" href="iron-overlay-manager.html">
14 <!--
15 `iron-overlay-backdrop` is a backdrop used by `Polymer.IronOverlayBehavior`. It should be a
16 singleton.
18 ### Styling
20 The following custom properties and mixins are available for styling.
22 Custom property | Description | Default
23 -------------------------------------------|------------------------|---------
24 `--iron-overlay-backdrop-background-color` | Backdrop background color | #000
25 `--iron-overlay-backdrop-opacity` | Backdrop opacity | 0.6
26 `--iron-overlay-backdrop` | Mixin applied to `iron-overlay-backdrop`. | {}
27 `--iron-overlay-backdrop-opened` | Mixin applied to `iron-overlay-backdrop` when it is displayed | {}
28 -->
30 <dom-module id="iron-overlay-backdrop">
32 <style>
34 :host {
35 position: fixed;
36 top: 0;
37 left: 0;
38 width: 100vw;
39 height: 100vh;
40 background-color: var(--iron-overlay-backdrop-background-color, #000);
41 opacity: 0;
42 transition: opacity 0.2s;
44 @apply(--iron-overlay-backdrop);
47 :host([opened]) {
48 opacity: var(--iron-overlay-backdrop-opacity, 0.6);
50 @apply(--iron-overlay-backdrop-opened);
53 </style>
55 <template>
56 <content></content>
57 </template>
59 </dom-module>
61 <script>
63 (function() {
65 Polymer({
67 is: 'iron-overlay-backdrop',
69 properties: {
71 /**
72 * Returns true if the backdrop is opened.
74 opened: {
75 readOnly: true,
76 reflectToAttribute: true,
77 type: Boolean,
78 value: false
81 _manager: {
82 type: Object,
83 value: Polymer.IronOverlayManager
88 /**
89 * Appends the backdrop to document body and sets its `z-index` to be below the latest overlay.
91 prepare: function() {
92 if (!this.parentNode) {
93 Polymer.dom(document.body).appendChild(this);
94 this.style.zIndex = this._manager.currentOverlayZ() - 1;
98 /**
99 * Shows the backdrop if needed.
101 open: function() {
102 // only need to make the backdrop visible if this is called by the first overlay with a backdrop
103 if (this._manager.getBackdrops().length < 2) {
104 this._setOpened(true);
109 * Hides the backdrop if needed.
111 close: function() {
112 // only need to make the backdrop invisible if this is called by the last overlay with a backdrop
113 if (this._manager.getBackdrops().length < 2) {
114 this._setOpened(false);
119 * Removes the backdrop from document body if needed.
121 complete: function() {
122 // only remove the backdrop if there are no more overlays with backdrops
123 if (this._manager.getBackdrops().length === 0 && this.parentNode) {
124 Polymer.dom(this.parentNode).removeChild(this);
130 })();
132 </script>