Bug 234145

Summary: When transform-style: preserve-3d is used with a grouping property it should still create a containing block
Product: WebKit Reporter: Martin Robinson <mrobinson>
Component: CSSAssignee: Martin Robinson <mrobinson>
Status: RESOLVED FIXED    
Severity: Normal CC: changseok, esprehn+autocc, ews-watchlist, fred.wang, glenn, kondapallykalyan, pdr, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Martin Robinson 2021-12-10 06:33:12 PST
https://drafts.csswg.org/css-transforms-2/#interpolation-of-transform-functions says:

> The use of this property with any value other than none establishes a stacking context. It also establishes a containing block for all descendants, just like the transform property does.

Currently we are handling this via the StyleAdjuster, which is why preserve-3d-flat-grouping-properties-containing-block.html is failing the WPT test suite.
Comment 1 Radar WebKit Bug Importer 2021-12-17 06:34:17 PST
<rdar://problem/86630387>
Comment 2 Martin Robinson 2022-01-05 10:00:09 PST
Created attachment 448397 [details]
Patch
Comment 3 Simon Fraser (smfr) 2022-01-05 11:02:04 PST
Comment on attachment 448397 [details]
Patch

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

> Source/WebCore/rendering/style/RenderStyle.cpp:1188
> +        if (usedTransformStyle3D() != other.usedTransformStyle3D()

I wonder if this will be a perf regression, since usedTransformStyle3D() does more work now. This code is pretty hot. Might be better to keep the /StyleAdjuster code but have it set a usedTransformStyle field.
Comment 4 Martin Robinson 2022-01-06 07:47:13 PST
Created attachment 448501 [details]
Patch
Comment 5 Martin Robinson 2022-01-06 08:12:05 PST
(In reply to Simon Fraser (smfr) from comment #3)
> Comment on attachment 448397 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=448397&action=review
> 
> > Source/WebCore/rendering/style/RenderStyle.cpp:1188
> > +        if (usedTransformStyle3D() != other.usedTransformStyle3D()
> 
> I wonder if this will be a perf regression, since usedTransformStyle3D()
> does more work now. This code is pretty hot. Might be better to keep the
> /StyleAdjuster code but have it set a usedTransformStyle field.

Thanks for the review!

The new patch takes the approach you suggest. I ended up adding a boolean field to StyleRareNonInheritedData because that makes managing style changes a little more straight-forward (and saves a bit). I can probably change this to be an enum field if that's a better path. In addition, I've rewritten the existing tests that checked this behavior. Now they test both the used and computed value.
Comment 6 Martin Robinson 2022-01-06 08:13:16 PST
Created attachment 448503 [details]
Patch
Comment 7 EWS 2022-01-07 00:46:39 PST
Committed r287742 (245812@main): <https://commits.webkit.org/245812@main>

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