| 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 /** | 5 /** |
| 6 * @extends {WebInspector.Object} | 6 * @extends {WebInspector.Object} |
| 7 * @constructor | 7 * @constructor |
| 8 */ | 8 */ |
| 9 WebInspector.SharedSidebarModel = function() | 9 WebInspector.SharedSidebarModel = function() |
| 10 { | 10 { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 if (!elementNode || !cssModel) | 106 if (!elementNode || !cssModel) |
| 107 return Promise.resolve(/** @type {?WebInspector.SharedSidebarModel.C
omputedStyle} */(null)); | 107 return Promise.resolve(/** @type {?WebInspector.SharedSidebarModel.C
omputedStyle} */(null)); |
| 108 | 108 |
| 109 if (!this._computedStylePromise) | 109 if (!this._computedStylePromise) |
| 110 this._computedStylePromise = cssModel.computedStylePromise(elementNo
de.id).then(verifyOutdated.bind(this, elementNode)); | 110 this._computedStylePromise = cssModel.computedStylePromise(elementNo
de.id).then(verifyOutdated.bind(this, elementNode)); |
| 111 | 111 |
| 112 return this._computedStylePromise; | 112 return this._computedStylePromise; |
| 113 | 113 |
| 114 /** | 114 /** |
| 115 * @param {!WebInspector.DOMNode} elementNode | 115 * @param {!WebInspector.DOMNode} elementNode |
| 116 * @param {?WebInspector.CSSStyleDeclaration} style | 116 * @param {?Map.<string, string>} style |
| 117 * @return {?WebInspector.SharedSidebarModel.ComputedStyle} | 117 * @return {?WebInspector.SharedSidebarModel.ComputedStyle} |
| 118 * @this {WebInspector.SharedSidebarModel} | 118 * @this {WebInspector.SharedSidebarModel} |
| 119 */ | 119 */ |
| 120 function verifyOutdated(elementNode, style) | 120 function verifyOutdated(elementNode, style) |
| 121 { | 121 { |
| 122 return elementNode === this._elementNode() && style ? new WebInspect
or.SharedSidebarModel.ComputedStyle(elementNode, style) : /** @type {?WebInspect
or.SharedSidebarModel.ComputedStyle} */(null); | 122 return elementNode === this._elementNode() && style ? new WebInspect
or.SharedSidebarModel.ComputedStyle(elementNode, style) : /** @type {?WebInspect
or.SharedSidebarModel.ComputedStyle} */(null); |
| 123 } | 123 } |
| 124 }, | 124 }, |
| 125 | 125 |
| 126 _onComputedStyleChanged: function() | 126 _onComputedStyleChanged: function() |
| 127 { | 127 { |
| 128 delete this._computedStylePromise; | 128 delete this._computedStylePromise; |
| 129 this.dispatchEventToListeners(WebInspector.SharedSidebarModel.Events.Com
putedStyleChanged); | 129 this.dispatchEventToListeners(WebInspector.SharedSidebarModel.Events.Com
putedStyleChanged); |
| 130 }, | 130 }, |
| 131 | 131 |
| 132 __proto__: WebInspector.Object.prototype | 132 __proto__: WebInspector.Object.prototype |
| 133 } | 133 } |
| 134 | 134 |
| 135 /** | 135 /** |
| 136 * @constructor | 136 * @constructor |
| 137 * @param {!WebInspector.DOMNode} node | 137 * @param {!WebInspector.DOMNode} node |
| 138 * @param {!WebInspector.CSSStyleDeclaration} computedStyle | 138 * @param {!Map.<string, string>} computedStyle |
| 139 */ | 139 */ |
| 140 WebInspector.SharedSidebarModel.ComputedStyle = function(node, computedStyle) | 140 WebInspector.SharedSidebarModel.ComputedStyle = function(node, computedStyle) |
| 141 { | 141 { |
| 142 this.node = node; | 142 this.node = node; |
| 143 this.computedStyle = computedStyle; | 143 this.computedStyle = computedStyle; |
| 144 } | 144 } |
| OLD | NEW |