Title: [294467] trunk/Source
- Revision
- 294467
- Author
- timothy_hor...@apple.com
- Date
- 2022-05-18 21:09:51 -0700 (Wed, 18 May 2022)
Log Message
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
Modified Paths
Diff
Modified: trunk/Source/WebCore/page/InteractionRegion.cpp (294466 => 294467)
--- trunk/Source/WebCore/page/InteractionRegion.cpp 2022-05-19 04:08:35 UTC (rev 294466)
+++ trunk/Source/WebCore/page/InteractionRegion.cpp 2022-05-19 04:09:51 UTC (rev 294467)
@@ -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: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeInteractionRegionLayers.mm (294466 => 294467)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeInteractionRegionLayers.mm 2022-05-19 04:08:35 UTC (rev 294466)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeInteractionRegionLayers.mm 2022-05-19 04:09:51 UTC (rev 294467)
@@ -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
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes