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

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: Fixed the failing cases! 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.toLowerCa se()] === true;
vivekg 2014/07/08 11:03:37 This enables the swatch in non-case sensitive way.
apavlov 2014/07/08 11:16:37 Generally, we should never compare to boolean lite
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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 "z-index": { m: "visuren" } 717 "z-index": { m: "visuren" }
718 } 718 }
719 719
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.toLowerCas e());
apavlov 2014/07/08 11:16:37 This conversion should be done inside WebInspector
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 (propertyName.toLowerCase() in WebInspector.CSSMetadata._colorAwareProper ties)
vivekg 2014/07/08 11:03:37 This change enables the suggestion keywords for th
apavlov 2014/07/08 11:16:37 Hmm, in fact, this does exactly the same as WebIns
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 {
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 * @param {string} longhand 1020 * @param {string} longhand
1021 * @return {?Array.<string>} 1021 * @return {?Array.<string>}
1022 */ 1022 */
1023 shorthands: function(longhand) 1023 shorthands: function(longhand)
1024 { 1024 {
1025 return this._shorthands[longhand]; 1025 return this._shorthands[longhand];
1026 } 1026 }
1027 } 1027 }
1028 1028
1029 WebInspector.CSSMetadata.initializeWithSupportedProperties([]); 1029 WebInspector.CSSMetadata.initializeWithSupportedProperties([]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698