Bug 229317

Summary: Ancestors with opacity should not affect top layer elements
Product: WebKit Reporter: Tim Nguyen (:ntim) <ntim>
Component: Layout and RenderingAssignee: Tim Nguyen (:ntim) <ntim>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, changseok, clopez, esprehn+autocc, ews-watchlist, fred.wang, glenn, koivisto, kondapallykalyan, pdr, simon.fraser, webkit-bug-importer, youennf, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 229350    
Bug Blocks: 84635    
Attachments:
Description Flags
Patch none

Description Tim Nguyen (:ntim) 2021-08-19 17:56:03 PDT
From: https://fullscreen.spec.whatwg.org/#new-stacking-layer

Ancestor elements with overflow, opacity, masks, etc. cannot affect it.
Comment 1 Tim Nguyen (:ntim) 2021-08-19 18:00:32 PDT
This needs a test too, unfortunately there's no WPT for this.
Comment 2 Radar WebKit Bug Importer 2021-08-19 23:23:53 PDT
<rdar://problem/82158248>
Comment 3 Tim Nguyen (:ntim) 2021-08-19 23:56:31 PDT
https://github.com/web-platform-tests/wpt/pull/30104
Comment 4 Tim Nguyen (:ntim) 2021-08-20 00:00:53 PDT
Created attachment 435945 [details]
Patch
Comment 5 EWS Watchlist 2021-08-20 00:01:55 PDT
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Comment 6 EWS 2021-08-20 01:04:02 PDT
Committed r281299 (240723@main): <https://commits.webkit.org/240723@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 435945 [details].
Comment 7 Simon Fraser (smfr) 2021-08-20 11:43:49 PDT
Comment on attachment 435945 [details]
Patch

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

> Source/WebCore/rendering/RenderLayerBacking.cpp:2435
> +    // Top layer elements should not be affected by parent elements opacity
> +    if (m_owningLayer.establishesTopLayer())
> +        return finalOpacity;

This seems like the wrong way to fix this. Here we're in compositing code, but don't we want to reset opacity in style? If for some reason we end up not using compositing for top layers, we'll get bad rendering.
Comment 8 Tim Nguyen (:ntim) 2021-08-20 13:51:25 PDT
(In reply to Simon Fraser (smfr) from comment #7)
> Comment on attachment 435945 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=435945&action=review
> 
> > Source/WebCore/rendering/RenderLayerBacking.cpp:2435
> > +    // Top layer elements should not be affected by parent elements opacity
> > +    if (m_owningLayer.establishesTopLayer())
> > +        return finalOpacity;
> 
> This seems like the wrong way to fix this. Here we're in compositing code,
> but don't we want to reset opacity in style? If for some reason we end up
> not using compositing for top layers, we'll get bad rendering.

I filed https://bugs.webkit.org/show_bug.cgi?id=229350