Skip to content

Commit

Permalink
Reuse InteractionRegion layers when an element is resized
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=260078
<rdar://112930285>

Reviewed by Tim Horton and Mike Wyrzykowski.

We currently only reuse InteractionRegions layers based on their frame.
This patch adds the ability to reuse layers when an element is resized
or moved.

* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeInteractionRegionLayers.mm:
(WebKit::setInteractionRegion): Deleted.
(WebKit::setInteractionRegionOcclusion): Deleted.
(WebKit::setInteractionRegionGuard): Deleted.
(WebKit::createInteractionRegionLayer):
Extract the layer creation code in a single function for readability.
(WebKit::configureRemoteEffect):
Extract the remote effect configuration in a function for readibility.
(WebKit::applyBackgroundColorForDebuggingToLayer):
Extract the debug layer configuration to a function for readability.
(WebKit::interactionRegionTypeForLayer):
(WebKit::interactionRegionGroupNameForRegion):
(WebKit::interactionRegionGroupNameForLayer):
(WebKit::isAnyInteractionRegionLayer):
Style fix. Re-order functions.

(WebKit::updateLayersForInteractionRegions):
Keep track of existing layers that are not part of a multi-layer
group effect for reuse.
Move the layer reuse / creation code to a lambda to use early returns
and improve readability. Add the new `groupName` based reuse code path.
Clarify the conditions under which we update properties on the
InteractionRegion layer.

* LayoutTests/interaction-region/layer-tree.html:
Make sure all branches of the `updateLayersForInteractionRegions()` get
exercised during the test.
* LayoutTests/interaction-region/interaction-layers-culling-expected.txt:
* LayoutTests/interaction-region/layer-tree-expected.txt:
Reset and update test expectations (something changed below us).

Canonical link: https://commits.webkit.org/266945@main
  • Loading branch information
