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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sdk/CSSStyleModel.js

Issue 1434613002: DevTools: kill WebInspector.StylesSectionModel class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 5 years, 1 month 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 | « third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/sdk/CSSStyleModel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/CSSStyleModel.js b/third_party/WebKit/Source/devtools/front_end/sdk/CSSStyleModel.js
index d7d37978deb551c9ad86801119ca7816560e37f2..6a4bddb33c0368ee9d19e78baa4e2aef6643e205 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/CSSStyleModel.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/CSSStyleModel.js
@@ -652,19 +652,6 @@ WebInspector.CSSStyleDeclaration.Type = {
Attributes: "Attributes"
}
-/**
- * @param {!WebInspector.CSSStyleModel} cssModel
- * @return {!WebInspector.CSSStyleDeclaration}
- */
-WebInspector.CSSStyleDeclaration.createDummyStyle = function(cssModel)
-{
- var dummyPayload = {
- shorthandEntries: [],
- cssProperties: []
- };
- return new WebInspector.CSSStyleDeclaration(cssModel, null, dummyPayload, WebInspector.CSSStyleDeclaration.Type.Regular);
-}
-
WebInspector.CSSStyleDeclaration.prototype = {
/**
* @param {!CSSAgent.CSSStyle} payload
@@ -1038,6 +1025,27 @@ WebInspector.CSSRule = function(cssModel, payload, matchingSelectors)
this.media = WebInspector.CSSMedia.parseMediaArrayPayload(cssModel, payload.media);
}
+/**
+ * @param {!WebInspector.CSSStyleModel} cssModel
+ * @param {string} selectorText
+ * @return {!WebInspector.CSSRule}
+ */
+WebInspector.CSSRule.createDummyRule = function(cssModel, selectorText)
+{
+ var dummyPayload = {
+ selectorList: {
+ selectors: [{ value: selectorText}],
+ },
+ style: {
+ styleSheetId: "0",
+ range: new WebInspector.TextRange(0, 0, 0, 0),
+ shorthandEntries: [],
+ cssProperties: []
+ }
+ };
+ return new WebInspector.CSSRule(cssModel, /** @type {!CSSAgent.CSSRule} */(dummyPayload));
+}
+
WebInspector.CSSRule.prototype = {
/**
* @param {!DOMAgent.NodeId} nodeId
@@ -1238,7 +1246,7 @@ WebInspector.CSSRule.prototype = {
/**
* @constructor
- * @param {?WebInspector.CSSStyleDeclaration} ownerStyle
+ * @param {!WebInspector.CSSStyleDeclaration} ownerStyle
* @param {number} index
* @param {string} name
* @param {string} value
@@ -1265,7 +1273,7 @@ WebInspector.CSSProperty = function(ownerStyle, index, name, value, important, d
}
/**
- * @param {?WebInspector.CSSStyleDeclaration} ownerStyle
+ * @param {!WebInspector.CSSStyleDeclaration} ownerStyle
* @param {number} index
* @param {!CSSAgent.CSSProperty} payload
* @return {!WebInspector.CSSProperty}
@@ -2052,6 +2060,7 @@ WebInspector.CSSStyleModel.MatchedStyleResult = function(cssModel, nodeId, inlin
this._nodeStyles = [];
this._nodeForStyle = new Map();
+ this._inheritedStyles = new Set();
/**
* @this {WebInspector.CSSStyleModel.MatchedStyleResult}
@@ -2098,6 +2107,7 @@ WebInspector.CSSStyleModel.MatchedStyleResult = function(cssModel, nodeId, inlin
if (inheritedInlineStyle && this._containsInherited(inheritedInlineStyle)) {
this._nodeForStyle.set(inheritedInlineStyle, parentNode);
this._nodeStyles.push(inheritedInlineStyle);
+ this._inheritedStyles.add(inheritedInlineStyle);
}
for (var j = inheritedMatchedCSSRules.length - 1; j >= 0; --j) {
@@ -2106,6 +2116,7 @@ WebInspector.CSSStyleModel.MatchedStyleResult = function(cssModel, nodeId, inlin
continue;
this._nodeForStyle.set(inheritedRule.style, parentNode);
this._nodeStyles.push(inheritedRule.style);
+ this._inheritedStyles.add(inheritedRule.style);
}
parentNode = parentNode.parentNode;
}
@@ -2176,7 +2187,7 @@ WebInspector.CSSStyleModel.MatchedStyleResult.prototype = {
*/
isInherited: function(style)
{
- return this.nodeForStyle(style) !== this._node;
+ return this._inheritedStyles.has(style);
}
}
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698