RESOLVED FIXED 245351
[LFC][Cleanup] Remove Layout::Box::formattingContextRoot
https://bugs.webkit.org/show_bug.cgi?id=245351
Summary [LFC][Cleanup] Remove Layout::Box::formattingContextRoot
zalan
Reported 2022-09-18 20:04:00 PDT
ssia
Attachments
Patch (22.64 KB, patch)
2022-09-18 20:30 PDT, zalan
no flags
zalan
Comment 1 2022-09-18 20:30:16 PDT
Antti Koivisto
Comment 2 2022-09-19 06:07:09 PDT
Comment on attachment 462427 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=462427&action=review > Source/WebCore/layout/formattingContexts/FormattingContext.cpp:280 > for (auto& descendant : descendantsOfType<Box>(root)) { > if (!descendant.isOutOfFlowPositioned()) > continue; > - if (&descendant.formattingContextRoot() != &root) > + auto nearestFormattingContextRoot = [&] { > + auto* ancestor = &descendant.containingBlock(); > + for (; !ancestor->establishesBlockFormattingContext(); ancestor = &ancestor->containingBlock()) { } > + return ancestor; > + }; > + if (nearestFormattingContextRoot() != &root) > continue; > formattingState().addOutOfFlowBox(descendant); > } This loop could just avoid traversing into subtrees that are in a separate formatting context.
zalan
Comment 3 2022-09-19 15:34:10 PDT
(In reply to Antti Koivisto from comment #2) > Comment on attachment 462427 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=462427&action=review > > > Source/WebCore/layout/formattingContexts/FormattingContext.cpp:280 > > for (auto& descendant : descendantsOfType<Box>(root)) { > > if (!descendant.isOutOfFlowPositioned()) > > continue; > > - if (&descendant.formattingContextRoot() != &root) > > + auto nearestFormattingContextRoot = [&] { > > + auto* ancestor = &descendant.containingBlock(); > > + for (; !ancestor->establishesBlockFormattingContext(); ancestor = &ancestor->containingBlock()) { } > > + return ancestor; > > + }; > > + if (nearestFormattingContextRoot() != &root) > > continue; > > formattingState().addOutOfFlowBox(descendant); > > } > > This loop could just avoid traversing into subtrees that are in a separate > formatting context. Yeah, this needs to be re-worked when getting it into shipping configuration (BFC) (there's a FIXME somewhere here).
EWS
Comment 4 2022-09-19 22:13:39 PDT
Committed 254662@main (3d0a14637f43): <https://commits.webkit.org/254662@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 462427 [details].
Radar WebKit Bug Importer
Comment 5 2022-09-19 22:14:18 PDT
Note You need to log in before you can comment on or make changes to this bug.