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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/audits/AuditRules.js

Issue 1774773003: DevTools: Remove vendor-prefixed css rule audit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: restore whitespace in test Created 4 years, 9 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/audits/AuditCategories.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 visitProperty: function(styleSheet, rule, property, result) 1346 visitProperty: function(styleSheet, rule, property, result)
1347 { 1347 {
1348 // Subclasses can implement. 1348 // Subclasses can implement.
1349 }, 1349 },
1350 1350
1351 __proto__: WebInspector.AuditRule.prototype 1351 __proto__: WebInspector.AuditRule.prototype
1352 } 1352 }
1353 1353
1354 /** 1354 /**
1355 * @constructor 1355 * @constructor
1356 * @extends {WebInspector.AuditRules.CSSRuleBase}
1357 */
1358 WebInspector.AuditRules.VendorPrefixedCSSProperties = function()
1359 {
1360 WebInspector.AuditRules.CSSRuleBase.call(this, "page-vendorprefixedcss", Web Inspector.UIString("Use normal CSS property names instead of vendor-prefixed one s"));
1361 this._webkitPrefix = "-webkit-";
1362 }
1363
1364 WebInspector.AuditRules.VendorPrefixedCSSProperties.supportedProperties = [
1365 "background-clip", "background-origin", "background-size",
1366 "border-radius", "border-bottom-left-radius", "border-bottom-right-radius", "border-top-left-radius", "border-top-right-radius",
1367 "box-shadow", "box-sizing", "opacity", "text-shadow"
1368 ].keySet();
1369
1370 WebInspector.AuditRules.VendorPrefixedCSSProperties.prototype = {
1371 /**
1372 * @override
1373 * @param {!WebInspector.AuditRules.ParsedStyleSheet} styleSheet
1374 */
1375 didVisitStyleSheet: function(styleSheet)
1376 {
1377 delete this._styleSheetResult;
1378 },
1379
1380 /**
1381 * @override
1382 */
1383 visitRule: function()
1384 {
1385 this._mentionedProperties = {};
1386 },
1387
1388 didVisitRule: function()
1389 {
1390 delete this._ruleResult;
1391 delete this._mentionedProperties;
1392 },
1393
1394 /**
1395 * @override
1396 * @param {!WebInspector.AuditRules.ParsedStyleSheet} styleSheet
1397 * @param {!WebInspector.CSSParser.StyleRule} rule
1398 * @param {!WebInspector.CSSParser.Property} property
1399 * @param {!WebInspector.AuditRuleResult} result
1400 */
1401 visitProperty: function(styleSheet, rule, property, result)
1402 {
1403 if (!property.name.startsWith(this._webkitPrefix))
1404 return;
1405
1406 var normalPropertyName = property.name.substring(this._webkitPrefix.leng th).toLowerCase(); // Start just after the "-webkit-" prefix.
1407 if (WebInspector.AuditRules.VendorPrefixedCSSProperties.supportedPropert ies[normalPropertyName] && !this._mentionedProperties[normalPropertyName]) {
1408 this._mentionedProperties[normalPropertyName] = true;
1409 if (!this._styleSheetResult)
1410 this._styleSheetResult = result.addChild(styleSheet.sourceURL ? WebInspector.linkifyResourceAsNode(styleSheet.sourceURL) : WebInspector.UIString ("<unknown>"));
1411 if (!this._ruleResult) {
1412 var anchor = WebInspector.linkifyURLAsNode(styleSheet.sourceURL, rule.selectorText);
1413 anchor.lineNumber = rule.lineNumber;
1414 this._ruleResult = this._styleSheetResult.addChild(anchor);
1415 }
1416 ++result.violationCount;
1417 this._ruleResult.addSnippet(WebInspector.UIString("\"%s%s\" is used, but \"%s\" is supported.", this._webkitPrefix, normalPropertyName, normalProper tyName));
1418 }
1419 },
1420
1421 __proto__: WebInspector.AuditRules.CSSRuleBase.prototype
1422 }
1423
1424 /**
1425 * @constructor
1426 * @extends {WebInspector.AuditRule} 1356 * @extends {WebInspector.AuditRule}
1427 */ 1357 */
1428 WebInspector.AuditRules.CookieRuleBase = function(id, name) 1358 WebInspector.AuditRules.CookieRuleBase = function(id, name)
1429 { 1359 {
1430 WebInspector.AuditRule.call(this, id, name); 1360 WebInspector.AuditRule.call(this, id, name);
1431 } 1361 }
1432 1362
1433 WebInspector.AuditRules.CookieRuleBase.prototype = { 1363 WebInspector.AuditRules.CookieRuleBase.prototype = {
1434 /** 1364 /**
1435 * @override 1365 * @override
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 result.violationCount = badUrls.length; 1555 result.violationCount = badUrls.length;
1626 }, 1556 },
1627 1557
1628 _collectorCallback: function(matchingResourceData, request, cookie) 1558 _collectorCallback: function(matchingResourceData, request, cookie)
1629 { 1559 {
1630 matchingResourceData[request.url] = (matchingResourceData[request.url] | | 0) + cookie.size(); 1560 matchingResourceData[request.url] = (matchingResourceData[request.url] | | 0) + cookie.size();
1631 }, 1561 },
1632 1562
1633 __proto__: WebInspector.AuditRules.CookieRuleBase.prototype 1563 __proto__: WebInspector.AuditRules.CookieRuleBase.prototype
1634 } 1564 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/audits/AuditCategories.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698