| Summary: | [LFC][Cleanup] Remove Layout::Box::formattingContextRoot | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | zalan <zalan> | ||||
| Component: | Layout and Rendering | Assignee: | zalan <zalan> | ||||
| Status: | RESOLVED FIXED | ||||||
| Severity: | Normal | CC: | bfulgham, koivisto, simon.fraser, webkit-bug-importer, zalan | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | WebKit Nightly Build | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Attachments: |
|
||||||
|
Description
zalan
2022-09-18 20:04:00 PDT
Created attachment 462427 [details]
Patch
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. (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). 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]. |