| Summary: | Web Inspector: Move CSS longhand and shorthand mapping away from WI.CSSCompletions | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Razvan Caliman <rcaliman> | ||||||
| Component: | Web Inspector | Assignee: | Razvan Caliman <rcaliman> | ||||||
| Status: | RESOLVED FIXED | ||||||||
| Severity: | Normal | CC: | ews-watchlist, hi, inspector-bugzilla-changes, pangle, webkit-bug-importer | ||||||
| Priority: | P2 | Keywords: | InRadar | ||||||
| Version: | WebKit Nightly Build | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Bug Depends on: | |||||||||
| Bug Blocks: | 231511, 230351 | ||||||||
| Attachments: |
|
||||||||
|
Description
Razvan Caliman
2021-10-08 08:41:59 PDT
Created attachment 440624 [details]
Patch v1.0
Moving longhand-to-shorthand mapping and checks away from WI.CSSCompletions
Comment on attachment 440624 [details] Patch v1.0 View in context: https://bugs.webkit.org/attachment.cgi?id=440624&action=review r=me > Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js:233 > + let shorthands = WI.CSSKeywordCompletions.ShorthandNamesForLongHandProperty.getOrInitialize(longhand, []); > + shorthands.push(property.name); NIT: you could instead use a `Multimap` to avoid the `getOrInitialize` (tho you'd need to either adjust the fallback locations to be a `new Set` or change `Multimap.prototype.get` to have a fallback) > Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js:262 > +WI.CSSKeywordCompletions.ShorthandNamesForLongHandProperty = new Map; yknow, technically, it's a bit odd for info about properties to be on something related to value keywords IMO it would be better to move these to `WI.CSSCompletions` (or create a new `WI.CSSPropertyCompletions`) Comment on attachment 440624 [details] Patch v1.0 View in context: https://bugs.webkit.org/attachment.cgi?id=440624&action=review >> Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js:262 >> +WI.CSSKeywordCompletions.ShorthandNamesForLongHandProperty = new Map; > > yknow, technically, it's a bit odd for info about properties to be on something related to value keywords > > IMO it would be better to move these to `WI.CSSCompletions` (or create a new `WI.CSSPropertyCompletions`) I agree. I followed precedent, but `WI.CSSKeywordCompletions` holds too much already. A new `WI.CSSPropertyCompletions` as host for all property-related maps would be best. This would isolate logic away from `WI.CSSKeywordCompletions` and `WI.CSSCompletions`. The task is not big, but it will yield a large code diff which would be best split into multiple patches. In the interest of making progress on Bug 230351 this week, I'll land this patch as-is (thanks for R+) and I'll open follow-ups to restructure code into a new `WI.CSSPropertyCompletions` afterwards. Comment on attachment 440624 [details] Patch v1.0 View in context: https://bugs.webkit.org/attachment.cgi?id=440624&action=review >> Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js:262 >> +WI.CSSKeywordCompletions.ShorthandNamesForLongHandProperty = new Map; > > yknow, technically, it's a bit odd for info about properties to be on something related to value keywords > > IMO it would be better to move these to `WI.CSSCompletions` (or create a new `WI.CSSPropertyCompletions`) I agree. I followed precedent, but `WI.CSSKeywordCompletions` holds too much already. A new `WI.CSSPropertyCompletions` as host for all property-related maps would be best. This would isolate logic away from `WI.CSSKeywordCompletions` and `WI.CSSCompletions`. The task is not big, but it will yield a large code diff which would be best split into multiple patches. In the interest of making progress on Bug 230351 this week, I'll land this patch as-is (thanks for R+) and I'll open follow-ups to restructure code into a new `WI.CSSPropertyCompletions` afterwards. Comment on attachment 440624 [details] Patch v1.0 View in context: https://bugs.webkit.org/attachment.cgi?id=440624&action=review >> Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js:262 >> +WI.CSSKeywordCompletions.ShorthandNamesForLongHandProperty = new Map; > > yknow, technically, it's a bit odd for info about properties to be on something related to value keywords > > IMO it would be better to move these to `WI.CSSCompletions` (or create a new `WI.CSSPropertyCompletions`) I agree. I followed precedent, but `WI.CSSKeywordCompletions` holds too much already. A new `WI.CSSPropertyCompletions` as host for all property-related maps would be best. This would isolate logic away from `WI.CSSKeywordCompletions` and `WI.CSSCompletions`. The task is not big, but it will yield a large code diff which would be best split into multiple patches. In the interest of making progress on Bug 230351 this week, I'll land this patch as-is (thanks for R+) and I'll open follow-ups to restructure code into a new `WI.CSSPropertyCompletions` afterwards. Comment on attachment 440624 [details] Patch v1.0 View in context: https://bugs.webkit.org/attachment.cgi?id=440624&action=review >> Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js:262 >> +WI.CSSKeywordCompletions.ShorthandNamesForLongHandProperty = new Map; > > yknow, technically, it's a bit odd for info about properties to be on something related to value keywords > > IMO it would be better to move these to `WI.CSSCompletions` (or create a new `WI.CSSPropertyCompletions`) I agree. I followed precedent, but `WI.CSSKeywordCompletions` holds too much already. A new `WI.CSSPropertyCompletions` as host for all property-related maps would be best. This would isolate logic away from `WI.CSSKeywordCompletions` and `WI.CSSCompletions`. The task is not big, but it will yield a large code diff which would be best split into multiple patches. In the interest of making progress on Bug 230351 this week, I'll land this patch as-is (thanks for R+) and I'll open follow-ups to restructure code into a new `WI.CSSPropertyCompletions` afterwards. Created attachment 440783 [details] Patch v1.0 Carry over R+; Land patch as is and follow-up in Bug 231511 Committed r283899 (242775@main): <https://commits.webkit.org/242775@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 440783 [details]. |