| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 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 | 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 WebInspector.ElementsSidebarPane = class extends WebInspector.VBox { | 7 Elements.ElementsSidebarPane = class extends UI.VBox { |
| 8 constructor() { | 8 constructor() { |
| 9 super(); | 9 super(); |
| 10 this.element.classList.add('flex-none'); | 10 this.element.classList.add('flex-none'); |
| 11 this._computedStyleModel = new WebInspector.ComputedStyleModel(); | 11 this._computedStyleModel = new Elements.ComputedStyleModel(); |
| 12 this._computedStyleModel.addEventListener( | 12 this._computedStyleModel.addEventListener( |
| 13 WebInspector.ComputedStyleModel.Events.ComputedStyleChanged, this.onCSSM
odelChanged, this); | 13 Elements.ComputedStyleModel.Events.ComputedStyleChanged, this.onCSSModel
Changed, this); |
| 14 | 14 |
| 15 this._updateThrottler = new WebInspector.Throttler(100); | 15 this._updateThrottler = new Common.Throttler(100); |
| 16 this._updateWhenVisible = false; | 16 this._updateWhenVisible = false; |
| 17 } | 17 } |
| 18 | 18 |
| 19 /** | 19 /** |
| 20 * @return {?WebInspector.DOMNode} | 20 * @return {?SDK.DOMNode} |
| 21 */ | 21 */ |
| 22 node() { | 22 node() { |
| 23 return this._computedStyleModel.node(); | 23 return this._computedStyleModel.node(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * @return {?WebInspector.CSSModel} | 27 * @return {?SDK.CSSModel} |
| 28 */ | 28 */ |
| 29 cssModel() { | 29 cssModel() { |
| 30 return this._computedStyleModel.cssModel(); | 30 return this._computedStyleModel.cssModel(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 /** | 33 /** |
| 34 * @protected | 34 * @protected |
| 35 * @return {!Promise.<?>} | 35 * @return {!Promise.<?>} |
| 36 */ | 36 */ |
| 37 doUpdate() { | 37 doUpdate() { |
| 38 return Promise.resolve(); | 38 return Promise.resolve(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 update() { | 41 update() { |
| 42 this._updateWhenVisible = !this.isShowing(); | 42 this._updateWhenVisible = !this.isShowing(); |
| 43 if (this._updateWhenVisible) | 43 if (this._updateWhenVisible) |
| 44 return; | 44 return; |
| 45 this._updateThrottler.schedule(innerUpdate.bind(this)); | 45 this._updateThrottler.schedule(innerUpdate.bind(this)); |
| 46 | 46 |
| 47 /** | 47 /** |
| 48 * @return {!Promise.<?>} | 48 * @return {!Promise.<?>} |
| 49 * @this {WebInspector.ElementsSidebarPane} | 49 * @this {Elements.ElementsSidebarPane} |
| 50 */ | 50 */ |
| 51 function innerUpdate() { | 51 function innerUpdate() { |
| 52 return this.isShowing() ? this.doUpdate() : Promise.resolve(); | 52 return this.isShowing() ? this.doUpdate() : Promise.resolve(); |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 | 55 |
| 56 /** | 56 /** |
| 57 * @override | 57 * @override |
| 58 */ | 58 */ |
| 59 wasShown() { | 59 wasShown() { |
| 60 super.wasShown(); | 60 super.wasShown(); |
| 61 if (this._updateWhenVisible) | 61 if (this._updateWhenVisible) |
| 62 this.update(); | 62 this.update(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 /** | 65 /** |
| 66 * @param {!WebInspector.Event} event | 66 * @param {!Common.Event} event |
| 67 */ | 67 */ |
| 68 onCSSModelChanged(event) { | 68 onCSSModelChanged(event) { |
| 69 } | 69 } |
| 70 }; | 70 }; |
| OLD | NEW |