serenity icon indicating copy to clipboard operation
serenity copied to clipboard

LibWeb: Avoid infinite recursion when hit testing SVGs

Open MacDue opened this issue 1 year ago • 2 comments

Previously, step 5 of the stacking context hit testing would just call hit_test() on the stacking context's paintable box. Which (at least for SVGs) is just indirect infinite recursion (it'll end up right back where it started after going through a few functions).

This now explicitly hit tests the descendants, which seems more correct, and avoids the crash for SVGs, but nothing really seems to depend on this step. Another solution (which I've done for a while working on SVGs) is just to delete step 5 entirely, and nothing seems to break.

Fixes #22305

MacDue avatar Feb 17 '24 19:02 MacDue

Can we add a test? There is internals.hitTest() that could be used for hit-testing text test.

kalenikaliaksandr avatar Feb 17 '24 19:02 kalenikaliaksandr

Can we add a test? There is internals.hitTest() that could be used for hit-testing text test.

Yes... But it was a bit tricky, as the test has to be a .svg (XML) file to reproduce the crash.

So this PR now includes the changes needed to get the test case working too.

MacDue avatar Feb 17 '24 23:02 MacDue