| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 /** | 4 /** |
| 5 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 Elements.ClassesPaneWidget = class extends UI.Widget { | 7 Elements.ClassesPaneWidget = class extends UI.Widget { |
| 8 constructor() { | 8 constructor() { |
| 9 super(); | 9 super(); |
| 10 this.element.className = 'styles-element-classes-pane'; | 10 this.element.className = 'styles-element-classes-pane'; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 /** | 178 /** |
| 179 * @implements {UI.ToolbarItem.Provider} | 179 * @implements {UI.ToolbarItem.Provider} |
| 180 * @unrestricted | 180 * @unrestricted |
| 181 */ | 181 */ |
| 182 Elements.ClassesPaneWidget.ButtonProvider = class { | 182 Elements.ClassesPaneWidget.ButtonProvider = class { |
| 183 constructor() { | 183 constructor() { |
| 184 this._button = new UI.ToolbarToggle(Common.UIString('Element Classes'), ''); | 184 this._button = new UI.ToolbarToggle(Common.UIString('Element Classes'), ''); |
| 185 this._button.setText('.cls'); | 185 this._button.setText('.cls'); |
| 186 this._button.element.classList.add('monospace'); | 186 this._button.element.classList.add('monospace'); |
| 187 this._button.addEventListener(UI.ToolbarButton.Events.Click, this._clicked,
this); | 187 this._button.addEventListener('click', this._clicked, this); |
| 188 this._view = new Elements.ClassesPaneWidget(); | 188 this._view = new Elements.ClassesPaneWidget(); |
| 189 } | 189 } |
| 190 | 190 |
| 191 _clicked() { | 191 _clicked() { |
| 192 Elements.ElementsPanel.instance().showToolbarPane(!this._view.isShowing() ?
this._view : null, this._button); | 192 Elements.ElementsPanel.instance().showToolbarPane(!this._view.isShowing() ?
this._view : null, this._button); |
| 193 } | 193 } |
| 194 | 194 |
| 195 /** | 195 /** |
| 196 * @override | 196 * @override |
| 197 * @return {!UI.ToolbarItem} | 197 * @return {!UI.ToolbarItem} |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 if (!this._classNamesPromise || this._selectedFrameId !== selectedNode.frame
Id()) | 255 if (!this._classNamesPromise || this._selectedFrameId !== selectedNode.frame
Id()) |
| 256 this._classNamesPromise = this._getClassNames(selectedNode); | 256 this._classNamesPromise = this._getClassNames(selectedNode); |
| 257 | 257 |
| 258 return this._classNamesPromise.then(completions => { | 258 return this._classNamesPromise.then(completions => { |
| 259 if (prefix[0] === '.') | 259 if (prefix[0] === '.') |
| 260 completions = completions.map(value => '.' + value); | 260 completions = completions.map(value => '.' + value); |
| 261 return completions.filter(value => value.startsWith(prefix)).map(completio
n => ({title: completion})); | 261 return completions.filter(value => value.startsWith(prefix)).map(completio
n => ({title: completion})); |
| 262 }); | 262 }); |
| 263 } | 263 } |
| 264 }; | 264 }; |
| OLD | NEW |