浏览代码

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 年之前
父节点
当前提交
245e3b9c3a
共有 1 个文件被更改,包括 4 次插入0 次删除
  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;
             continue;
         return result;
         return result;
     }
     }
+
+    if (!visible_for_hit_testing())
+        return {};
+
     return HitTestResult { const_cast<PaintableBox&>(*this) };
     return HitTestResult { const_cast<PaintableBox&>(*this) };
 }
 }