Skip to content

Comments

@remotion/web-renderer: Support background-clip CSS property#6198

Merged
JonnyBurger merged 13 commits intomainfrom
background-clip-text-2
Jan 2, 2026
Merged

@remotion/web-renderer: Support background-clip CSS property#6198
JonnyBurger merged 13 commits intomainfrom
background-clip-text-2

Conversation

@JonnyBurger
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings January 2, 2026 18:38
@vercel
Copy link
Contributor

vercel bot commented Jan 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
bugs Ready Ready Preview, Comment Jan 2, 2026 9:48pm
remotion Ready Ready Preview, Comment Jan 2, 2026 9:48pm

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for the CSS background-clip property in the web renderer, enabling backgrounds to be clipped to different box areas (border-box, padding-box, content-box) and to text.

Key changes:

  • Implemented background clipping logic with support for all standard values including text
  • Refactored background drawing into a dedicated module
  • Added helper functions to calculate clipping boundaries based on padding and border dimensions

Reviewed changes

Copilot reviewed 20 out of 23 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
draw-background.ts New file implementing background rendering with clip support
get-padding-box.ts New file calculating padding/content box boundaries for clipping
get-clipped-background.ts New file handling background-clip: text via composition
draw-element.ts Refactored to use new background drawing system
border-radius.ts Updated to calculate border radius for clipped boxes
parse-linear-gradient.ts Added offset parameters for gradient positioning
draw-text.ts Added support for rendering text with background-clip
handle-text-node.ts Passes onlyBackgroundClip flag to text drawing
tree-walker-cleanup-after-children.ts New utility for managing cleanup in tree traversal
Test files Added test fixture and test case for background-clip functionality

contextToDraw.fillStyle = backgroundColor;
contextToDraw.fillRect(
boundingRect.left - offsetLeft,
boundingRect.top - offsetLeft,
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Y coordinate calculation is using offsetLeft instead of offsetTop. This should be boundingRect.top - offsetTop to correctly position the background fill rectangle.

Suggested change
boundingRect.top - offsetLeft,
boundingRect.top - offsetTop,

Copilot uses AI. Check for mistakes.
@JonnyBurger
Copy link
Member Author

@claude one test is failing but it is okay, just increase the tolerance to 0.03

@claude
Copy link

claude bot commented Jan 2, 2026

Claude finished @JonnyBurger's task in 59s —— View job


Task: Increase test tolerance to 0.03

  • Read the background-clip test file
  • Update tolerance to 0.03
  • Commit and push changes

Summary

Successfully increased the allowedMismatchedPixelRatio from 0.01 to 0.03 in the background-clip test file (packages/web-renderer/src/test/background-clip.test.tsx). The change has been committed and pushed to the background-clip-text-2 branch.


|

Co-authored-by: Jonny Burger <JonnyBurger@users.noreply.github.com>
@JonnyBurger JonnyBurger merged commit 9265c17 into main Jan 2, 2026
14 of 15 checks passed
@JonnyBurger JonnyBurger deleted the background-clip-text-2 branch January 2, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant