| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 if (!shorthands) { | 62 if (!shorthands) { |
| 63 shorthands = []; | 63 shorthands = []; |
| 64 this._shorthands.set(longhandName, shorthands); | 64 this._shorthands.set(longhandName, shorthands); |
| 65 } | 65 } |
| 66 shorthands.push(propertyName); | 66 shorthands.push(propertyName); |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 this._values.sort(); | 70 this._values.sort(); |
| 71 this._valuesSet = new Set(this._values); | 71 this._valuesSet = new Set(this._values); |
| 72 } | 72 }; |
| 73 | 73 |
| 74 WebInspector.CSSMetadata.VariableRegex = /(var\(--.*?\))/g; | 74 WebInspector.CSSMetadata.VariableRegex = /(var\(--.*?\))/g; |
| 75 WebInspector.CSSMetadata.URLRegex = /url\(\s*('.+?'|".+?"|[^)]+)\s*\)/g; | 75 WebInspector.CSSMetadata.URLRegex = /url\(\s*('.+?'|".+?"|[^)]+)\s*\)/g; |
| 76 | 76 |
| 77 WebInspector.CSSMetadata.prototype = { | 77 WebInspector.CSSMetadata.prototype = { |
| 78 /** | 78 /** |
| 79 * @return {!Array<string>} | 79 * @return {!Array<string>} |
| 80 */ | 80 */ |
| 81 allProperties: function() | 81 allProperties: function() |
| 82 { | 82 { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 var weight = WebInspector.CSSMetadata.Weight[properties[i]]; | 210 var weight = WebInspector.CSSMetadata.Weight[properties[i]]; |
| 211 if (!weight) | 211 if (!weight) |
| 212 weight = WebInspector.CSSMetadata.Weight[this.canonicalPropertyN
ame(properties[i])]; | 212 weight = WebInspector.CSSMetadata.Weight[this.canonicalPropertyN
ame(properties[i])]; |
| 213 if (weight > maxWeight) { | 213 if (weight > maxWeight) { |
| 214 maxWeight = weight; | 214 maxWeight = weight; |
| 215 index = i; | 215 index = i; |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 return index; | 218 return index; |
| 219 } | 219 } |
| 220 } | 220 }; |
| 221 | 221 |
| 222 /** | 222 /** |
| 223 * @return {!WebInspector.CSSMetadata} | 223 * @return {!WebInspector.CSSMetadata} |
| 224 */ | 224 */ |
| 225 WebInspector.cssMetadata = function() | 225 WebInspector.cssMetadata = function() |
| 226 { | 226 { |
| 227 if (!WebInspector.CSSMetadata._instance) | 227 if (!WebInspector.CSSMetadata._instance) |
| 228 WebInspector.CSSMetadata._instance = new WebInspector.CSSMetadata(WebIns
pector.CSSMetadata._generatedProperties || []); | 228 WebInspector.CSSMetadata._instance = new WebInspector.CSSMetadata(WebIns
pector.CSSMetadata._generatedProperties || []); |
| 229 return WebInspector.CSSMetadata._instance; | 229 return WebInspector.CSSMetadata._instance; |
| 230 } | 230 }; |
| 231 | 231 |
| 232 WebInspector.CSSMetadata._distanceProperties = new Set([ | 232 WebInspector.CSSMetadata._distanceProperties = new Set([ |
| 233 "background-position", "border-spacing", "bottom", "font-size", "height", "l
eft", "letter-spacing", "max-height", "max-width", "min-height", | 233 "background-position", "border-spacing", "bottom", "font-size", "height", "l
eft", "letter-spacing", "max-height", "max-width", "min-height", |
| 234 "min-width", "right", "text-indent", "top", "width", "word-spacing" | 234 "min-width", "right", "text-indent", "top", "width", "word-spacing" |
| 235 ]); | 235 ]); |
| 236 | 236 |
| 237 WebInspector.CSSMetadata._bezierAwareProperties = new Set([ | 237 WebInspector.CSSMetadata._bezierAwareProperties = new Set([ |
| 238 "animation", "animation-timing-function", "transition", "transition-timing-f
unction", "-webkit-animation", "-webkit-animation-timing-function", | 238 "animation", "animation-timing-function", "transition", "transition-timing-f
unction", "-webkit-animation", "-webkit-animation-timing-function", |
| 239 "-webkit-transition", "-webkit-transition-timing-function" | 239 "-webkit-transition", "-webkit-transition-timing-function" |
| 240 ]); | 240 ]); |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 "none", "objects", "spaces", "ink", "edges", "box-decoration" | 701 "none", "objects", "spaces", "ink", "edges", "box-decoration" |
| 702 ] }, | 702 ] }, |
| 703 "mix-blend-mode": { values: [ | 703 "mix-blend-mode": { values: [ |
| 704 "normal", "multiply", "screen", "overlay", "darken", "lighten", "color-d
odge", "color-burn", "hard-light", "soft-light", | 704 "normal", "multiply", "screen", "overlay", "darken", "lighten", "color-d
odge", "color-burn", "hard-light", "soft-light", |
| 705 "difference", "exclusion", "hue", "saturation", "color", "luminosity", "
unset" | 705 "difference", "exclusion", "hue", "saturation", "color", "luminosity", "
unset" |
| 706 ] }, | 706 ] }, |
| 707 "background-blend-mode": { values: [ | 707 "background-blend-mode": { values: [ |
| 708 "normal", "multiply", "screen", "overlay", "darken", "lighten", "color-d
odge", "color-burn", "hard-light", "soft-light", | 708 "normal", "multiply", "screen", "overlay", "darken", "lighten", "color-d
odge", "color-burn", "hard-light", "soft-light", |
| 709 "difference", "exclusion", "hue", "saturation", "color", "luminosity", "
unset" | 709 "difference", "exclusion", "hue", "saturation", "color", "luminosity", "
unset" |
| 710 ] }, | 710 ] }, |
| 711 } | 711 }; |
| 712 | 712 |
| 713 // Weight of CSS properties based on their usage from https://www.chromestatus.c
om/metrics/css/popularity | 713 // Weight of CSS properties based on their usage from https://www.chromestatus.c
om/metrics/css/popularity |
| 714 WebInspector.CSSMetadata.Weight = { | 714 WebInspector.CSSMetadata.Weight = { |
| 715 "align-content": 57, | 715 "align-content": 57, |
| 716 "align-items": 129, | 716 "align-items": 129, |
| 717 "align-self": 55, | 717 "align-self": 55, |
| 718 "animation": 175, | 718 "animation": 175, |
| 719 "animation-delay": 114, | 719 "animation-delay": 114, |
| 720 "animation-direction": 113, | 720 "animation-direction": 113, |
| 721 "animation-duration": 137, | 721 "animation-duration": 137, |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 "widows": 115, | 960 "widows": 115, |
| 961 "width": 268, | 961 "width": 268, |
| 962 "will-change": 74, | 962 "will-change": 74, |
| 963 "word-break": 166, | 963 "word-break": 166, |
| 964 "word-spacing": 157, | 964 "word-spacing": 157, |
| 965 "word-wrap": 197, | 965 "word-wrap": 197, |
| 966 "writing-mode": 41, | 966 "writing-mode": 41, |
| 967 "z-index": 239, | 967 "z-index": 239, |
| 968 "zoom": 200 | 968 "zoom": 200 |
| 969 }; | 969 }; |
| OLD | NEW |