In CanvasRenderingContext2DBase, instead of downcasting the CanvasBase object to HTMLCanvasElement, call CanvasBase methods introduced in bug #182503, making it possible for OffscreenCanvas to leverage this class properly.
Created attachment 333582 [details]
Depends on changes in bug #182503.
Created attachment 334802 [details]
Reviewable, but still depends on bug #182503.