diff --git a/third_party/blink/renderer/core/layout/layout_replaced.cc b/third_party/blink/renderer/core/layout/layout_replaced.cc index b94e2aec3eecb..c6624dbf7ea33 100644 --- a/third_party/blink/renderer/core/layout/layout_replaced.cc +++ b/third_party/blink/renderer/core/layout/layout_replaced.cc @@ -172,7 +172,8 @@ bool LayoutReplaced::NodeAtPoint(HitTestResult& result, return true; } - if (StyleRef().HasBorderRadius() && + if (!result.GetHitTestRequest().IsHitTestVisualOverflow() && + StyleRef().HasBorderRadius() && HitTestClippedOutByBorder(hit_test_location, accumulated_offset)) { return false; } diff --git a/third_party/blink/renderer/core/paint/box_fragment_painter.cc b/third_party/blink/renderer/core/paint/box_fragment_painter.cc index fb374f6b8c869..e013281d41faa 100644 --- a/third_party/blink/renderer/core/paint/box_fragment_painter.cc +++ b/third_party/blink/renderer/core/paint/box_fragment_painter.cc @@ -2353,17 +2353,23 @@ bool BoxFragmentPainter::NodeAtPoint(const HitTestContext& hit_test, } } - // Check border-shape and border-radius clipping. - if (style.HasBorderShape()) { - PhysicalRect rect(physical_offset, size); - const Path outer_path = ComputeBorderShapeOuterPath( - style, rect, box_fragment_.GetLayoutObject()); - if (!hit_test.location.Intersects(outer_path)) { + // Check border-shape and border-radius clipping. Skip this when hit-testing + // visual overflow (IntersectionObserver V2 occlusion), because the rounded + // border-box does not include painted ink overflow such as box-shadow; the + // InkOverflowIncludingFilters() check below handles that case. + if (!hit_test.result->GetHitTestRequest().IsHitTestVisualOverflow()) + [[likely]] { + if (style.HasBorderShape()) { + PhysicalRect rect(physical_offset, size); + const Path outer_path = ComputeBorderShapeOuterPath( + style, rect, box_fragment_.GetLayoutObject()); + if (!hit_test.location.Intersects(outer_path)) { + return false; + } + } else if (style.HasBorderRadius() && + HitTestClippedOutByBorder(hit_test.location, physical_offset)) { return false; } - } else if (style.HasBorderRadius() && - HitTestClippedOutByBorder(hit_test.location, physical_offset)) { - return false; } bool pointer_events_bounding_box = false;