OLD | NEW |
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 Loading... |
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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 /** | 722 /** |
723 * @param {string} propertyName | 723 * @param {string} propertyName |
724 * @return {!WebInspector.CSSMetadata} | 724 * @return {!WebInspector.CSSMetadata} |
725 */ | 725 */ |
726 WebInspector.CSSMetadata.keywordsForProperty = function(propertyName) | 726 WebInspector.CSSMetadata.keywordsForProperty = function(propertyName) |
727 { | 727 { |
728 var acceptedKeywords = ["inherit", "initial"]; | 728 var acceptedKeywords = ["inherit", "initial"]; |
729 var descriptor = WebInspector.CSSMetadata.descriptor(propertyName); | 729 var descriptor = WebInspector.CSSMetadata.descriptor(propertyName); |
730 if (descriptor && descriptor.values) | 730 if (descriptor && descriptor.values) |
731 acceptedKeywords.push.apply(acceptedKeywords, descriptor.values); | 731 acceptedKeywords.push.apply(acceptedKeywords, descriptor.values); |
732 if (propertyName in WebInspector.CSSMetadata._colorAwareProperties) | 732 if (WebInspector.CSSMetadata.isColorAwareProperty(propertyName)) |
733 acceptedKeywords.push.apply(acceptedKeywords, WebInspector.CSSMetadata._
colors); | 733 acceptedKeywords.push.apply(acceptedKeywords, WebInspector.CSSMetadata._
colors); |
734 return new WebInspector.CSSMetadata(acceptedKeywords); | 734 return new WebInspector.CSSMetadata(acceptedKeywords); |
735 } | 735 } |
736 | 736 |
737 /** | 737 /** |
738 * @param {string} propertyName | 738 * @param {string} propertyName |
739 * @return {?Object} | 739 * @return {?Object} |
740 */ | 740 */ |
741 WebInspector.CSSMetadata.descriptor = function(propertyName) | 741 WebInspector.CSSMetadata.descriptor = function(propertyName) |
742 { | 742 { |
743 if (!propertyName) | 743 if (!propertyName) |
744 return null; | 744 return null; |
745 var unprefixedName = propertyName.replace(/^-webkit-/, ""); | 745 var unprefixedName = propertyName.replace(/^-webkit-/, ""); |
| 746 propertyName = propertyName.toLowerCase(); |
746 var entry = WebInspector.CSSMetadata._propertyDataMap[propertyName]; | 747 var entry = WebInspector.CSSMetadata._propertyDataMap[propertyName]; |
747 if (!entry && unprefixedName !== propertyName) | 748 if (!entry && unprefixedName !== propertyName) |
748 entry = WebInspector.CSSMetadata._propertyDataMap[unprefixedName]; | 749 entry = WebInspector.CSSMetadata._propertyDataMap[unprefixedName]; |
749 return entry || null; | 750 return entry || null; |
750 } | 751 } |
751 | 752 |
752 WebInspector.CSSMetadata.initializeWithSupportedProperties = function(properties
) | 753 WebInspector.CSSMetadata.initializeWithSupportedProperties = function(properties
) |
753 { | 754 { |
754 WebInspector.CSSMetadata.cssPropertiesMetainfo = new WebInspector.CSSMetadat
a(properties); | 755 WebInspector.CSSMetadata.cssPropertiesMetainfo = new WebInspector.CSSMetadat
a(properties); |
755 } | 756 } |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 * @param {string} longhand | 1023 * @param {string} longhand |
1023 * @return {?Array.<string>} | 1024 * @return {?Array.<string>} |
1024 */ | 1025 */ |
1025 shorthands: function(longhand) | 1026 shorthands: function(longhand) |
1026 { | 1027 { |
1027 return this._shorthands[longhand]; | 1028 return this._shorthands[longhand]; |
1028 } | 1029 } |
1029 } | 1030 } |
1030 | 1031 |
1031 WebInspector.CSSMetadata.initializeWithSupportedProperties([]); | 1032 WebInspector.CSSMetadata.initializeWithSupportedProperties([]); |
OLD | NEW |