Bug 181080 - [CoordnatedGraphics] A child layer of a semitransparent layer isn't clipped properly
Summary: [CoordnatedGraphics] A child layer of a semitransparent layer isn't clipped p...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Miguel Gomez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-21 01:07 PST by Fujii Hironori
Modified: 2018-01-29 07:26 PST (History)
9 users (show)

See Also:


Attachments
test case (528 bytes, text/html)
2017-12-21 01:07 PST, Fujii Hironori
no flags Details
screenshot of GTK port (155.99 KB, image/png)
2017-12-21 01:10 PST, Fujii Hironori
no flags Details
screenshot of Mac port (OK)(trunk@225968) (105.06 KB, image/png)
2017-12-21 01:20 PST, Fujii Hironori
no flags Details
Patch (2.18 KB, patch)
2018-01-29 04:58 PST, Miguel Gomez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.