Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overlay regions do not correctly handle sticky positioned scrolling nodes #3383

Conversation

mwyrzykowski
Copy link
Contributor

@mwyrzykowski mwyrzykowski commented Aug 16, 2022

649ae3d

Overlay regions do not correctly handle sticky positioned scrolling nodes
https://bugs.webkit.org/show_bug.cgi?id=243973
<rdar://98640826>

Reviewed by Tim Horton.

Sticky node regions should be added to the overlay regions but their rectangles
can move during scrolling. Also fixed or sticky rectangles can change
during page zoom.

To support this, instead of storing a list of rectangles, store a list of
layer IDs with event regions and then compute the rectangles.

* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(addOverlayEventRegions):
Store only the layer ID.

(-[WKWebView _updateOverlayRegions:destroyedLayers:]):
Recompute the rectangles from the current frames of the nodes whenever the layer
properties change. Scrolling and page zoom where this would be impacted both
trigger a change in layer properties.

* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
Renamed function.

* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
(WebKit::RemoteLayerTreeHost::overlayRegionIDs const):
(WebKit::RemoteLayerTreeHost::updateOverlayRegionIDs):
Renamed.

* Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
(WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
Call renamed function.

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

dbe0f34

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe
βœ… πŸ›  ios-sim βœ… πŸ›  mac-debug βœ… πŸ›  gtk βœ… πŸ›  wincairo
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ gtk-wk2
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ api-mac βœ… πŸ§ͺ api-gtk
βœ… πŸ›  tv βœ… πŸ§ͺ mac-wk1
βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-wk2
βœ… πŸ›  πŸ§ͺ merge loading πŸ›  watch βœ… πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  watch-sim βœ… πŸ§ͺ mac-wk2-stress

@mwyrzykowski mwyrzykowski self-assigned this Aug 16, 2022
@mwyrzykowski mwyrzykowski added Layout and Rendering For bugs with layout and rendering of Web pages. Other labels Aug 16, 2022
@mwyrzykowski mwyrzykowski force-pushed the eng/Overlay-regions-do-not-correctly-handle-sticky-positioned-scrolling-nodes branch from 61b666e to 5096d86 Compare August 16, 2022 23:41
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Aug 17, 2022
@@ -94,7 +94,7 @@ class RemoteLayerTreeHost {
HashMap<WebCore::GraphicsLayer::PlatformLayerID, std::unique_ptr<RemoteLayerTreeNode>> m_nodes;
HashMap<WebCore::GraphicsLayer::PlatformLayerID, RetainPtr<WKAnimationDelegate>> m_animationDelegates;
#if ENABLE(OVERLAY_REGIONS_IN_EVENT_REGION)
HashMap<WebCore::GraphicsLayer::PlatformLayerID, CGRect> m_overlayRegionsWithIDs;
HashMap<WebCore::GraphicsLayer::PlatformLayerID, const RemoteLayerTreeNode*> m_overlayRegionNodesWithIDs;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a bad idea to store raw pointers here. Maybe a strong or weak reference?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, they're not refcounted...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(can you prove that this is safe?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh good point. I'll change this from a map to a set. The Map is storing <layerID, Node> but that is not needed, I can just store the layerID

@@ -555,11 +555,36 @@ - (CGPoint)_puic_contentOffsetForCrownInputSequencerOffset:(double)sequencerOffs
#endif // HAVE(PEPPER_UI_CORE)

#if ENABLE(OVERLAY_REGIONS_IN_EVENT_REGION)
- (bool)_updateOverlayRegions:(const Vector<CGRect> &)overlayRegions
static void addDebugOverlays(CALayer *layer, const Vector<CGRect>& overlayRegions)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably land this in a separate patch; keeping the behavior change and the debugging UI separate.

@mwyrzykowski mwyrzykowski removed the merging-blocked Applied to prevent a change from being merged label Aug 17, 2022
@mwyrzykowski mwyrzykowski force-pushed the eng/Overlay-regions-do-not-correctly-handle-sticky-positioned-scrolling-nodes branch from 5096d86 to 466ca8a Compare August 17, 2022 23:10
@mwyrzykowski mwyrzykowski force-pushed the eng/Overlay-regions-do-not-correctly-handle-sticky-positioned-scrolling-nodes branch from 466ca8a to b7a7eb3 Compare August 18, 2022 00:36
@mwyrzykowski mwyrzykowski force-pushed the eng/Overlay-regions-do-not-correctly-handle-sticky-positioned-scrolling-nodes branch from b7a7eb3 to dbe0f34 Compare August 19, 2022 04:34
@hortont424 hortont424 added the merge-queue Applied to send a pull request to merge-queue label Aug 19, 2022
…odes

https://bugs.webkit.org/show_bug.cgi?id=243973
<rdar://98640826>

Reviewed by Tim Horton.

Sticky node regions should be added to the overlay regions but their rectangles
can move during scrolling. Also fixed or sticky rectangles can change
during page zoom.

To support this, instead of storing a list of rectangles, store a list of
layer IDs with event regions and then compute the rectangles.

* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(addOverlayEventRegions):
Store only the layer ID.

(-[WKWebView _updateOverlayRegions:destroyedLayers:]):
Recompute the rectangles from the current frames of the nodes whenever the layer
properties change. Scrolling and page zoom where this would be impacted both
trigger a change in layer properties.

* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
Renamed function.

* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h:
(WebKit::RemoteLayerTreeHost::overlayRegionIDs const):
(WebKit::RemoteLayerTreeHost::updateOverlayRegionIDs):
Renamed.

* Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
(WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
Call renamed function.

Canonical link: https://commits.webkit.org/253603@main
@webkit-early-warning-system webkit-early-warning-system force-pushed the eng/Overlay-regions-do-not-correctly-handle-sticky-positioned-scrolling-nodes branch from dbe0f34 to 649ae3d Compare August 19, 2022 21:30
@webkit-commit-queue
Copy link
Collaborator

Committed 253603@main (649ae3d): https://commits.webkit.org/253603@main

Reviewed commits have been landed. Closing PR #3383 and removing active labels.

@webkit-early-warning-system webkit-early-warning-system merged commit 649ae3d into WebKit:main Aug 19, 2022
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Layout and Rendering For bugs with layout and rendering of Web pages.
Projects
None yet
5 participants