RESOLVED FIXED 200237
Web Inspector: Styles: variable swatch not shown for var() with a fallback
https://bugs.webkit.org/show_bug.cgi?id=200237
Summary Web Inspector: Styles: variable swatch not shown for var() with a fallback
Devin Rousso
Reported 2019-07-29 13:26:44 PDT
var(--test) shows a swatch var(--test, 0) does NOT show a swatch
Attachments
Patch (9.05 KB, patch)
2019-07-29 15:34 PDT, Devin Rousso
no flags
Archive of layout-test-results from ews104 for mac-highsierra-wk2 (2.83 MB, application/zip)
2019-07-29 16:39 PDT, EWS Watchlist
no flags
Patch (31.65 KB, patch)
2019-08-03 15:23 PDT, Devin Rousso
joepeck: review+
Patch (31.65 KB, patch)
2019-08-05 15:28 PDT, Devin Rousso
no flags
Devin Rousso
Comment 1 2019-07-29 15:34:43 PDT
EWS Watchlist
Comment 2 2019-07-29 16:39:06 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 3 2019-07-29 16:39:08 PDT Comment hidden (obsolete)
Joseph Pecoraro
Comment 4 2019-08-02 20:18:05 PDT
Comment on attachment 375111 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=375111&action=review > Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js:98 > +WI.CSSKeywordCompletions.isTimingFunctionAwareProperty = function(name) > +{ > + if (name in WI.CSSKeywordCompletions._timingFunctionAwareProperties) > + return true; > + > + let isNotPrefixed = name.charAt(0) !== "-"; > + if (isNotPrefixed && ("-webkit-" + name) in WI.CSSKeywordCompletions._timingFunctionAwareProperties) > + return true; I don't think this works at all. `_timingFunctionAwareProperties` is a Set and JavaScript's ` in ` syntax does not work with Sets. They should be like the other code that was updated: if (WI.CSSKeywordCompletions._timingFunctionAwareProperties.has(name)) ... if (isNotPrefixed && WI.CSSKeywordCompletions._timingFunctionAwareProperties.has("-webkit-" + name)) ... > Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js:453 > + tokens = this._addVariableTokens(tokens); Did the order matter? This now creates an inline swatch for the variable earlier, before colors. I didn't follow this logic all the way to see if that would be good or bad.
Devin Rousso
Comment 5 2019-08-03 12:16:08 PDT
Comment on attachment 375111 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=375111&action=review >> Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js:98 >> + return true; > > I don't think this works at all. `_timingFunctionAwareProperties` is a Set and JavaScript's ` in ` syntax does not work with Sets. > > They should be like the other code that was updated: > > if (WI.CSSKeywordCompletions._timingFunctionAwareProperties.has(name)) > ... > if (isNotPrefixed && WI.CSSKeywordCompletions._timingFunctionAwareProperties.has("-webkit-" + name)) > ... Oops! I changed `_colorAwareProperties`, but forgot about `_timingFunctionAwareProperties` 😅 >> Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js:453 >> + tokens = this._addVariableTokens(tokens); > > Did the order matter? This now creates an inline swatch for the variable earlier, before colors. I didn't follow this logic all the way to see if that would be good or bad. Yes, the order does have an effect, because the various `_add*Tokens` replaces the token with an `WI.InlineSwatch`, meaning we no longer get access to the token data from CodeMirror. I actually need to rework this a tiny bit so we get swatches for fallback values.
Devin Rousso
Comment 6 2019-08-03 15:23:59 PDT
Joseph Pecoraro
Comment 7 2019-08-05 13:51:24 PDT
Comment on attachment 375491 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=375491&action=review r=me > Source/WebInspectorUI/ChangeLog:33 > + Follow the variable "path" until an ultimate value is reached. Follow the variable chain?
Devin Rousso
Comment 8 2019-08-05 15:28:09 PDT
WebKit Commit Bot
Comment 9 2019-08-05 16:40:47 PDT
Comment on attachment 375571 [details] Patch Clearing flags on attachment: 375571 Committed r248279: <https://trac.webkit.org/changeset/248279>
WebKit Commit Bot
Comment 10 2019-08-05 16:40:48 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 11 2019-08-05 16:41:20 PDT
Note You need to log in before you can comment on or make changes to this bug.