Title: [294688] branches/safari-7614.1.14.100-branch/Source
- Revision
- 294688
- Author
- [email protected]
- Date
- 2022-05-23 15:15:32 -0700 (Mon, 23 May 2022)
Log Message
Cherry-pick r294467. rdar://problem/93507791
REGRESSION (r294160): Occasional infinite loops under updateLayersForInteractionRegions
https://bugs.webkit.org/show_bug.cgi?id=240610
<rdar://problem/93507791>
Reviewed by Wenson Hsieh.
* Source/WebCore/page/InteractionRegion.cpp:
(WebCore::regionForElement):
Avoid emitting empty rects for interaction regions, and avoid emitting the region
at all if this results in an empty set of rects.
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeInteractionRegionLayers.mm:
(WebKit::updateLayersForInteractionRegions):
Never re-use a layer with empty bounds; we should never get here, but I'd rather
re-create the layer if we do than corrupt the hash table.
Canonical link: https://commits.webkit.org/250729@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294467 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-7614.1.14.100-branch/Source/WebCore/page/InteractionRegion.cpp (294687 => 294688)
--- branches/safari-7614.1.14.100-branch/Source/WebCore/page/InteractionRegion.cpp 2022-05-23 22:14:39 UTC (rev 294687)
+++ branches/safari-7614.1.14.100-branch/Source/WebCore/page/InteractionRegion.cpp 2022-05-23 22:15:32 UTC (rev 294688)
@@ -107,23 +107,26 @@
return rect;
});
- if (rectsInContentCoordinates.isEmpty())
- return std::nullopt;
-
if (is<RenderBox>(*renderer)) {
RoundedRect::Radii borderRadii = downcast<RenderBox>(*renderer).borderRadii();
region.borderRadius = borderRadii.minimumRadius();
}
- region.rectsInContentCoordinates = rectsInContentCoordinates.map([&](auto rect) {
+ region.rectsInContentCoordinates = compactMap(rectsInContentCoordinates, [&](auto rect) -> std::optional<FloatRect> {
auto contentsRect = rect;
if (&frameView != &mainFrameView)
contentsRect.intersect(frameClipRect);
+ if (contentsRect.isEmpty())
+ return std::nullopt;
+
return contentsRect;
});
-
+
+ if (region.rectsInContentCoordinates.isEmpty())
+ return std::nullopt;
+
return region;
}
Modified: branches/safari-7614.1.14.100-branch/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeInteractionRegionLayers.mm (294687 => 294688)
--- branches/safari-7614.1.14.100-branch/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeInteractionRegionLayers.mm 2022-05-23 22:14:39 UTC (rev 294687)
+++ branches/safari-7614.1.14.100-branch/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeInteractionRegionLayers.mm 2022-05-23 22:15:32 UTC (rev 294688)
@@ -87,8 +87,12 @@
HashMap<IntRect, CALayer *> interactionRegionLayers;
for (CALayer *sublayer in layer.sublayers) {
- if (isInteractionRegionLayer(sublayer))
- interactionRegionLayers.set(enclosingIntRect(sublayer.frame), sublayer);
+ if (!isInteractionRegionLayer(sublayer))
+ continue;
+ auto enclosingFrame = enclosingIntRect(sublayer.frame);
+ if (enclosingFrame.isEmpty())
+ continue;
+ interactionRegionLayers.set(enclosingFrame, sublayer);
}
bool applyBackgroundColorForDebugging = [[NSUserDefaults standardUserDefaults] boolForKey:@"WKInteractionRegionDebugFill"];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes