Summary: | Web Inspector: if a known CSS property has an unsupported value, only strikethrough the value | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Brian Burg <burg> | ||||||
Component: | Web Inspector | Assignee: | Nobody <webkit-unassigned> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | commit-queue, graouts, hi, joepeck, jonowells, mattbaker, nvasilyev, timothy, webkit-bug-importer | ||||||
Priority: | P2 | Keywords: | InRadar | ||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | All | ||||||||
OS: | All | ||||||||
Attachments: |
|
Good call! Created attachment 254219 [details]
Patch
Comment on attachment 254219 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=254219&action=review Awesome! > Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js:279 > + nameMatchesValidPropertyExactly(name) Do we need to do anything special for properties that can have a "-webkit-" prefix or not? Like transform can, and some others. > Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js:542 > + this._codeMirror.markText(start, end, {className: "invalid"}); Will this marker get cleared when edits are made to make the value valid? Comment on attachment 254219 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=254219&action=review >> Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js:279 >> + nameMatchesValidPropertyExactly(name) > > Do we need to do anything special for properties that can have a "-webkit-" prefix or not? Like transform can, and some others. I tested this with a few different "-webkit-" prefixed properties and it worked correctly without any issues, so no. As far as I understand, the property name includes "-webkit-" so it will match with that in mind. If I had used canonicalName, then this would be a problem as it strips prefixes. >> Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js:542 >> + this._codeMirror.markText(start, end, {className: "invalid"}); > > Will this marker get cleared when edits are made to make the value valid? Yes the marker is redrawn every time the editor is updated, so if the property is no longer invalid it will not draw. Comment on attachment 254219 [details] Patch Clearing flags on attachment: 254219 Committed r185184: <http://trac.webkit.org/changeset/185184> All reviewed patches have been landed. Closing bug. Comment on attachment 254219 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=254219&action=review > Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js:281 > + for (var property of this._values) { Array.prototype.includes? Comment on attachment 254219 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=254219&action=review >>> Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js:279 >>> + nameMatchesValidPropertyExactly(name) >> >> Do we need to do anything special for properties that can have a "-webkit-" prefix or not? Like transform can, and some others. > > I tested this with a few different "-webkit-" prefixed properties and it worked correctly without any issues, so no. As far as I understand, the property name includes "-webkit-" so it will match with that in mind. If I had used canonicalName, then this would be a problem as it strips prefixes. This name reads weird to me. How about isValidPropertyName or isSupportedPropertyName? >> Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js:281 >> + for (var property of this._values) { > > Array.prototype.includes? Yes! Created a new bug for additional changes: https://bugs.webkit.org/show_bug.cgi?id=145668. |
Created attachment 246049 [details] Current appearance Use case: accidentally put 'visibility: none;' in the stylesheet. The whole line is strikethrough with red. But we know 'visibility' is a real property (cross references with CSS.getSupportedProperties), so just cross out the property value.