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

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

Issue 1534323003: DevTools: [CSS] do not treat random css comments as disabled properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/core/inspector/InspectorStyleSheet.cpp ('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 8492d514956bd59447ff8401666c7d405211d967..c94f7ccb77222744358af85e229a0531c7b45172 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/CSSStyleModel.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/CSSStyleModel.js
@@ -1439,9 +1439,9 @@ WebInspector.CSSProperty.prototype = {
function processToken(token, tokenType, column, newColumn)
{
if (!insideProperty) {
- var isDisabledProperty = tokenType && tokenType.includes("css-comment") && token.includes(":");
+ var disabledProperty = tokenType && tokenType.includes("css-comment") && isDisabledProperty(token);
var isPropertyStart = tokenType && (tokenType.includes("css-meta") || tokenType.includes("css-property"));
- if (isDisabledProperty) {
+ if (disabledProperty) {
result = result.trimRight() + indentation + token;
} else if (isPropertyStart) {
insideProperty = true;
@@ -1461,6 +1461,19 @@ WebInspector.CSSProperty.prototype = {
propertyText += token;
}
}
+
+ /**
+ * @param {string} text
+ * @return {boolean}
+ */
+ function isDisabledProperty(text)
+ {
+ var colon = text.indexOf(":");
+ if (colon === -1)
+ return false;
+ var propertyName = text.substring(2, colon).trim();
+ return CSS.supports(propertyName, "initial") || propertyName.startsWith("-moz-") || propertyName.startsWith("-o-") || propertyName.startsWith("-webkit-") || propertyName.startsWith("-ms-");
pfeldman 2016/01/04 21:27:01 You should either query the target (generated) css
lushnikov 2016/01/11 23:52:11 How are your suggestions better than this?
+ }
},
/**
« no previous file with comments | « third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698