Bläddra i källkod

LibWeb: Honor `pointer-events: none` when hitting a PaintableBox

If the PaintableBox had children, but we didn't hit any of them, we
default to saying that you hit the PaintableBox itself.

However, if said PaintableBox has `pointer-events: none`, we should
say nothing was hit, so that the hit testing can continue.

This fixes an issue where Discord server icons were not clickable.
Andreas Kling 2 år sedan
förälder
incheckning
245e3b9c3a
1 ändrade filer med 4 tillägg och 0 borttagningar
  1. 4 0
      Userland/Libraries/LibWeb/Painting/PaintableBox.cpp

+ 4 - 0
Userland/Libraries/LibWeb/Painting/PaintableBox.cpp

@@ -688,6 +688,10 @@ Optional<HitTestResult> PaintableBox::hit_test(CSSPixelPoint position, HitTestTy
             continue;
         return result;
     }
+
+    if (!visible_for_hit_testing())
+        return {};
+
     return HitTestResult { const_cast<PaintableBox&>(*this) };
 }