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

Side by Side Diff: appengine/chromium_rietveld/new_static/components/cr-dialog.html

Issue 1001723003: Create a common directory of widgets and css. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!-- Copyright (c) 2014 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 <link rel="import" href="cr-dialog-backdrop.html">
6 <link rel="import" href="cr-keyboard.html">
7
8 <polymer-element name="cr-dialog" extends="dialog">
9 <template>
10 <style>
11 :host(.polyfill) {
12 position: absolute;
13 top: 100px;
14 left: 0;
15 right: 0;
16 width: -webkit-fit-content;
17 height: -webkit-fit-content;
18 margin: auto;
19 background: white;
20 z-index: 100;
21 }
22
23 :host(.polyfill:not([open])) {
24 display: none;
25 }
26 </style>
27 <content></content>
28 <template if="{{ polyfill && open }}">
29 <cr-keyboard on-key-escape="{{ fireCancelEvent }}"></cr-keyboard>
30 </template>
31 </template>
32 <script>
33 (function() {
34 var backdrop = document.createElement("cr-dialog-backdrop");
35 Polymer("cr-dialog", {
36 created: function() {
37 if (window.HTMLDialogElement)
38 return;
39 this.classList.add("polyfill");
40 this.showModal = function() {
41 this.open = true;
42 this.setAttribute("open", "");
43 document.body.appendChild(backdrop);
44 this.async(function() {
45 // Focus the first input.
46 var input = this.querySelector("input, textarea, * /deep / input, * /deep/ textarea");
47 if (input)
48 input.focus();
49 });
50 };
51 this.close = function() {
52 if (!this.open)
53 return;
54 this.removeAttribute("open");
55 backdrop.remove();
56 };
57 this.fireCancelEvent = function(event) {
58 event.preventDefault();
59 if (!this.fire("cancel").defaultPrevented)
60 this.close();
61 };
62 },
63 });
64 })();
65 </script>
66 </ploymer-element>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698