Bug 238560

Summary: `contain: layout` on the html element should change position:fixed behavior
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: Layout and RenderingAssignee: Rob Buis <rbuis>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, cathiechen, changseok, clopez, dino, esprehn+autocc, ews-watchlist, fmalita, glenn, gyuyoung.kim, kondapallykalyan, pdr, rbuis, sabouhallawa, schenney, sergio, simon.fraser, webkit-bug-importer, youennf, zalan
Priority: P2 Keywords: BrowserCompat, InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://github.com/web-platform-tests/wpt/pull/33667
https://bugs.webkit.org/show_bug.cgi?id=243571
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Simon Fraser (smfr)
Reported 2022-03-30 10:52:17 PDT
https://codepen.io/smfr/pen/VwyzQvb https://www.w3.org/TR/css-contain-1/#layout-containment says that layout containment creates containing block for position:fixed. That doesn't work in WebKit.
Attachments
Patch (1.63 KB, patch)
2022-04-15 10:10 PDT, Rob Buis
no flags
Patch (1.62 KB, patch)
2022-04-16 01:11 PDT, Rob Buis
no flags
Patch (6.11 KB, patch)
2022-04-18 08:31 PDT, Rob Buis
no flags
Patch (7.98 KB, patch)
2022-04-21 13:30 PDT, Rob Buis
no flags
Radar WebKit Bug Importer
Comment 1 2022-04-06 10:53:14 PDT
Rob Buis
Comment 2 2022-04-13 07:14:57 PDT
I noticed the problem goes away if RenderLayerCompositor treats contain: layout always as a composited layer. However I guess it should work for non composited too...
Simon Fraser (smfr)
Comment 3 2022-04-13 09:22:08 PDT
Seems like `RenderElement::canContainFixedPositionObjects()` already considers containment so not sure why this is broken. Maybe RenderLayer::flagsForUpdateLayerPositions() also needs fixing.
Rob Buis
Comment 4 2022-04-15 10:10:24 PDT
Simon Fraser (smfr)
Comment 5 2022-04-15 10:26:50 PDT
Comment on attachment 457706 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=457706&action=review > Source/WebCore/rendering/RenderBox.cpp:2325 > + else if (hasTransform() || shouldApplyLayoutContainment(*this)) This should share code with canContainFixedPositionObjects()
Rob Buis
Comment 6 2022-04-16 01:11:08 PDT
Rob Buis
Comment 7 2022-04-18 08:31:39 PDT
EWS Watchlist
Comment 8 2022-04-18 08:33:16 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
Rob Buis
Comment 9 2022-04-19 13:29:54 PDT
Comment on attachment 457706 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=457706&action=review >> Source/WebCore/rendering/RenderBox.cpp:2325 >> + else if (hasTransform() || shouldApplyLayoutContainment(*this)) > > This should share code with canContainFixedPositionObjects() Done.
Simon Fraser (smfr)
Comment 10 2022-04-21 11:20:53 PDT
Comment on attachment 457806 [details] Patch RenderSVGRoot::mapLocalToContainer() and RenderBox::mapAbsoluteToLocalPoint() need the same change.
Rob Buis
Comment 11 2022-04-21 13:30:17 PDT
EWS
Comment 12 2022-04-21 22:36:41 PDT
Committed r293209 (249880@main): <https://commits.webkit.org/249880@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 458086 [details].
Note You need to log in before you can comment on or make changes to this bug.