Native rich-text CSS support queries

The native XHTML decoder evaluates @supports groups and supports() import conditions against its supported rich-text declarations and selector grammar

<body xmlns="http://www.w3.org/1999/xhtml">
  <style><![CDATA[
    @supports (font-size: calc(10pt + 5pt)) and selector(span.notice) {
      span.notice { font-size: 15pt }
    }
    @supports not (display: grid) {
      span.notice { font-weight: bold }
    }
  ]]></style>
  <p><span class="notice">Conditional text</span></p>
</body>

In the native profile both groups apply, producing 15-point bold text with the caller's supplied fonts

Declaration and selector admission

Declaration queries use the existing admission helpers for font-size, font-weight, font-style, text-decoration, color, text-align, font-family, line-height, font shorthand, letter-spacing and word-spacing

Numeric queries share the finite CSS math profile, default font metrics and explicit media dimensions; unsupported properties or unadmitted values evaluate false

Font-family queries require the configured FontFamilyNames collection, and an unavailable but valid family can use the existing supplied-family fallback

A valid !important annotation is accepted in a declaration query without changing the conditional group's cascade priority; an extra declaration, trailing semicolon or invalid priority is refused

selector() checks the existing native selector grammar and current sheet's namespace declarations without matching a document element

Every selector branch must be supported, including branches inside normally forgiving is() and where() lists; undefined namespace prefixes and unknown pseudo classes evaluate false

Root :scope and the static :hover, :active, :focus, :focus-visible and :focus-within grammar are supported. A successful feature query describes parser support; user-action selectors still never match a PDF appearance, and functional forms such as :hover() are invalid

Selector probes restore temporary matcher storage and leave subsequent stylesheet matching intact; their work still consumes the shared node and cancellation budgets

Boolean syntax and forward-compatible conditions

Conditions accept not, homogeneous and or or chains, and nested parentheses; mixing and with or requires explicit grouping

Comments and CSS identifier escapes follow the decoder's existing tokenizer, and not must be a keyword separated from the following term rather than a not() function token

Balanced unknown functions and parenthesized general-enclosed conditions evaluate false, so an enclosing not can provide a fallback

Malformed strings, malformed unquoted URL tokens and unmatched delimiters invalidate the enclosing condition before negation; numeric dimensions and quoted function tokens retain their distinct token boundaries

Groups, imports and output

Conditional groups retain their actual source position, selector specificity and important priorities, and can nest with supported media groups

@import "metrics.css" supports(line-height: 18pt) print;
@import "fallback.css" supports(not selector(span:future));

An import's optional supports() condition follows the resource URI and precedes its optional media condition; both must admit the resource before it contributes declarations

Relative URI resolution, cycle handling, namespace isolation and the existing import-order requirements remain those of caller-supplied style sheets

Admitted declarations reach actual decoded runs, computed canonical rich values, saved field appearances and default-profile rich FDF/XFDF imports through the same decoder

Bounds and acceptance

Condition parsing and selector probes consume the existing MaxNodes and MaxTotalCodeUnits limits; nested conditions, blocks and groups share MaxDepth

Cancellation propagates EHPDFOperationCancelled without returning partial runs, and failed queries or budgets retain fresh and reused decode recovery

Tests/Linux/RichTextSupports/Run.py verifies declaration, selector, Boolean and URL-token behavior, nested cascade and imports, measured cancellation and actual saved plain and AES-encrypted PDF output

This native profile does not add browser layout, import layers, custom properties, additional selector syntax or CSS conditional features beyond the supported declaration and selector queries above

The condition syntax follows supported portions of CSS Conditional Rules Level 3 and Level 4; the native admission profile defines which queries succeed

Native decoder · Decode options · Media profiles