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

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

Issue 1204393002: DevTools: [CSS] promisify CSSStyleModel fetching methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 /** 62 /**
63 * @param {?WebInspector.CSSStyleDeclaration} style 63 * @param {?WebInspector.CSSStyleDeclaration} style
64 * @this {WebInspector.MetricsSidebarPane} 64 * @this {WebInspector.MetricsSidebarPane}
65 */ 65 */
66 function callback(style) 66 function callback(style)
67 { 67 {
68 if (!style || this.node() !== node) 68 if (!style || this.node() !== node)
69 return; 69 return;
70 this._updateMetrics(style); 70 this._updateMetrics(style);
71 } 71 }
72 cssModel.getComputedStyleAsync(node.id, callback.bind(this));
73
74 /** 72 /**
75 * @param {?WebInspector.CSSStyleModel.InlineStyleResult} inlineStyleRes ult 73 * @param {?WebInspector.CSSStyleModel.InlineStyleResult} inlineStyleRes ult
76 * @this {WebInspector.MetricsSidebarPane} 74 * @this {WebInspector.MetricsSidebarPane}
77 */ 75 */
78 function inlineStyleCallback(inlineStyleResult) 76 function inlineStyleCallback(inlineStyleResult)
79 { 77 {
80 if (inlineStyleResult && this.node() === node) 78 if (inlineStyleResult && this.node() === node)
81 this.inlineStyle = inlineStyleResult.inlineStyle; 79 this.inlineStyle = inlineStyleResult.inlineStyle;
82 finishedCallback();
83 } 80 }
84 cssModel.getInlineStylesAsync(node.id, inlineStyleCallback.bind(this)); 81
82 var promises = [
83 cssModel.computedStylePromise(node.id).then(callback.bind(this)),
84 cssModel.inlineStylesPromise(node.id).then(inlineStyleCallback.bind( this))
85 ];
86 Promise.all(promises)
87 .then(finishedCallback.bind(null, undefined))
88 .catch(/** @type {function()} */(finishedCallback));
85 }, 89 },
86 90
87 /** 91 /**
88 * @override 92 * @override
89 */ 93 */
90 onDOMModelChanged: function() 94 onDOMModelChanged: function()
91 { 95 {
92 this.update(); 96 this.update();
93 }, 97 },
94 98
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 }, 460 },
457 461
458 editingCommitted: function(element, userInput, previousContent, context) 462 editingCommitted: function(element, userInput, previousContent, context)
459 { 463 {
460 this.editingEnded(element, context); 464 this.editingEnded(element, context);
461 this._applyUserInput(element, userInput, previousContent, context, true) ; 465 this._applyUserInput(element, userInput, previousContent, context, true) ;
462 }, 466 },
463 467
464 __proto__: WebInspector.ElementsSidebarPane.prototype 468 __proto__: WebInspector.ElementsSidebarPane.prototype
465 } 469 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698