[webkit-reviews] review granted: [Bug 245351] [LFC][Cleanup] Remove Layout::Box::formattingContextRoot : [Attachment 462427] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Sep 19 06:07:09 PDT 2022


Antti Koivisto <koivisto at iki.fi> has granted  review:
Bug 245351: [LFC][Cleanup] Remove Layout::Box::formattingContextRoot
https://bugs.webkit.org/show_bug.cgi?id=245351

Attachment 462427: Patch

https://bugs.webkit.org/attachment.cgi?id=462427&action=review




--- Comment #2 from Antti Koivisto <koivisto at iki.fi> ---
Comment on attachment 462427
  --> https://bugs.webkit.org/attachment.cgi?id=462427
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.


More information about the webkit-reviews mailing list