Bug 216031

Summary: EventRegion paint should respect layer's foreground and background painting phases
Product: WebKit Reporter: Antti Koivisto <koivisto>
Component: ScrollingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: changseok, esprehn+autocc, ews-watchlist, fred.wang, glenn, kondapallykalyan, pdr, simon.fraser
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch none

Description Antti Koivisto 2020-09-01 03:19:00 PDT
We are currently painting event region for the box background to the foreground layer.
Comment 1 Antti Koivisto 2020-09-01 03:19:26 PDT
<rdar://problem/67282372>
Comment 2 Antti Koivisto 2020-09-01 03:31:25 PDT
Created attachment 407668 [details]
patch
Comment 3 Simon Fraser (smfr) 2020-09-01 09:35:14 PDT
Comment on attachment 407668 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=407668&action=review

> Source/WebCore/rendering/RenderBlock.cpp:1140
> +        if (paintInfo.eventRegionContext)
> +            paintInfoForChild.paintBehavior.add(PaintBehavior::EventRegionIncludeBackground);

This is pretty weird. I wish event region painting followed normal painting more closely.

> Source/WebCore/rendering/RenderLayer.cpp:4654
> +            paintBehavior = paintBehavior & PaintBehavior::CompositedOverflowScrollContent;

I know you moved this and I added it in r262337 but I don't understand it.
Comment 4 Simon Fraser (smfr) 2020-09-01 09:37:56 PDT
Comment on attachment 407668 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=407668&action=review

>> Source/WebCore/rendering/RenderBlock.cpp:1140
>> +            paintInfoForChild.paintBehavior.add(PaintBehavior::EventRegionIncludeBackground);
> 
> This is pretty weird. I wish event region painting followed normal painting more closely.

Maybe leave it alone so I can decipher it without too many history jumps.
Comment 5 Antti Koivisto 2020-09-01 09:41:31 PDT
> > Source/WebCore/rendering/RenderBlock.cpp:1140
> > +        if (paintInfo.eventRegionContext)
> > +            paintInfoForChild.paintBehavior.add(PaintBehavior::EventRegionIncludeBackground);
> 
> This is pretty weird. I wish event region painting followed normal painting
> more closely.

It basically just does the same thing the code next to it does with paint phases:

newPhase = (newPhase == PaintPhase::ChildBlockBackgrounds) ? PaintPhase::ChildBlockBackground : newPhase;

(ChildBlockBackgrounds vs ChildBlockBackground is bit subtle)

> I know you moved this and I added it in r262337 but I don't understand it.

I suppose the other flags are not relevant for event regions?
Comment 6 EWS 2020-09-01 10:48:42 PDT
Committed r266403: <https://trac.webkit.org/changeset/266403>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 407668 [details].