| Summary: | Web Inspector: Add "unset" to CSS value autocompletion | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Diego Pino <dpino> | ||||||||
| Component: | Web Inspector | Assignee: | Joseph Pecoraro <joepeck> | ||||||||
| Status: | RESOLVED FIXED | ||||||||||
| Severity: | Minor | CC: | bburg, commit-queue, dino, hi, hyatt, joepeck, nvasilyev, timothy, webkit-bug-importer | ||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||
| Version: | 528+ (Nightly build) | ||||||||||
| Hardware: | All | ||||||||||
| OS: | All | ||||||||||
| Bug Depends on: | 148614 | ||||||||||
| Bug Blocks: | |||||||||||
| Attachments: |
|
||||||||||
|
Description
Diego Pino
2014-01-25 03:23:19 PST
Created attachment 222204 [details]
Patch
Comment on attachment 222204 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=222204&action=review > Source/WebInspectorUI/UserInterface/CSSKeywordCompletions.js:36 > + var acceptedKeywords = ["inherit", "initial", "unset"]; According to MDN no browser supports "unset". If that is true, let's not add it. We only show completions for things WebKit actually supports. Comment on attachment 222204 [details]
Patch
We discussed this on IRC. I'm going to r-. Although this is technically correct, our existing behavior is smart and would be more useful to users.
Currently we always autocomplete "initial", and we only autocomplete "inherit" on inheritable properties (e.g. color, but not background-image).
That makes sense, because on a non-inheritable property, "inherit" would just mean "initial", the default value.
And, like Tim suggested, we don't support "unset" yet. We don't want to show properties in the frontend that a backend does not yet support. Currently if you typed "color: unset" in Web Inspector, it would get a red strike through. That would be weird if we showed it as an autocomplete suggestion =).
Comment on attachment 222204 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=222204&action=review > Source/WebInspectorUI/UserInterface/CSSKeywordCompletions.js:-49 > - // FIXME: This doesn't necessarily make sense. Some non-inheritable properties allow "inherit". You probably wrote this patch because of the FIXME comment. So that FIXME can be removed and replaced with a descriptive comment // Only suggest "inherit" on inheritable properties even though it is valid on all properties. Created attachment 222241 [details] Test of initial and inherit values on non-inherited property (background-image) I have attached a page showing how different boxes are rendered setting different values (initial, inherit, etc) for background-image (non-inherited property). At this point I can conclude the following: * When an inherited property is not set, its value is set to the value of its parent. * When a non-inherited property is not set, its value is set to its initial value (spec specifies what that value is, http://www.w3.org/TR/CSS2/propidx.html). * Setting an inherited property to inherit is the same as setting no value for that property. * Setting a non-inherited property to initial is the same as setting no value for that property. * Initial and inherit can be applied to either inherited and non-inherited properties. As Joseph told me on IRC, setting "inherit" to a non-inherited property in the current implementation is valid, because it's not crossed through. The point is that the autocompletion doesn't suggest "inherit" on non-inherited properties. When the user starts typing "in" it will only suggest "initial" for non-inherited properties (and suggests "inherit" and "initial" for inherited properties). The good thing of the current implementation is that it's easy to know what properties are inherited and which ones are not just by looking at the values suggested (if inherit is not suggested it means the property is non-inherited). With regard to "unset", I agree with removing it. I opened <https://bugs.webkit.org/show_bug.cgi?id=127638> about removing the FIXME. This bug can either be closed, or remain open to add "unset" when WebKit supports unset. Retitling as such. Comment on attachment 222204 [details]
Patch
Seems this can be addressed now that "unset" has landed. The patch likely needs an update and I don't know if the semantics for "unset" changed.
Seems easy enough! Created attachment 263245 [details]
[PATCH] Proposed Fix
Comment on attachment 263245 [details]
[PATCH] Proposed Fix
r=me
Comment on attachment 263245 [details] [PATCH] Proposed Fix Clearing flags on attachment: 263245 Committed r191187: <http://trac.webkit.org/changeset/191187> All reviewed patches have been landed. Closing bug. |