Bug 181080

Summary: [CoordnatedGraphics] A child layer of a semitransparent layer isn't clipped properly
Product: WebKit Reporter: Fujii Hironori <Hironori.Fujii>
Component: WebKitGTKAssignee: Miguel Gomez <magomez>
Status: RESOLVED FIXED    
Severity: Normal CC: bugs-noreply, cmarcelo, commit-queue, ews-watchlist, kondapallykalyan, luiz, magomez, noam, zan
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
test case
none
screenshot of GTK port
none
screenshot of Mac port (OK)(trunk@225968)
none
Patch none

Description Fujii Hironori 2017-12-21 01:07:16 PST
Created attachment 330019 [details]
test case

[CoordnatedGraphics] A child layer of a semitransparent layer isn't clipped properly

The blue layer should be clipped by the green rect.

GTK port: NG
Mac port: OK
Chrome: OK
Edge: OK
Firefox: OK
Comment 1 Fujii Hironori 2017-12-21 01:10:27 PST
Created attachment 330021 [details]
screenshot of GTK port
Comment 2 Fujii Hironori 2017-12-21 01:20:07 PST
Created attachment 330022 [details]
screenshot of Mac port (OK)(trunk@225968)
Comment 3 Miguel Gomez 2018-01-25 06:25:30 PST
This is due to a problem with ClipStack.

When painting the pieces of the blue rectangle that are out of the green one, a clipping area is set at (0,0) with size 0x0, which means that nothing should be rendered. But CliptStack doesn't apply that clipping area (doesn't call glScissor) because the area is empty, so the pieces that should not be rendered are rendered anyway. I'm not sure why ClipStack behaves that way though.

I see 2 ways to fix this, both of them fixing the issue:

- Remove the check for an empty area in ClipStack::apply(). This causes that nothing gets rendered when the clipping area is empty, which makes sense IMO.

- In TextureMapperLayer::paintSelfAndChildren(), if the layer clips its children, check whether the resulting clipping area is empty and, in that case, do not try to paint the layer children. This is more efficient, as we avoid painting layers that will be fully clipped.

Despite none of the fixes break any layout test, I'm trying to figure out possible side effects them. I'll upload a patch when I'm sure I'm not breaking anything.
Comment 4 Miguel Gomez 2018-01-29 04:58:45 PST
Created attachment 332535 [details]
Patch
Comment 5 WebKit Commit Bot 2018-01-29 07:26:21 PST
Comment on attachment 332535 [details]
Patch

Clearing flags on attachment: 332535

Committed r227729: <https://trac.webkit.org/changeset/227729>
Comment 6 WebKit Commit Bot 2018-01-29 07:26:23 PST
All reviewed patches have been landed.  Closing bug.