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

Unified Diff: Source/devtools/front_end/elements/StylesSidebarPane.js

Issue 1350183004: DevTools: CSS.getMatchedStylesForNode protocol command to return inline styles (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix tests Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/audits/AuditRules.js ('k') | Source/devtools/front_end/sdk/CSSStyleModel.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/elements/StylesSidebarPane.js
diff --git a/Source/devtools/front_end/elements/StylesSidebarPane.js b/Source/devtools/front_end/elements/StylesSidebarPane.js
index be874986a1b752ff22fee3c9f03ea2777bdc5654..0303973facd6e204d98214d83dc74c4658d63654 100644
--- a/Source/devtools/front_end/elements/StylesSidebarPane.js
+++ b/Source/devtools/front_end/elements/StylesSidebarPane.js
@@ -332,69 +332,34 @@ WebInspector.StylesSidebarPane.prototype = {
/**
* @param {!WebInspector.DOMNode} node
- * @param {!WebInspector.StylesSidebarPane.MatchedRulesPayload} payload
+ * @param {?WebInspector.CSSStyleModel.MatchedStyleResult} matchedStyles
* @return {?{matched: !WebInspector.SectionCascade, pseudo: !Map.<number, !WebInspector.SectionCascade>}}
* @this {WebInspector.StylesSidebarPane}
*/
- function buildMatchedCascades(node, payload)
+ function buildMatchedCascades(node, matchedStyles)
{
- if (node !== this.node() || !payload.fulfilled())
+ if (!matchedStyles || node !== this.node())
+ return null;
+ if (!matchedStyles.matchedCSSRules || !matchedStyles.pseudoElements || !matchedStyles.inherited)
return null;
return {
- matched: this._buildMatchedRulesSectionCascade(node, payload),
- pseudo: this._buildPseudoCascades(node, payload)
+ matched: this._buildMatchedRulesSectionCascade(node, matchedStyles),
+ pseudo: this._buildPseudoCascades(node, matchedStyles)
};
}
},
/**
* @param {!WebInspector.DOMNode} node
- * @return {!Promise.<!WebInspector.StylesSidebarPane.MatchedRulesPayload>}
+ * @return {!Promise.<?WebInspector.CSSStyleModel.MatchedStyleResult>}
*/
_matchedStylesForNode: function(node)
{
- var payload = new WebInspector.StylesSidebarPane.MatchedRulesPayload();
var cssModel = this.cssModel();
if (!cssModel)
- return Promise.resolve(payload);
-
- var promises = [
- cssModel.inlineStylesPromise(node.id).then(inlineCallback),
- cssModel.matchedStylesPromise(node.id).then(matchedCallback)
- ];
- return Promise.all(promises).then(returnPayload);
-
- /**
- * @param {?WebInspector.CSSStyleModel.InlineStyleResult} inlineStyleResult
- */
- function inlineCallback(inlineStyleResult)
- {
- if (!inlineStyleResult)
- return;
- payload.inlineStyle = inlineStyleResult.inlineStyle;
- payload.attributesStyle = inlineStyleResult.attributesStyle;
- }
-
- /**
- * @param {?WebInspector.CSSStyleModel.MatchedStyleResult} matchedResult
- */
- function matchedCallback(matchedResult)
- {
- if (matchedResult) {
- payload.matchedCSSRules = matchedResult.matchedCSSRules;
- payload.pseudoElements = matchedResult.pseudoElements;
- payload.inherited = matchedResult.inherited;
- }
- }
-
- /**
- * @return {!WebInspector.StylesSidebarPane.MatchedRulesPayload}
- */
- function returnPayload()
- {
- return payload;
- }
+ return Promise.resolve(/** @type {?WebInspector.CSSStyleModel.MatchedStyleResult} */(null));
+ return cssModel.matchedStylesPromise(node.id)
},
/**
@@ -485,7 +450,7 @@ WebInspector.StylesSidebarPane.prototype = {
/**
* @param {!WebInspector.DOMNode} node
- * @param {!WebInspector.StylesSidebarPane.MatchedRulesPayload} styles
+ * @param {!WebInspector.CSSStyleModel.MatchedStyleResult} styles
* @return {!Map<number, !WebInspector.SectionCascade>}
*/
_buildPseudoCascades: function(node, styles)
@@ -517,7 +482,7 @@ WebInspector.StylesSidebarPane.prototype = {
/**
* @param {!WebInspector.DOMNode} node
- * @param {!WebInspector.StylesSidebarPane.MatchedRulesPayload} styles
+ * @param {!WebInspector.CSSStyleModel.MatchedStyleResult} styles
* @return {!WebInspector.SectionCascade}
*/
_buildMatchedRulesSectionCascade: function(node, styles)
@@ -3084,33 +3049,6 @@ WebInspector.StylesSidebarPropertyRenderer.prototype = {
/**
* @constructor
- */
-WebInspector.StylesSidebarPane.MatchedRulesPayload = function()
-{
- /** @type {?WebInspector.CSSStyleDeclaration} */
- this.inlineStyle = null;
- /** @type {?WebInspector.CSSStyleDeclaration} */
- this.attributesStyle = null;
- /** @type {?Array.<!WebInspector.CSSRule>} */
- this.matchedCSSRules = null;
- /** @type {?Array.<!WebInspector.CSSStyleModel.PseudoElementMatches>} */
- this.pseudoElements = null;
- /** @type {?Array.<!WebInspector.CSSStyleModel.InheritedMatches>} */
- this.inherited = null;
-}
-
-WebInspector.StylesSidebarPane.MatchedRulesPayload.prototype = {
- /**
- * @return {boolean}
- */
- fulfilled: function()
- {
- return !!(this.matchedCSSRules && this.pseudoElements && this.inherited);
- }
-}
-
-/**
- * @constructor
* @extends {WebInspector.Widget}
* @param {!WebInspector.ToolbarItem} toolbarItem
*/
« no previous file with comments | « Source/devtools/front_end/audits/AuditRules.js ('k') | Source/devtools/front_end/sdk/CSSStyleModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698