0x48piraj / 0x48piraj/kurogane

Proposal: Investigate HTML-in-Canvas (CanvasDrawElement) support via Chromium/CEF flags

未关闭
#4 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
chromium/flags experimental proposal renderer/core
主要语言
Rust
星标
8
派生
4
平均合并
16 小时 19 分钟
30 天内合并 PR
7

描述

## Summary

This issue proposes exploring support for the experimental *HTML-in-Canvas* API (CanvasDrawElement) from the [Web Incubator Community Group](https://wicg.io/) in Kurogane via Chromium/CEF feature flags.

Rather than committing to adoption, the goal is to evaluate feasibility, performance impact and alignment with Kurogane’s rendering-focused use cases.

## Background

The HTML-in-Canvas proposal (incubated in WICG) introduces APIs that allow rendering DOM elements directly into `` contexts, including:

* `drawElementImage()`
* `layoutsubtree` attribute
* `canvas.onpaint` event
* `captureElementImage()` for OffscreenCanvas workflows

The feature is currently:

* Implemented behind a Chromium flag (`canvas-draw-element`)
* Available in experimental builds (e.g. Chromium Canary)
* Not standardized and subject to change

Reference:
[https://github.com/WICG/html-in-canvas](https://github.com/WICG/html-in-canvas)

## Why is this relevant?

Kurogane is explicitly designed for:

* High-frequency rendering workloads (WebGL, Canvas, WASM)
* Direct control over the Chromium rendering pipeline
* Cross-platform GPU consistency (especially on Linux)

HTML-in-Canvas aligns strongly with these goals by enabling:

* Rendering complex, styled DOM content into GPU-backed canvas contexts
* More consistent accessibility vs traditional canvas text rendering
* New hybrid rendering patterns (DOM -> GPU surface -> 2D/3D composition)
* Potential use in:

* In-app UI layers
* Game-like interfaces
* Visualization overlays
* Media export pipelines

## Proposal

Investigate whether Kurogane can expose this feature **optionally** via Chromium/CEF flags.

### Exploration areas

1. **CEF / Chromium compatibility**

* Identify the Chromium version where `canvas-draw-element` exists
* Map to corresponding CEF version(s)
* Verify whether the feature is compiled into CEF builds

2. **Flag support**

* Test enabling via:

```
chrome://flags/#canvas-draw-element
```

Read more over https://html-in-canvas.dev/docs/browser-support/

3. **Runtime behavior**

* Validate basic demos from the WICG repo
* Test:

* 2D canvas usage
* OffscreenCanvas + worker flows
* WebGL/WebGPU interop (if available)

4. **Performance characteristics**

* Compare against:

* Manual canvas text/layout rendering
* DOM overlays
* Measure:

* Frame consistency
* GPU utilization
* Latency

5. **Platform consistency**

* Especially Linux vs Windows behavior
* Any compositor / vsync interactions

## Non-goals

* Shipping this as a stable or default feature
* Building abstractions around the API (yet)
* Guaranteeing long-term support

This is strictly exploratory.

## Risks

* API is unstable
* Potential mismatch between Chromium and CEF exposure
* Behavior may change or be removed upstream
* Additional maintenance burden if relied upon too early

## Potential outcome

If viable, Kurogane could:

* Expose experimental rendering capabilities ahead of mainstream frameworks
* Enable advanced GPU/DOM hybrid rendering patterns
* Further differentiate from WebView-based approaches and higher-level runtimes

## Next steps

* [x] Identify minimum Chromium + CEF version
* [x] Attempt flag enablement in a dev build
* [x] Run WICG demos inside Kurogane
* [ ] Document findings (working / broken / missing)

贡献指南

打开贡献指南

调研方向

该 issue 是一个探索性提案。首先检查链接的 WICG 仓库和 html-in-canvas.dev 文档,以了解浏览器支持情况。确定包含 'canvas-draw-element' 标志的 Chromium 和 CEF 版本。在 Kurogane 开发构建中运行 WICG 演示,以查看该功能是否有效。记录有关兼容性、性能和跨平台一致性的任何发现。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript
领域
computer-graphics, desktop, web-dev
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。