[webkit-changes] [WebKit/WebKit] b6bfbe: Weave the InteractionRegion layers into the conten...

Etienne Segonzac noreply at github.com
Tue Aug 29 19:44:20 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b6bfbe1b58219e8ce3d8a546248a62730168ce1c
      https://github.com/WebKit/WebKit/commit/b6bfbe1b58219e8ce3d8a546248a62730168ce1c
  Author: Etienne Segonzac <sgz at apple.com>
  Date:   2023-08-29 (Tue, 29 Aug 2023)

  Changed paths:
    M LayoutTests/interaction-region/full-page-overlay-expected.txt
    M LayoutTests/interaction-region/full-page-overlay.html
    M LayoutTests/interaction-region/interaction-layers-culling-expected.txt
    M LayoutTests/interaction-region/layer-tree-expected.txt
    M LayoutTests/interaction-region/layer-tree.html
    M LayoutTests/interaction-region/overlay-expected.txt
    M LayoutTests/interaction-region/position-only-update-expected.txt
    M Source/WebCore/PAL/pal/spi/cocoa/QuartzCoreSPI.h
    M Source/WebCore/page/InteractionRegion.cpp
    M Source/WebCore/page/scrolling/ScrollingStateNode.cpp
    M Source/WebCore/page/scrolling/ScrollingStateNode.h
    M Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNodeCocoa.h
    M Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNodeCocoa.mm
    M Source/WebCore/page/scrolling/cocoa/ScrollingTreeOverflowScrollProxyNodeCocoa.h
    M Source/WebCore/page/scrolling/cocoa/ScrollingTreeOverflowScrollProxyNodeCocoa.mm
    M Source/WebCore/page/scrolling/cocoa/ScrollingTreePositionedNodeCocoa.h
    M Source/WebCore/page/scrolling/cocoa/ScrollingTreePositionedNodeCocoa.mm
    M Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.h
    M Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.mm
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeInteractionRegionLayers.h
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeInteractionRegionLayers.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm

  Log Message:
  -----------
  Weave the InteractionRegion layers into the content layer tree
https://bugs.webkit.org/show_bug.cgi?id=260386
<rdar://102758344>

Reviewed by Tim Horton.

InteractionRegion layers lived in a "duplicated", always-on-top, layer tree.
This patch merges them back into the content's layer tree. This makes
for an overall lighter tree, but the main goal is to let content layers
partially occlude the glow effects.
When a compositing layer has Interaction Regions, we create and insert an
InteractionRegions container as one of its sublayers. *Positioning is key!*
It's always positioned below the first sublayer that contains other
Interaction Regions.

* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
(WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToLayer):
(WebKit::RemoteLayerTreePropertyApplier::applyProperties):
(WebKit::applyCommonPropertiesToLayer): Deleted.
(WebKit::applyInteractionRegionsHierarchyUpdate): Deleted.
Remove the "duplicated" layer tree code paths.
(WebKit::RemoteLayerTreePropertyApplier::applyHierarchyUpdates):
Signal the RemoteLayerTreeNode when an hierarchy update happened.

* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::updateLayerTree):
Remove the code that was keeping the "duplicated" InteractionRegion layer
tree always on top.

* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeInteractionRegionLayers.h:
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeInteractionRegionLayers.mm:
(WebKit::isAnyInteractionRegionLayer): Deleted.
(WebKit::insertInteractionRegionLayersForLayer): Deleted.
Remove the code that was maintaining the "duplicated" InteractionRegion
layer tree.
(WebKit::updateLayersForInteractionRegions):
Remove the InteractionRegions container from the node when it contains no
Interaction Region.
Re-introduce the HashSet preventing duplicated layers with the same
rect.

* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h:
(WebKit::RemoteLayerTreeNode::interactionRegionsLayer const): Deleted.
Rename the node's `interactionRegionsLayer` as
`interactionRegionsContainer`.
Change the API so that it's lazily created when needed.
(WebKit::RemoteLayerTreeNode::hasInteractionRegionsDescendant const):
(WebKit::RemoteLayerTreeNode::setHasInteractionRegionsDescendant):
Introduce a new `hasInteractionRegionsDescendant` flag.
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
(WebKit::RemoteLayerTreeNode::~RemoteLayerTreeNode):
Remove the InteractionRegions container, if any, in the destructor.
(WebKit::RemoteLayerTreeNode::detachFromParent):
Remove the InteractionRegions container, if any, when detaching.
(WebKit::RemoteLayerTreeNode::initializeLayer):
Set layers as `hitTestsContentsAlphaChannel`, this is key for the glow
effect to work properly while the InteractionRegion layers are weaved
into the content tree.
(WebKit::RemoteLayerTreeNode::ensureInteractionRegionsContainer):
Return the existing InteractionRegions container if it exists.
Create and position an InteractionRegions container otherwise.
Adding a new container can impact the positioning of containers higher
in the tree given our positioning rule.
(WebKit::RemoteLayerTreeNode::removeInteractionRegionsContainer):
Remove and release the InteractionRegions container if it exists.
Remove a container can impact the positioning of containers higher in
the tree.
(WebKit::RemoteLayerTreeNode::updateInteractionRegionAfterHierarchyChange):
React to a hierarchy change (sublayers update):
- reposition the InteractionRegions container if needed.
- update the `hasInteractionRegionsDescendant` flag if needed.
(WebKit::RemoteLayerTreeNode::hasInteractionRegions const):
A node "has interaction regions" if it owns an InteractionRegions
container or if one of its descendants does.
(WebKit::RemoteLayerTreeNode::repositionInteractionRegionsContainerIfNeeded):
Find the correct position of the InteractionRegions container and move
it here if needed.
(WebKit::RemoteLayerTreeNode::propagateInteractionRegionsChangeInHierarchy):
Traverse the node's hierarchy to maintain the containers positions and
`hasInteractionRegionsDescendant` flags.

* Source/WebCore/PAL/pal/spi/cocoa/QuartzCoreSPI.h:
Add the SPI for `hitTestsContentsAlphaChannel`.

* Source/WebCore/page/InteractionRegion.cpp:
(WebCore::shouldGetOcclusion):
(WebCore::isOverlay): Deleted.
Rename `isOverlay` to `shouldGetOcclusion`.
(WebCore::interactionRegionForRenderedRegion):
Don't generate extra occlusion layers when the compositing layer is
already occluding.

* Source/WebCore/page/scrolling/ScrollingStateNode.cpp:
(WebCore::ScrollingStateNode::setInteractionRegionsLayer): Deleted.
* Source/WebCore/page/scrolling/ScrollingStateNode.h:
(WebCore::ScrollingStateNode::interactionRegionsLayer const): Deleted.
* Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNodeCocoa.h:
* Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNodeCocoa.mm:
(WebCore::ScrollingTreeFixedNodeCocoa::commitStateBeforeChildren):
(WebCore::ScrollingTreeFixedNodeCocoa::applyLayerPositions):
* Source/WebCore/page/scrolling/cocoa/ScrollingTreeOverflowScrollProxyNodeCocoa.h:
* Source/WebCore/page/scrolling/cocoa/ScrollingTreeOverflowScrollProxyNodeCocoa.mm:
(WebCore::ScrollingTreeOverflowScrollProxyNodeCocoa::commitStateBeforeChildren):
(WebCore::ScrollingTreeOverflowScrollProxyNodeCocoa::applyLayerPositions):
* Source/WebCore/page/scrolling/cocoa/ScrollingTreePositionedNodeCocoa.h:
* Source/WebCore/page/scrolling/cocoa/ScrollingTreePositionedNodeCocoa.mm:
(WebCore::ScrollingTreePositionedNodeCocoa::commitStateBeforeChildren):
(WebCore::ScrollingTreePositionedNodeCocoa::applyLayerPositions):
* Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.h:
* Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.mm:
(WebCore::ScrollingTreeStickyNodeCocoa::commitStateBeforeChildren):
(WebCore::ScrollingTreeStickyNodeCocoa::applyLayerPositions):
* Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
(WebKit::RemoteScrollingCoordinatorProxyIOS::connectStateNodeLayers):
* Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::commitStateBeforeChildren):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::repositionScrollingLayers):
Remove the code that was maintaining the "duplicated" InteractionRegion
layer tree.

* LayoutTests/interaction-region/full-page-overlay.html:
* LayoutTests/interaction-region/full-page-overlay-expected.txt:
Cover the overlay detection logic without compositing.
* LayoutTests/interaction-region/layer-tree.html:
* LayoutTests/interaction-region/layer-tree-expected.txt:
Update the layer tree test to exercise more of the RemoteLayerTreeNode
logic.
* LayoutTests/interaction-region/interaction-layers-culling-expected.txt:
Test expectation update: new layer tree structure.
* LayoutTests/interaction-region/overlay-expected.txt:
* LayoutTests/interaction-region/position-only-update-expected.txt:

Test expectation update: removed occlusion layers.
Canonical link: https://commits.webkit.org/267441@main




More information about the webkit-changes mailing list