OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2015 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2015 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 | 7 |
8 <link rel="import" href="/tracing/base/base.html"> | 8 <link rel="import" href="/tracing/base/base.html"> |
9 | 9 |
10 <dom-module id='tr-ui-b-dropdown'> | 10 <dom-module id='tr-ui-b-dropdown'> |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 if (!this.isOpen) | 111 if (!this.isOpen) |
112 this.show(); | 112 this.show(); |
113 else | 113 else |
114 this.close(); | 114 this.close(); |
115 }, | 115 }, |
116 | 116 |
117 show: function() { | 117 show: function() { |
118 if (this.isOpen) | 118 if (this.isOpen) |
119 return; | 119 return; |
120 | 120 |
121 this.$.outer.classList.add('open'); | 121 Polymer.dom(this.$.outer).classList.add('open'); |
122 | 122 |
123 var ddr = this.$.outer.getBoundingClientRect(); | 123 var ddr = this.$.outer.getBoundingClientRect(); |
124 var rW = Math.max(ddr.width, 150); | 124 var rW = Math.max(ddr.width, 150); |
125 this.$.dialog.style.minWidth = rW + 'px'; | 125 this.$.dialog.style.minWidth = rW + 'px'; |
126 this.$.dialog.showModal(); | 126 this.$.dialog.showModal(); |
127 | 127 |
128 var ddw = this.$.outer.getBoundingClientRect().width; | 128 var ddw = this.$.outer.getBoundingClientRect().width; |
129 var w = this.$.dialog.getBoundingClientRect().width; | 129 var w = this.$.dialog.getBoundingClientRect().width; |
130 this.$.dialog.style.top = ddr.bottom - 1 + 'px'; | 130 this.$.dialog.style.top = ddr.bottom - 1 + 'px'; |
131 this.$.dialog.style.left = ddr.left + 'px'; | 131 this.$.dialog.style.left = ddr.left + 'px'; |
(...skipping 10 matching lines...) Expand all Loading... |
142 | 142 |
143 onDialogCancel_: function(e) { | 143 onDialogCancel_: function(e) { |
144 e.preventDefault(); | 144 e.preventDefault(); |
145 this.close(); | 145 this.close(); |
146 }, | 146 }, |
147 | 147 |
148 close: function() { | 148 close: function() { |
149 if (!this.isOpen) | 149 if (!this.isOpen) |
150 return; | 150 return; |
151 this.$.dialog.close(); | 151 this.$.dialog.close(); |
152 this.$.outer.classList.remove('open'); | 152 Polymer.dom(this.$.outer).classList.remove('open'); |
153 this.$.outer.focus(); | 153 this.$.outer.focus(); |
154 }, | 154 }, |
155 | 155 |
156 get isOpen() { | 156 get isOpen() { |
157 return this.$.dialog.hasAttribute('open'); | 157 return this.$.dialog.hasAttribute('open'); |
158 } | 158 } |
159 }); | 159 }); |
160 </script> | 160 </script> |
OLD | NEW |