The canvas Layout tests revealed roughly 24 crashes. This patch corrects a number of problems: 1. BitmapImage cannot create ID2D1Bitmaps without a render target. However, some code paths allowed a nullptr target to be used. 2. Direct2D will not allow you to draw an ID2D1Bitmap to itself. We need to create a copy. 3. Consolidate the empty 'State' class in PlatformContextDirect2D with the separate stack of rendering state. This was cruft left over from before the PlatformContextDirect2D code was in place. This simplifies a lot of the code, and avoids some cases where the stacks were not in sync.
Created attachment 379287 [details] Patch
With the patch there are no crashes (but 145 failures!). Fixing failures next.
Comment on attachment 379287 [details] Patch Clearing flags on attachment: 379287 Committed r250188: <https://trac.webkit.org/changeset/250188>
All reviewed patches have been landed. Closing bug.
<rdar://problem/55595290>