Implement parsing, styling, layout, display list, and rasterization for linear-gradient(), -webkit-linear-gradient(), and -o-linear-gradient(). This enables gradient backgrounds used extensively in Bootstrap 3 and similar frameworks. Key changes: - Define ColorStopPosition, ColorStop, LinearGradient types in shared crate - Parse modern (to bottom) and legacy prefixed (origin-based) direction syntax - Add BackgroundImage enum replacing Option<String> in style system - Thread gradient data through layout boxes and display list items - Rasterize gradients by projecting pixels onto gradient line with color interpolation - CSS spec fixup ensures stop positions are monotonically non-decreasing - Update WPT manifest: promote 1 newly-passing test, demote 5 false passes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5.0 KiB
5.0 KiB
CSS Support Matrix
This document tracks implemented CSS features and gaps, with a focus on completing CSS 2.1 support. CSS is modular (there is no single “CSS4”), so this is organized by selectors, properties, values, and at-rules as implemented in this codebase.
Scope And Prioritization
Prioritization is based on visual impact and popularity in typical pages.
Implemented Today (High-Level)
Selectors:
- Type, class, ID, universal selectors
- Attribute selectors:
[attr],[attr=value],^=,$=,*=,~=,|= - Combinators: descendant, child (
>), adjacent sibling (+), general sibling (~) - Pseudo-classes:
:root,:link,:checked,:disabled,:enabled,:required,:optional,:read-only,:read-write,:defined,:dir(),:lang(),:not(),:is(),:where(),:has(),:first-child,:last-child,:only-child,:nth-child(),:nth-last-child(),:first-of-type,:last-of-type,:only-of-type,:nth-of-type(),:nth-last-of-type(),:empty
Properties (parsed + applied):
display(block, inline, inline-block, flex, none, table variants)- Box model:
width,height,margin-*,padding-*,border-*-width,border-*-color,border-*-style - Shorthands:
margin,padding,border,border-*,border-width,border-color,border-style,background(color only) background-color,color,font-size- Positioning:
position,top,right,bottom,left,z-index - Overflow:
overflow,overflow-x,overflow-y(visible, hidden) - Flexbox:
flex-direction,justify-content,align-items,gap,flex-grow,flex-shrink,flex-basis - Text:
white-space,line-height,text-align - Tables:
border-spacing,vertical-align - Constraints:
max-width,min-width,max-height,min-height - Floats:
float,clear - Custom properties (CSS variables), including
var()in key shorthands
Values:
- Length units:
px,em,rem,% - Colors: named colors, hex (
#rgb,#rgba,#rrggbb,#rrggbbaa),rgb(),rgba()
At-rules:
- None (all
@rules are skipped)
Known Missing Or Incomplete Behavior
Selectors and pseudo-classes:
- Pseudo-elements never match (e.g.,
::before,::after,::first-line,::first-letter,::placeholder). - Many pseudo-classes are parsed but always return false:
:hover,:focus,:focus-visible,:focus-within,:active,:visited,:target,:placeholder-shown,:default,:valid,:invalid,:in-range,:out-of-range,:indeterminate. - Attribute selector case-sensitivity flags (
i/s) are parsed but not honored.
At-rules and media:
@mediais supported (viewport width/height, prefers-color-scheme; nesting supported).@font-faceis supported (font-family, src with url()/format(), font-weight, font-style; TTF/OTF only, WOFF2 not yet supported).@import,@supports,@keyframes,@layerare not supported.
Properties and values:
- Many CSS 2.1 properties are missing entirely (see Prioritized Backlog below).
backgroundshorthand extracts color andlinear-gradient()(no repeat, position, size).- Border styles are limited to
none,solid,dashed,dotted. - Units missing:
pt,pc,in,cm,mm,ex,ch. - Color functions missing:
hsl(),hsla().
Prioritized Backlog For CSS 2.1 Completion
Tier 1: High visual impact and common usage
font-weight(bold text for<b>,<strong>,<th>)font-style(italics for<em>,<i>,<cite>,<var>)font-family(monospace for<code>,<pre>,<kbd>,<samp>)text-decoration(underlines for links)list-style-type,list-style-position(bulleted and numbered lists)background-imagewithurl()andlinear-gradient()(including-webkit-and-o-prefixes),background-repeat,background-position(basic background rendering)- Pseudo-elements
::beforeand::after(even limitedcontentsupport for simple strings) :hoverand:focus(core interactive styling)
Tier 2: Layout correctness and common rendering expectations
border-collapse(tables)caption-side(tables)vertical-alignfor inline/inline-block elements in layout (not just computed value)line-heightinheritance nuances andnormaldefault per font metrics (currently fixed 1.2)%resolution forheight,top,bottomwith containing block rulesoverflow: scrollandoverflow: autovisibility(hidden while taking space)white-spacelayout behavior forpre-wrapandpre-line
Tier 3: CSS 2.1 coverage and polish
text-transformletter-spacing,word-spacingtext-indentdirection,unicode-bidiquotescontent(full support for pseudo-elements)outlinepropertiescursor- Full unit support:
pt,pc,in,cm,mm,ex,ch - Full color support:
hsl(),hsla()
Notes
- This list reflects observed gaps in
crates/css,crates/style, andcrates/selectorsas of the current tree. - If you add a property, update the parser (
PropertyIdand parsing), computed style (ComputedStyles), and layout/paint as needed.