Bug 249555

Summary: HitTest for RootInlineBox/InlineFlowBox should take care of border-radius.
Product: WebKit Reporter: Ahmad Saleem <ahmad.saleem792>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bfulgham, karlcow, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: BrowserCompat, InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   

Description Ahmad Saleem 2022-12-18 08:27:35 PST
Hi Team,

While going through Blink's commit, I came across another failing:

Commit - https://chromium.googlesource.com/chromium/blink/+/33dd960f98fa10ffcbd8f9539ff4221ce8d08f43

Webkit GitHub Source - https://jsfiddle.net/xngkjt9s/show

^ Failing in Safari 16.2 and STP160 while Chrome Canary 111 and Firefox Nightly 110 passes all.

WebKit Source - https://github.com/WebKit/WebKit/blob/e6ff73fa8a9f8a8196001a303e29a06e1bbd294e/Source/WebCore/rendering/LegacyInlineFlowBox.cpp#L1070

Just wanted to raise it so we can fix this as well.

Thanks!
Comment 1 Ahmad Saleem 2022-12-20 13:27:48 PST
if (renderer().style()->hasBorderRadius()) {
LayoutRect borderRect = logicalFrameRect()
borderRect.moveBy(accumulatedOffset)
FloatRoundedRect border = renderer.style()->getRoundedBorderFor(borderRect, includeLogicalLeftEdge(), includeLogicalRightEdge());
(!locationInContainer.intersects(border))
return false;
}

^ I think it will work, will try and let's see. Might need some help.
Comment 2 zalan 2022-12-21 13:35:17 PST
This fails with IFC too so a fix in legacy won't do much at this point.
Comment 3 Radar WebKit Bug Importer 2022-12-25 08:28:15 PST
<rdar://problem/103696378>
Comment 4 Ahmad Saleem 2024-02-23 14:23:31 PST
This compiles but does not fix the failing test (might be IFC taking over):

if (renderer().style().hasBorderRadius()) {

        auto borderRect = logicalFrameRect();

        borderRect.moveBy(accumulatedOffset);

        auto border = renderer().style().getRoundedBorderFor(LayoutRect(borderRect), includeLogicalLeftEdge(), includeLogicalRightEdge());

        if (!locationInContainer.intersects(border))

            return false;

    }