Repository navigation
Update the CSS engine to ExCSS master - #287
Merged
Merged
Conversation
- Vendor ExCSS 589afaf instead of PeachPDF 0.9.6's copy, keep only the renderer's hooks and the fixes ExCSS doesn't have yet: escaped surrogates, alignment prefixes without a keyword, transition: none and list-style-type: hebrew - Fix the parsing ExCSS got wrong compared to the old copy: inset and spread in text-shadow, "top 2px" in perspective-origin, math functions in grid tracks and basic shapes, and palette-mix() in font-palette - Map the flow-relative longhands, white-space-collapse, text-wrap-mode, text-align-all and font-variant-caps in the renderer, ExCSS keeps them as properties of their own - Let a later declaration of the same longhand win over a deferred var() declaration, also through a shorthand or a flow-relative name - Match :first-child and friends, which ExCSS creates as plain pseudo-classes, and honor the s flag of attribute selectors - Resolve the colors the renderer's own parsers don't know through the engine, and light-dark() as its light color - Lay out display: flow-root as block and keep ignoring display: contents, ExCSS accepts both now - Don't treat overflow: clip as a scroll container or a formatting context - Close the gaps ExCSS fixed and record the ones it introduced
eXpl0it3r
force-pushed
the
excss-sync
branch
from
November 13, 2026 11:52
621ab6f to
8f2dfa2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Core/CssEnginewas PeachPDF 0.9.6's copy of ExCSS. ExCSS itself has received 118 commits since 4.3.2 in the mean time, a good chunk of them upstreamed from PeachPDF, so this replaces the copy with ExCSS master (589afaf), keptinternaland in our namespace. On top of it, only the hooks the renderer needs (Stylesheet.IsUserAgent,Length.ToPixels, the media feature helpers,CalcEvaluator,CodepointRange) and a few fixes ExCSS doesn't have stay local:safewithout a keyword no longer throwstransition: noneis acceptedlist-style-type: hebrewis acceptedtext-shadowtakesinsetand a non-negative spread distance (Text Decoration 4)perspective-origin: top 2pxis rejected, only keyword pairs may be swappedfont-paletteacceptspalette-mix()The last four are things the old copy got right and ExCSS master doesn't. They're good candidates to upstream to ExCSS, together with the first four.
ExCSS represents a few things differently, so the renderer is adapted:
float: inline-start) are properties of their own and get mapped to the physical sides, LTR as beforewhite-spaceandtext-alignare shorthands now, their longhands are combined back, andtext-align-allandfont-variant-capsmap to the properties the box knows:first-childand friends come in as plain pseudo-classes and are matched by the renderer, and thesflag of attribute selectors compares case-sensitivelyvar()is applied after the cascade, and a later declaration only overrode it under the exact same name. With the flow-relative properties and the new shorthands that broke, e.g.margin-inline-start: var(--m)won over a latermargin-left. A later declaration now wins for every longhand it sets, which also fixesmargin: var(--m)overriding a latermargin-lefton masterExCSS also accepts values that broke the rendering, because the old copy simply rejected them:
display: flow-rootanddisplay: contentscollapsed the box to 0×0.flow-rootlays out asblocknow,contentsstays ignored as before.rgb(calc(…)), relative colors andlight-dark()ended up transparent. Colors the renderer's own parsers don't know are resolved through the engine, andlight-dark()gives its light color, as long ascolor-schemeis ignored.overflow: clipwas treated as a scroll container and a new formatting context.The spec manifests are updated accordingly. Over 100 gap tests pass now and lost their
[Ignore], a few more were split into the part that passes and the part that doesn't, and the recorded gaps went from 1'558 to 1'445. The four PeachPDF-only grammars that only tests used are gone, their tests now check what the parser accepts and rejects.How to test this PR?
CI should succeed. Additionally:
[Ignore]dotnet run --project Source/Tools/HtmlRenderer.SpecCompliance -c Release -- check) reports no problems