Repository navigation
Read bgcolor, font color and body text as legacy colors - #1344
Open
yangkx1024 wants to merge 1 commit into
Open
yangkx1024 wants to merge 1 commit into
yangkx1024 wants to merge 1 commit into
Conversation
`bgcolor` only took `#rgb` and `#rrggbb`, and read `#rgb` without scaling each digit (`#fff` as `#0f0f0f`), so the white tables common in email painted near black. Color names, hex digits without the `#` and values with spaces around them were ignored. Parse them with Stylo's implementation of the HTML "rules for parsing a legacy colour value", as the dimension attributes already use Stylo's parser, and map `font color` and `body text` to `color`, which were not mapped at all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
yangkx1024
marked this pull request as ready for review
October 30, 2026 07:29
This branch has not been deployed
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.
bgcoloronly accepted#rgband#rrggbb, and read#rgbwithout scaling each digit, so#fffbecame#0f0f0f. The white tables that HTML email is full of came out near black. Color names, hex without the#, and values with surrounding spaces were ignored, and<font color>and<body text>weren't mapped at all.This parses them with Stylo's implementation of the HTML "rules for parsing a legacy colour value" (
style::servo::attr::parse_legacy_color), the same module the dimension attributes already use, and mapsfont colorandbody texttocolor.body link/vlinkwould need:linkstate and are left out.bgcolorstill applies to whichever elements it did before.CI's WPT run covers
cssandsvgonly, which doesn't exercise these attributes, so I've addedtests/blitz-tests/tests/legacy_color_attributes.rs. It compares each attribute against the equivalent CSS. The#fffandfont colorcases fail without the change.I found this while using Blitz to render mail in an email client, and have been running it there from a fork.