RESOLVED FIXED 238854
[Multicol] Incorrect clipping when a layer is present between the column and the content layer
https://bugs.webkit.org/show_bug.cgi?id=238854
Summary [Multicol] Incorrect clipping when a layer is present between the column and ...
zalan
Reported 2022-04-05 19:41:03 PDT
Created attachment 456775 [details] Test case see test case
Attachments
Test case (293 bytes, text/html)
2022-04-05 19:41 PDT, zalan
no flags
Patch (1.47 KB, patch)
2022-09-19 11:11 PDT, Rob Buis
no flags
Patch (1.44 KB, patch)
2022-10-19 06:25 PDT, Rob Buis
no flags
Patch (3.73 KB, patch)
2022-11-16 13:57 PST, Rob Buis
no flags
Patch (4.19 KB, patch)
2022-11-17 10:42 PST, Rob Buis
no flags
Patch (6.58 KB, patch)
2022-11-18 03:43 PST, Rob Buis
no flags
Patch (11.81 KB, patch)
2022-11-18 06:54 PST, Rob Buis
no flags
Patch (10.43 KB, patch)
2022-11-18 07:03 PST, Rob Buis
no flags
Patch (11.63 KB, patch)
2022-11-19 08:24 PST, Rob Buis
no flags
Patch (84.80 KB, patch)
2022-11-19 13:25 PST, Rob Buis
no flags
Patch (85.58 KB, patch)
2022-11-20 03:33 PST, Rob Buis
no flags
Patch (85.42 KB, patch)
2022-11-22 02:47 PST, Rob Buis
no flags
Patch (85.40 KB, patch)
2022-11-22 07:57 PST, Rob Buis
no flags
Radar WebKit Bug Importer
Comment 1 2022-04-07 12:50:15 PDT
Rob Buis
Comment 2 2022-09-19 07:38:04 PDT
There seems to be a difference between the clipping div being relative (positioned or static). This is the render tree for test case: (B)lock/(I)nline/I(N)line-block, (A)bsolute/Fi(X)ed/(R)elative/Stic(K)y, (F)loating, (O)verflow clip, Anon(Y)mous, (G)enerated, has(L)ayer, hasLayer(S)crollableArea, (C)omposited, (+)Dirty style, (+)Dirty layout B---YGLSC -- RenderView at (0,0) size 1728x944 renderer->(0x1430008b0) B-----LS- -- HTML RenderBlock at (0,0) size 1728x944 renderer->(0x143001860) node->(0x1430011c0) B-------- -- BODY RenderBody at (8,8) size 1712x928 renderer->(0x143001ad0) node->(0x14303f730) B-----L-- -- DIV RenderBlock at (0,0) size 206x56 renderer->(0x14301be60) node->(0x14304cc90) B---YGL-- -- RenderMultiColumnFlowThread at (3,3) size 92x100 renderer->(0x143073150) (layout overflow 0,0 400x100) [fragment containers 0x143073360] BR----L-- -- DIV RenderBlock at (0,0) size 92x100 renderer->(0x14301c1e0) node->(0x143072fa0) (layout overflow 0,0 400x100) (visual overflow 0,0 400x100) [spans fragment containers in flow 0x143073150 from 0x143073360 to 0x143073360] B-------- -- DIV RenderBlock at (0,0) size 400x100 renderer->(0x14301c410) node->(0x143073030) [spans fragment containers in flow 0x143073150 from 0x143073360 to 0x143073360] -------- -- Line: (top: 0 bottom: 18) with leading (top: 0 bottom: 18) -------- -- RootInlineBox at (0,0) size 167x18 (0x143065040) renderer->(0x14301c410) -------- -- InlineTextBox at (0,0) size 167x18 (0x143073580) renderer->(0x14301c550) run(0, 28) "PASS if this text is visible" I-------- -- #text RenderText renderer->(0x14301c550) node->(0x10341a1b0) length->(28) "PASS if this text is visible" B---YG--- --* RenderMultiColumnSet at (3,3) size 200x50 renderer->(0x143073360) (column count 2, size 92x50, gap 16) This is the render tree for test case with position: relative removed: (B)lock/(I)nline/I(N)line-block, (A)bsolute/Fi(X)ed/(R)elative/Stic(K)y, (F)loating, (O)verflow clip, Anon(Y)mous, (G)enerated, has(L)ayer, hasLayer(S)crollableArea, (C)omposited, (+)Dirty style, (+)Dirty layout B---YGLSC -+ RenderView at (0,0) size 1728x0 renderer->(0x1430008b0) layout->[normal child] B-----LS- -+ HTML RenderBlock at (0,0) size 1728x0 renderer->(0x143001860) node->(0x1430011c0) layout->[self][normal child] B-------- -+ BODY RenderBody at (8,8) size 1712x0 renderer->(0x143001ad0) node->(0x14303f730) layout->[self][normal child] B-----L-- -+ DIV RenderBlock at (0,0) size 206x3 renderer->(0x14301be60) node->(0x14304cc90) layout->[self][normal child] B---YGL-- -- RenderMultiColumnFlowThread at (3,3) size 92x100 renderer->(0x143073150) (layout overflow 0,0 400x100) (visual overflow 0,0 400x100) [fragment containers 0x143073360] B-------- -- DIV RenderBlock at (0,0) size 92x100 renderer->(0x14301c1e0) node->(0x143072fa0) (layout overflow 0,0 400x100) (visual overflow 0,0 400x100) [spans fragment containers in flow 0x143073150 from 0x143073360 to 0x143073360] B-------- -- DIV RenderBlock at (0,0) size 400x100 renderer->(0x14301c410) node->(0x143073030) [spans fragment containers in flow 0x143073150 from 0x143073360 to 0x143073360] -------- -- Line: (top: 0 bottom: 18) with leading (top: 0 bottom: 18) -------- -- RootInlineBox at (0,0) size 167x18 (0x143065040) renderer->(0x14301c410) -------- -- InlineTextBox at (0,0) size 167x18 (0x143073580) renderer->(0x14301c550) run(0, 28) "PASS if this text is visible" I-------- -- #text RenderText renderer->(0x14301c550) node->(0x10341a1b0) length->(28) "PASS if this text is visible" B---YG--- --* RenderMultiColumnSet at (3,3) size 200x50 renderer->(0x143073360) (column count 2, size 92x50, gap 16) RenderFragmentContainer::overflowRectForFragmentedFlowPortion asks visualOverflowRectForBox on the RenderMultiColumnFlowThread. Since the RenderMultiColumnFlowThread in the first case has no visual overflow, there is clipping against columns, and in the second case there is clipping of 400x100, hence the green rect is unclipped as expected.
Rob Buis
Comment 3 2022-09-19 11:11:00 PDT
Rob Buis
Comment 4 2022-09-29 11:49:04 PDT
@Alan do you think the patch is close? I wonder if RenderMultiColumnFlowThread always should collect the kid(s) visual overflow and that it is the root cause.
zalan
Comment 5 2022-10-01 17:06:29 PDT
(In reply to Rob Buis from comment #4) > @Alan do you think the patch is close? I wonder if > RenderMultiColumnFlowThread always should collect the kid(s) visual overflow > and that it is the root cause. I don't know. I'd look into the multicol spec to see if it says something about ink overflow.
Rob Buis
Comment 6 2022-10-19 06:25:36 PDT
Tim Nguyen (:ntim)
Comment 7 2022-10-19 10:14:22 PDT
I wonder if that fixes imported/w3c/web-platform-tests/css/css-contain/contain-size-monolithic-002.html [ ImageOnlyFailure ] as well
Tim Nguyen (:ntim)
Comment 8 2022-10-19 10:15:25 PDT
and bug 41796 as well.
Rob Buis
Comment 9 2022-10-20 09:05:29 PDT
(In reply to Tim Nguyen (:ntim) from comment #8) > and bug 41796 as well. It fixes the test Cathie attached in bug 41796. contain-size-monolithic-002.html is not fixed by this patch.
Ahmad Saleem
Comment 10 2022-11-09 15:17:48 PST
It seems this patch didn't landed, is it something on radar?
Rob Buis
Comment 11 2022-11-16 13:57:12 PST
Rob Buis
Comment 12 2022-11-17 10:42:19 PST
Tim Nguyen (:ntim)
Comment 13 2022-11-17 13:48:31 PST
Comment on attachment 463589 [details] Patch Can we add passing testcases?
Rob Buis
Comment 14 2022-11-18 03:43:50 PST
EWS Watchlist
Comment 15 2022-11-18 03:46:19 PST
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 16 2022-11-18 06:54:08 PST
Rob Buis
Comment 17 2022-11-18 07:03:30 PST
Rob Buis
Comment 18 2022-11-18 09:06:17 PST
(In reply to Tim Nguyen (:ntim) from comment #13) > Comment on attachment 463589 [details] > Patch > > Can we add passing testcases? Ah, I completely forgot! I have added Alan's test case as well as Cathie's test from bug 41796.
Rob Buis
Comment 19 2022-11-19 08:24:36 PST
Rob Buis
Comment 20 2022-11-19 13:25:09 PST
Rob Buis
Comment 21 2022-11-20 03:33:51 PST
Darin Adler
Comment 22 2022-11-21 10:48:16 PST
Comment on attachment 463629 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=463629&action=review > Source/WebCore/rendering/RenderBlock.cpp:680 > + if (RenderFragmentedFlow* containingFragmentedFlow = enclosingFragmentedFlow()) Could use “auto*” here, which would help readability. I might even call this local just “flow” to make the two lines easier to read. More explicit might not be important with something with such a narrow scope. > Source/WebCore/rendering/RenderBox.cpp:4996 > + childVisualOverflowRect->move(delta); Can’t we just put “+ delta” on the end of the previous line instead? > Source/WebCore/rendering/RenderBox.cpp:5003 > + // Add in visual overflow from the child. Even if the child clips its overflow, it may still This comment seems to be in the wrong place now; might need to split and reword it to be less confusing. > LayoutTests/fast/multicol/positioned-split.html:1 > +<div style="-webkit-column-gap: 0;-webkit-column-count:2; -webkit-column-fill:auto; column-count:2; column-fill:auto; border:2px solid black; height:300px;"> Space after the semicolon?
Tim Nguyen (:ntim)
Comment 23 2022-11-21 16:06:48 PST
Comment on attachment 463629 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=463629&action=review > LayoutTests/imported/w3c/web-platform-tests/css/css-multicol/multicol-relative-child-clipping.html:3 > +<link rel="help" href="href=https://drafts.csswg.org/css-multicol/"> Please fix `href="href=` Also please address naming comments upstream too: https://github.com/web-platform-tests/wpt/pull/37027/files (Also `multicol-` is probably redundant in the file name for both files)
Rob Buis
Comment 24 2022-11-22 02:47:47 PST
Rob Buis
Comment 25 2022-11-22 07:42:35 PST
Comment on attachment 463629 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=463629&action=review >> LayoutTests/imported/w3c/web-platform-tests/css/css-multicol/multicol-relative-child-clipping.html:3 >> +<link rel="help" href="href=https://drafts.csswg.org/css-multicol/"> > > Please fix `href="href=` > > Also please address naming comments upstream too: https://github.com/web-platform-tests/wpt/pull/37027/files > > (Also `multicol-` is probably redundant in the file name for both files) Fixed all these. Bad luck that I copy and pasted from one of the few WPT tests that has this href mistake!
Rob Buis
Comment 26 2022-11-22 07:43:43 PST
Comment on attachment 463629 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=463629&action=review >> Source/WebCore/rendering/RenderBlock.cpp:680 >> + if (RenderFragmentedFlow* containingFragmentedFlow = enclosingFragmentedFlow()) > > Could use “auto*” here, which would help readability. I might even call this local just “flow” to make the two lines easier to read. More explicit might not be important with something with such a narrow scope. Done. >> Source/WebCore/rendering/RenderBox.cpp:4996 >> + childVisualOverflowRect->move(delta); > > Can’t we just put “+ delta” on the end of the previous line instead? There does not seem to be a suitable operator overload, sadly. >> LayoutTests/fast/multicol/positioned-split.html:1 >> +<div style="-webkit-column-gap: 0;-webkit-column-count:2; -webkit-column-fill:auto; column-count:2; column-fill:auto; border:2px solid black; height:300px;"> > > Space after the semicolon? Fixed.
Rob Buis
Comment 27 2022-11-22 07:57:13 PST
EWS
Comment 28 2022-11-22 13:47:33 PST
Committed 256953@main (3fc32a416db0): <https://commits.webkit.org/256953@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 463671 [details].
Note You need to log in before you can comment on or make changes to this bug.