`GraphicsContext::clipTransformedPath()` new API for transform-agnostic SVG clipping
Component: WebCore graphics / GPU process IPC | 898701f
Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
Source/WebKit/GPUProcess/graphics/RemoteGraphicsContext.cpp
In GPU-process rendering, the WebContent process records drawing into display lists or sends per-call IPC through RemoteGraphicsContextProxy, and the GPU process replays onto a real CG or Skia context; large or reused paths travel as cached objects referenced by identifier. The old SVG clipper called setCTM(), writing an absolute CTM and baking in the recording-time base transform. Clips in CG and Skia live in device space, so a temporary CTM change followed by a restore leaves the clip intact, whereas save()/restore() would discard it.
The new virtual clipTransformedPath(pathTransform, path, windRule) clips to the transformed path without changing the CTM: the base class transforms a copy of the path, while CG and Skia overrides concatenate, clip, and restore. A new DisplayList::ClipTransformedPath item and two new IPC messages (ClipTransformedPath, ClipTransformedCachedPath) carry it, and both SVG clipper renderers switch to it.
Significance
SVG path clipping can now be recorded into display lists without an absolute CTM, so the lists can be replayed under a different base transform while keeping paths cacheable. It also adds new display-list and IPC surface at the WebContent-to-GPU boundary.
Audit directions
Two new IPC messages decode an attacker-controllable AffineTransform, a Path or cached-path identifier, and a WindRule from a potentially compromised WebContent process. Narrow: a missing cache identifier is already handled by MESSAGE_CHECK(pathImpl); the open question is whether an identifier resolving to a stale entry or an unexpected impl kind is safe downstream, since the Path is built straight from the impl. Nothing validates the transform at decode time, so feed NaN/Inf, singular and huge-scale matrices to CGContextConcatCTM and Skia concat. Compare the CG override's CGContextGetCTM()/CGContextSetCTM() restore against the old getCTM() for drift when device scale isn't part of the CTM or the context is layer- or bitmap-backed, and the CG-only empty-path branch against Skia, which has none. Wider: the recorder's updateStateForClipTransformedPath intersects clipBounds with (ctm * pathTransform).mapRect(path.fastBoundingRect()) — check it matches what the GPU process actually clips, since a mismatch could desynchronize culling bounds — and note that BifurcatedGraphicsContext deliberately inherits the base implementation, so the two can diverge; review the new DisplayListDataTester entry and item serialization too. Tell: a new remote graphics message whose decoded transform reaches a platform context call with no finiteness check.