Changeset 239690 in webkit
- Timestamp:
- Jan 7, 2019 12:20:17 PM (5 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r239649 r239690 1 2019-01-07 Nikita Vasilyev <nvasilyev@apple.com> 2 3 Web Inspector: "white" isn't recognized as a color keyword 4 https://bugs.webkit.org/show_bug.cgi?id=193173 5 <rdar://problem/47068595> 6 7 Reviewed by Joseph Pecoraro. 8 9 Attempt to parse "atom" token types as colors. 10 11 Display color picker only for color-aware properties. For instance, 12 display it for "color: white" but not for "-apple-pay-button-style: white". 13 14 * UserInterface/Models/CSSKeywordCompletions.js: 15 (addKeywordsForName): 16 (WI.CSSKeywordCompletions.forProperty): 17 (WI.CSSKeywordCompletions.isColorAwareProperty): 18 * UserInterface/Views/SpreadsheetStyleProperty.js: 19 (WI.SpreadsheetStyleProperty.prototype._renderValue): 20 (WI.SpreadsheetStyleProperty.prototype._addColorTokens): 21 1 22 2019-01-04 Joseph Pecoraro <pecoraro@apple.com> 2 23 -
trunk/Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js
r236622 r239690 44 44 acceptedKeywords = acceptedKeywords.concat(WI.CSSKeywordCompletions._propertyKeywordMap["-webkit-" + name]); 45 45 46 if (name in WI.CSSKeywordCompletions._colorAwareProperties) 47 acceptedKeywords = acceptedKeywords.concat(WI.CSSKeywordCompletions._colors); 48 else if (isNotPrefixed && ("-webkit-" + name) in WI.CSSKeywordCompletions._colorAwareProperties) 49 acceptedKeywords = acceptedKeywords.concat(WI.CSSKeywordCompletions._colors); 50 else if (name.endsWith("color")) 46 if (WI.CSSKeywordCompletions.isColorAwareProperty(name)) 51 47 acceptedKeywords = acceptedKeywords.concat(WI.CSSKeywordCompletions._colors); 52 48 … … 76 72 77 73 return new WI.CSSCompletions(Array.from(new Set(acceptedKeywords)), true); 74 }; 75 76 WI.CSSKeywordCompletions.isColorAwareProperty = function(name) 77 { 78 if (name in WI.CSSKeywordCompletions._colorAwareProperties) 79 return true; 80 81 let isNotPrefixed = name.charAt(0) !== "-"; 82 if (isNotPrefixed && ("-webkit-" + name) in WI.CSSKeywordCompletions._colorAwareProperties) 83 return true; 84 85 if (name.endsWith("color")) 86 return true; 87 88 return false; 78 89 }; 79 90 -
trunk/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js
r239588 r239690 421 421 if (this._property.enabled) { 422 422 // FIXME: <https://webkit.org/b/178636> Web Inspector: Styles: Make inline widgets work with CSS functions (var(), calc(), etc.) 423 tokens = this._addGradientTokens(tokens); 424 tokens = this._addColorTokens(tokens); 423 424 // CSS variables may contain color - display color picker for them. 425 if (this._property.variable || WI.CSSKeywordCompletions.isColorAwareProperty(this._property.name)) { 426 tokens = this._addGradientTokens(tokens); 427 tokens = this._addColorTokens(tokens); 428 } 425 429 tokens = this._addTimingFunctionTokens(tokens, "cubic-bezier"); 426 430 tokens = this._addTimingFunctionTokens(tokens, "spring"); … … 563 567 // Color Function start 564 568 colorFunctionStartIndex = i; 565 } else if (isNaN(colorFunctionStartIndex) && token.type && token.type.includes("keyword")) {569 } else if (isNaN(colorFunctionStartIndex) && token.type && (token.type.includes("atom") || token.type.includes("keyword"))) { 566 570 // Color keyword 567 571 pushPossibleColorToken(token.value, token);
Note: See TracChangeset
for help on using the changeset viewer.