Skip to content

[css-paint-api] paint() images are not rendered anywhere inside :link/:visited subtrees in Chromium (151/153) — conformance bug or intentional privacy mitigation? #1178

Open

Description

@jasonrale

Summary

In Chromium (verified on Chrome for Testing 151.0.7922.34 and Headless Chrome 153, Linux, headless and headed), a paint() image does not rasterize anywhere inside the subtree of an element matching :link/:visited — not on the anchor itself, not on its pseudo-elements, and not on its descendant elements.

The behavior is live-toggled by the presence of the href attribute on the same element: removing href makes the paint background appear instantly; re-adding it makes it disappear. <button> and non-link elements paint fine on the same page with the same registered worklet.

Reduced test case (single file, no dependencies)

<!doctype html>
<meta charset="utf-8">
<title>paint :link repro</title>
<style>
  .skin {
    display: inline-block;
    width: 220px;
    height: 44px;
    margin: 8px 0;
    background: paint(solid-red);
    color: #fff;
    font: 16px/44px monospace;
    padding-left: 8px;
    box-sizing: border-box;
    vertical-align: top;
  }
  .row { display: block; }
</style>
<div class="row"><div class="skin">DIV</div></div>
<div class="row"><a class="skin">A no href</a></div>
<div class="row"><a class="skin" href="#">A with href</a></div>
<div class="row"><a class="skin" href="https://example.com/x">A external href</a></div>
<script>
  const src = `
    registerPaint('solid-red', class {
      paint(ctx, geom) {
        ctx.fillStyle = 'rgb(255,0,0)';
        ctx.fillRect(0, 0, geom.width, geom.height);
      }
    });
  `;
  CSS.paintWorklet
    .addModule(URL.createObjectURL(new Blob([src], { type: 'text/javascript' })))
    .then(() => (document.title += ' [registered]'));
</script>

Expected (per CSS Painting API § 7 Drawing an image: "If a paint() function image for a box is within the visual viewport, the user agent must display an image output from an invocation of the draw a paint image algorithm"): all four elements render a red plate.

Actual: DIV and the <a> without href render the red plate; both <a href> elements render nothing for the paint() background (only the white text is visible). Pixel-level verification: ~9500 red pixels for the first two, 0 for the link pair.

Live toggle from DevTools on the same node confirms causality:

document.querySelectorAll('.skin')[2].removeAttribute('href') // red plate appears
document.querySelectorAll('.skin')[2].setAttribute('href', '#') // plate disappears

Additional observations

  • CSS.supports('background-image', 'paint(x)') returns true, so @supports-based fallbacks do not engage — authors have no declarative way to detect this.
  • Using the paint image as a mask is worse: mask-image: paint(...) on a link resolves to a fully transparent mask, hiding the element entirely instead of falling back to "no mask".
  • The suppression extends to the whole subtree: moving the background: paint() to a ::before pseudo or a child <span> of the link does not help.
  • will-change: transform, transform: translateZ(0), and background-attachment: fixed do not change the outcome.
  • Registration timing is irrelevant (registering from a synchronous inline script at the start of <body> behaves the same).
  • No related toggle exists in chrome://flags.
  • I could not find an existing public report for this in the Chromium tracker.

Question for the WG

§ 10 Privacy Considerations notes that "the timing of paint callbacks can be used as a high-bandwidth channel for detecting 'visited' state for links" and that "no official mitigations are planned at this time". The observed behavior looks like it could be a (broad) mitigation for exactly that channel — if it is intentional, it appears to be undocumented, it defeats @supports detection, and its blast radius (all :link/:visited subtrees, including masks) seems far wider than the timing channel described.

  • Is Chromium's behavior conformant with § 7 as written?
  • If engines are expected to suppress paint output on link subtrees for privacy reasons, should the spec say so and define the exact scope (and ideally a detectable condition)?

Either way, some spec clarification would help authors decide when paint() is safe to rely on for link-styled controls (a common pattern for button-like links).

Activity

  1. jasonrale commented on Sep 28, 2026

    @jasonrale
    Author

    Filed in the Chromium tracker as well: https://issues.chromium.org/issues/566807520 (component: Blink>CSS).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions