Bug 249248

Summary: [GPU Process] [FormControls] Route drawing the ControlPart through GraphicsContext
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: Layout and RenderingAssignee: Said Abou-Hallawa <sabouhallawa>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, Hironori.Fujii, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 249168    

Description Said Abou-Hallawa 2022-12-13 12:56:17 PST
We will make RenderBox create a ControlPart from its DOM element. We will start by the MeterPart as an example for the whole workflow since it is a simple control.

RenderBox::paintBoxDecorations() will call GraphicsContext::drawControlPart() which will delegate the call to ControlPart::draw(). ControlPart::draw() will create the PlatformControl using its ControlFactory. On macOS the ControlFactory will be of type ControlFactoryMac and the PlatformControl will be of type MeterMac. ControlPart::draw() will call MeterMac::draw() which will call AppKit to draw the NSLevelIndicatorCell.

For GPUP a new DisplayList item named DrawControlPart will be added. This will route the display to RemoteDisplayListRecorder which will call drawControlPart() from its ImageBuffer context. Because ControlFactoryMac will use a single NSLevelIndicatorCell for all MeterMac it creates, there should be a ControlFactoryMac per rendering thread in GPUP. So each RemoteDisplayListRecorder should have one ControlFactoryMac and should set it all in the ControlParts its renders through ControlPart::setControlFactory().
Comment 1 Radar WebKit Bug Importer 2022-12-13 12:56:48 PST
<rdar://problem/103315944>
Comment 2 Simon Fraser (smfr) 2022-12-13 12:57:33 PST
> RenderBox::paintBoxDecorations() will call GraphicsContext::drawControlPart()

What role will RenderTheme play in this code path?
Comment 3 Said Abou-Hallawa 2022-12-13 13:07:40 PST
Pull request: https://github.com/WebKit/WebKit/pull/7566
Comment 4 EWS 2022-12-16 02:33:23 PST
Committed 257981@main (27e83068fe9e): <https://commits.webkit.org/257981@main>

Reviewed commits have been landed. Closing PR #7566 and removing active labels.
Comment 5 Said Abou-Hallawa 2022-12-16 07:06:54 PST
(In reply to Simon Fraser (smfr) from comment #2)
> > RenderBox::paintBoxDecorations() will call GraphicsContext::drawControlPart()
> 
> What role will RenderTheme play in this code path?

RenderTheme will create the ControlPart from the RenderBox and its renderer. RenderThemeMac will answer questions specific to macOS when creating the ControlPart.