etiennesegonzac committed Aug 16, 2023
1 parent a5a18a2 commit 3f543a9
Show file tree
Hide file tree
Showing 4 changed files with 548 additions and 120 deletions.
238 changes: 214 additions & 24 deletions LayoutTests/interaction-region/interaction-layers-culling-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,38 +110,228 @@
(layer bounds [x: 0 y: 0 width: 0 height: 0])
(layer anchorPoint [x: 0 y: 0]))
(
(layer bounds [x: 0 y: 0 width: 8.16 height: 36])
(layer position [x: 792.9200000000001 y: 792.9200000000001])
(layer bounds [x: 0 y: 0 width: 800 height: 32])
(layer position [x: 400 y: 400])
(layer zPosition 1000)
(layer opacity 0)
(sublayers
(
(layer bounds [x: 0 y: 0 width: 8.16 height: 36])
(layer position [x: 4.08 y: 4.08])
(layer zPosition 1000)
(layer bounds [x: 0 y: 0 width: 96 height: 32])
(layer position [x: 400 y: 400]))
(
(layer bounds [x: 0 y: 0 width: 800 height: 12])
(layer position [x: 400 y: 400])
(sublayers
(
(layer bounds [x: 0 y: 0 width: 8.16 height: 36])
(layer position [x: 4.08 y: 4.08])
(layer cornerRadius 4.760000000000001))))
(
(layer bounds [x: 0 y: 0 width: 8.16 height: 36])
(layer position [x: 4.08 y: 4.08])
(layer opacity 0.005))))
(layer bounds [x: 0 y: 0 width: 96 height: 12])
(layer position [x: 400 y: 400])
(layer cornerRadius 6)
(sublayers
(
(layer bounds [x: 0 y: 0 width: 96 height: 12])
(layer position [x: 48 y: 48])
(layer cornerRadius 6))
(
(layer bounds [x: 0 y: 0 width: 96 height: 12])
(layer position [x: 48 y: 48])
(layer cornerRadius 6))
(
(layer bounds [x: 0 y: 0 width: 96 height: 12])
(layer position [x: 48 y: 48])
(layer cornerRadius 6))
(
(layer bounds [x: 0 y: 0 width: 5.999999999999995 height: 90])
(layer position [x: 48 y: 48])
(layer opacity 0)
(sublayers
(
(layer bounds [x: 0 y: 0 width: 5.999999999999995 height: 90])
(layer position [x: 2.9999999999999973 y: 2.9999999999999973])
(layer opacity 0.15)
(sublayers
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 2.9999999999999973 y: 2.9999999999999973])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 2.9999999999999973 y: 2.9999999999999973])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 2.9999999999999973 y: 2.9999999999999973])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 2.9999999999999973 y: 2.9999999999999973])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 2.9999999999999973 y: 2.9999999999999973])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 2.9999999999999973 y: 2.9999999999999973])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 2.9999999999999973 y: 2.9999999999999973])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 2.9999999999999973 y: 2.9999999999999973])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 2.9999999999999973 y: 2.9999999999999973])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 2.9999999999999973 y: 2.9999999999999973])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 2.9999999999999973 y: 2.9999999999999973])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 2.9999999999999973 y: 2.9999999999999973])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 2.9999999999999973 y: 2.9999999999999973])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 2.9999999999999973 y: 2.9999999999999973])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 2.9999999999999973 y: 2.9999999999999973])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 2.9999999999999973 y: 2.9999999999999973])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 2.9999999999999973 y: 2.9999999999999973])
(layer cornerRadius 1))))))
(
(layer bounds [x: 0 y: 0 width: 90 height: 6])
(layer position [x: 48 y: 48])
(layer opacity 0.15)
(layer cornerRadius 3))))))))
(
(layer bounds [x: 0 y: 0 width: 786 height: 8.16])
(layer position [x: 395.84000000000003 y: 395.84000000000003])
(layer bounds [x: 0 y: 0 width: 32 height: 600])
(layer position [x: 791 y: 791])
(layer zPosition 1000)
(layer opacity 0)
(sublayers
(
(layer bounds [x: 0 y: 0 width: 786 height: 8.16])
(layer position [x: 393 y: 393])
(layer zPosition 1000)
(layer bounds [x: 0 y: 0 width: 32 height: 96])
(layer position [x: 16 y: 16]))
(
(layer bounds [x: 0 y: 0 width: 12 height: 600])
(layer position [x: 16 y: 16])
(sublayers
(
(layer bounds [x: 0 y: 0 width: 786 height: 8.16])
(layer position [x: 393 y: 393])
(layer cornerRadius 4.760000000000001))))
(
(layer bounds [x: 0 y: 0 width: 786 height: 8.16])
(layer position [x: 393 y: 393])
(layer opacity 0.005))))))))
(layer bounds [x: 0 y: 0 width: 12 height: 96])
(layer position [x: 6 y: 6])
(layer cornerRadius 6)
(sublayers
(
(layer bounds [x: 0 y: 0 width: 12 height: 96])
(layer position [x: 6 y: 6])
(layer cornerRadius 6))
(
(layer bounds [x: 0 y: 0 width: 12 height: 96])
(layer position [x: 6 y: 6])
(layer cornerRadius 6))
(
(layer bounds [x: 0 y: 0 width: 12 height: 96])
(layer position [x: 6 y: 6])
(layer cornerRadius 6))
(
(layer bounds [x: 0 y: 0 width: 6 height: 90])
(layer position [x: 6 y: 6])
(layer opacity 0)
(sublayers
(
(layer bounds [x: 0 y: 0 width: 6 height: 90])
(layer position [x: 3 y: 3])
(layer opacity 0.15)
(sublayers
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 3 y: 3])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 3 y: 3])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 3 y: 3])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 3 y: 3])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 3 y: 3])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 3 y: 3])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 3 y: 3])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 3 y: 3])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 3 y: 3])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 3 y: 3])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 3 y: 3])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 3 y: 3])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 3 y: 3])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 3 y: 3])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 3 y: 3])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 3 y: 3])
(layer cornerRadius 1))
(
(layer bounds [x: 0 y: 0 width: 4 height: 2])
(layer position [x: 3 y: 3])
(layer cornerRadius 1))))))
(
(layer bounds [x: 0 y: 0 width: 6 height: 90])
(layer position [x: 6 y: 6])
(layer opacity 0.15)
(layer cornerRadius 3))))))))))))
Loading

0 comments on commit 3f543a9

Please sign in to comment.