Repository navigation
Implement background-clip: text - #1340
Merged
Merged
Conversation
staging-devin-ai-integration
Bot
force-pushed
the
devin/1793319884-background-clip-text
branch
from
October 30, 2026 02:58
7578aac to
d2c9275
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.
Turns on Stylo's
layout.css.background-clip.text.enabledpref and paints text-clipped backgrounds.Each run of adjacent text-clipped background layers (including the background colour when the last layer is text-clipped) is painted into an isolation layer clipped to the border box. The run is then cut down with a
Compose::DestInlayer containing a text mask. This is the same technique the CSSmaskcode uses.The mask comes from a new dedicated
draw_text_masktraversal. It walkslayout_childrenrather thanpaint_children, because in-flow stacking contexts with a z-index get hoisted out ofpaint_children. It skips out-of-flow,display: noneand non-visible nodes, and paints glyphs and text decorations with an opaque brush (a newbrush_overrideonstroke_text). It applies transforms, scroll offsets and overflow clips, but not opacity, filters or blend modes. The transform and clip logic is now shared withrender_elementthroughnode_transform,scrolled_transformandshould_clip_node.WPT
css/css-backgrounds/background-clip: 13 → 25 passing.css/css-backgrounds+css/css-masking: 805 → 816 passing.One new failure:
css/css-backgrounds/background-multiple-layers-table-cell.html. Once the pref is on, its text-clipped table-row-group layer becomes valid, but table track backgrounds only paint solid colours. Still failing, due to features out of scope here:clip-text-inline, whichdraw_inline_backgroundsdoesn't handle)WPT results
Subtests: 15 newly passing, 1 newly failing (net +14).
Subtest changes by area (5 areas)
Full diff (16 changed tests)
Generated by the WPT workflow.