Commit 4b26244
committed
LibWeb: Extract Canvas2DContextBase from CanvasRenderingContext2D
OffscreenCanvasRenderingContext2D duplicates CanvasRenderingContext2D
interface but stubs out every drawing operation, because all the real
recording/present/readback logic was welded to HTMLCanvasElement inside
CanvasRenderingContext2D. Nearly all of that logic is owner-agnostic: it
funnels through the shared canvas command list and drawing state.
Move it into a new abstract Canvas2DContextBase. The element-specific
behavior is reduced to five small hooks (dirty marking after draws, the
Page providing the compositor host, repaint on backing storage creation,
the contextlost/contextrestored event target, and style-resolved
drop-shadow filter colors) that CanvasRenderingContext2D now implements
against HTMLCanvasElement. AbstractCanvasMixin gains set_font and
resolved_letter_spacing as pure virtuals so the base's text code can
reach the CanvasTextDrawingStyles<T> mixin that stays on leaf classes.
This is a pure refactor with no behavior change in preparation for
offscreen canvas support.1 parent 36456bc commit 4b26244
7 files changed
Lines changed: 1741 additions & 1632 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
489 | 489 | | |
490 | 490 | | |
491 | 491 | | |
| 492 | + | |
492 | 493 | | |
493 | 494 | | |
494 | 495 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
| |||
0 commit comments