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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js

Issue 2144923002: DevTools: remove the ComputedStyles -> Styles pane dependency. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaselined Created 4 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Joseph Pecoraro 3 * Copyright (C) 2009 Joseph Pecoraro
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 }, 235 },
236 236
237 /** 237 /**
238 * @override 238 * @override
239 * @return {!Promise.<?>} 239 * @return {!Promise.<?>}
240 */ 240 */
241 doUpdate: function() 241 doUpdate: function()
242 { 242 {
243 this._discardElementUnderMouse(); 243 this._discardElementUnderMouse();
244 244
245 return this.fetchMatchedCascade() 245 return this._fetchMatchedCascade()
246 .then(this._innerRebuildUpdate.bind(this)); 246 .then(this._innerRebuildUpdate.bind(this));
247 }, 247 },
248 248
249 _resetCache: function() 249 _resetCache: function()
250 { 250 {
251 delete this._matchedCascadePromise; 251 if (this.cssModel())
252 this.cssModel().discardCachedMatchedCascade();
252 }, 253 },
253 254
254 /** 255 /**
255 * @return {!Promise.<?WebInspector.CSSMatchedStyles>} 256 * @return {!Promise.<?WebInspector.CSSMatchedStyles>}
256 */ 257 */
257 fetchMatchedCascade: function() 258 _fetchMatchedCascade: function()
258 { 259 {
259 var node = this.node(); 260 var node = this.node();
260 if (!node) 261 if (!node || !this.cssModel())
261 return Promise.resolve(/** @type {?WebInspector.CSSMatchedStyles} */ (null)); 262 return Promise.resolve(/** @type {?WebInspector.CSSMatchedStyles} */ (null));
262 if (!this._matchedCascadePromise) 263
263 this._matchedCascadePromise = this._matchedStylesForNode(node).then( validateStyles.bind(this)); 264 return this.cssModel().cachedMatchedCascadeForNode(node).then(validateSt yles.bind(this));
264 return this._matchedCascadePromise;
265 265
266 /** 266 /**
267 * @param {?WebInspector.CSSMatchedStyles} matchedStyles 267 * @param {?WebInspector.CSSMatchedStyles} matchedStyles
268 * @return {?WebInspector.CSSMatchedStyles} 268 * @return {?WebInspector.CSSMatchedStyles}
269 * @this {WebInspector.StylesSidebarPane} 269 * @this {WebInspector.StylesSidebarPane}
270 */ 270 */
271 function validateStyles(matchedStyles) 271 function validateStyles(matchedStyles)
272 { 272 {
273 return matchedStyles && matchedStyles.node() === this.node() ? match edStyles : null; 273 return matchedStyles && matchedStyles.node() === this.node() ? match edStyles : null;
274 } 274 }
275 }, 275 },
276 276
277 /** 277 /**
278 * @param {!WebInspector.DOMNode} node
279 * @return {!Promise.<?WebInspector.CSSMatchedStyles>}
280 */
281 _matchedStylesForNode: function(node)
282 {
283 var cssModel = this.cssModel();
284 if (!cssModel)
285 return Promise.resolve(/** @type {?WebInspector.CSSMatchedStyles} */ (null));
286 return cssModel.matchedStylesPromise(node.id)
287 },
288
289 /**
290 * @param {boolean} editing 278 * @param {boolean} editing
291 */ 279 */
292 setEditingStyle: function(editing) 280 setEditingStyle: function(editing)
293 { 281 {
294 if (this._isEditingStyle === editing) 282 if (this._isEditingStyle === editing)
295 return; 283 return;
296 this.element.classList.toggle("is-editing-style", editing); 284 this.element.classList.toggle("is-editing-style", editing);
297 this._isEditingStyle = editing; 285 this._isEditingStyle = editing;
298 }, 286 },
299 287
(...skipping 2865 matching lines...) Expand 10 before | Expand all | Expand 10 after
3165 3153
3166 /** 3154 /**
3167 * @override 3155 * @override
3168 * @return {!WebInspector.ToolbarItem} 3156 * @return {!WebInspector.ToolbarItem}
3169 */ 3157 */
3170 item: function() 3158 item: function()
3171 { 3159 {
3172 return this._button; 3160 return this._button;
3173 } 3161 }
3174 } 3162 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698