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

Side by Side Diff: Source/devtools/front_end/sdk/CSSMetadata.js

Issue 376803002: [DevTools] Color values should be case insensitive while suggestions should be case aware (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review comments done! Created 6 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Nikita Vasilyev. All rights reserved. 2 * Copyright (C) 2010 Nikita Vasilyev. All rights reserved.
3 * Copyright (C) 2010 Joseph Pecoraro. All rights reserved. 3 * Copyright (C) 2010 Joseph Pecoraro. All rights reserved.
4 * Copyright (C) 2010 Google Inc. All rights reserved. 4 * Copyright (C) 2010 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are 7 * modification, are permitted provided that the following conditions are
8 * met: 8 * met:
9 * 9 *
10 * * Redistributions of source code must retain the above copyright 10 * * Redistributions of source code must retain the above copyright
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 * @type {!WebInspector.CSSMetadata} 69 * @type {!WebInspector.CSSMetadata}
70 */ 70 */
71 WebInspector.CSSMetadata.cssPropertiesMetainfo = new WebInspector.CSSMetadata([] ); 71 WebInspector.CSSMetadata.cssPropertiesMetainfo = new WebInspector.CSSMetadata([] );
72 72
73 /** 73 /**
74 * @param {string} propertyName 74 * @param {string} propertyName
75 * @return {boolean} 75 * @return {boolean}
76 */ 76 */
77 WebInspector.CSSMetadata.isColorAwareProperty = function(propertyName) 77 WebInspector.CSSMetadata.isColorAwareProperty = function(propertyName)
78 { 78 {
79 return WebInspector.CSSMetadata._colorAwareProperties[propertyName] === true ; 79 return !!WebInspector.CSSMetadata._colorAwareProperties[propertyName.toLower Case()];
80 } 80 }
81 81
82 /** 82 /**
83 * @return {!Object.<string, boolean>} 83 * @return {!Object.<string, boolean>}
84 */ 84 */
85 WebInspector.CSSMetadata.colors = function() 85 WebInspector.CSSMetadata.colors = function()
86 { 86 {
87 if (!WebInspector.CSSMetadata._colorsKeySet) 87 if (!WebInspector.CSSMetadata._colorsKeySet)
88 WebInspector.CSSMetadata._colorsKeySet = WebInspector.CSSMetadata._color s.keySet(); 88 WebInspector.CSSMetadata._colorsKeySet = WebInspector.CSSMetadata._color s.keySet();
89 return WebInspector.CSSMetadata._colorsKeySet; 89 return WebInspector.CSSMetadata._colorsKeySet;
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 /** 720 /**
721 * @param {string} propertyName 721 * @param {string} propertyName
722 * @return {!WebInspector.CSSMetadata} 722 * @return {!WebInspector.CSSMetadata}
723 */ 723 */
724 WebInspector.CSSMetadata.keywordsForProperty = function(propertyName) 724 WebInspector.CSSMetadata.keywordsForProperty = function(propertyName)
725 { 725 {
726 var acceptedKeywords = ["inherit", "initial"]; 726 var acceptedKeywords = ["inherit", "initial"];
727 var descriptor = WebInspector.CSSMetadata.descriptor(propertyName); 727 var descriptor = WebInspector.CSSMetadata.descriptor(propertyName);
728 if (descriptor && descriptor.values) 728 if (descriptor && descriptor.values)
729 acceptedKeywords.push.apply(acceptedKeywords, descriptor.values); 729 acceptedKeywords.push.apply(acceptedKeywords, descriptor.values);
730 if (propertyName in WebInspector.CSSMetadata._colorAwareProperties) 730 if (WebInspector.CSSMetadata.isColorAwareProperty(propertyName))
731 acceptedKeywords.push.apply(acceptedKeywords, WebInspector.CSSMetadata._ colors); 731 acceptedKeywords.push.apply(acceptedKeywords, WebInspector.CSSMetadata._ colors);
732 return new WebInspector.CSSMetadata(acceptedKeywords); 732 return new WebInspector.CSSMetadata(acceptedKeywords);
733 } 733 }
734 734
735 /** 735 /**
736 * @param {string} propertyName 736 * @param {string} propertyName
737 * @return {?Object} 737 * @return {?Object}
738 */ 738 */
739 WebInspector.CSSMetadata.descriptor = function(propertyName) 739 WebInspector.CSSMetadata.descriptor = function(propertyName)
740 { 740 {
741 if (!propertyName) 741 if (!propertyName)
742 return null; 742 return null;
743 propertyName = propertyName.toLowerCase();
743 var unprefixedName = propertyName.replace(/^-webkit-/, ""); 744 var unprefixedName = propertyName.replace(/^-webkit-/, "");
744 var entry = WebInspector.CSSMetadata._propertyDataMap[propertyName]; 745 var entry = WebInspector.CSSMetadata._propertyDataMap[propertyName];
745 if (!entry && unprefixedName !== propertyName) 746 if (!entry && unprefixedName !== propertyName)
746 entry = WebInspector.CSSMetadata._propertyDataMap[unprefixedName]; 747 entry = WebInspector.CSSMetadata._propertyDataMap[unprefixedName];
747 return entry || null; 748 return entry || null;
748 } 749 }
749 750
750 WebInspector.CSSMetadata.initializeWithSupportedProperties = function(properties ) 751 WebInspector.CSSMetadata.initializeWithSupportedProperties = function(properties )
751 { 752 {
752 WebInspector.CSSMetadata.cssPropertiesMetainfo = new WebInspector.CSSMetadat a(properties); 753 WebInspector.CSSMetadata.cssPropertiesMetainfo = new WebInspector.CSSMetadat a(properties);
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 * @param {string} longhand 1021 * @param {string} longhand
1021 * @return {?Array.<string>} 1022 * @return {?Array.<string>}
1022 */ 1023 */
1023 shorthands: function(longhand) 1024 shorthands: function(longhand)
1024 { 1025 {
1025 return this._shorthands[longhand]; 1026 return this._shorthands[longhand];
1026 } 1027 }
1027 } 1028 }
1028 1029
1029 WebInspector.CSSMetadata.initializeWithSupportedProperties([]); 1030 WebInspector.CSSMetadata.initializeWithSupportedProperties([]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698