blob: 1d78b530ef889768c3cd7b24e92a337f7ab8e201 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<style>
a {
background-image: paint(linkpainter);
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<a id="target"></a>
<script>
function addPaintletFromSource (src) {
var uri = 'data:application/javascript;charset=utf-8;base64,' + btoa(src);
CSS.paintWorklet.addModule(uri).then();
}
addPaintletFromSource(`
class LinkPainter {
paint(ctx, geom) {
ctx.fillStyle = 'black';
ctx.fillRect(0, 0, geom.width, geom.height);
}
}
registerPaint('linkpainter', LinkPainter);
`);
target.href = 'https://cs.chromium.org';
</script>
</body>
</html>