[webkit-changes] [WebKit/WebKit] be575e: Fix negative z-index layers from triggering unnece...

mattwoodrow noreply at github.com
Wed Sep 21 20:28:43 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: be575e7192eed0f7fc0d3a335a1df8f91e909b30
      https://github.com/WebKit/WebKit/commit/be575e7192eed0f7fc0d3a335a1df8f91e909b30
  Author: Matt Woodrow <mattwoodrow at apple.com>
  Date:   2022-09-21 (Wed, 21 Sep 2022)

  Changed paths:
    A LayoutTests/compositing/layer-creation/no-compositing-for-negative-z-sibling-expected.txt
    A LayoutTests/compositing/layer-creation/no-compositing-for-negative-z-sibling-nested-expected.txt
    A LayoutTests/compositing/layer-creation/no-compositing-for-negative-z-sibling-nested.html
    A LayoutTests/compositing/layer-creation/no-compositing-for-negative-z-sibling.html
    A LayoutTests/platform/ios-wk2/compositing/layer-creation/no-compositing-for-negative-z-sibling-expected.txt
    A LayoutTests/platform/ios-wk2/compositing/layer-creation/no-compositing-for-negative-z-sibling-nested-expected.txt
    M Source/WebCore/rendering/LayerOverlapMap.cpp
    M Source/WebCore/rendering/LayerOverlapMap.h
    M Source/WebCore/rendering/RenderLayerCompositor.cpp

  Log Message:
  -----------
  Fix negative z-index layers from triggering unnecessary compositing of foreground layers.
https://bugs.webkit.org/show_bug.cgi?id=244543
<rdar://99335877>

Reviewed by Simon Fraser.

We currently push a speculative compositing container onto the overlap stack when processing
negative z-index children, in case any of them require compositing. We then pop it off it it doesn't
get used. Unfortunately other mutations can happen to the overlap stack while it's pushed, and just
popping the unused container isn't sufficient to restore this.

This instead duplicates the overlap stack when we push a speculative compositing container, and makes any
changes to both of them. Once we know which path is correct, we select the correct stack and throw away
the duplicate.

This fixes cases where negative z-index children weren't composited, but they ended up affecting overlaps
of positive z-index children and making them composited unnecessarily.

* LayoutTests/compositing/layer-creation/no-compositing-for-negative-z-sibling-expected.txt: Added.
* LayoutTests/compositing/layer-creation/no-compositing-for-negative-z-sibling.html: Added.
* Source/WebCore/rendering/LayerOverlapMap.cpp:
(WebCore::OverlapMapContainer::isEmpty const):
(WebCore::LayerOverlapMap::add):
(WebCore::LayerOverlapMap::overlapsLayers const):
(WebCore::LayerOverlapMap::pushCompositingContainer):
(WebCore::LayerOverlapMap::pushSpeculativeCompositingContainer):
(WebCore::LayerOverlapMap::confirmSpeculativeCompositingContainer):
(WebCore::LayerOverlapMap::maybePopSpeculativeCompositingContainer):
* Source/WebCore/rendering/LayerOverlapMap.h:
* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::computeCompositingRequirements):

Canonical link: https://commits.webkit.org/254746@main




More information about the webkit-changes mailing list