| 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/extras/tquery/tquery.html"> | 8 <link rel="import" href="/tracing/extras/tquery/tquery.html"> | 
| 9 | 9 | 
| 10 <dom-module id='tr-ui-scripting-control'> | 10 <dom-module id='tr-ui-scripting-control'> | 
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 80 | 80 | 
| 81   _isEnterKey: function(event) { | 81   _isEnterKey: function(event) { | 
| 82     // Check if in IME. | 82     // Check if in IME. | 
| 83     return event.keyCode !== 229 && event.keyIdentifier === 'Enter'; | 83     return event.keyCode !== 229 && event.keyIdentifier === 'Enter'; | 
| 84   }, | 84   }, | 
| 85 | 85 | 
| 86   _setFocused: function(focused) { | 86   _setFocused: function(focused) { | 
| 87     var promptEl = this.$.prompt; | 87     var promptEl = this.$.prompt; | 
| 88     if (focused) { | 88     if (focused) { | 
| 89       promptEl.focus(); | 89       promptEl.focus(); | 
| 90       this.$.root.classList.add('focused'); | 90       Polymer.dom(this.$.root).classList.add('focused'); | 
| 91       // Move cursor to the end of any existing text. | 91       // Move cursor to the end of any existing text. | 
| 92       if (promptEl.innerText.length > 0) { | 92       if (promptEl.innerText.length > 0) { | 
| 93         var sel = window.getSelection(); | 93         var sel = window.getSelection(); | 
| 94         sel.collapse(promptEl.firstChild, promptEl.innerText.length); | 94         sel.collapse( | 
|  | 95             Polymer.dom(promptEl).firstChild, promptEl.innerText.length); | 
| 95       } | 96       } | 
| 96     } else { | 97     } else { | 
| 97       promptEl.blur(); | 98       promptEl.blur(); | 
| 98       this.$.root.classList.remove('focused'); | 99       Polymer.dom(this.$.root).classList.remove('focused'); | 
| 99       // Workaround for crbug.com/89026 to ensure the prompt doesn't retain | 100       // Workaround for crbug.com/89026 to ensure the prompt doesn't retain | 
| 100       // keyboard focus. | 101       // keyboard focus. | 
| 101       var parent = promptEl.parentElement; | 102       var parent = promptEl.parentElement; | 
| 102       var nextEl = promptEl.nextSibling; | 103       var nextEl = Polymer.dom(promptEl).nextSibling; | 
| 103       promptEl.remove(); | 104       promptEl.remove(); | 
| 104       Polymer.dom(parent).insertBefore(promptEl, nextEl); | 105       Polymer.dom(parent).insertBefore(promptEl, nextEl); | 
| 105     } | 106     } | 
| 106   }, | 107   }, | 
| 107 | 108 | 
| 108   onConsoleFocus: function(e) { | 109   onConsoleFocus: function(e) { | 
| 109     e.stopPropagation(); | 110     e.stopPropagation(); | 
| 110     this._setFocused(true); | 111     this._setFocused(true); | 
| 111   }, | 112   }, | 
| 112 | 113 | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 153     historyEl.innerText += line; | 154     historyEl.innerText += line; | 
| 154   }, | 155   }, | 
| 155 | 156 | 
| 156   promptKeyPress: function(e) { | 157   promptKeyPress: function(e) { | 
| 157     e.stopPropagation(); | 158     e.stopPropagation(); | 
| 158   }, | 159   }, | 
| 159 | 160 | 
| 160   toggleVisibility: function() { | 161   toggleVisibility: function() { | 
| 161     var root = this.$.root; | 162     var root = this.$.root; | 
| 162     if (!this.visible) { | 163     if (!this.visible) { | 
| 163       root.classList.remove('hidden'); | 164       Polymer.dom(root).classList.remove('hidden'); | 
| 164       this._setFocused(true); | 165       this._setFocused(true); | 
| 165     } else { | 166     } else { | 
| 166       root.classList.add('hidden'); | 167       Polymer.dom(root).classList.add('hidden'); | 
| 167       this._setFocused(false); | 168       this._setFocused(false); | 
| 168     } | 169     } | 
| 169   }, | 170   }, | 
| 170 | 171 | 
| 171   get hasFocus() { | 172   get hasFocus() { | 
| 172     return this === document.activeElement; | 173     return this === document.activeElement; | 
| 173   }, | 174   }, | 
| 174 | 175 | 
| 175   get visible() { | 176   get visible() { | 
| 176     var root = this.$.root; | 177     var root = this.$.root; | 
| 177     return !root.classList.contains('hidden'); | 178     return !Polymer.dom(root).classList.contains('hidden'); | 
| 178   }, | 179   }, | 
| 179 | 180 | 
| 180   get controller() { | 181   get controller() { | 
| 181     return this.controller_; | 182     return this.controller_; | 
| 182   }, | 183   }, | 
| 183 | 184 | 
| 184   set controller(c) { | 185   set controller(c) { | 
| 185     this.controller_ = c; | 186     this.controller_ = c; | 
| 186   } | 187   } | 
| 187 }); | 188 }); | 
| 188 </script> | 189 </script> | 
| OLD | NEW | 
|---|