<html>
    <head>
      <base href="https://bugs.webkit.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:simon.fraser@apple.com" title="Simon Fraser (smfr) <simon.fraser@apple.com>"> <span class="fn">Simon Fraser (smfr)</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Position:fixed layers shouldn't allocate a backing buffer if all children are offscreen"
   href="https://bugs.webkit.org/show_bug.cgi?id=235420">bug 235420</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Attachment #449611 is obsolete</td>
           <td>1
           </td>
           <td>
                
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Position:fixed layers shouldn't allocate a backing buffer if all children are offscreen"
   href="https://bugs.webkit.org/show_bug.cgi?id=235420#c3">Comment # 3</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Position:fixed layers shouldn't allocate a backing buffer if all children are offscreen"
   href="https://bugs.webkit.org/show_bug.cgi?id=235420">bug 235420</a>
              from <span class="vcard"><a class="email" href="mailto:simon.fraser@apple.com" title="Simon Fraser (smfr) <simon.fraser@apple.com>"> <span class="fn">Simon Fraser (smfr)</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=449611&action=diff" name="attach_449611" title="Patch">attachment 449611</a> <a href="attachment.cgi?id=449611&action=edit" title="Patch">[details]</a></span>
Patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=449611&action=review">https://bugs.webkit.org/attachment.cgi?id=449611&action=review</a>

<span class="quote">> Source/WebCore/rendering/RenderLayerBacking.cpp:2793
> +static bool intersectsWithAncestor(const RenderLayer& ancestor, const LayoutRect& ancestorCompositedBounds, const RenderLayer& child)</span >

I would put child as the first argument.

<span class="quote">> Source/WebCore/rendering/RenderLayerBacking.cpp:2798
> +            return true;</span >

It would be more truthful to have the function return std::optional<bool> and return nullopt here.

<span class="quote">> Source/WebCore/rendering/RenderLayerBacking.cpp:2802
> +    LayoutPoint delta = child.convertToLayerCoords(&ancestor, LayoutPoint(), RenderLayer::AdjustForColumns);</span >

auto delta. Maybe also "{ }" instead of LayoutPoint().

It's unfortunate that this function is called inside a descendant layer tree walk, then your loop above, and child.convertToLayerCoords() both do ancestor tree walks, which can be a perf issue (we've seen this in the past). Maybe traverseVisibleNonCompositedDescendantLayers() can accumulate the "offset from ancestor" as it's doing the descendant traversal.

Probably fine in this case (we don't expect a lot of ancestor walking) but generally to be avoided.

<span class="quote">> Source/WebCore/rendering/RenderLayerBacking.cpp:2803
> +    LayoutRect overlap = child.overlapBounds();</span >

auto

<span class="quote">> Source/WebCore/rendering/RenderLayerBacking.cpp:2804
> +    overlap.move(delta.x(), delta.y());</span >

overlap.moveBy(delta);

<span class="quote">> LayoutTests/compositing/backing/no-backing-for-offscreen-children-of-position-fixed.html:19
> +  <div style="position: fixed;z-index: -1;left: 0;top: 0;right: 0;bottom: 0;opacity: 0.5;"></span >

I don't think the z-index: -1 is relevant. Also this layer doesn't need to be full height or width (and making it so makes it harder to identify in the layer output). Also the opacity is not required.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>