GNOME Bugzilla – Bug 796130
css.lang: Various improvements
Last modified: 2018-05-18 09:36:13 UTC
These changes add highlighting for more CSS statements, and improve consistency and extensibility of the CSS lang file. (Apologies for the number of patches, I went a little overboard :-P )
Created attachment 372048 [details] [review] [PATCH 01/21] css.lang: @font-face improvements * Add src property name * Add support for unicode wildcard ranges (e.g. U+4??)
Created attachment 372049 [details] [review] [PATCH 02/21] css.lang: Add animatable properties This adds an animatable-properties context, matching property names that can be animated (i.e. appear as property values for animation or transition properties). Based on the list from MDN[1]. [1] https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animated_properties
Created attachment 372050 [details] [review] [PATCH 03/21] css.lang: Support Unicode and character escapes for IDs and classes This adds an identifier regex that closely follows the rules for CSS identifiers, and uses this regex wherever CSS identifiers are used (ID/class/tag selectors, function names), so that Unicode characters and character escapes are correctly highlighted. This also removes the unicode-character-reference context, as Unicode character escapes do not appear anywhere else (except for inside strings, but then they are highlighted as part of the string).
Created attachment 372051 [details] [review] [PATCH 04/21] css.lang: Add support for @keyframes call / block This adds support for the @keyframes call (allowing strings for the keyframes name) and block (using percentages and "from"/"to" as selectors). This also adds a percetage context, split from dimension to support the keyframe selector.
Created attachment 372052 [details] [review] [PATCH 05/21] css.lang: Add highlighting for vendor prefixed values This adds highlightening for vendor-specific pseudo-elements, pseudo-classes, at-rules, property names, property values, and functions. Fixes bug 761053.
Created attachment 372053 [details] [review] [PATCH 06/21] css.lang: Move media queries and @media call into separate contexts This moves the media query and at-media-call contexts into top-level contexts.
Created attachment 372054 [details] [review] [PATCH 07/21] css.lang: Reorganize structure of lang file This groups related contexts together (selectors, at-rules, etc) and reorders the contexts into a more logical order.
Created attachment 372055 [details] [review] [PATCH 08/21] css.lang: Add container contexts to help lang file organization This adds: * all-* contexts to make referencing all contexts of a particular group (e.g. basic data types) easier * declaration context to make matching style declarations reusable * comment and string convenience contexts * comma, colon and semicolon contexts to replace punctuators (and actually match these symbols and block delimiters in all contexts)
Created attachment 372056 [details] [review] [PATCH 09/21] css.lang: Limit attribute operator highlighting This adds an attribute selector container context, replacing the delimiters context, to limit highlighting of attribute selector operators (and strings) to inside the attribute selector.
Created attachment 372057 [details] [review] [PATCH 10/21] css.lang: Add highlighting for @supports This adds an at-supports-call context to highlight the @supports at-rule.
Created attachment 372058 [details] [review] [PATCH 11/21] css.lang: Add highlighting for @charset, @import, and @namespace calls This adds contexts for @charset, @import, and @namespace calls, to highlight the valid data types for each call, and an error context for invalid @charset calls, since it has stricter syntactic requirements.
Created attachment 372059 [details] [review] [PATCH 12/21] css.lang: Update media features and feature values This adds new media features and feature values, and removes deprecated media features, from Media Queries Level 4.
Created attachment 372060 [details] [review] [PATCH 13/21] css.lang: Sort and update pseudo-elements and pseudo-classes This sorts the lists of pseudo-elements and pseudo-classes alphabetically, and adds pseudo-classes from CSS Basic User Interface Module Level 3 / HTML5.
Created attachment 372061 [details] [review] [PATCH 14/21] css.lang: Add highlighting for :lang() and :not() arguments This adds contexts to highlight the parentheses and arguments of :lang() and :not().
Created attachment 372062 [details] [review] [PATCH 15/21] css.lang: Make dimension and resolution contexts easier to read This turns the dimension and resolution simple contexts into keyword contexts, making the units easier to read and to update.
Created attachment 372063 [details] [review] [PATCH 16/21] css.lang: Add missing font-variant-east-asian values This adds JIS variant values (jis78, jis83, jis90, jis04) for the font-variant-east-asian property.
Created attachment 372064 [details] [review] [PATCH 17/21] css.lang: Add more number regexs This adds more number- and integer-related regexs, to enable more code reuse and clarify usage in contexts.
Created attachment 372065 [details] [review] [PATCH 18/21] css.lang: Add highlighting for @font-feature-values block This adds contexts to highlight @font-feature-values blocks. This also adds a positive-integer context, used inside feature value blocks.
Created attachment 372066 [details] [review] [PATCH 19/21] css.lang: Add more support for CSS Paged Media Module Level 3 This adds the at-page-call context to highlight @page blocks, and property names/values from Paged Media Module Level 3.
Created attachment 372067 [details] [review] [PATCH 20/21] css.lang: Rename selector style/context IDs This renames the IDs of selector styles and contexts to follow the naming conventions used for all other styles/contexts. This also splits the selector-grammar context, to label the symbols using their actual (CSS spec) names.
Created attachment 372068 [details] [review] [PATCH 21/21] css.lang: Update styles to better reflect contexts This updates the styles / style IDs to align with their matching contexts / CSS syntax components.
Thanks!
Pushed, see commit 975114b3d5566a6dcc4152d14eb0e69c9c453b5d and the previous ones.