Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: Source/devtools/front_end/elements/SharedSidebarModel.js

Issue 1310883002: DevTools: represent ComputedStyle with simple Map (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix test Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698